Revision b80a03a9
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
328 | 328 |
$main::lxdebug->enter_sub(); |
329 | 329 |
|
330 | 330 |
my ($self, $myconfig, $form) = @_; |
331 |
$form->{IC_expense} = "1000"; |
|
332 |
$form->{IC_income} = "2000"; |
|
333 |
|
|
334 |
if ($form->{item} ne 'service') { |
|
335 |
$form->{IC} = $form->{IC_expense}; |
|
336 |
} |
|
337 |
|
|
338 |
($form->{inventory_accno}) = split(/--/, $form->{IC}); |
|
339 |
($form->{expense_accno}) = split(/--/, $form->{IC_expense}); |
|
340 |
($form->{income_accno}) = split(/--/, $form->{IC_income}); |
|
341 | 331 |
|
342 | 332 |
# connect to database, turn off AutoCommit |
343 | 333 |
my $dbh = $form->dbconnect_noauto($myconfig); |
... | ... | |
459 | 449 |
|
460 | 450 |
$form->{orphaned} = 1; |
461 | 451 |
$form->{onhand} = $form->{stock} if $form->{item} eq 'assembly'; |
462 |
if ($form->{partnumber} eq "" && $form->{inventory_accno} eq "") {
|
|
452 |
if ($form->{partnumber} eq "" && $form->{"item"} eq "service") {
|
|
463 | 453 |
$form->{partnumber} = $form->update_defaults($myconfig, "servicenumber"); |
464 | 454 |
} |
465 |
if ($form->{partnumber} eq "" && $form->{inventory_accno} ne "") {
|
|
455 |
if ($form->{partnumber} eq "" && $form->{"item"} ne "service") {
|
|
466 | 456 |
$form->{partnumber} = $form->update_defaults($myconfig, "articlenumber"); |
467 | 457 |
} |
468 | 458 |
|
... | ... | |
473 | 463 |
($partsgroup, $partsgroup_id) = split /--/, $form->{partsgroup}; |
474 | 464 |
} |
475 | 465 |
|
466 |
my ($subq_inventory, $subq_expense, $subq_income); |
|
467 |
if ($form->{"item"} eq "part") { |
|
468 |
$subq_inventory = |
|
469 |
qq|(SELECT bg.inventory_accno_id | . |
|
470 |
qq| FROM buchungsgruppen bg | . |
|
471 |
qq| WHERE bg.id = | . $dbh->quote($form->{"buchungsgruppen_id"}) . qq|)|; |
|
472 |
} else { |
|
473 |
$subq_inventory = "NULL"; |
|
474 |
} |
|
475 |
|
|
476 |
if ($form->{"item"} ne "assembly") { |
|
477 |
$subq_expense = |
|
478 |
qq|(SELECT bg.expense_accno_id_0 | . |
|
479 |
qq| FROM buchungsgruppen bg | . |
|
480 |
qq| WHERE bg.id = | . $dbh->quote($form->{"buchungsgruppen_id"}) . qq|)|; |
|
481 |
} else { |
|
482 |
$subq_expense = "NULL"; |
|
483 |
} |
|
484 |
|
|
485 |
$subq_income = |
|
486 |
qq|(SELECT bg.income_accno_id_0 | . |
|
487 |
qq| FROM buchungsgruppen bg | . |
|
488 |
qq| WHERE bg.id = | . $dbh->quote($form->{"buchungsgruppen_id"}) . qq|)|; |
|
489 |
|
|
476 | 490 |
$query = qq|UPDATE parts SET |
477 | 491 |
partnumber = '$form->{partnumber}', |
478 | 492 |
description = '$form->{description}', |
... | ... | |
491 | 505 |
bin = '$form->{bin}', |
492 | 506 |
buchungsgruppen_id = '$form->{buchungsgruppen_id}', |
493 | 507 |
payment_id = '$form->{payment_id}', |
494 |
inventory_accno_id = (SELECT c.id FROM chart c |
|
495 |
WHERE c.accno = '$form->{inventory_accno}'), |
|
496 |
income_accno_id = (SELECT c.id FROM chart c |
|
497 |
WHERE c.accno = '$form->{income_accno}'), |
|
498 |
expense_accno_id = (SELECT c.id FROM chart c |
|
499 |
WHERE c.accno = '$form->{expense_accno}'), |
|
508 |
inventory_accno_id = $subq_inventory, |
|
509 |
income_accno_id = $subq_income, |
|
510 |
expense_accno_id = $subq_expense, |
|
500 | 511 |
obsolete = '$form->{obsolete}', |
501 | 512 |
image = '$form->{image}', |
502 | 513 |
drawing = '$form->{drawing}', |
Auch abrufbar als: Unified diff
Beim Speichern von Artikeln werden die Kontennummern jetzt anhand von $form->{"item"} gefüllt.