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

SF.net SVN: ledger-smb:[6276] addons/1.3/wxPOS



Revision: 6276
          http://sourceforge.net/p/ledger-smb/code/6276
Author:   einhverfr
Date:     2013-11-09 16:25:11 +0000 (Sat, 09 Nov 2013)
Log Message:
-----------
Still dealing with null chart id errors.  Will fix those tomorrow

Modified Paths:
--------------
    addons/1.3/wxPOS/WXPOS/Invoice.pm
    addons/1.3/wxPOS/WXPOS/Sysconfig.pm
    addons/1.3/wxPOS/wxpos.conf.template

Modified: addons/1.3/wxPOS/WXPOS/Invoice.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/Invoice.pm	2013-11-09 15:28:50 UTC (rev 6275)
+++ addons/1.3/wxPOS/WXPOS/Invoice.pm	2013-11-09 16:25:11 UTC (rev 6276)
@@ -16,6 +16,7 @@
 
 use Carp;
 use WXPOS::State;
+use WXPOS::Part;
 
 sub _get_prefix {
     return 'invoice__';
@@ -54,6 +55,21 @@
 
 has invnumber => (is => 'lazy');
 
+sub _build_invnumber {
+    my ($self) = @_;
+    my $invseq;
+    if ('1' eq $self->entity_class){
+        $invseq = 'vinumber';
+   } elsif ('2' eq $self->entity_class){
+        $invseq = 'cinumber';
+   }
+    my ($seq) = $self->call_procedure(funcname => 'setting_increment',
+                                    funcprefix => '',
+                                          args => [$invseq],
+    );
+}
+
+
 =head2 transdate
 
 Invoice date, defaults to 'today'
@@ -221,21 +237,30 @@
     my ($self) = @_;
     my $dbh = $self->_get_dbh;
     my $sfx;
+    my $invnumber;
+    my $invseq;
 
     if ('1' eq $self->entity_class){
         $sfx = 'ap';
     } elsif ('2' eq $self->entity_class){
         $sfx = 'ar';
     } 
-
     $dbh->begin_work;
     my ($ref) = $self->call_dbmethod(funcname => "start_$sfx");
     my ($id) = values (%$ref);
     $self->id($id);
     foreach my $line (@{$self->invoice_lines}){
+        my $part = WXPOS::Part->get_by_partnumber(
+                     $line->{partnumber},
+                     $self->entity_credit_account,
+                     $self->entity_class
+        );
+        $line->{parts_id} = $part->id;
         $self->call_dbmethod(funcname => "add_item_$sfx", args => $line);
     }
     foreach my $pmt (@{$self->payments}){
+        $pmt->{"${sfx}_accno"} = $WXPOS::Sysconfig::Accounts->{$sfx};
+        $pmt->{cash_accno} = $WXPOS::Sysconfig::Accounts->{cash};
         $self->call_dbmethod(funcname => "add_payment_$sfx", args => $pmt);
     }
     $self->call_dbmethod(funcname => "finalize_$sfx");

Modified: addons/1.3/wxPOS/WXPOS/Sysconfig.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/Sysconfig.pm	2013-11-09 15:28:50 UTC (rev 6275)
+++ addons/1.3/wxPOS/WXPOS/Sysconfig.pm	2013-11-09 16:25:11 UTC (rev 6276)
@@ -94,4 +94,12 @@
 if ($cfg->val('currency', 'series')){
    $curr->{series} = split /\s*,\s*/, $cfg->val('currency', 'series');
 }
+
+our $accounts = {};
+
+for my $var(qw(cash ar ap)){
+    $accounts->{$var} = $cfg->val('accounts', $var)
+         if $cfg->val('accounts', $var);
+}
+
 1;

Modified: addons/1.3/wxPOS/wxpos.conf.template
===================================================================
--- addons/1.3/wxPOS/wxpos.conf.template	2013-11-09 15:28:50 UTC (rev 6275)
+++ addons/1.3/wxPOS/wxpos.conf.template	2013-11-09 16:25:11 UTC (rev 6276)
@@ -24,3 +24,8 @@
 [currency]
 curr=IDR
 series=100000,50000,20000,10000,5000,2000,1000,500,200,100,50 
+
+[accounts]
+cash=1060
+ar=1200
+ap=2100

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