Revision 3b1eaa1a
Von Moritz Bunkus vor fast 16 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
549 | 549 |
my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; |
550 | 550 |
my $price_factor; |
551 | 551 |
|
552 |
$form->{amount_cogs} = {}; |
|
553 |
|
|
552 | 554 |
foreach my $i (1 .. $form->{rowcount}) { |
553 | 555 |
if ($form->{type} eq "credit_note") { |
554 | 556 |
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}) * -1; |
... | ... | |
771 | 773 |
|
772 | 774 |
$project_id = conv_i($form->{"globalproject_id"}); |
773 | 775 |
|
776 |
foreach my $trans_id (keys %{ $form->{amount_cogs} }) { |
|
777 |
foreach my $accno (keys %{ $form->{amount_cogs}{$trans_id} }) { |
|
778 |
next unless ($form->{expense_inventory} =~ /\Q$accno\E/); |
|
779 |
|
|
780 |
$form->{amount_cogs}{$trans_id}{$accno} = $form->round_amount($form->{amount_cogs}{$trans_id}{$accno}, 2); |
|
781 |
|
|
782 |
if (!$payments_only && ($form->{amount_cogs}{$trans_id}{$accno} != 0)) { |
|
783 |
$query = |
|
784 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
785 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 0, ?)|; |
|
786 |
@values = (conv_i($trans_id), $accno, $form->{amount_cogs}{$trans_id}{$accno}, conv_date($form->{invdate}), conv_i($project_id)); |
|
787 |
do_query($form, $dbh, $query, @values); |
|
788 |
$form->{amount_cogs}{$trans_id}{$accno} = 0; |
|
789 |
} |
|
790 |
} |
|
791 |
|
|
792 |
foreach my $accno (keys %{ $form->{amount_cogs}{$trans_id} }) { |
|
793 |
$form->{amount_cogs}{$trans_id}{$accno} = $form->round_amount($form->{amount_cogs}{$trans_id}{$accno}, 2); |
|
794 |
|
|
795 |
if (!$payments_only && ($form->{amount_cogs}{$trans_id}{$accno} != 0)) { |
|
796 |
$query = |
|
797 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
798 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 0, ?)|; |
|
799 |
@values = (conv_i($trans_id), $accno, $form->{amount_cogs}{$trans_id}{$accno}, conv_date($form->{invdate}), conv_i($project_id)); |
|
800 |
do_query($form, $dbh, $query, @values); |
|
801 |
} |
|
802 |
} |
|
803 |
} |
|
804 |
|
|
774 | 805 |
foreach my $trans_id (keys %{ $form->{amount} }) { |
775 | 806 |
foreach my $accno (keys %{ $form->{amount}{$trans_id} }) { |
776 | 807 |
next unless ($form->{expense_inventory} =~ /\Q$accno\E/); |
... | ... | |
1211 | 1242 |
if (!$main::eur) { |
1212 | 1243 |
$ref->{expense_accno} = ($form->{"expense_accno_$row"}) ? $form->{"expense_accno_$row"} : $ref->{expense_accno}; |
1213 | 1244 |
# add to expense |
1214 |
$form->{amount}{ $form->{id} }{ $ref->{expense_accno} } += -$linetotal; |
|
1245 |
$form->{amount_cogs}{ $form->{id} }{ $ref->{expense_accno} } += -$linetotal;
|
|
1215 | 1246 |
$form->{expense_inventory} .= " " . $ref->{expense_accno}; |
1216 | 1247 |
$ref->{inventory_accno} = ($form->{"inventory_accno_$row"}) ? $form->{"inventory_accno_$row"} : $ref->{inventory_accno}; |
1217 | 1248 |
# deduct inventory |
1218 |
$form->{amount}{ $form->{id} }{ $ref->{inventory_accno} } -= -$linetotal; |
|
1249 |
$form->{amount_cogs}{ $form->{id} }{ $ref->{inventory_accno} } -= -$linetotal;
|
|
1219 | 1250 |
$form->{expense_inventory} .= " " . $ref->{inventory_accno}; |
1220 | 1251 |
} |
1221 | 1252 |
|
Auch abrufbar als: Unified diff
Beim Buchen von Verkaufsrechnungen muss die Umbuchung der Warenbestandskonten mit Steuerschlüssel 0 ( = keine Steuer) vermerkt werden.