[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [185] trunk
- Subject: SF.net SVN: ledger-smb: [185] trunk
- From: ..hidden..
- Date: Mon, 02 Oct 2006 20:26:42 -0700
Revision: 185
http://svn.sourceforge.net/ledger-smb/?rev=185&view=rev
Author: einhverfr
Date: 2006-10-02 20:26:37 -0700 (Mon, 02 Oct 2006)
Log Message:
-----------
Merged SL-POS.
Modified Paths:
--------------
trunk/CONTRIBUTORS
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/IC.pm
trunk/LedgerSMB/RC.pm
trunk/bin/mozilla/gl.pl
trunk/bin/mozilla/ir.pl
trunk/bin/mozilla/pos.pl
trunk/bin/mozilla/ps.pl
trunk/bin/mozilla/rc.pl
trunk/menu.ini
Added Paths:
-----------
trunk/drivers/
trunk/drivers/pd3000.pl
trunk/pos.conf.pl
trunk/utils/pos/
trunk/utils/pos/directnet.pl
trunk/utils/pos/pos-hardware-client-startup-script
Modified: trunk/CONTRIBUTORS
===================================================================
--- trunk/CONTRIBUTORS 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/CONTRIBUTORS 2006-10-03 03:26:37 UTC (rev 185)
@@ -17,6 +17,9 @@
Seneca Cunningham <tentra @ gmail.com>
Contributed code fixes.
+Jason Rodriguez <jasonjayr+ledgersmb @ gmail.com> provided the logic to force
+the password change in the admin.pl. He maintains the Gentoo Ebuilds packages.
+
Other Contributors:
========================
Dave van Ginneken <davevg @ gmail.com> fixed many HTML errors and has patched
@@ -25,11 +28,9 @@
Angus Carr <apcarr @ users.sourceforge.net> Has provided some corrections to
the documentation.
-Jason Rodriguez <jasonjayr+ledgersmb @ gmail.com> provided the logic to force
-the password change in the admin.pl
Christopher Browne <cbrowne @ acm.org> provided some corrections to the
-documentation, the Pg-tables.sql, and a setup file for replication
+documentation, the Pg-tables.sql, and a setup file for replication.
Original Authors of SQL-Ledger:
@@ -39,4 +40,3 @@
Systems, Inc.
Tony Fraser <tony @ sybaspace.com>
-Both of the above are mentioned as contributors to a single file in SQL-Ledger.
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/LedgerSMB/Form.pm 2006-10-03 03:26:37 UTC (rev 185)
@@ -523,6 +523,23 @@
@results;
}
+sub get_my_emp_num {
+ my ($self, $myconfig, $form) = @_;
+ %myconfig = %{$myconfig};
+ my $dbh = $form->{dbh};
+ # we got a connection, check the version
+ my $query = qq|
+ SELECT employeenumber FROM employee
+ WHERE login = ?|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($form->{login}) || $form->dberror($query);
+ $sth->execute;
+
+ my ($id) = $sth->fetchrow_array;
+ $sth->finish;
+ $form->{'emp_num'} = $id;
+}
+
sub parse_template {
my ($self, $myconfig, $userspath) = @_;
@@ -1297,8 +1314,8 @@
}
sub run_custom_queries {
+ my ($self, $tablename, $query_type, $linenum) = @_;
my $dbh = $self->{dbh};
- my ($self, $tablename, $query_type, $linenum) = @_;
if ($query_type !~ /^(select|insert|update)$/i){
$self->error($locale->text(
"Passed incorrect query type to get_cutstom_queries."
@@ -1379,7 +1396,7 @@
} elsif ($query_type eq 'SELECT'){
for (@rc){
$query = shift @{$_};
- $sth = $form->{dbh}->prepare($query);
+ $sth = $self->{dbh}->prepare($query);
$sth->execute($form->{id});
$ref = $sth->fetchrow_hashref(NAME_lc);
for (keys %{$ref}){
Modified: trunk/LedgerSMB/IC.pm
===================================================================
--- trunk/LedgerSMB/IC.pm 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/LedgerSMB/IC.pm 2006-10-03 03:26:37 UTC (rev 185)
@@ -38,7 +38,7 @@
my ($self, $myconfig, $form) = @_;
# connect to db
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $i;
my $query = qq|SELECT p.*,
@@ -80,11 +80,11 @@
FROM parts p
JOIN assembly a ON (a.parts_id = p.id)
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE a.id = $form->{id}
+ WHERE a.id = ?
|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query);
$form->{assembly_rows} = 0;
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
@@ -106,10 +106,10 @@
if ($form->{makemodel} ne "") {
$query = qq|SELECT make, model
FROM makemodel
- WHERE parts_id = $form->{id}|;
+ WHERE parts_id = ?|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{makemodels} }, $ref;
@@ -122,10 +122,10 @@
$query = qq|SELECT c.accno
FROM chart c, partstax pt
WHERE pt.chart_id = c.id
- AND pt.parts_id = $form->{id}|;
+ AND pt.parts_id = ?|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query);
while (($key) = $sth->fetchrow_array) {
$form->{amount}{$key} = $key;
@@ -133,22 +133,23 @@
$sth->finish;
+ my $id = $dbh->quote($form->{id});
# is it an orphan
$query = qq|SELECT parts_id
FROM invoice
- WHERE parts_id = $form->{id}
+ WHERE parts_id = $id
UNION
SELECT parts_id
FROM orderitems
- WHERE parts_id = $form->{id}
+ WHERE parts_id = $id
UNION
SELECT parts_id
FROM assembly
- WHERE parts_id = $form->{id}
+ WHERE parts_id = $id
UNION
SELECT parts_id
FROM jcitems
- WHERE parts_id = $form->{id}|;
+ WHERE parts_id = $id
($form->{orphaned}) = $dbh->selectrow_array($query);
$form->{orphaned} = !$form->{orphaned};
@@ -166,11 +167,11 @@
pv.lastcost, pv.leadtime, pv.curr AS vendorcurr
FROM partsvendor pv
JOIN vendor v ON (v.id = pv.vendor_id)
- WHERE pv.parts_id = $form->{id}
+ WHERE pv.parts_id = ?
ORDER BY 2|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{vendormatrix} }, $ref;
@@ -187,18 +188,18 @@
FROM partscustomer pc
LEFT JOIN customer c ON (c.id = pc.customer_id)
LEFT JOIN pricegroup g ON (g.id = pc.pricegroup_id)
- WHERE pc.parts_id = $form->{id}
+ WHERE pc.parts_id = ?
ORDER BY c.name, g.pricegroup, pc.pricebreak|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{customermatrix} }, $ref;
}
$sth->finish;
}
-
- $dbh->disconnect;
+
+ $form->get_custom_queries('parts', 'SELECT');
}
@@ -492,6 +493,7 @@
my $rc = $dbh->commit;
$dbh->disconnect;
+ $form->get_custom_queries('parts', 'UPDATE');
$rc;
}
Modified: trunk/LedgerSMB/RC.pm
===================================================================
--- trunk/LedgerSMB/RC.pm 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/LedgerSMB/RC.pm 2006-10-03 03:26:37 UTC (rev 185)
@@ -33,12 +33,90 @@
package RC;
+
+sub getposlines{
+ my ($self, $myconfig, $form) = @_;
+ %pos_config = %{$form->{pos_config}};
+ %pos_sources = %{$form->{pos_sources}};
+ my $sources = '';
+ foreach $key (keys %pos_sources){
+ $sources .= ", '$key'";
+ }
+ $sources =~ s/^,\s*//;
+ my $dbh = $form->{dbh};
+ # Considering the query below to be safe since all variables are from config
+ # files rather than user input.
+ my $query = qq|
+ SELECT sum(amount) AS amount, source FROM acc_trans
+ WHERE chart_id =
+ (SELECT id FROM chart WHERE accno = '$pos_config{till_accno}')
+ AND transdate = date 'NOW'
+ AND cleared IS NOT TRUE
+ GROUP BY source
+ |;
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{$form->{TB}}, $ref;
+ }
+ $sth->finish;
+ my $query = qq|
+ SELECT sum(amount) AS sum FROM acc_trans
+ WHERE chart_id =
+ (SELECT id FROM chart WHERE accno = '$pos_config{till_accno}')
+ AND transdate = date 'NOW'
+ AND cleared IS NOT TRUE
+ |;
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+ my $ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->{sum} = $ref->{sum};
+ $sth->finish;
+}
+
+sub clear_till {
+ my ($self, $myconfig, $form) = @_;
+ %pos_config = %{$form->{pos_config}};
+ %pos_sources = %{$form->{pos_sources}};
+ my $sources = '';
+ foreach $key (keys %pos_sources){
+ $sources .= ", '$key'";
+ }
+ $sources =~ s/^,\s//;
+ my $dbh = $form->{dbh};
+ my $query = qq|
+ UPDATE acc_trans
+ SET cleared = TRUE
+ WHERE chart_id =
+ (SELECT id FROM chart WHERE accno = '$pos_config{till_accno}')
+ AND transdate = date 'NOW'
+ |;
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+}
+
+sub getbalance{
+ my ($self, $myconfig, $form) = @_;
+ my $dbh = $form->{dbh};
+
+ my $query = qq|SELECT sum(amount) AS balance
+ FROM acc_trans
+ WHERE chart_id =
+ (SELECT id FROM chart WHERE accno = '$form->{accno}')|;
+
+ my $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+ my $ref = $sth->fetchrow_hashref(NAME_lc);
+ $form->{balance} = $ref->{balance};
+}
+
+
sub paymentaccounts {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->{dbh};
my $query = qq|SELECT accno, description
FROM chart
Modified: trunk/bin/mozilla/gl.pl
===================================================================
--- trunk/bin/mozilla/gl.pl 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/bin/mozilla/gl.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -83,7 +83,23 @@
# $locale->text('Nov')
# $locale->text('Dec')
+sub pos_adjust {
+ $form->{rowcount} = 3;
+ require "pos.conf.pl";
+ $form->{accno_1} = $pos_config{'close_cash_accno'};
+ $form->{accno_2} = $pos_config{'coa_prefix'};
+ $form->{accno_3} = $pos_config{'coa_prefix'};
+}
+sub add_pos_adjust {
+ $form->{pos_adjust} = 1;
+ $form->{reference} = $locale->text("Adjusting Till: (till) Source: (source)");
+ $form->{description} =
+ $locale->text("Adjusting till due to data entry error.");
+ $form->{callback} = "$form->{script}?action=add_pos_adjust&transfer=$form->{transfer}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
+ &add;
+}
+
sub add {
$form->{title} = "Add";
@@ -93,6 +109,9 @@
&create_links;
$form->{rowcount} = ($form->{transfer}) ? 3 : 9;
+ if ($form->{pos_adjust}){
+ &pos_adjust;
+ }
$form->{oldtransdate} = $form->{transdate};
$form->{focus} = "reference";
@@ -856,7 +875,7 @@
|;
}
- $form->hide_form(qw(rowcount selectaccno));
+ $form->hide_form(qw(rowcount selectaccno pos_adjust));
print qq|
<input type=hidden name=selectprojectnumber value="|.$form->escape($form->{selectprojectnumber},1).qq|">|;
Modified: trunk/bin/mozilla/ir.pl
===================================================================
--- trunk/bin/mozilla/ir.pl 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/bin/mozilla/ir.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -461,10 +461,12 @@
<tr>
<th align=left>|.$locale->text('Notes').qq|</th>
<th align=left>|.$locale->text('Internal Notes').qq|</th>
+ <th align=left>|.$locale->text('Import Text').qq|</th>
</tr>
<tr valign=top>
<td>$notes</td>
<td>$intnotes</td>
+ <td><textarea name=import_text rows=$rows cols=25></textarea>
</tr>
</table>
</td>
@@ -624,9 +626,72 @@
}
+sub import_text {
+ my @o_list;
+ my @i_lines = split(/(\n|\r|\r\n)/, $form->{import_text});
+ foreach $i (@i_lines){
+ chomp($i);
+ if ($i != ""){ # Strip out blank lines
+ push @o_list, $i;
+ }
+ }
+ my $c = 1;
+ my $linenumber = 0;
+ foreach $l (@o_list){
+ if ($c % 2){
+ $linenumber += 1;
+ $form->{"partnumber_$linenumber"} = $l;
+ }
+ else {
+ $form->{"qty_$linenumber"} = $l;
+ }
+ $c += 1;
+ $form->{rowcount}=$linenumber;
+ IR->retrieve_item(\%myconfig, \%$form);
+ $rows = scalar @{ $form->{item_list} };
+ $rows = 0 unless $rows;
+ $i = $form->{rowcount};
+ if ($rows = 0){
+ $form->{"id_$i"} = 0;
+ $form->{"unit_$i"} = $locale->text('ea');
+ &new_item;
+ } elsif ($rows > 1){
+ &select_item;
+ exit;
+ } else {
+ map { $form->{item_list}[$i]{$_} = $form->quote($form->{item_list}[$i]{$_}) } qw(partnumber description unit);
+
+ map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
+
+ $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
+
+ ($dec) = ($s =~ /\.(\d+)/);
+ $dec = length $dec;
+ $decimalplaces = ($dec > 2) ? $dec : 2;
+
+ $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
+ map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
+ map { $form->{"${_}_base"} += $amount } (split / /, $form->{"taxaccounts_$i"});
+ map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded};
+
+ $form->{creditremaining} -= $amount;
+
+ $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
+ $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+
+ }
+ $form->{item_list} = [];
+ }
+ ++$form->{rowcount}
+}
+
sub update {
+ if($form->{import_text}){
+ &import_text;
+ }
+
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
if ($newname = &check_name(vendor)) {
Modified: trunk/bin/mozilla/pos.pl
===================================================================
--- trunk/bin/mozilla/pos.pl 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/bin/mozilla/pos.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -44,12 +44,55 @@
1;
# end
+sub check_alert {
+ my $rc = $form->{'rowcount'};
+ if (!$form->{"partnumber_$rc"}){
+ --$rc; # Ensures that alert shows up when item is selected from a list;
+ }
+ for (1 .. $rc){
+ $form->{'check_id'} = ($form->{'check_id'} || $form->{"check_id_$_"});
+ }
+}
+sub 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{
+ &send_to_pd;
+ &check_alert;
+}
+
+sub open_drawer{
+ open (PRINTER, "|-", $printer{Printer});
+ print PRINTER $pos_config{'rp_cash_open'};
+ close PRINTER;
+ sleep 1;
+}
+
+sub open {
+ &open_drawer;
+ &update;
+}
+
sub add {
+ $form->{nextsub} = 'add';
$form->{title} = $locale->text('Add POS Invoice');
- $form->{callback} = "$form->{script}?action=$form->{nextsub}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
+ $form->{callback} = "$form->{script}?action=$form->{nextsub}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
&invoice_links;
@@ -68,10 +111,14 @@
&display_form;
+ $form->{dontdisplayrows} = 1;
+ &openinvoices;
}
sub openinvoices {
+ undef %column_data;
+ undef %column_heading;
$ENV{REMOTE_ADDR} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
$form->{till} = $4;
@@ -94,7 +141,7 @@
$form->{title} = $locale->text('Edit POS Invoice');
- $form->{callback} = "$form->{script}?action=$form->{nextsub}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
+ $form->{callback} = "$form->{script}?action=$form->{nextsub}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
&invoice_links;
&prepare_invoice;
@@ -115,6 +162,10 @@
sub form_header {
+ if (!$form->{'check_id'}){
+ &check_alert;
+ }
+
# set option selected
for (qw(AR currency)) {
$form->{"select$_"} =~ s/ selected//;
@@ -228,7 +279,7 @@
<form method=post action="$form->{script}">
|;
- $form->hide_form(qw(id till type format printed title discount creditlimit creditremaining tradediscount business closedto locked oldtransdate customer_id oldcustomer));
+ $form->hide_form(qw(id till type format printed title discount creditlimit creditremaining tradediscount business closedto locked oldtransdate customer_id oldcustomer check_id));
print qq|
<input type=hidden name=vc value="customer">
@@ -236,7 +287,15 @@
<table width=100%>
<tr class=listtop>
<th class=listtop>$form->{title}</font></th>
- </tr>
+ </tr>|;
+ if ($form->{'check_id'}){
+ print qq|
+ <tr class=listtop>
+ <th class=listtop style="background-color: red">|.$locale->text('Check ID').qq|
+ </th>
+ </tr>|;
+ }
+ print qq|
<tr height="5"></tr>
<tr>
<td>
@@ -378,12 +437,25 @@
$form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
$form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
-
- $column_data{paid} = qq|<td><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
+ if ($form->{"paid__$i"}){
+ $column_data{paid} = qq|<td><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
+ } else {
+ $column_data{paid} = qq|<td><input accesskey='n' name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
+ }
+
$column_data{source} = qq|<td><input name="source_$i" size=10 value="$form->{"source_$i"}"></td>|;
$column_data{memo} = qq|<td><input name="memo_$i" size=10 value="$form->{"memo_$i"}"></td>|;
- $column_data{AR_paid} = qq|<td><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
+ if ($pos_config{"coa_prefix"}){
+ if (!$form->{"AR_paid_$i"}){
+ $form->{"AR_paid_$i"} =
+ $pos_config{"coa_prefix"}.'.'.$pos_config{"till"};
+ }
+ $column_data{AR_paid} = qq|<input type=hidden name="AR_paid_$i"
+ value='$form->{"AR_paid_$i"}'>|;
+ } else {
+ $column_data{AR_paid} = qq|<td><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
+ }
print qq|
<tr>
|;
@@ -520,6 +592,7 @@
sub post {
+ $form->{media} = 'Printer';
$form->isblank("customer", $locale->text('Customer missing!'));
# if oldcustomer ne customer redo form
@@ -532,6 +605,7 @@
}
&validate_items;
+ &print;
$form->isblank("exchangerate", $locale->text('Exchange rate missing!')) if ($form->{currency} ne $form->{defaultcurrency});
@@ -542,7 +616,16 @@
$total = $form->parse_amount(\%myconfig, $form->{invtotal});
# deduct change from first payment
- $form->{"paid_1"} = $form->format_amount(\%myconfig, $form->parse_amount(\%myconfig, $form->{"paid_1"}) - ($paid - $total), 2) if $paid > $total;
+ #$form->{"paid_1"} = $form->{invtotal} if $paid > $total;
+ $form->{paid} = $paid;
+ if ($paid > $total){
+ ++$form->{paidaccounts};
+ my $pa = $form->{paidaccounts};
+ $form->{"paid_$pa"} = $total - $paid;
+ $form->{"source_$pa"} = 'cash';
+ $form->{"exchangerate_$pa"} = 0;
+ $form->{"AR_paid_$pa"} = $form->{AR_paid_1}
+ }
($form->{AR}) = split /--/, $form->{AR};
@@ -667,6 +750,22 @@
sub print {
+ if (!$form->{invnumber}){
+ $form->{invnumber} = $form->update_defaults(\%myconfig, 'sinumber');
+ }
+ $rc = $form->{'rowcount'};
+ $pc = $form->{'paidaccounts'};
+ if ($form->{"partnumber_$rc"} || $form->{"description_$rc"} ||
+ $form->{"paid_$pc"}){
+ &update;
+ exit;
+ }
+ for $i (1 .. $rc - 1){
+ if ($form->{"qty_$i"} != $form->{"oldqty_$i"}){
+ &update;
+ exit;
+ }
+ }
if (!$form->{invnumber}) {
$form->{invnumber} = $form->update_defaults(\%myconfig, "sinumber");
@@ -681,7 +780,8 @@
for (qw(employee department)) { $form->{$_} =~ s/--.*//g; }
$form->{invdate} = $form->{transdate};
- $form->{dateprinted} = scalar localtime;
+ my @lt = localtime();
+ $form->{dateprinted} = $lt[2].":".$lt[1].":".$lt[0];
&print_form($old_form);
@@ -690,6 +790,7 @@
sub print_form {
my $old_form = shift;
+ &open_drawer;
# if oldcustomer ne customer redo form
$customer = $form->{customer};
@@ -743,6 +844,7 @@
$form->{rowcount}--;
$form->{pre} = "<body bgcolor=#ffffff>\n<pre>";
delete $form->{stylesheet};
+ $form->{cd_open} = $pos_config{rp_cash_drawer_open};
$form->parse_template(\%myconfig, $userspath);
@@ -768,7 +870,7 @@
if (! $form->{printandpost}) {
$form->{rowcount}--;
- &display_form;
+ #&display_form;
}
}
Modified: trunk/bin/mozilla/ps.pl
===================================================================
--- trunk/bin/mozilla/ps.pl 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/bin/mozilla/ps.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -50,6 +50,7 @@
require "$form->{path}/is.pl";
require "$form->{path}/rp.pl";
require "$form->{path}/pos.pl";
+require "pos.conf.pl";
# customizations
if (-f "$form->{path}/custom_pos.pl") {
Modified: trunk/bin/mozilla/rc.pl
===================================================================
--- trunk/bin/mozilla/rc.pl 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/bin/mozilla/rc.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -188,10 +188,299 @@
sub continue { &{ $form->{nextsub} } };
+sub till_closing {
+ $form->{callback} = "$form->{script}?path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+ @colheadings = qw(Source Actual Expected Error);
+
+ $form->{title} = "Closing Till For $form->{login}";
+ require "pos.conf.pl";
+ RC->getposlines(\%myconfig, \%$form);
+ $form->header;
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+<input type=hidden name=path value=$form->{path}>
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=sessionid value=$form->{sessionid}>
+
+<input type=hidden name=callback value="$form->{callback}">
+<input type=hidden name=sum value="|.$form->{sum} * -1 .qq|">
+<table width=100%>
+ <tr>
+ <th class=listtop>$form->{title}</th>
+ </tr>
+</table>
+<table width=100%>
+|;
+
+ print "<tr>";
+ map {print "<td class=listheading>$_</td>";} @colheadings;
+ print "</tr>";
+ my $j;
+ my $source;
+ foreach $source (sort keys %pos_sources){
+ $amount = 0;
+ foreach $ref (@{$form->{TB}}){
+ if ($ref->{source} eq $source){
+ $amount = $ref->{amount} * -1;
+ last;
+ }
+ }
+ ++$j;
+ $j = $j % 2;
+ print qq|<tr class=listrow$j><td>|.$pos_sources{$source}.qq|</td>
+ <td><input name="amount_$source">
+ <input type=hidden name="expected_$source"
+ value="$amount"></td>
+ <td>\$$amount</td>
+ <td id="error_$source"> </td></tr>|;
+ }
+ print qq|
+<script type='text/javascript'>
+
+function money_round(m){
+ var r;
+ r = Math.round(m * 100)/100;
+ return r;
+}
+
+function custom_calc_total(){
+ document.forms[0].sub_100.value = document.forms[0].calc_100.value * 100;
+ document.forms[0].sub_50.value = document.forms[0].calc_50.value * 50;
+ document.forms[0].sub_20.value = document.forms[0].calc_20.value * 20;
+ document.forms[0].sub_10.value = document.forms[0].calc_10.value * 10;
+ document.forms[0].sub_5.value = document.forms[0].calc_5.value * 5;
+ document.forms[0].sub_1.value = document.forms[0].calc_1.value * 1;
+ document.forms[0].sub_050.value = document.forms[0].calc_050.value * .5;
+ document.forms[0].sub_025.value = document.forms[0].calc_025.value * .25;
+ document.forms[0].sub_010.value = document.forms[0].calc_010.value * .10;
+ document.forms[0].sub_005.value = document.forms[0].calc_005.value * .05;
+ document.forms[0].sub_001.value = document.forms[0].calc_001.value * .01;
+ document.forms[0].sub_sub.value = document.forms[0].sub_100.value * 1 +
+ document.forms[0].sub_50.value*1 + document.forms[0].sub_20.value*1 +
+ document.forms[0].sub_10.value*1 + document.forms[0].sub_5.value*1 +
+ document.forms[0].sub_1.value*1 + document.forms[0].sub_050.value*1 +
+ document.forms[0].sub_025.value*1 + document.forms[0].sub_010.value*1 +
+ document.forms[0].sub_005.value*1 + document.forms[0].sub_001.value*1;
+ document.forms[0].sub_001.value =
+ money_round(document.forms[0].sub_001.value);
+ document.forms[0].sub_010.value =
+ money_round(document.forms[0].sub_010.value);
+ document.forms[0].sub_005.value =
+ money_round(document.forms[0].sub_005.value);
+ document.forms[0].sub_sub.value =
+ money_round(document.forms[0].sub_sub.value);
+ document.forms[0].amount_cash.value = money_round(
+ document.forms[0].sub_sub.value - $pos_config{till_cash});
+ check_errors();
+}
+function check_errors(){
+ var cumulative_error = 0;
+ var source_error = 0;
+ var err_cell;
+ |;
+ map {
+ print " source_error = money_round(
+ document.forms[0].amount_$_.value -
+ document.forms[0].expected_$_.value);
+ cumulative_error = cumulative_error + source_error;
+ err_cell = document.getElementById('error_$_');
+ err_cell.innerHTML = '\$' + source_error;\n";
+ } (keys %pos_sources);
+ print qq|
+ alert('Cumulative Error: \$' + money_round(cumulative_error));
+}
+</script>
+
+<table>
+<col><col><col>
+ <tr>
+ <td><input type=text name=calc_100 value="$form->{calc_100}"></td>
+ <th>X \$100 = </th>
+ <td><input type=text name=sub_100 value="$form->{sub_100}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_50 value="$form->{calc_50}"></td>
+ <th>X \$50 = </th>
+ <td><input type=text name=sub_50 value="$form->{sub_50}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_20 value="$form->{calc_20}"></td>
+ <th>X \$20 = </th>
+ <td><input type=text name=sub_20 value="$form->{sub_20}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_10 value="$form->{calc_10}"></td>
+ <th>X \$10 = </th>
+ <td><input type=text name=sub_10 value="$form->{sub_10}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_5 value="$form->{calc_5}"></td>
+ <th>X \$5 = </th>
+ <td><input type=text name=sub_5 value="$form->{sub_5}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_1 value="$form->{calc_1}"></td>
+ <th>X \$1 = </th>
+ <td><input type=text name=sub_1 value="$form->{sub_1}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_050 value="$form->{calc_050}"></td>
+ <th>X \$0.50 = </th>
+ <td><input type=text name=sub_050 value="$form->{sub_050}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_025 value="$form->{calc_025}"></td>
+ <th>X \$.25 = </th>
+ <td><input type=text name=sub_025 value="$form->{sub_025}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_010 value="$form->{calc_010}"></td>
+ <th>X \$.10 = </th>
+ <td><input type=text name=sub_010 value="$form->{sub_010}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_005 value="$form->{calc_005}"></td>
+ <th>X \$.05 = </th>
+ <td><input type=text name=sub_005 value="$form->{sub_005}"></td>
+ </tr>
+ <tr>
+ <td><input type=text name=calc_001 value="$form->{calc_001}"></td>
+ <th>X \$.01 = </th>
+ <td><input type=text name=sub_001 value="$form->{sub_001}"></td>
+ </tr>
+ <tr>
+ <td> </td>
+ <th>Subtotal:</th>
+ <td><input type=text name=sub_sub value="$form->{sub_sub}"></td>
+</table>
+<input type=button name=calculate class=submit onClick="custom_calc_total()"
+ value='Calculate'>
+|;
+ print qq|</table><input type=submit name=action value="|.
+ $locale->text("close_till").qq|">|;
+ print qq|
+</form>
+
+</body>
+</html>
+|;
+}
+
+
+sub close_till {
+ use SL::GL;
+ require 'pos.conf.pl';
+ RC->clear_till(\%myconfig, \%$form);
+ my $amount = 0;
+ my $expected = 0;
+ my $difference = 0;
+ my $lines = '';
+ $form->{rowcount} = 2;
+ foreach $key (keys %pos_sources){
+ $amount = 0;
+ $expected = 0;
+ $amount = $form->parse_amount(\%myconfig, $form->{"amount_$key"});
+ $expected = $form->parse_amount(\%myconfig, $form->{"expected_$key"});
+ $gl_entry = "Closing Till $pos_config{till} source = $key";
+ $accno1 = $pos_config{till_accno};
+ if (${$pos_config{'source_accno_override'}{$key}}){
+ $accno2 = ${$pos_config{'source_accno_override'}{$key}};
+ } else {
+ $accno2 = $pos_config{'close_cash_accno'};
+ }
+ $form->{reference} = $gl_entry;
+ $form->{accno_1} = $accno1;
+ $form->{credit_1} = $amount;
+ $form->{accno_2} = $accno2;
+ $form->{debit_2} = $amount;
+ $form->{transdate} = $form->current_date(\%myconfig);
+ GL->post_transaction(\%myconfig, \%$form);
+ delete $form->{id};
+ $error = $amount - $expected;
+ $difference += $error;
+ $lines .= "Source: $key, Amount: $amount\nExpected: $expected. Error= $error\n\n";
+ }
+ $gl_entry = "Closing Till: $pos_config{till} Over/Under";
+ $amount = $difference * -1;
+ $form->{reference} = $gl_entry;
+ $form->{accno_1} = $accno1;
+ $form->{credit_1} = $amount;
+ $form->{accno_2} = $pos_config{coa_prefix};
+ $form->{debit_2} = $amount;
+ $form->{transdate} = $form->current_date(\%myconfig);
+ GL->post_transaction(\%myconfig, \%$form);
+ delete $form->{id};
+ $lines .= "Cumulative Error: $amount";
+ $form->{accno} = $form->{accno_1};
+ RC->getbalance(\%myconfig, \%$form);
+ $amount = $form->{balance} * -1;
+ $gl_entry = "Resetting Till: $pos_config{till}";
+ $form->{reference} = $gl_entry;
+ $form->{accno_1} = $accno1;
+ $form->{credit_1} = $amount;
+ $form->{accno_2} = $pos_config{coa_prefix};
+ $form->{debit_2} = $amount;
+ $form->{transdate} = $form->current_date(\%myconfig);
+ GL->post_transaction(\%myconfig, \%$form);
+ delete $form->{id};
+
+ $head = "Closing Till $pos_config{till} for $form->{login}\n".
+ "Date: $form->{transdate}\n\n\n";
+ $cash = join ("\n",
+ ("Cash Breakdown:",
+ "$form->{calc_100} x 100 = $form->{sub_100}",
+ "$form->{calc_50} x 50 = $form->{sub_50}",
+ "$form->{calc_20} x 20 = $form->{sub_20}",
+ "$form->{calc_10} x 10 = $form->{sub_10}",
+ "$form->{calc_5} x 5 = $form->{sub_5}",
+ "$form->{calc_1} x 1 = $form->{sub_1}",
+ "$form->{calc_050} x 0.50 = $form->{sub_050}",
+ "$form->{calc_025} x 0.25 = $form->{sub_025}",
+ "$form->{calc_010} x 0.10 = $form->{sub_010}",
+ "$form->{calc_005} x 0.05 = $form->{sub_005}",
+ "$form->{calc_001} x 0.01 = $form->{sub_001}",
+ "Total Cash in Drawer: $form->{sub_sub}",
+ "Less Cash in Till At Start: $pos_config{till_cash}",
+ "\n"));
+ $foot = "Cumulative Error: $difference\n Reset Till By $amount\n\n\n\n\n\n\n\n\n\n";
+ open (PRN, "|-", $printer{Printer});
+ print PRN $head;
+ print PRN $lines;
+ print PRN $cash;
+ print PRN $cash;
+ print PRN $foot;
+ close PRN;
+ if ($difference > 0){
+ $message = "You are over by ".$difference;
+ } elsif ($difference < 0){
+ $message = "You are under by ".$difference * -1;
+ }
+ else {
+ $message = "Congradulations! Your till is exactly balanced.";
+ }
+ $form->info($message);
+}
+
sub get_payments {
($form->{accno}, $form->{account}) = split /--/, $form->{accno};
+ if ($form->{'pos'}){
+ require "pos.conf.pl";
+ $form->{fromdate} = $form->current_date(\%myconfig);
+ unless ($form->{source}){
+ $form->{source} = (sort keys(%pos_sources))[0];
+ }
+ if ($form->{source} eq 'cash'){
+ $form->{summary} = "true";
+ } else {
+ $form->{summary} = "";
+ }
+ $form->{accno} = $pos_config{'coa_prefix'} . "." . $pos_config{'till'};
+ $form->{account} = $form->{source};
+ }
RC->payment_transactions(\%myconfig, \%$form);
@@ -243,6 +532,8 @@
<form method=post action=$form->{script}>
+<input type=hidden name=source value="$form->{source}">
+<input type=hidden name=cumulative_error value="$form->{cumulative_error}">
<table width=100%>
<tr>
<th class=listtop>$form->{title}</th>
@@ -359,12 +650,15 @@
$column_data{cleared} = qq|<td align=center>*</td>
<input type=hidden name="cleared_$i" value=$ref->{cleared}>
<input type=hidden name="oldcleared_$i" value=$ref->{oldcleared}>
- <input type=hidden name="source_$i" value="$ref->{source}">|;
+ <input type=hidden name="source_$i" value="$ref->{source}">
+ <input type=hidden name="amount_$1" value="$ref->{amount}">|;
} else {
$cleared += $ref->{amount} * $ml if $checked;
$clearfx = ($checked) ? 1 : 0;
$column_data{cleared} = qq|<td align=center><input name="cleared_$i" type=checkbox class=checkbox value=1 $checked>
- <input type=hidden name="source_$i" value="$ref->{source}"></td>|;
+ <input type=hidden name="source_$i" value="$ref->{source}">
+ <input type=hidden name="amount_$i" value="$ref->{amount}">
+ </td>|;
}
}
@@ -402,6 +696,9 @@
$form->{statementbalance} = $form->parse_amount(\%myconfig, $form->{statementbalance});
$difference = $form->format_amount(\%myconfig, $form->{beginningbalance} + $cleared - $form->{statementbalance}, 2, 0);
+ if ($form->{source}){
+ $difference = 0;
+ }
$form->{statementbalance} = $form->format_amount(\%myconfig, $form->{statementbalance}, 2, 0);
print qq|
@@ -411,7 +708,46 @@
</tr>
|;
-
+ if ($form->{'pos'}){
+ $close_next = qq|<input type=submit class=submit name=action
+ value="|.$locale->text('close_next').qq|">|;
+ $done = "";
+ }
+ else {
+ $close_next = "";
+ $done = qq|<input type=submit class=submit name=action
+ value="|.$locale->text('Done').qq|">|;
+ }
+ if ($form->{'pos'}){
+ $difference = qq|
+ <tr>
+ <th align=right><select name=over_under>
+ <option value=under>|.$locale->text('Under').qq|</option>
+ <option value=over>|.$locale->text('Over').qq|</option>
+ </select><input type=hidden name=pos value='true'>
+ </th>
+ <td width=10%></td>
+ <td align=right><input name=null size=11
+ value='|.$form->{null2}.qq|'></td>
+ <input type=hidden name=difference
+ value=$difference>
+
+ |;
+ if ($form->{'over_under'}){
+ $o_u = $form->{'over_under'};
+ $difference =~ s/(value=$o_u)/SELECTED $1/g;
+ }
+ } else {
+ $difference = qq|
+ <tr>
+ <th align=right nowrap>|.$locale->text('Difference').qq|</th>
+ <td width=10%></td>
+ <td align=right><input name=null size=11 value=$difference></td>
+ <input type=hidden name=difference value=$difference>
+ </tr>|;
+ }
+
+
if ($form->{report}) {
print qq|
@@ -434,12 +770,7 @@
<td width=10%></td>
<td align=right><input name=statementbalance size=11 value=$form->{statementbalance}></td>
</tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Difference').qq|</th>
- <td width=10%></td>
- <td align=right><input name=null size=11 value=$difference></td>
- <input type=hidden name=difference value=$difference>
- </tr>
+ $difference
</table>
</td>
</tr>
@@ -458,7 +789,8 @@
<br>
<input type=submit class=submit name=action value="|.$locale->text('Update').qq|">
<input type=submit class=submit name=action value="|.$locale->text('Select all').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Done').qq|">|;
+ $done
+ $close_next |;
}
if ($form->{menubar}) {
@@ -477,6 +809,7 @@
sub update {
+ $form->{null2} = $form->{null};
RC->payment_transactions(\%myconfig, \%$form);
Added: trunk/drivers/pd3000.pl
===================================================================
--- trunk/drivers/pd3000.pl (rev 0)
+++ trunk/drivers/pd3000.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -0,0 +1,47 @@
+#
+######################################################################
+# LedgerSMB Accounting and ERP
+# http://www.ledgersmb.org/
+#
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+# Driver for Logic Controls PD-3000 Pole Display.
+# As with all pole display drivers, the control codes are contained in a hash
+# array called $pd_control.
+
+# THis pole display uses separate meanings for LF and CR. Both are included.
+# LF moves the cursor to the other line (same position), while CR moves the
+# cursor to the left-most spot (same line). Assume most PD's do this.
+# Most of this is simple ASCII, but what to make things clear.
+
+# This first part is straight from the manual.
+# Not including the bit about installing fonts.
+
+%pd_control = (
+ 'mode_vscroll' => pack('C', 18),
+ 'mode_normal' => pack('C', 17),
+ 'bright_full' => pack('CC', 4, 0xFF),
+ 'bright_high' => pack('CC', 4, 0x60),
+ 'bright_med' => pack('CC', 4, 0x40),
+ 'bright_low' => pack('CC', 4, 0x20),
+ 'backspace' => pack('C', 8),
+ 'htab' => pack('C', 9), # Functions like cursor movement
+ 'lf' => pack('C', 0x0A),
+ 'cr' => pack('C', 0x0D),
+ 'digit_select' => pack('C', 0x10), # Pack followed by a number 0-39
+ 'cursor_on' => pack('C', 0x13),
+ 'cursor_off' => pack('C', 0x14),
+ 'reset' => pack('C', 0x1F),
+ 'scroll_message' => pack ('C', 0x05), # Followed by up to 45 chars.
+);
+
+# A few more useful control sequences:
+$pd_control{'new_line'} = $pd_control{'cr'}.$pd_control{'lf'};
+
Modified: trunk/menu.ini
===================================================================
--- trunk/menu.ini 2006-10-03 02:05:40 UTC (rev 184)
+++ trunk/menu.ini 2006-10-03 03:26:37 UTC (rev 185)
@@ -83,6 +83,11 @@
module=ps.pl
action=receipts
+[POS--Close Till]
+module=rc.pl
+action=till_closing
+pos=true
+
[AP]
[AP--Add Transaction]
@@ -332,6 +337,14 @@
module=gl.pl
action=search
+[General Ledger--Adjust Till]
+module=gl.pl
+action=add_pos_adjust
+reference=Adjusting Till: (till) Source: (source)
+rowcount=3
+pos_adjust=1
+description=Adjusting till due to data entry error.
+
[Goods & Services]
[Goods & Services--Add Part]
Added: trunk/pos.conf.pl
===================================================================
--- trunk/pos.conf.pl (rev 0)
+++ trunk/pos.conf.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -0,0 +1,79 @@
+
+# This sets up the settings for the POS hardware. You can use it to override
+# printing commands etc. as well.
+
+# Chris Travers
+# ..hidden..
+# 2004-02-07
+
+# Begin Editing Here
+
+$pos_config{'rem_host'}=$ENV{'REMOTE_ADDR'};
+
+$pos_config{'pd_host'} = $pos_config{'rem_host'};
+$pos_config{'pd_port'} = 6601;
+$pos_config{'pd_proto'} = 'tcp';
+
+require "drivers/pd3000.pl"; # Use the PD3000 driver
+
+# Some businesses may want to Override this for custom apps
+$pos_config{'pd_host'} = $pos_config{'rem_host'};
+
+$pos_config{'rp_port'} = 6602;
+$pos_config{'rp_proto'} = 'tcp';
+
+$pos_config{'rp_netdirect'} = 'yes';
+
+# Some businesses may want to Override this for custom apps
+$pos_config{'rp_host'} = $pos_config{'rem_host'};
+$pos_config{'rp_cash_open'} = pack("CCCCC",27,112,0,25,250);
+
+$pos_config{'coa_prefix'} = 1300;
+
+$pos_config{'close_cash_accno'} = 1060;
+$pos_config{till_cash} = 200;
+# Add your sources here.
+
+$pos_sources{'visa'} = "Visa/MC";
+$pos_sources{'disc'} = "Discover";
+$pos_sources{'check'} = 'Check';
+$pos_sources{'cash'} = 'Cash';
+$pos_sources{'gcert'} = 'Gift Cert';
+
+${$pos_config{'source_accno_override'}{'gcert'}} = '2105';
+# Define your till accno scheme here. Current supported values are 'termina'
+# and 'cashier'
+
+$pos_config{'till_type'} = 'cashier';
+
+# FLAGS: 1 = projects, 2 = departments
+$pos_config{'disable_tables'} = 3;
+# Stop Editing Here
+
+if (lc($pos_config{'till_type'}) eq 'terminal'){
+ $pos_config{'till'} = (split(/\./, $pos_config{'rem_host'}))[3];
+}
+elsif (lc($pos_config{'till_type'}) eq 'cashier'){
+ use LedgerSMB::User;
+ $pos_config{'till'} = $form->get_my_emp_num(\%myconfig, \%$form);
+}
+else {
+ $form->error("No till type defined in pos.conf.pl!");
+}
+$pos_config{till_accno} = "$pos_config{coa_prefix}.$pos_config{till}";
+$pos_config{'pd_dest'}=pack(
+ 's n a4 x8', 2, $pos_config{'pd_port'},
+ pack('CCCC', split(/\./, $pos_config{'pd_host'}))
+);
+
+
+$form->{pos_config} = \%pos_config;
+$form->{pos_sources} = \%pos_sources;
+
+# Due to the architecture of SL, we need to use netcat to print.
+# Otherwise the document gets spooled twice and this interferes with timeliness.
+
+%printer = (
+ 'Printer' => "utils/pos/directnet.pl $pos_config{rp_host} $pos_config{rp_proto} $pos_config{rp_port}"
+);
+1;
Added: trunk/utils/pos/directnet.pl
===================================================================
--- trunk/utils/pos/directnet.pl (rev 0)
+++ trunk/utils/pos/directnet.pl 2006-10-03 03:26:37 UTC (rev 185)
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+($host, $proto, $port) = @ARGV;
+
+socket(SOCK, 2, 1, getprotobynumber($proto));
+
+$dest=pack(
+ 's n a4 x8', 2, $port,
+ pack('CCCC', split(/\./, $host))
+);
+
+connect (SOCK, $dest);
+
+open ('STD', '-');
+while ($line = <STD>){
+ print SOCK $line;
+}
+close STD;
+close SOCK;
+
Property changes on: trunk/utils/pos/directnet.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/utils/pos/pos-hardware-client-startup-script
===================================================================
--- trunk/utils/pos/pos-hardware-client-startup-script (rev 0)
+++ trunk/utils/pos/pos-hardware-client-startup-script 2006-10-03 03:26:37 UTC (rev 185)
@@ -0,0 +1,11 @@
+#!/bin/bash
+netcat=/usr/local/bin/netcat
+while((1))
+do
+ $netcat -lp6601 > /dev/ttyS0
+done&
+
+while((1))
+do
+ $netcat -lp6602 > /dev/lp0
+done&
Property changes on: trunk/utils/pos/pos-hardware-client-startup-script
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.