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

SF.net SVN: ledger-smb: [1781] trunk/bin



Revision: 1781
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1781&view=rev
Author:   einhverfr
Date:     2007-10-17 17:44:57 -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/bin/is.pl
    trunk/bin/pos.pl
    trunk/bin/rc.pl

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2007-10-18 00:40:43 UTC (rev 1780)
+++ trunk/bin/is.pl	2007-10-18 00:44:57 UTC (rev 1781)
@@ -53,6 +53,7 @@
 1;
 
 # end of main
+sub on_update{}
 
 sub add {
     if ($form->{type} eq 'credit_invoice'){
@@ -831,6 +832,7 @@
 }
 
 sub update {
+    on_update();
     $form->{taxes} = {};
     $form->{exchangerate} =
       $form->parse_amount( \%myconfig, $form->{exchangerate} );

Modified: trunk/bin/pos.pl
===================================================================
--- trunk/bin/pos.pl	2007-10-18 00:40:43 UTC (rev 1780)
+++ trunk/bin/pos.pl	2007-10-18 00:44:57 UTC (rev 1781)
@@ -45,10 +45,39 @@
 use LedgerSMB::Template;
 use LedgerSMB::Tax;
 
+$form->{currency} = 'USD';
 1;
 
 # end
+sub custom_send_to_pd{
+  socket(SOCK, 2, 1, getprotobynumber($pos_config{'pd_proto'}));
+  connect(SOCK, $pos_config{'pd_dest'});
+  my $rn = $numrows - 1;
+  my $ds_string = sprintf (
+	'%s%s @ $%-7.2f%s%s%s', 
+	$pd_control{'new_line'},
+	$form->{"qty_$rn"},
+	$form->{"sellprice_$rn"},
+	$pd_control{'new_line'},
+	"Subtotal: \$".sprintf('%-7.2f', $form->{'invtotal'})
+  );
+  print SOCK $ds_string;
+  close SOCK;
+}
 
+sub on_update{
+   &custom_send_to_pd;
+   &custom_check_alert;
+}
+
+sub open_drawer{
+   require "pos.conf.pl";
+   open (PRINTER, "|-", ${'LedgerSMB::Sysconfig::printer'}{Printer});
+   print PRINTER $pos_config{'rp_cash_open'};
+   close PRINTER;
+   sleep 1;
+}
+
 sub check_alert {
     my $rc = $form->{'rowcount'};
     if ( !$form->{"partnumber_$rc"} ) {
@@ -80,14 +109,7 @@
     &check_alert;
 }
 
-sub open_drawer {
-    open( PRINTER, "|-", ${LedgerSMB::Sysconfig::printer}{Printer} );
-    print PRINTER $pos_config{'rp_cash_open'};
-    close PRINTER;
-    sleep 1;
-}
-
-sub open {
+sub open_till {
     &open_drawer;
     &update;
 }
@@ -606,12 +628,10 @@
         %button = (
             'update' =>
               { ndx => 1, key => 'U', value => $locale->text('Update') },
-            'print' =>
-              { ndx => 2, key => 'P', value => $locale->text('Print') },
-            'post' => { ndx => 3, key => 'O', value => $locale->text('Post') },
+            'open_till' => { ndx => 3, key => 'O', value => $locale->text('Open Till') },
             'print_and_post' => {
                 ndx   => 4,
-                key   => 'R',
+                key   => 'P',
                 value => $locale->text('Print and Post')
             },
             'delete' =>
@@ -676,7 +696,6 @@
 
 sub post {
 
-    $form->{media} = 'Printer';
     $form->isblank( "customer", $locale->text('Customer missing!') );
 
     # if oldcustomer ne customer redo form
@@ -689,7 +708,6 @@
     }
 
     &validate_items;
-    &print;
 
     $form->isblank( "exchangerate", $locale->text('Exchange rate missing!') )
       if ( $form->{currency} ne $form->{defaultcurrency} );
@@ -709,7 +727,7 @@
         ++$form->{paidaccounts};
         my $pa = $form->{paidaccounts};
         $form->{"paid_$pa"}         = $total - $paid;
-        $form->{"source_$pa"}       = 'cash';
+        $form->{"memo_$pa"}       = 'cash';
         $form->{"exchangerate_$pa"} = 0;
         $form->{"AR_paid_$pa"}      = $form->{AR_paid_1};
     }
@@ -887,7 +905,10 @@
 
 }
 
+
 sub print {
+    open_drawer();
+    sleep 1;
     if ( !$form->{invnumber} ) {
         $form->{invnumber} = $form->update_defaults( \%myconfig, 'sinumber' );
     }
@@ -1041,7 +1062,7 @@
 }
 
 sub print_and_post {
-
+    $form->{media} = 'Printer';  
     $form->error( $locale->text('Select a Printer!') )
       if ( $form->{media} eq 'screen' );
     $form->{printandpost} = 1;

Modified: trunk/bin/rc.pl
===================================================================
--- trunk/bin/rc.pl	2007-10-18 00:40:43 UTC (rev 1780)
+++ trunk/bin/rc.pl	2007-10-18 00:44:57 UTC (rev 1781)
@@ -236,7 +236,7 @@
     foreach $source ( sort keys %pos_sources ) {
         $amount = 0;
         foreach $ref ( @{ $form->{TB} } ) {
-            if ( $ref->{source} eq $source ) {
+            if ( $ref->{memo} eq $source ) {
                 $amount = $ref->{amount} * -1;
                 last;
             }


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