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

SF.net SVN: ledger-smb:[6263] addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm



Revision: 6263
          http://sourceforge.net/p/ledger-smb/code/6263
Author:   einhverfr
Date:     2013-11-08 11:30:13 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
Outline of add payment logic, not working yet

Modified Paths:
--------------
    addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm

Modified: addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm	2013-11-08 10:18:27 UTC (rev 6262)
+++ addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm	2013-11-08 11:30:13 UTC (rev 6263)
@@ -81,6 +81,7 @@
                                  [500, 360], [60, 24]);
     EVT_BUTTON($self->{WxPanel}, $post_btn, sub{$self->_Post});
     EVT_BUTTON($self->{WxPanel}, $cancel_btn, sub{$self->_Cancel});
+    $self->{paylist} = [];
 
     ### SHOW DIALOG
     $self->ShowModal();
@@ -93,6 +94,33 @@
 }
 
 sub _AddPayment {
+   my ($self) = @_;
+   #Variables
+   my $num = $self->{list}->GetItemCount();
+   my $amount = $self->{payment}->GetValue();
+   my $type = $self->{memo}->GetValue();
+   my $source= $self->{source}->GetValue();
+   my $paid = $self->{total_paid}->GetLabel();
+   my $owing = $self->{owing}->GetLabel();
+   my $total = $self->{total}->GetLabel();
+
+   # Update labels
+   $paid += $amount;
+   $self->{total_paid}->SetLabel($paid);
+   $owing = $total - $paid;
+   if ($owing < 0) {
+       $self->{owing_label}->SetLabel('Change');
+       $self->{owing}->SetLabel($owing * -1);
+   } else {
+       $self->{owing_label}->SetLabel('Owing');
+       $self->{owing}->SetLabel($owing);
+   }
+
+   # update list;
+   my $item = $self->{list}->InsertStringItem($num, $num);
+   $self->{list}->SetItem($item, 1, $amount);
+   $self->{list}->SetItem($item, 2, $type);
+   $self->{list}->SetItem($item, 3, $source);
 }
 
 sub _Cancel{

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


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits