Revision 361d8846
Von Sven Schöling vor fast 12 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
818 | 818 |
|
819 | 819 |
$project_id = conv_i($form->{"globalproject_id"}); |
820 | 820 |
|
821 |
my $taxdate = $form->{deliverydate} ? $form->{deliverydate} : $form->{invdate}; |
|
822 |
|
|
823 | 821 |
foreach my $trans_id (keys %{ $form->{amount_cogs} }) { |
824 | 822 |
foreach my $accno (keys %{ $form->{amount_cogs}{$trans_id} }) { |
825 | 823 |
next unless ($form->{expense_inventory} =~ /\Q$accno\E/); |
... | ... | |
828 | 826 |
|
829 | 827 |
if (!$payments_only && ($form->{amount_cogs}{$trans_id}{$accno} != 0)) { |
830 | 828 |
$query = |
831 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
|
|
832 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT id FROM tax WHERE taxkey=0), 0, ?)|;
|
|
829 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
830 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 0, ?)|; |
|
833 | 831 |
@values = (conv_i($trans_id), $accno, $form->{amount_cogs}{$trans_id}{$accno}, conv_date($form->{invdate}), conv_i($project_id)); |
834 | 832 |
do_query($form, $dbh, $query, @values); |
835 | 833 |
$form->{amount_cogs}{$trans_id}{$accno} = 0; |
... | ... | |
841 | 839 |
|
842 | 840 |
if (!$payments_only && ($form->{amount_cogs}{$trans_id}{$accno} != 0)) { |
843 | 841 |
$query = |
844 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
|
|
845 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT id FROM tax WHERE taxkey=0), 0, ?)|;
|
|
842 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
843 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 0, ?)|; |
|
846 | 844 |
@values = (conv_i($trans_id), $accno, $form->{amount_cogs}{$trans_id}{$accno}, conv_date($form->{invdate}), conv_i($project_id)); |
847 | 845 |
do_query($form, $dbh, $query, @values); |
848 | 846 |
} |
... | ... | |
857 | 855 |
|
858 | 856 |
if (!$payments_only && ($form->{amount}{$trans_id}{$accno} != 0)) { |
859 | 857 |
$query = |
860 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
|
|
858 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
861 | 859 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, |
862 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1), |
|
863 | 860 |
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; |
864 |
@values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_i($project_id));
|
|
861 |
@values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_i($project_id)); |
|
865 | 862 |
do_query($form, $dbh, $query, @values); |
866 | 863 |
$form->{amount}{$trans_id}{$accno} = 0; |
867 | 864 |
} |
... | ... | |
872 | 869 |
|
873 | 870 |
if (!$payments_only && ($form->{amount}{$trans_id}{$accno} != 0)) { |
874 | 871 |
$query = |
875 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
|
|
872 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
876 | 873 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, |
877 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1), |
|
878 | 874 |
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; |
879 |
@values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_date($taxdate), $accno, conv_i($project_id));
|
|
875 |
@values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_i($project_id)); |
|
880 | 876 |
do_query($form, $dbh, $query, @values); |
881 | 877 |
} |
882 | 878 |
} |
... | ... | |
922 | 918 |
|
923 | 919 |
if ($form->{amount}{ $form->{id} }{ $form->{AR} } != 0) { |
924 | 920 |
$query = |
925 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id)
|
|
921 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id) |
|
926 | 922 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, |
927 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1), |
|
928 | 923 |
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; |
929 |
@values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, conv_date($taxdate), $form->{AR}, $project_id);
|
|
924 |
@values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, $project_id); |
|
930 | 925 |
do_query($form, $dbh, $query, @values); |
931 | 926 |
} |
932 | 927 |
|
... | ... | |
935 | 930 |
my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig)); |
936 | 931 |
|
937 | 932 |
$query = |
938 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, tax_id, taxkey, project_id)
|
|
933 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id) |
|
939 | 934 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, |
940 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1), |
|
941 | 935 |
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; |
942 | 936 |
@values = (conv_i($form->{"id"}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"}, |
943 |
$gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, conv_date($taxdate), $accno, $project_id);
|
|
937 |
$gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id); |
|
944 | 938 |
do_query($form, $dbh, $query, @values); |
945 | 939 |
|
946 | 940 |
# exchangerate difference |
... | ... | |
980 | 974 |
if ( $form->{fx}{$accno}{$transdate} != 0 ) { |
981 | 975 |
|
982 | 976 |
$query = |
983 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, tax_id, taxkey, project_id)
|
|
977 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id) |
|
984 | 978 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1', |
985 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1), |
|
986 |
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; |
|
987 |
@values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_date($taxdate), $accno, conv_i($project_id)); |
|
979 |
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; |
|
980 |
@values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_i($project_id)); |
|
988 | 981 |
do_query($form, $dbh, $query, @values); |
989 | 982 |
} |
990 | 983 |
} |
Auch abrufbar als: Unified diff
Revert "tax_id in acc_trans"
This reverts commit 357d134d265637fb37ed2cd47da2ce3ef44d015a.