Revision 340fd435
Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
274 | 274 |
} |
275 | 275 |
my $q_item = <<SQL; |
276 | 276 |
UPDATE delivery_order_items SET |
277 |
delivery_order_id = ?, parts_id = ?, description = ?, longdescription = ?, qty = ?, base_qty = ?, |
|
277 |
delivery_order_id = ?, position = ?, parts_id = ?, description = ?, longdescription = ?, qty = ?, base_qty = ?,
|
|
278 | 278 |
sellprice = ?, discount = ?, unit = ?, reqdate = ?, project_id = ?, serialnumber = ?, |
279 | 279 |
ordnumber = ?, transdate = ?, cusordnumber = ?, |
280 | 280 |
lastcost = ? , price_factor_id = ?, price_factor = (SELECT factor FROM price_factors where id = ?), |
... | ... | |
296 | 296 |
for my $i (1 .. $form->{rowcount}) { |
297 | 297 |
next if (!$form->{"id_$i"}); |
298 | 298 |
|
299 |
my $position = $i; |
|
300 |
|
|
299 | 301 |
if (!$form->{"delivery_order_items_id_$i"}) { |
300 | 302 |
# there is no persistent id, therefore create one with all necessary constraints |
301 | 303 |
my $q_item_id = qq|SELECT nextval('delivery_order_items_id')|; |
302 | 304 |
my $h_item_id = prepare_query($form, $dbh, $q_item_id); |
303 | 305 |
do_statement($form, $h_item_id, $q_item_id); |
304 | 306 |
$form->{"delivery_order_items_id_$i"} = $h_item_id->fetchrow_array(); |
305 |
$query = qq|INSERT INTO delivery_order_items (id, delivery_order_id, parts_id) VALUES (?, ?, ?)|;
|
|
307 |
$query = qq|INSERT INTO delivery_order_items (id, delivery_order_id, position, parts_id) VALUES (?, ?, ?, ?)|;
|
|
306 | 308 |
do_query($form, $dbh, $query, conv_i($form->{"delivery_order_items_id_$i"}), |
307 |
conv_i($form->{"id"}), conv_i($form->{"id_$i"})); |
|
309 |
conv_i($form->{"id"}), conv_i($position), conv_i($form->{"id_$i"}));
|
|
308 | 310 |
$h_item_id->finish(); |
309 | 311 |
} |
310 | 312 |
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); |
... | ... | |
336 | 338 |
$pricegroup_id = undef if !$pricegroup_id; |
337 | 339 |
|
338 | 340 |
# save detail record in delivery_order_items table |
339 |
@values = (conv_i($form->{id}), conv_i($form->{"id_$i"}), |
|
341 |
@values = (conv_i($form->{id}), conv_i($position), conv_i($form->{"id_$i"}),
|
|
340 | 342 |
$form->{"description_$i"}, $restricter->process($form->{"longdescription_$i"}), |
341 | 343 |
$form->{"qty_$i"}, $baseqty, |
342 | 344 |
$form->{"sellprice_$i"}, $form->{"discount_$i"} / 100, |
... | ... | |
740 | 742 |
LEFT JOIN project pr ON (doi.project_id = pr.id) |
741 | 743 |
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) |
742 | 744 |
WHERE doi.delivery_order_id IN ($do_ids_placeholders) |
743 |
ORDER BY doi.oid|;
|
|
745 |
ORDER BY doi.delivery_order_id, doi.position|;
|
|
744 | 746 |
|
745 | 747 |
$form->{form_details} = selectall_hashref_query($form, $dbh, $query, @do_ids); |
746 | 748 |
|
Auch abrufbar als: Unified diff
Item-Positionen in DB: Lieferschein-Masken honorieren und speichern diese.