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

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



Revision: 1782
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1782&view=rev
Author:   einhverfr
Date:     2007-10-17 17:45:37 -0700 (Wed, 17 Oct 2007)

Log Message:
-----------
POS Fixes:
1:  Drawer opening now uses correct printer designation
2: Change issued is now entered with correct memo field.
3:  Closing tell report works as advertised

Modified Paths:
--------------
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/RC.pm
    trunk/LedgerSMB/Session/DB.pm
    trunk/sql/Pg-database.sql

Added Paths:
-----------
    trunk/scripts/vouchers.pl

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2007-10-18 00:44:57 UTC (rev 1781)
+++ trunk/LedgerSMB/IS.pm	2007-10-18 00:45:37 UTC (rev 1782)
@@ -916,6 +916,11 @@
     my $ml;
     my $invoice_id;
     my $ndx;
+    for (keys %$form) {
+        if (UNIVERSAL::isa( $form->{$_}, 'Math::BigFloat' )){
+            $form->{$_} = $form->{$_}->bstr();
+        }
+    }
 
     foreach $i ( 1 .. $form->{rowcount} ) {
         $form->{"qty_$i"} = $form->parse_amount( $myconfig, $form->{"qty_$i"} );
@@ -1138,7 +1143,7 @@
     $form->{paid} = 0;
     for $i ( 1 .. $form->{paidaccounts} ) {
         $form->{"paid_$i"} =
-          $form->parse_amount( $myconfig, $form->{"paid_$i"} );
+          $form->parse_amount( $myconfig, $form->{"paid_$i"} )->bstr();
         $form->{paid} += $form->{"paid_$i"};
         $form->{datepaid} = $form->{"datepaid_$i"}
           if ( $form->{"paid_$i"} );

Modified: trunk/LedgerSMB/RC.pm
===================================================================
--- trunk/LedgerSMB/RC.pm	2007-10-18 00:44:57 UTC (rev 1781)
+++ trunk/LedgerSMB/RC.pm	2007-10-18 00:45:37 UTC (rev 1782)
@@ -45,11 +45,11 @@
     my $dbh = $form->{dbh};
 
     my $query = qq| 
-		  SELECT sum(amount) AS amount, source FROM acc_trans
+		  SELECT sum(amount) AS amount, memo FROM acc_trans
 		   WHERE chart_id = (SELECT id FROM chart 
 		                    WHERE accno = ?)
 		         AND transdate = date 'NOW' AND cleared IS NOT TRUE
-		GROUP BY source|;
+		GROUP BY memo|;
     my $sth = $dbh->prepare($query);
     $sth->execute( $pos_config{till_accno} ) || $form->dberror($query);
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {

Modified: trunk/LedgerSMB/Session/DB.pm
===================================================================
--- trunk/LedgerSMB/Session/DB.pm	2007-10-18 00:44:57 UTC (rev 1781)
+++ trunk/LedgerSMB/Session/DB.pm	2007-10-18 00:45:37 UTC (rev 1782)
@@ -266,7 +266,6 @@
       $fetchPassword->fetchrow_array;
 
     if ( $dbusername ne $username ) {
-
         # User data retrieved from db not for the requested user
         return 0;
     }

Added: trunk/scripts/vouchers.pl
===================================================================
--- trunk/scripts/vouchers.pl	                        (rev 0)
+++ trunk/scripts/vouchers.pl	2007-10-18 00:45:37 UTC (rev 1782)
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+
+# This file is copyright (C) 2007the LedgerSMB core team and licensed under 
+# the GNU General Public License.  For more information please see the included
+# LICENSE and COPYRIGHT files
+
+package LedgerSMB::Scripts::vouchers;
+our $VERSION = '0.1';
+
+$menufile = "menu.ini";
+use LedgerSMB::Batch;
+use LedgerSMB::Voucher;
+use LedgerSMB::Template;
+use strict;
+
+sub create_batch {
+    my ($request) = @_;
+    $request->{hidden} = [
+        batch_type => $request->{batch_type},
+    ];
+    my $template = LedgerSMB::Template->new(
+        user =>$request->{_user}, 
+        locale => $request->{_locale},
+        path => 'UI',
+        template => 'create_batch',
+        format => 'HTML'
+    );
+    $template->render($request);
+}
+
+sub create_vouchers {
+    #  This function is not safe for caching as long as the scripts are in bin.
+    #  This is because these scripts import all functions into the *current*
+    #  namespace.  People using fastcgi and modperl should *not* cache this 
+    #  module at the moment. -- CT
+    my %vouchers_dispatch = (
+        payable    => {script => 'bin/ap.pl', function => sub {add()}},
+        receivable => {script => 'bin/ar.pl', function => sub {add()}},
+        payments   => {script => 'bin/cp.pl', function => sub {payments()}},
+        receipts   => {script => 'bin/cp.pl', function => sub {receipts()}},
+        gl         => {script => 'bin/gl.pl'. function => sub {add()}},
+    )
+    require $vouchers_dispatch{$request->{batch_type}}{script}
+    $vouchers_dispatch{$request->{batch_type}}{function}();
+}
+
+sub list_vouchers {
+}
+
+sub approve_batch {
+}
+
+sub delete_batch {
+}
+
+1;

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2007-10-18 00:44:57 UTC (rev 1781)
+++ trunk/sql/Pg-database.sql	2007-10-18 00:45:37 UTC (rev 1782)
@@ -781,6 +781,7 @@
 insert into batch_class (id,class) values (3,'payment');
 insert into batch_class (id,class) values (4,'payment_reversal');
 insert into batch_class (id,class) values (5,'gl');
+insert into batch_class (id,class) values (6,'receipt');
 
 SELECT SETVAL('batch_class_id_seq',6);
 
@@ -795,12 +796,22 @@
   created_on date default now()
 );
 
+COMMENT ON batch.batch_class_id IS
+$$ Note that this field is largely used for sorting the vouchers.  A given batch is NOT restricted to this type.$$;
+
 CREATE TABLE voucher (
-  trans_id int,
+  trans_id int REFERENCES transactions(id) NOT NULL,
   batch_id int references batch(id) not null,
-  id serial primary key
+  id serial NOT NULL,
+  batch_class int references batch_class not null,
+  PRIMARY KEY (batch_class, batch_id, trans_id)
 );
 
+COMMENT ON batch.batch_class IS $$ This is the authoritative class of the 
+voucher. $$;
+
+COMMENT ON voucher.id IS $$ This is simply a surrogate key for easy reference.$$;
+
 --
 create table shipto (
   trans_id int,


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