my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
my $query =
- qq|SELECT dord.id, dord.donumber, dord.ordnumber, dord.transdate,
+ qq|SELECT dord.id, dord.donumber, dord.ordnumber,
+ dord.transdate, dord.reqdate,
ct.${vc}number, ct.name, dord.${vc}_id, dord.globalproject_id,
dord.closed, dord.delivered, dord.shippingpoint, dord.shipvia,
dord.transaction_description,
my %allowed_sort_columns = (
"transdate" => "dord.transdate",
+ "reqdate" => "dord.reqdate",
"id" => "dord.id",
"donumber" => "dord.donumber",
"ordnumber" => "dord.ordnumber",
delete $form->{id};
}
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
# retrieve individual items
# this query looks up all information about the items
# stuff different from the whole will not be overwritten, but saved with a suffix.
$query =
qq|SELECT doi.id AS delivery_order_items_id,
p.partnumber, p.assembly, p.listprice, doi.description, doi.qty,
- doi.sellprice, doi.parts_id AS id, doi.unit, doi.discount, p.bin, p.notes AS partnotes,
+ doi.sellprice, doi.parts_id AS id, doi.unit, doi.discount, p.notes AS partnotes,
doi.reqdate, doi.project_id, doi.serialnumber, doi.lastcost,
doi.ordnumber, doi.transdate, doi.cusordnumber, doi.longdescription,
doi.price_factor_id, doi.price_factor, doi.marge_price_factor, doi.pricegroup_id,
LEFT JOIN project pr ON (doi.project_id = pr.id)
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
WHERE doi.delivery_order_id IN ($do_ids_placeholders)
- ORDER BY doi.$oid{$myconfig->{dbdriver}}|;
+ ORDER BY doi.oid|;
$form->{form_details} = selectall_hashref_query($form, $dbh, $query, @do_ids);
my $partsgroup;
my $position = 0;
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
my (@project_ids, %projectnumbers, %projectdescriptions);
push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"});
qw(runningnumber number description longdescription qty unit
partnotes serialnumber reqdate projectnumber projectdescription
si_runningnumber si_number si_description
- si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit);
+ si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit weight lineweight);
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays);
$form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} };
+ my $totalweight = 0;
my $sameitem = "";
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
push @{ $form->{TEMPLATE_ARRAYS}{projectdescription} },
$projectdescriptions{$form->{"project_id_$i"}};
+ my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"};
+ $totalweight += $lineweight;
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight;
+
if ($form->{"assembly_$i"}) {
$sameitem = "";
my $sortorder = "";
if ($form->{groupitems}) {
$sortorder =
- qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|;
+ qq|ORDER BY pg.partsgroup, a.oid|;
} else {
- $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
+ $sortorder = qq|ORDER BY a.oid|;
}
do_statement($form, $h_pg, $q_pg, conv_i($form->{"id_$i"}));
for @{ $ic_cvar_configs };
}
+ $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3);
+ $form->{totalweight_nofmt} = $totalweight;
+ my $defaults = AM->get_defaults();
+ $form->{weightunit} = $defaults->{weightunit};
+
$h_pg->finish();
$h_bin_wh->finish();