From 9d7d99054d518b37ff727920bfcd2087e6b62a69 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 18 Oct 2007 00:38:57 +0000 Subject: 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 git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1779 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/IS.pm | 7 +++++- LedgerSMB/RC.pm | 4 +-- LedgerSMB/Session/DB.pm | 1 - bin/is.pl | 2 ++ bin/pos.pl | 65 +++++++++++++++++++++++++++++-------------------- bin/rc.pl | 2 +- import_members.pl | 60 ++------------------------------------------- pos.conf.pl | 6 +++++ 8 files changed, 58 insertions(+), 89 deletions(-) diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm index 5cc991c6..034835ff 100755 --- a/LedgerSMB/IS.pm +++ b/LedgerSMB/IS.pm @@ -913,6 +913,11 @@ sub post_invoice { 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"} ); @@ -1115,7 +1120,7 @@ sub post_invoice { $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"} ); diff --git a/LedgerSMB/RC.pm b/LedgerSMB/RC.pm index 6ffc16bf..63558b49 100755 --- a/LedgerSMB/RC.pm +++ b/LedgerSMB/RC.pm @@ -45,11 +45,11 @@ sub getposlines { 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) ) { diff --git a/LedgerSMB/Session/DB.pm b/LedgerSMB/Session/DB.pm index 9b682e8a..c595a1c0 100755 --- a/LedgerSMB/Session/DB.pm +++ b/LedgerSMB/Session/DB.pm @@ -254,7 +254,6 @@ sub password_check { my ( $dbusername, $md5Password, $cryptPassword ) = $fetchPassword->fetchrow_array; if ( $dbusername ne $username ) { - # User data retrieved from db not for the requested user return 0; } diff --git a/bin/is.pl b/bin/is.pl index 3322f695..3338018a 100755 --- a/bin/is.pl +++ b/bin/is.pl @@ -53,6 +53,7 @@ require "bin/io.pl"; 1; # end of main +sub on_update{} sub add { @@ -808,6 +809,7 @@ qq|{taxes} = {}; $form->{exchangerate} = $form->parse_amount( \%myconfig, $form->{exchangerate} ); diff --git a/bin/pos.pl b/bin/pos.pl index 0622681f..35fea78a 100755 --- a/bin/pos.pl +++ b/bin/pos.pl @@ -42,9 +42,38 @@ 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'}; @@ -77,14 +106,7 @@ sub on_update { &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; } @@ -246,14 +268,6 @@ sub form_header { | if $form->{selectdepartment}; - $employee = qq| - - | . $locale->text('Salesperson') . qq| - - - -| if $form->{selectemployee}; if ( $form->{change} != $form->{oldchange} ) { $form->{creditremaining} -= $form->{oldchange}; @@ -347,7 +361,7 @@ sub form_header { - + $business
@@ -603,12 +617,10 @@ qq||; %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' => @@ -673,7 +685,6 @@ qq|