[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3708] trunk



Revision: 3708
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3708&view=rev
Author:   einhverfr
Date:     2011-09-17 23:36:19 +0000 (Sat, 17 Sep 2011)
Log Message:
-----------
Correcting payment report prior to posting

Modified Paths:
--------------
    trunk/UI/payments/payments_detail.html
    trunk/scripts/payment.pl

Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html	2011-09-17 23:17:14 UTC (rev 3707)
+++ trunk/UI/payments/payments_detail.html	2011-09-17 23:36:19 UTC (rev 3708)
@@ -207,6 +207,11 @@
 			name = "contact_$count"
 			value = r.contact_id
 		} ?>
+		<?lsmb INCLUDE input element_data = {
+			type = "hidden"
+			name = "contact_label_" _ r.contact_id
+			value = r.econtrol_code _ "--" _ r.account_number _ "--" _ r.contact_name
+		} ?>
 		<?lsmb IF action == "update_payments" -?>
 			<?lsmb IF ${"id_$r.contact_id"} -?>
 				<?lsmb r.selected = 1 -?>

Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	2011-09-17 23:17:14 UTC (rev 3707)
+++ trunk/scripts/payment.pl	2011-09-17 23:36:19 UTC (rev 3708)
@@ -147,11 +147,12 @@
         format   => ($request->{report_format}) ? $request->{report_format} : 'HTML',
     ); 
     my $cols;
-    @$cols =  qw(accno source memo debits credits);
+    @$cols =  qw(pay_to accno source memo debits credits);
     my $rows = [];
     my $total_debits = 0;
     my $total_credits = 0;
     my $heading = {
+        pay_to          => $request->{_locale}->text('Pay To'),
         accno           => $request->{_locale}->text('Account Number'),
         acc_description => $request->{_locale}->text('Account Title'),
         transdate       => $request->{_locale}->text('Date'),
@@ -164,35 +165,38 @@
     for my $crow (1 .. $request->{contact_count}){
         my $ref;
         my $cid = $request->{"contact_$crow"};
-        $ref = {accno     => $request->{ar_ap_accno},
-                transdate => $request->{date_paid}, 
-                source    => $request->{"source_$cid"}, 
-                memo      => $request->{"memo_$cid"},
-                amount    => 0
-               };
-        for my $invrow (1 .. $request->{"invoice_count_$cid"}){
-            my $inv_id = $request->{"invoice_${cid}_$invrow"};
-            if ($request->{"paid_$cid"} eq 'all'){
-                $ref->{amount} += $request->{"payment_$inv_id"};
-            } else {
-               $ref->{amount} += $request->{"net_$inv_id"};
-            }
+        if ($request->{"id_$cid"}){
+            $ref = {pay_to    => $request->{"contact_label_$cid"},
+                    accno     => $request->{ar_ap_accno},
+                    transdate => $request->{date_paid}, 
+                    source    => $request->{"source_$cid"}, 
+                    memo      => $request->{"memo_$cid"},
+                    amount    => 0
+                   };
+            for my $invrow (1 .. $request->{"invoice_count_$cid"}){
+                 my $inv_id = $request->{"invoice_${cid}_$invrow"};
+                 if ($request->{"paid_$cid"} eq 'all'){
+                     $ref->{amount} += $request->{"payment_$inv_id"};
+                 } else {
+                     $ref->{amount} += $request->{"net_$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};
+              }
+              $total_debits += $ref->{debits};
+              $total_credits += $ref->{credits};
+              push @$rows, $ref;
+              $total += $ref->{amount};
         }
-        # 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};
-        }
-        $total_debits += $ref->{debits};
-        $total_credits += $ref->{credits};
-        push @$rows, $ref;
-        $total += $ref->{amount};
     }
     
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.