Revision ce2e13e6
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
56 | 56 |
my $vc = $form->{vc} eq "customer" ? "customer" : "vendor"; |
57 | 57 |
|
58 | 58 |
$query = |
59 |
qq|SELECT dord.id, dord.donumber, dord.ordnumber, dord.oreqnumber, dord.transdate,
|
|
59 |
qq|SELECT dord.id, dord.donumber, dord.ordnumber, dord.transdate, |
|
60 | 60 |
ct.name, dord.${vc}_id, dord.globalproject_id, |
61 | 61 |
dord.closed, dord.delivered, dord.shippingpoint, dord.shipvia, |
62 | 62 |
dord.transaction_description, |
63 | 63 |
pr.projectnumber AS globalprojectnumber, |
64 | 64 |
e.name AS employee, |
65 | 65 |
sm.name AS salesman, |
66 |
oreq.id AS oreq_id, |
|
67 | 66 |
oe.id AS oe_id |
68 | 67 |
FROM delivery_orders dord |
69 | 68 |
LEFT JOIN $vc ct ON (dord.${vc}_id = ct.id) |
70 | 69 |
LEFT JOIN employee e ON (dord.employee_id = e.id) |
71 | 70 |
LEFT JOIN employee sm ON (dord.salesman_id = sm.id) |
72 | 71 |
LEFT JOIN project pr ON (dord.globalproject_id = pr.id) |
73 |
LEFT JOIN order_request oreq ON (dord.oreqnumber = oreq.oreqnumber) |
|
74 | 72 |
LEFT JOIN oe ON ((dord.ordnumber = oe.ordnumber) AND NOT COALESCE(oe.quotation, FALSE))|; |
75 | 73 |
|
76 | 74 |
push @where, ($form->{type} eq 'sales_delivery_order' ? '' : 'NOT ') . qq|COALESCE(dord.is_sales, FALSE)|; |
... | ... | |
138 | 136 |
"id" => "dord.id", |
139 | 137 |
"donumber" => "dord.donumber", |
140 | 138 |
"ordnumber" => "dord.ordnumber", |
141 |
"oreqnumber" => "dord.oreqnumber", |
|
142 | 139 |
"name" => "ct.name", |
143 | 140 |
"employee" => "e.name", |
144 | 141 |
"salesman" => "sm.name", |
... | ... | |
226 | 223 |
id, delivery_order_id, parts_id, description, longdescription, qty, base_qty, |
227 | 224 |
sellprice, discount, unit, reqdate, project_id, serialnumber, |
228 | 225 |
ordnumber, transdate, cusordnumber, |
229 |
lastcost, price_factor_id, price_factor, marge_price_factor, |
|
230 |
v_partnumber, v_description) |
|
226 |
lastcost, price_factor_id, price_factor, marge_price_factor) |
|
231 | 227 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, |
232 |
(SELECT factor FROM price_factors WHERE id = ?), ?, ?, ?)|;
|
|
228 |
(SELECT factor FROM price_factors WHERE id = ?), ?)|; |
|
233 | 229 |
my $h_item = prepare_query($form, $dbh, $q_item); |
234 | 230 |
|
235 | 231 |
my $q_item_stock = |
... | ... | |
277 | 273 |
$form->{"cusordnumber_$i"}, |
278 | 274 |
$form->{"lastcost_$i"}, |
279 | 275 |
conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), |
280 |
conv_i($form->{"marge_price_factor_$i"}), |
|
281 |
$form->{"v_partnumber_$i"}, $form->{"v_description_$i"}); |
|
276 |
conv_i($form->{"marge_price_factor_$i"})); |
|
282 | 277 |
do_statement($form, $h_item, $q_item, @values); |
283 | 278 |
|
284 | 279 |
my $stock_info = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_$i"}); |
... | ... | |
299 | 294 |
# save DO record |
300 | 295 |
$query = |
301 | 296 |
qq|UPDATE delivery_orders SET |
302 |
donumber = ?, ordnumber = ?, cusordnumber = ?, oreqnumber = ?, transdate = ?, vendor_id = ?,
|
|
297 |
donumber = ?, ordnumber = ?, cusordnumber = ?, transdate = ?, vendor_id = ?, |
|
303 | 298 |
customer_id = ?, reqdate = ?, |
304 | 299 |
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?, |
305 | 300 |
delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, |
... | ... | |
308 | 303 |
WHERE id = ?|; |
309 | 304 |
|
310 | 305 |
@values = ($form->{donumber}, $form->{ordnumber}, |
311 |
$form->{cusordnumber}, $form->{oreqnumber}, conv_date($form->{transdate}),
|
|
306 |
$form->{cusordnumber}, conv_date($form->{transdate}), |
|
312 | 307 |
conv_i($form->{vendor_id}), conv_i($form->{customer_id}), |
313 | 308 |
conv_date($reqdate), $form->{shippingpoint}, $form->{shipvia}, |
314 | 309 |
$form->{notes}, $form->{intnotes}, |
... | ... | |
454 | 449 |
# so if any of these infos is important (or even different) for any item, |
455 | 450 |
# it will be killed out and then has to be fetched from the item scope query further down |
456 | 451 |
$query = |
457 |
qq|SELECT dord.cp_id, dord.donumber, dord.ordnumber, dord.oreqnumber, dord.transdate, dord.reqdate,
|
|
452 |
qq|SELECT dord.cp_id, dord.donumber, dord.ordnumber, dord.transdate, dord.reqdate, |
|
458 | 453 |
dord.shippingpoint, dord.shipvia, dord.notes, dord.intnotes, |
459 | 454 |
e.name AS employee, dord.employee_id, dord.salesman_id, |
460 | 455 |
dord.${vc}_id, cv.name AS ${vc}, |
... | ... | |
514 | 509 |
doi.reqdate, doi.project_id, doi.serialnumber, doi.lastcost, |
515 | 510 |
doi.ordnumber, doi.transdate, doi.cusordnumber, doi.longdescription, |
516 | 511 |
doi.price_factor_id, doi.price_factor, doi.marge_price_factor, |
517 |
doi.v_partnumber, doi.v_description, |
|
518 | 512 |
pr.projectnumber, |
519 | 513 |
pg.partsgroup |
520 | 514 |
FROM delivery_order_items doi |
... | ... | |
627 | 621 |
qw(runningnumber number description longdescription qty unit |
628 | 622 |
partnotes serialnumber reqdate projectnumber |
629 | 623 |
si_runningnumber si_number si_description |
630 |
si_warehouse si_bin si_chargenumber si_qty si_unit |
|
631 |
v_partnumber v_description); |
|
624 |
si_warehouse si_bin si_chargenumber si_qty si_unit); |
|
632 | 625 |
|
633 | 626 |
my $sameitem = ""; |
634 | 627 |
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) { |
... | ... | |
661 | 654 |
push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; |
662 | 655 |
push @{ $form->{reqdate} }, $form->{"reqdate_$i"}; |
663 | 656 |
push @{ $form->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}}; |
664 |
push @{ $form->{v_partnumber} }, $form->{"v_partnumber_$i"}; |
|
665 |
push @{ $form->{v_description} }, $form->{"v_description_$i"}; |
|
666 | 657 |
|
667 | 658 |
if ($form->{"assembly_$i"}) { |
668 | 659 |
$sameitem = ""; |
Auch abrufbar als: Unified diff
Fälschlicherweise gemergeten Code entfernt.