Revision 98452aaa
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
139 | 139 |
|
140 | 140 |
IC->prepare_parts_for_printing(); |
141 | 141 |
|
142 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
|
143 |
|
|
142 | 144 |
my @arrays = |
143 | 145 |
qw(runningnumber number description longdescription qty ship unit bin |
144 | 146 |
deliverydate_oe ordnumber_oe transdate_oe licensenumber validuntil |
... | ... | |
147 | 149 |
linetotal nodiscount_linetotal tax_rate projectnumber |
148 | 150 |
price_factor price_factor_name partsgroup); |
149 | 151 |
|
152 |
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
|
153 |
|
|
150 | 154 |
my @tax_arrays = qw(taxbase tax taxdescription taxrate taxnumber); |
151 | 155 |
|
152 | 156 |
my @payment_arrays = qw(payment paymentaccount paymentdate paymentsource paymentmemo); |
... | ... | |
349 | 353 |
} |
350 | 354 |
$sth->finish; |
351 | 355 |
} |
356 |
|
|
357 |
map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs }; |
|
352 | 358 |
} |
353 | 359 |
} |
354 | 360 |
|
... | ... | |
509 | 515 |
my ($query, $sth, $null, $project_id, @values); |
510 | 516 |
my $exchangerate = 0; |
511 | 517 |
|
518 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC', |
|
519 |
dbh => $dbh); |
|
520 |
|
|
512 | 521 |
if (!$form->{employee_id}) { |
513 | 522 |
$form->get_employee($dbh); |
514 | 523 |
} |
... | ... | |
682 | 691 |
($null, my $pricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"}); |
683 | 692 |
$pricegroup_id *= 1; |
684 | 693 |
|
694 |
my ($invoice_id) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('invoiceid')|); |
|
695 |
|
|
685 | 696 |
# save detail record in invoice table |
686 | 697 |
$query = |
687 |
qq|INSERT INTO invoice (trans_id, parts_id, description, longdescription, qty, |
|
698 |
qq|INSERT INTO invoice (id, trans_id, parts_id, description, longdescription, qty,
|
|
688 | 699 |
sellprice, fxsellprice, discount, allocated, assemblyitem, |
689 | 700 |
unit, deliverydate, project_id, serialnumber, pricegroup_id, |
690 | 701 |
ordnumber, transdate, cusordnumber, base_qty, subtotal, |
691 | 702 |
marge_percent, marge_total, lastcost, |
692 | 703 |
price_factor_id, price_factor, marge_price_factor) |
693 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, |
|
704 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
694 | 705 |
(SELECT factor FROM price_factors WHERE id = ?), ?)|; |
695 | 706 |
|
696 |
@values = (conv_i($form->{id}), conv_i($form->{"id_$i"}), |
|
707 |
@values = ($invoice_id, conv_i($form->{id}), conv_i($form->{"id_$i"}),
|
|
697 | 708 |
$form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"}, |
698 | 709 |
$form->{"sellprice_$i"}, $fxsellprice, |
699 | 710 |
$form->{"discount_$i"}, $allocated, 'f', |
... | ... | |
714 | 725 |
@values = (conv_i($form->{"id"}), conv_i($form->{"licensenumber_$i"})); |
715 | 726 |
do_query($form, $dbh, $query, @values); |
716 | 727 |
} |
728 |
|
|
729 |
CVar->save_custom_variables(module => 'IC', |
|
730 |
sub_module => 'invoice', |
|
731 |
trans_id => $invoice_id, |
|
732 |
configs => $ic_cvar_configs, |
|
733 |
variables => $form, |
|
734 |
name_prefix => 'ic_', |
|
735 |
name_postfix => "_$i", |
|
736 |
dbh => $dbh); |
|
717 | 737 |
} |
718 | 738 |
} |
719 | 739 |
|
... | ... | |
1467 | 1487 |
c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid, |
1468 | 1488 |
c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from AS expense_valid, |
1469 | 1489 |
|
1490 |
i.id AS invoice_id, |
|
1470 | 1491 |
i.description, i.longdescription, i.qty, i.fxsellprice AS sellprice, i.discount, i.parts_id AS id, i.unit, i.deliverydate AS reqdate, |
1471 | 1492 |
i.project_id, i.serialnumber, i.id AS invoice_pos, i.pricegroup_id, i.ordnumber, i.transdate, i.cusordnumber, i.subtotal, i.lastcost, |
1472 | 1493 |
i.price_factor_id, i.price_factor, i.marge_price_factor, |
... | ... | |
1488 | 1509 |
$sth = prepare_execute_query($form, $dbh, $query, $id); |
1489 | 1510 |
|
1490 | 1511 |
while (my $ref = $sth->fetchrow_hashref('NAME_lc')) { |
1512 |
# Retrieve custom variables. |
|
1513 |
my $cvars = CVar->get_custom_variables(dbh => $dbh, |
|
1514 |
module => 'IC', |
|
1515 |
sub_module => 'invoice', |
|
1516 |
trans_id => $ref->{invoice_id}, |
|
1517 |
); |
|
1518 |
map { $ref->{"ic_cvar_$_->{name}"} = $_->{value} } @{ $cvars }; |
|
1519 |
delete $ref->{invoice_id}; |
|
1520 |
|
|
1491 | 1521 |
map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid)) if !$ref->{"part_inventory_accno_id"}; |
1492 | 1522 |
delete($ref->{"part_inventory_accno_id"}); |
1493 | 1523 |
|
Auch abrufbar als: Unified diff
Verwendung von benutzerdefinierten Variablen für Waren/Dienstleistungen/Erzegunisse in Verkaufsrechnungen implementiert.