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

SF.net SVN: ledger-smb: [1779] branches/1.2



Revision: 1779
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1779&view=rev
Author:   einhverfr
Date:     2007-10-17 17:38: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:
--------------
    branches/1.2/LedgerSMB/IS.pm
    branches/1.2/LedgerSMB/RC.pm
    branches/1.2/LedgerSMB/Session/DB.pm
    branches/1.2/bin/is.pl
    branches/1.2/bin/pos.pl
    branches/1.2/bin/rc.pl
    branches/1.2/import_members.pl
    branches/1.2/pos.conf.pl

Modified: branches/1.2/LedgerSMB/IS.pm
===================================================================
--- branches/1.2/LedgerSMB/IS.pm	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/LedgerSMB/IS.pm	2007-10-18 00:38:57 UTC (rev 1779)
@@ -913,6 +913,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"} );
@@ -1115,7 +1120,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: branches/1.2/LedgerSMB/RC.pm
===================================================================
--- branches/1.2/LedgerSMB/RC.pm	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/LedgerSMB/RC.pm	2007-10-18 00:38:57 UTC (rev 1779)
@@ -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: branches/1.2/LedgerSMB/Session/DB.pm
===================================================================
--- branches/1.2/LedgerSMB/Session/DB.pm	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/LedgerSMB/Session/DB.pm	2007-10-18 00:38:57 UTC (rev 1779)
@@ -254,7 +254,6 @@
     my ( $dbusername, $md5Password, $cryptPassword ) =
       $fetchPassword->fetchrow_array;
     if ( $dbusername ne $username ) {
-
         # User data retrieved from db not for the requested user
         return 0;
     }

Modified: branches/1.2/bin/is.pl
===================================================================
--- branches/1.2/bin/is.pl	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/bin/is.pl	2007-10-18 00:38:57 UTC (rev 1779)
@@ -53,6 +53,7 @@
 1;
 
 # end of main
+sub on_update{}
 
 sub add {
 
@@ -808,6 +809,7 @@
 }
 
 sub update {
+    on_update();
     $form->{taxes} = {};
     $form->{exchangerate} =
       $form->parse_amount( \%myconfig, $form->{exchangerate} );

Modified: branches/1.2/bin/pos.pl
===================================================================
--- branches/1.2/bin/pos.pl	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/bin/pos.pl	2007-10-18 00:38:57 UTC (rev 1779)
@@ -42,10 +42,39 @@
 
 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"} ) {
@@ -77,14 +106,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;
 }
@@ -246,14 +268,6 @@
 	      </tr>
 | if $form->{selectdepartment};
 
-    $employee = qq|
-	      <tr>
-	        <th align="right" nowrap>| . $locale->text('Salesperson') . qq|</th>
-		<td colspan="3"><select name="employee">$form->{selectemployee}</select></td>
-		<input type="hidden" name="selectemployee" value="|
-      . $form->escape( $form->{selectemployee}, 1 ) . qq|">
-	      </tr>
-| if $form->{selectemployee};
 
     if ( $form->{change} != $form->{oldchange} ) {
         $form->{creditremaining} -= $form->{oldchange};
@@ -347,7 +361,7 @@
 	        <td></td>
 		<td colspan="3">
 		  <table>
-		    <tr>
+		    <!-- tr>
 		      <th align="right" nowrap>| . $locale->text('Credit Limit') . qq|</th>
 		      <td>$form->{creditlimit}</td>
 		      <td width="10"></td>
@@ -355,7 +369,7 @@
 		      <td class="plus$n">|
       . $form->format_amount( \%myconfig, $form->{creditremaining}, 0, "0" )
       . qq|</font></td>
-		    </tr>
+		    </tr -->
 		    $business
 		  </table>
 		</td>
@@ -603,12 +617,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' =>
@@ -673,7 +685,6 @@
 
 sub post {
 
-    $form->{media} = 'Printer';
     $form->isblank( "customer", $locale->text('Customer missing!') );
 
     # if oldcustomer ne customer redo form
@@ -686,7 +697,6 @@
     }
 
     &validate_items;
-    &print;
 
     $form->isblank( "exchangerate", $locale->text('Exchange rate missing!') )
       if ( $form->{currency} ne $form->{defaultcurrency} );
@@ -706,7 +716,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};
     }
