+sub close_order {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ $main::lxdebug->leave_sub() unless ($form->{"id"});
+
+ my $dbh = $form->dbconnect($myconfig);
+ do_query($form, $dbh, qq|UPDATE oe SET closed = TRUE where ordnumber = ?|,
+ $form->{"id"});
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id,
o.reqdate, o.project_id, o.serialnumber, o.ship,
o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription,
o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id,
o.reqdate, o.project_id, o.serialnumber, o.ship,
o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription,
pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup
FROM orderitems o
JOIN parts p ON (o.parts_id = p.id)
pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup
FROM orderitems o
JOIN parts p ON (o.parts_id = p.id)
# delete orderitems_id in collective orders, so that they get cloned no matter what
delete $ref->{orderitems_id} if (@ids);
# delete orderitems_id in collective orders, so that they get cloned no matter what
delete $ref->{orderitems_id} if (@ids);
$query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
$query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
- FROM tax t LEFT JOIN chart c ON (c.id=t.chart_id)
- WHERE t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
- ORDER BY accno|;
+ FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
+ WHERE t.id in (SELECT tk.tax_id from taxkeys tk where tk.chart_id = (SELECT id from chart WHERE accno='$accno_id') AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
+ ORDER BY c.accno|;
$stw = $dbh->prepare($query);
$stw->execute || $form->dberror($query);
$ref->{taxaccounts} = "";
$stw = $dbh->prepare($query);
$stw->execute || $form->dberror($query);
$ref->{taxaccounts} = "";
- qw(runningnumber number qty ship unit bin partnotes serialnumber reqdate sellprice listprice netprice discount linetotal);
+ qw(runningnumber number qty ship unit bin partnotes
+ serialnumber reqdate sellprice listprice netprice
+ discount p_discount linetotal);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
map { push(@{ $form->{$_} }, "") }
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
map { push(@{ $form->{$_} }, "") }
- qw(runningnumber ship bin serialnumber number unit bin qty reqdate sellprice listprice netprice discount linetotal nodiscount_linetotal);
+ qw(runningnumber ship bin serialnumber number unit bin qty
+ reqdate sellprice listprice netprice discount p_discount
+ linetotal nodiscount_linetotal);
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
push(@{ $form->{description} }, $sameitem);
}
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
push(@{ $form->{description} }, $sameitem);
}
. qq|, $ref->{partnumber}, $ref->{description}|);
map { push(@{ $form->{$_} }, "") }
. qq|, $ref->{partnumber}, $ref->{description}|);
map { push(@{ $form->{$_} }, "") }