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

SF.net SVN: ledger-smb:[6707] trunk/LedgerSMB



Revision: 6707
          http://sourceforge.net/p/ledger-smb/code/6707
Author:   einhverfr
Date:     2014-01-29 14:56:35 +0000 (Wed, 29 Jan 2014)
Log Message:
-----------
Basic overpayment reversal logic done.  Big issue is there needs to be a filter screen for providing currency, etc.

Modified Paths:
--------------
    trunk/LedgerSMB/Report/Listings/Overpayments.pm
    trunk/LedgerSMB/Scripts/reports.pm
    trunk/LedgerSMB/Scripts/vouchers.pm

Modified: trunk/LedgerSMB/Report/Listings/Overpayments.pm
===================================================================
--- trunk/LedgerSMB/Report/Listings/Overpayments.pm	2014-01-29 14:08:04 UTC (rev 6706)
+++ trunk/LedgerSMB/Report/Listings/Overpayments.pm	2014-01-29 14:56:35 UTC (rev 6707)
@@ -156,7 +156,7 @@
    return [
           { name => 'action',
             text => LedgerSMB::Report::text('Reverse'),
-           value => 'reverse',
+           value => 'reverse_overpayment',
             type => 'submit',
            class => 'submit'
           },

Modified: trunk/LedgerSMB/Scripts/reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/reports.pm	2014-01-29 14:08:04 UTC (rev 6706)
+++ trunk/LedgerSMB/Scripts/reports.pm	2014-01-29 14:56:35 UTC (rev 6707)
@@ -183,6 +183,9 @@
 
 sub search_overpayments {
     my ($request) = @_;
+    my $hiddens = {};
+    $hiddens->{$_} = $request->{$_} for qw(batch_id);
+    $request->{hiddens} = $hiddens;
     LedgerSMB::Report::Listings::Overpayments->new(%$request)->render($request);
 }
 

Modified: trunk/LedgerSMB/Scripts/vouchers.pm
===================================================================
--- trunk/LedgerSMB/Scripts/vouchers.pm	2014-01-29 14:08:04 UTC (rev 6706)
+++ trunk/LedgerSMB/Scripts/vouchers.pm	2014-01-29 14:56:35 UTC (rev 6707)
@@ -147,7 +147,7 @@
 				my ($request) = @_;
 				$request->{account_class} = 2;
                                 if ($request->{overpayment}){
-                                    LedgerSMB::Scripts::reports::search_overpayments();
+                                    LedgerSMB::Scripts::reports::search_overpayments($request);
                                 } else {
 			   	    LedgerSMB::Scripts::payment::get_search_criteria($request, $custom_batch_types);
                                 }
@@ -318,6 +318,27 @@
     LedgerSMB::Scripts::reports::start_report($request);
 }
 
+=item reverse_overpayment 
+
+Adds overpayment reversal vouchers to a batch
+
+=cut
+
+sub reverse_overpayment {
+    my ($request) = @_;
+    my $batch = LedgerSMB::Batch->new(base => $request);
+    $batch->get;
+    for (1 .. $request->{rowcount_}){
+        my $id = $request->{"id_$_"}
+        $batch->call_procedure(procname => 'overpayment__reverse',
+           args => [$id, $batch->{post_date}, $batch->{id}, $a_class,
+                 $request->{cash_accno}, $request->{exchangerate}, 
+                 $request->{curr}]
+         ) if $id;
+    }
+    LedgerSMB::Scripts::reports::search_overpayments($request);
+}
+
 eval { do "scripts/custom/vouchers.pl"};
 1;
 

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


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits