X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDO.pm;h=76a0ec075e0016235970d2518e00c98e31a83b05;hb=79c048aa6a9699c5a994d7e21f4fd3ec8fa29693;hp=2eb93376f132158cd8a60553bc1c04278968ccf6;hpb=be776964b83340e69fa2f02eae59b703c0c95b88;p=kivitendo-erp.git diff --git a/SL/DO.pm b/SL/DO.pm index 2eb93376f..76a0ec075 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -61,7 +61,8 @@ sub transactions { 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, @@ -143,6 +144,7 @@ sub transactions { my %allowed_sort_columns = ( "transdate" => "dord.transdate", + "reqdate" => "dord.reqdate", "id" => "dord.id", "donumber" => "dord.donumber", "ordnumber" => "dord.ordnumber", @@ -348,7 +350,7 @@ sub save { shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?, delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, - is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, curr = (SELECT id FROM currencies WHERE curr = ?) + is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, curr = ? WHERE id = ?|; @values = ($form->{donumber}, $form->{ordnumber}, @@ -616,7 +618,7 @@ sub retrieve { d.description AS department, dord.language_id, dord.shipto_id, dord.globalproject_id, dord.delivered, dord.transaction_description, - dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.curr FROM currencies cu WHERE cu.id=dord.curr) AS currency + dord.taxzone_id, dord.taxincluded, dord.terms, dord.curr AS currency FROM delivery_orders dord JOIN ${vc} cv ON (dord.${vc}_id = cv.id) LEFT JOIN employee e ON (dord.employee_id = e.id) @@ -638,6 +640,9 @@ sub retrieve { } $sth->finish(); + # remove any trailing whitespace + $form->{currency} =~ s/\s*$//; + $form->{donumber_array} =~ s/\s*$//g; $form->{saved_donumber} = $form->{donumber}; @@ -808,7 +813,7 @@ sub order_details { 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); @@ -817,6 +822,7 @@ sub order_details { $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]; @@ -852,6 +858,13 @@ sub order_details { 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 = ""; @@ -905,6 +918,9 @@ sub order_details { for @{ $ic_cvar_configs }; } + $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); + $form->{totalweight_nofmt} = $totalweight; + $h_pg->finish(); $h_bin_wh->finish();