[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [2182] trunk
- Subject: SF.net SVN: ledger-smb: [2182] trunk
- From: ..hidden..
- Date: Tue, 01 Jul 2008 16:34:41 -0700
Revision: 2182
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2182&view=rev
Author: aurynn_cmd
Date: 2008-07-01 16:34:41 -0700 (Tue, 01 Jul 2008)
Log Message:
-----------
Adding Pending Transactions support to reconciliation.
Modified Paths:
--------------
trunk/LedgerSMB/Reconciliation.pm
trunk/UI/Reconciliation/correct.html
trunk/scripts/Reconciliation.pl
trunk/sql/modules/Reconciliaton.sql
Added Paths:
-----------
trunk/UI/Reconciliation/pending.html
Modified: trunk/LedgerSMB/Reconciliation.pm
===================================================================
--- trunk/LedgerSMB/Reconciliation.pm 2008-07-01 20:56:40 UTC (rev 2181)
+++ trunk/LedgerSMB/Reconciliation.pm 2008-07-01 23:34:41 UTC (rev 2182)
@@ -228,6 +228,14 @@
);
}
+sub get_pending {
+
+ my $self = shift @_;
+ return $self->exec_method(
+ funcname=>'reconciliation__pending',
+ args=>[$self->{month}]
+ );
+}
1;
\ No newline at end of file
Modified: trunk/UI/Reconciliation/correct.html
===================================================================
--- trunk/UI/Reconciliation/correct.html 2008-07-01 20:56:40 UTC (rev 2181)
+++ trunk/UI/Reconciliation/correct.html 2008-07-01 23:34:41 UTC (rev 2182)
@@ -4,34 +4,34 @@
<table>
<tr>
<td>
- Account/SCN
+ Account
</td>
<td>
- <input type="input" name="scn" value="<?lsmb entry.scn?>"/>
+ <input type="input" name="scn" value="<?lsmb entry.account?>"/>
</td>
</tr>
<tr>
<td>
- Amount
+ SCN
</td>
<td>
- <input type="input" name="amount" value="<?lsmb entry.their_balance?>"/>
+ <input type="input" name="scn" value="<?lsmb entry.scn?>"/>
</td>
</tr>
<tr>
<td>
- Cleared
+ Amount
</td>
<td>
- <input type="input" name="cleared" value="<?lsmb entry.clear_time?>"/>
+ <input type="input" name="amount" value="<?lsmb entry.their_balance?>"/>
</td>
</tr>
<tr>
<td>
- Cleared
+ Cleared at
</td>
<td>
- <input type="input" name="cleared" value="<?lsmb entry.clear?>"/>
+ <input type="input" name="cleared" value="<?lsmb entry.clear_time?>"/>
</td>
</tr>
<tr>
Added: trunk/UI/Reconciliation/pending.html
===================================================================
--- trunk/UI/Reconciliation/pending.html (rev 0)
+++ trunk/UI/Reconciliation/pending.html 2008-07-01 23:34:41 UTC (rev 2182)
@@ -0,0 +1,54 @@
+<div>
+ <?lsmb IF pending?>
+ <table>
+ <tr>
+ <td>
+ Account
+ </td>
+ <td>SCN</td>
+ <td>Entry</td>
+ <td>Amount</td>
+ <td>Transaction Date</td>
+ </tr>
+ <?lsmb FOR trans IN pending?>
+
+ <td><?lsmb trans.account?></td>
+ <td><?lsmb trans.source?></td>
+ <td><a href="transactions.pl?entry=<?lsmb trans.entry_id?>">Full Entry</a></td>
+ <td><?lsmb trans.transdate?></td>
+
+ <?lsmb END?>
+ <?lsmb ELSE?>
+ <form name="month" method="reconciliation.pl" action="POST">
+ <input type="hidden" name="action" value="pending"/>
+ Year: <select name="year">
+ <option value="2008">2008</option>
+ <option value="2007">2008</option>
+ <option value="2006">2008</option>
+ <option value="2005">2008</option>
+ <option value="2004">2008</option>
+ <option value="2003">2008</option>
+ <option value="2002">2008</option>
+ <option value="2001">2008</option>
+ <option value="2000">2000</option>
+ </select>
+
+ Month: <select name="month">
+ <option value="12">December</option>
+ <option value="11">November</option>
+ <option value="10">October</option>
+ <option value="9">September</option>
+ <option value="8">August</option>
+ <option value="7">July</option>
+ <option value="6">June</option>
+ <option value="5">May</option>
+ <option value="4">April</option>
+ <option value="3">March</option>
+ <option value="2">February</option>
+ <option value="1">January</option>
+ </select>
+ <input type="submit" value="Get Pending Transactions">
+ </form>
+ <?lsmb END?>
+ </table>
+</div>
\ No newline at end of file
Modified: trunk/scripts/Reconciliation.pl
===================================================================
--- trunk/scripts/Reconciliation.pl 2008-07-01 20:56:40 UTC (rev 2181)
+++ trunk/scripts/Reconciliation.pl 2008-07-01 23:34:41 UTC (rev 2182)
@@ -358,6 +358,48 @@
}
);
}
+
+=pod
+
+=over
+
+=item pending ($self, $request, $user)
+
+Requires {date} and {month}, to handle the month-to-month pending transactions
+in the database. No mechanism is provided to grab ALL pending transactions
+from the acc_trans table.
+
+=back
+
+=cut
+
+
+sub pending {
+
+ my ($class, $request) = @_;
+
+ my $recon = LedgerSMB::DBObject::Reconciliation->new(base=>request, copy=>'all');
+ my $template;
+
+ $template= LedgerSMB::Template->new(
+ user => $user,
+ template=>'reconciliation/pending.html',
+ language=>$user->{language},
+ format=>'html'
+ );
+ if ($request->type() eq "POST") {
+ return $template->render(
+ {
+ pending=>$recon->get_pending($request->{year}."-".$request->{month});
+ }
+ );
+ }
+ else {
+
+ return $template->render();
+ }
+}
+
# eval { do "scripts/custom/Reconciliation.pl" };
1;
Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql 2008-07-01 20:56:40 UTC (rev 2181)
+++ trunk/sql/modules/Reconciliaton.sql 2008-07-01 23:34:41 UTC (rev 2182)
@@ -1,7 +1,8 @@
CREATE TABLE reports (
id bigserial primary key not null,
report_id int NOT NULL,
- scn int, -- What is SCN?
+ account text not null,
+ scn text not null, -- What is SCN?
their_balance numeric,
our_balance numeric,
errorcode INT,
@@ -78,7 +79,7 @@
in_user TEXT;
BEGIN
select into in_user from current_user;
- select into current_row from reports where reports.id = in_report_id and reports.scn = in_scn;
+ select into current_row from reports where reports.id = in_id and reports.report_id = in_report_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'No such SCN % in this report.', in_scn;
END IF;
@@ -323,44 +324,21 @@
END;
$$ language 'plpgsql';
-create or replace function reconciliation__pending_transactions (in_report_id INT, in_month TIMESTAMP, in_user INT) RETURNS setof int as $$
+create or replace function reconciliation__pending_transactions (in_month DATE) RETURNS setof acc_trans as $$
DECLARE
gl_row acc_trans;
BEGIN
-
FOR gl_row IN
select gl.* from acc_trans gl, reports pr
where gl.cleared = 'f'
and date_trunc('month',gl.transdate) <= date_trunc('month', in_month)
- and gl.entry_id <> pr.lid
+ and gl.entry_id <> pr.ledger_id -- there's no entries in the reports for this
LOOP
-
- INSERT INTO reports (
- report_id,
- scn,
- their_balance,
- our_balance,
- error_code,
- user,
- clear_time,
- ledger_id
- )
- VALUES (
- in_report_id, -- add it to the report ID
- gl_row.source, -- the source control number
- 0, -- The banks' amount for the transaction
- gl_row.amount, -- our recorded amount
- 4, -- The error code, meaning it's uncleared.
- in_user, -- the report-generating user
- in_month, -- basically, right now.
- gl_row.entry_id -- the foreign key to the ledger
- );
-
+ RETURN NEXT gl_row;
END LOOP;
END;
-
-$$ language plpgsql;
+$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION reconciliation__report (in_report_id INT) RETURNS setof reports as $$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.