push(@{ $form->{description} }, qq|$form->{"description_$i"}|);
push(@{ $form->{qty} },
$form->format_amount($myconfig, $form->{"qty_$i"}));
push(@{ $form->{description} }, qq|$form->{"description_$i"}|);
push(@{ $form->{qty} },
$form->format_amount($myconfig, $form->{"qty_$i"}));
- push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|);
- push(@{ $form->{deliverydate} }, qq|$form->{"deliverydate_$i"}|);
+ push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|);
+ push(@{ $form->{deliverydate_oe} }, qq|$form->{"deliverydate_$i"}|);
- push(@{ $form->{sellprice} }, $form->{"sellprice_$i"});
- push(@{ $form->{ordnumber} }, $form->{"ordnumber_$i"});
- push(@{ $form->{transdate} }, $form->{"transdate_$i"});
+ push(@{ $form->{sellprice} }, $form->{"sellprice_$i"});
+ push(@{ $form->{ordnumber_oe} }, qq|$form->{"ordnumber_$i"}|);
+ push(@{ $form->{transdate_oe} }, qq|$form->{"transdate_$i"}|);
push(@{ $form->{licensenumber} }, $licensenumber);
push(@{ $form->{validuntil} },
$locale->date($myconfig, $validuntil, 0));
push(@{ $form->{licensenumber} }, $licensenumber);
push(@{ $form->{validuntil} },
$locale->date($myconfig, $validuntil, 0));
} else {
push(@{ $form->{licensenumber} }, "");
push(@{ $form->{validuntil} }, "");
} else {
push(@{ $form->{licensenumber} }, "");
push(@{ $form->{validuntil} }, "");
$form->round_amount(
$sellprice * $form->parse_amount($myconfig,
$form->{"discount_$i"}) / 100,
$decimalplaces);
$form->round_amount(
$sellprice * $form->parse_amount($myconfig,
$form->{"discount_$i"}) / 100,
$decimalplaces);
push(@{ $form->{netprice} },
($form->{"netprice_$i"} != 0)
? $form->format_amount(
push(@{ $form->{netprice} },
($form->{"netprice_$i"} != 0)
? $form->format_amount(
- push(@{ $form->{discount} }, $discount);
+ push(@{ $form->{discount} }, $discount);
+ push(@{ $form->{p_discount} }, $form->{"discount_$i"});
# get rest for the customer
my $query = qq|SELECT ct.*, cp.*, ct.notes as customernotes
FROM customer ct
# get rest for the customer
my $query = qq|SELECT ct.*, cp.*, ct.notes as customernotes
FROM customer ct
- $form->{taxincluded} = $taxincluded;
+ # remove notes, id and taxincluded before copy back
+ delete @$ref{qw(id taxincluded notes)};
+ map { $form->{$_} = $ref->{$_} } keys %$ref;
# save detail record in invoice table
$query = qq|INSERT INTO invoice (trans_id, parts_id, description, qty,
sellprice, fxsellprice, discount, allocated, assemblyitem,
# save detail record in invoice table
$query = qq|INSERT INTO invoice (trans_id, parts_id, description, qty,
sellprice, fxsellprice, discount, allocated, assemblyitem,
- unit, deliverydate, project_id, serialnumber, pricegroup_id)
+ unit, deliverydate, project_id, serialnumber, pricegroup_id,
+ ordnumber, transdate, cusordnumber)
VALUES ($form->{id}, $form->{"id_$i"},
'$form->{"description_$i"}', $form->{"qty_$i"},
$form->{"sellprice_$i"}, $fxsellprice,
$form->{"discount_$i"}, $allocated, 'f',
'$form->{"unit_$i"}', $deliverydate, (SELECT id from project where projectnumber = '$project_id'),
VALUES ($form->{id}, $form->{"id_$i"},
'$form->{"description_$i"}', $form->{"qty_$i"},
$form->{"sellprice_$i"}, $fxsellprice,
$form->{"discount_$i"}, $allocated, 'f',
'$form->{"unit_$i"}', $deliverydate, (SELECT id from project where projectnumber = '$project_id'),
- '$form->{"serialnumber_$i"}',
- '$pricegroup_id')|;
+ '$form->{"serialnumber_$i"}', '$pricegroup_id',
+ '$form->{"ordnumber_$i"}', '$form->{"transdate_$i"}', '$form->{"cusordnumber_$i"}')|;
$form->{taxincluded} *= 1;
my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
$form->{taxincluded} *= 1;
my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
invoice = '1',
shippingpoint = '$form->{shippingpoint}',
shipvia = '$form->{shipvia}',
invoice = '1',
shippingpoint = '$form->{shippingpoint}',
shipvia = '$form->{shipvia}',
# retrieve invoice
$query = qq|SELECT a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber,
# retrieve invoice
$query = qq|SELECT a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber,
a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes,
a.duedate, a.taxincluded, a.curr AS currency,
a.employee_id, e.name AS employee
a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes,
a.duedate, a.taxincluded, a.curr AS currency,
a.employee_id, e.name AS employee
i.discount, i.parts_id AS id, i.unit, i.deliverydate,
i.project_id, pr.projectnumber, i.serialnumber,
p.partnumber, p.assembly, p.bin, p.notes AS partnotes, i.id AS invoice_pos,
i.discount, i.parts_id AS id, i.unit, i.deliverydate,
i.project_id, pr.projectnumber, i.serialnumber,
p.partnumber, p.assembly, p.bin, p.notes AS partnotes, i.id AS invoice_pos,
- pg.partsgroup, i.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=i.pricegroup_id) as pricegroup
+ pg.partsgroup, i.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=i.pricegroup_id) as pricegroup,
+ i.ordnumber, i.transdate, i.cusordnumber