Revision 8b60748b
Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt
SL/OE.pm | ||
---|---|---|
515 | 515 |
$pricegroup_id *= 1; |
516 | 516 |
$pricegroup_id = undef if !$pricegroup_id; |
517 | 517 |
|
518 |
my $position = $i; |
|
519 |
|
|
518 | 520 |
# save detail record in orderitems table |
519 | 521 |
if (! $form->{"orderitems_id_$i"}) { |
520 | 522 |
$query = qq|SELECT nextval('orderitemsid')|; |
521 | 523 |
($form->{"orderitems_id_$i"}) = selectrow_query($form, $dbh, $query); |
522 | 524 |
|
523 |
$query = qq|INSERT INTO orderitems (id) VALUES (?)|;
|
|
524 |
do_query($form, $dbh, $query, $form->{"orderitems_id_$i"}); |
|
525 |
$query = qq|INSERT INTO orderitems (id, position) VALUES (?, ?)|;
|
|
526 |
do_query($form, $dbh, $query, $form->{"orderitems_id_$i"}, conv_i($position));
|
|
525 | 527 |
} |
526 | 528 |
my $orderitems_id = $form->{"orderitems_id_$i"}; |
527 | 529 |
push @processed_orderitems, $orderitems_id; |
528 | 530 |
|
529 | 531 |
$query = <<SQL; |
530 | 532 |
UPDATE orderitems SET |
531 |
trans_id = ?, parts_id = ?, description = ?, longdescription = ?, qty = ?, base_qty = ?, |
|
533 |
trans_id = ?, position = ?, parts_id = ?, description = ?, longdescription = ?, qty = ?, base_qty = ?,
|
|
532 | 534 |
sellprice = ?, discount = ?, unit = ?, reqdate = ?, project_id = ?, serialnumber = ?, ship = ?, |
533 | 535 |
pricegroup_id = ?, ordnumber = ?, transdate = ?, cusordnumber = ?, subtotal = ?, |
534 | 536 |
marge_percent = ?, marge_total = ?, lastcost = ?, price_factor_id = ?, |
... | ... | |
537 | 539 |
WHERE id = ? |
538 | 540 |
SQL |
539 | 541 |
@values = ( |
540 |
conv_i($form->{id}), conv_i($form->{"id_$i"}), |
|
542 |
conv_i($form->{id}), conv_i($position), conv_i($form->{"id_$i"}),
|
|
541 | 543 |
$form->{"description_$i"}, $restricter->process($form->{"longdescription_$i"}), |
542 | 544 |
$form->{"qty_$i"}, $baseqty, |
543 | 545 |
$fxsellprice, $form->{"discount_$i"}, |
... | ... | |
960 | 962 |
($form->{id} |
961 | 963 |
? qq|WHERE o.trans_id = ?| |
962 | 964 |
: qq|WHERE o.trans_id IN (| . join(", ", map("?", @ids)) . qq|)|) . |
963 |
qq|ORDER BY o.oid|;
|
|
965 |
qq|ORDER BY o.trans_id, o.position|;
|
|
964 | 966 |
|
965 | 967 |
@ids = $form->{id} ? ($form->{id}) : @ids; |
966 | 968 |
$sth = prepare_execute_query($form, $dbh, $query, @values); |
... | ... | |
1092 | 1094 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
1093 | 1095 |
|
1094 | 1096 |
my $oe_query = qq|SELECT * FROM oe WHERE id = ?|; |
1095 |
my $oi_query = qq|SELECT * FROM orderitems WHERE trans_id = ?|; |
|
1097 |
my $oi_query = qq|SELECT * FROM orderitems WHERE trans_id = ? ORDER BY position|;
|
|
1096 | 1098 |
|
1097 | 1099 |
my $order = selectfirst_hashref_query($form, $dbh, $oe_query, conv_i($params{id})); |
1098 | 1100 |
$order->{orderitems} = selectall_hashref_query( $form, $dbh, $oi_query, conv_i($params{id})); |
Auch abrufbar als: Unified diff
Item-Positionen in DB: Angebot/Auftrags-Masken honorieren und speichern diese.