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->{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));
- $licensenumber = "Lizenz: " . $licensenumber;
$sth->finish;
- push(@{ $form->{licensenumber} }, $licensenumber);
} else {
push(@{ $form->{licensenumber} }, "");
push(@{ $form->{validuntil} }, "");
$dec = length $dec;
my $decimalplaces = ($dec > 2) ? $dec : 2;
- my $i_discount = $form->round_amount($sellprice *
- $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100, $decimalplaces);
+ my $i_discount =
+ $form->round_amount(
+ $sellprice * $form->parse_amount($myconfig,
+ $form->{"discount_$i"}) / 100,
+ $decimalplaces);
- my $discount = $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces);
+ my $discount =
+ $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces);
# keep a netprice as well, (sellprice - discount)
$form->{"netprice_$i"} = $sellprice - $i_discount;
: " ";
$linetotal = ($linetotal != 0) ? $linetotal : " ";
- push(@{ $form->{discount} }, $discount);
+ push(@{ $form->{discount} }, $discount);
+ push(@{ $form->{p_discount} }, $form->{"discount_$i"});
$form->{total} += $linetotal;
$form->{paid} = $form->format_amount($myconfig, $form->{paid}, 2);
- # myconfig variables
- map { $form->{$_} = $myconfig->{$_} }
- (qw(company address tel fax signature businessnumber));
$form->{username} = $myconfig->{name};
$dbh->disconnect;
$contact = "and cp.cp_id = $form->{cp_id}";
}
- $taxincluded = $form->{taxincluded};
-
# get rest for the customer
my $query = qq|SELECT ct.*, cp.*, ct.notes as customernotes
FROM customer ct
$sth->execute || $form->dberror($query);
$ref = $sth->fetchrow_hashref(NAME_lc);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- $form->{taxincluded} = $taxincluded;
+ # remove notes, id and taxincluded before copy back
+ delete @$ref{qw(id taxincluded notes)};
+ map { $form->{$_} = $ref->{$_} } keys %$ref;
$sth->finish;
$dbh->disconnect;
$form->{taxincluded} *= 1;
my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
+ my $deliverydate =
+ ($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL";
# fill in subject if there is none
$form->{subject} = qq|$form->{label} $form->{invnumber}|
paid = $form->{paid},
datepaid = $datepaid,
duedate = $duedate,
+ deliverydate = $deliverydate,
invoice = '1',
shippingpoint = '$form->{shippingpoint}',
shipvia = '$form->{shipvia}',
# retrieve invoice
$query = qq|SELECT a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber,
- a.transdate AS invdate, a.paid,
+ a.transdate AS invdate, a.deliverydate, a.paid,
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