@@ -884,7 +894,10 @@
 
 }
 
+
 sub print {
+    open_drawer();
+    sleep 1;
     if ( !$form->{invnumber} ) {
         $form->{invnumber} = $form->update_defaults( \%myconfig, 'sinumber' );
     }
@@ -1029,7 +1042,7 @@
 }
 
 sub print_and_post {
-
+    $form->{media} = 'Printer';  
     $form->error( $locale->text('Select a Printer!') )
       if ( $form->{media} eq 'screen' );
     $form->{printandpost} = 1;

Modified: branches/1.2/bin/rc.pl
===================================================================
--- branches/1.2/bin/rc.pl	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/bin/rc.pl	2007-10-18 00:38:57 UTC (rev 1779)
@@ -250,7 +250,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;
             }

Modified: branches/1.2/import_members.pl
===================================================================
--- branches/1.2/import_members.pl	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/import_members.pl	2007-10-18 00:38:57 UTC (rev 1779)
@@ -106,6 +106,7 @@
 
     $myUser = $member{$_};
     &save_member($myUser);
+    ${LedgerSMB::Sysconfig::GLOBALDBH}->commit;
     print "Import of user '$_' seems to have succeeded.\n";
 
 }
@@ -220,63 +221,6 @@
         );
 
     }
+    $dbh->commit;
 
-    if ( !$self->{'admin'} ) {
-
-        $self->{dbpasswd} =~ s/\\'/'/g;
-        $self->{dbpasswd} =~ s/\\\\/\\/g;
-
-        # format dbconnect and dboptions string
-        LedgerSMB::User::dbconnect_vars( $self, $self->{dbname} );
-
-        # check if login is in database
-        my $dbh = DBI->connect(
-            $self->{dbconnect}, $self->{dbuser},
-            $self->{dbpasswd}, { AutoCommit => 0 }
-        ) or $self->error($DBI::errstr);
-        $dbh->{pg_enable_utf8} = 1;
-
-        # add login to employee table if it does not exist
-        my $login = $self->{login};
-        $login =~ s/@.*//;
-        my $sth = $dbh->prepare("SELECT id FROM employee WHERE login = ?;");
-        $sth->execute($login);
-
-        my ($id) = $sth->fetchrow_array;
-        $sth->finish;
-        my $employeenumber;
-        my @values;
-        if ($id) {
-
-            $query = qq|UPDATE employee SET
-			role = ?,
-			email = ?, 
-			name = ?
-			WHERE login = ?|;
-
-            @values = ( $self->{role}, $self->{email}, $self->{name}, $login );
-
-        }
-        else {
-
-            my ($employeenumber) =
-              Form::update_defaults( "", \%$self, "employeenumber", $dbh );
-            $query = qq|
-				INSERT INTO employee 
-				            (login, employeenumber, name, 
-				            workphone, role, email, sales)
-				    VALUES (?, ?, ?, ?, ?, ?, '1')|;
-
-            @values = (
-                $login,       $employeenumber, $self->{name},
-                $self->{tel}, $self->{role},   $self->{email}
-            );
-        }
-
-        $sth = $dbh->prepare($query);
-        $sth->execute(@values);
-        $dbh->commit;
-        $dbh->disconnect;
-
-    }
 }

Modified: branches/1.2/pos.conf.pl
===================================================================
--- branches/1.2/pos.conf.pl	2007-10-17 23:16:35 UTC (rev 1778)
+++ branches/1.2/pos.conf.pl	2007-10-18 00:38:57 UTC (rev 1779)
@@ -9,6 +9,11 @@
 
 # Begin Editing Here
 
+if ($ENV{'REMOTE_ADDR'} =~ /^(127\.0\.0\.1|10\.0\.0\.8)$/){
+$ENV{'REMOTE_ADDR'} = '10.0.0.15';
+}
+
+
 $pos_config{'rem_host'} = $ENV{'REMOTE_ADDR'};
 
 $pos_config{'pd_host'}  = $pos_config{'rem_host'};
@@ -100,4 +105,5 @@
 ${'LedgerSMB::Sysconfig::printer'}{'Printer'} =
 "utils/pos/directnet.pl $pos_config{rp_host} $pos_config{rp_proto} $pos_config{rp_port}";
 
+
 1;


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