[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3003] trunk/scripts/payment.pl
- Subject: SF.net SVN: ledger-smb:[3003] trunk/scripts/payment.pl
- From: ..hidden..
- Date: Wed, 19 May 2010 19:11:10 +0000
Revision: 3003
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3003&view=rev
Author: einhverfr
Date: 2010-05-19 19:11:09 +0000 (Wed, 19 May 2010)
Log Message:
-----------
Payment report prior to posting
Modified Paths:
--------------
trunk/scripts/payment.pl
Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl 2010-05-19 17:57:29 UTC (rev 3002)
+++ trunk/scripts/payment.pl 2010-05-19 19:11:09 UTC (rev 3003)
@@ -104,6 +104,84 @@
$template->render($payment);
}
+sub pre_bulk_post_report {
+ my ($request) = @_;
+ my $template = LedgerSMB::Template->new(
+ user => $request->{_user},
+ locale => $request->{_locale},
+ path => 'UI',
+ template => 'form-dynatable',
+ format => ($request->{format}) ? $request->{format} : 'HTML',
+ );
+ my $cols = qw(accno transdate source memo debit credit);
+ my $rows = [];
+ my $heading = {};
+ my $total = 0;
+ for my $crow (1 .. $request->{contact_count}){
+ my $ref;
+ my $cid = $request->{"contact_$crow"};
+ for my $invrow (1 .. $request->{"invoice_count_$cid"}){
+ my $inv_id = $request->{"invoice_${cid}_$invrow"};
+ $ref = {accno => $request->{ar_ap_accno},
+ transdate => $request->{date_paid},
+ source => $request->{"source_$cid"},
+ memo => $request->{"memo_$cid"},
+ };
+ $ref->{amount} += $request->{"payment_$inv_id"};
+ }
+ # If vendor, this is debit-normal so multiply by -1
+ if ($request->{account_class} == 1){
+ $ref->{amount} *= -1;
+ }
+ if ($ref->{amount} < 0) {
+ $ref->{debits} = $ref->{amount} * -1;
+ $ref->{credits} = 0;
+ } else {
+ $ref->{debits} = 0;
+ $ref->{credits} = $ref->{amount};
+ }
+ push @$rows, $ref;
+ $total += 0;
+ }
+
+ # Cash summary
+ my $ref = {
+ accno => $request->{cash_accno},
+ transdate => $request->{date_paid},
+ source => $request->{_locale}->text('Total'),
+ amount => $total,
+ };
+
+ if ($ref->{amount} < 0) {
+ $ref->{debits} = $ref->{amount} * -1;
+ $ref->{credits} = 0;
+ } else {
+ $ref->{debits} = 0;
+ $ref->{credits} = $ref->{amount};
+ }
+ push @$rows, $ref;
+
+ my $buttons = [{
+ text => $request->{_locale}->text('Post'),
+ name => 'action',
+ value => 'payments_bulk_post',
+ class => 'submit',
+ }];
+ $request->{action} = "p";
+ $template->render({
+ form => $request,
+ hiddens => $request,
+ columns => $cols,
+ heading => $heading,
+ rows => $rows,
+ buttons => $buttons,
+ });
+}
+
+sub p_payments_bulk_post {
+ payments_bulk_post(@_);
+}
+
sub get_search_results {
my ($request) = @_;
my $rows = [];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.