Revision aec14b51
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
72 | 72 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
73 | 73 |
$form->{taxincluded} = 0 unless $form->{taxincluded}; |
74 | 74 |
|
75 |
# make sure to have a id |
|
76 |
my ($query, $sth, @values); |
|
77 |
if (!$payments_only) { |
|
78 |
# if we have an id delete old records |
|
79 |
if ($form->{id}) { |
|
80 |
|
|
81 |
# delete detail records |
|
82 |
$query = qq|DELETE FROM acc_trans WHERE trans_id = ?|; |
|
83 |
do_query($form, $dbh, $query, $form->{id}); |
|
84 |
|
|
85 |
} else { |
|
86 |
|
|
87 |
($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|); |
|
88 |
|
|
89 |
$query = |
|
90 |
qq|INSERT INTO ap (id, invnumber, employee_id,currency_id, taxzone_id) | . |
|
91 |
qq|VALUES (?, ?, (SELECT e.id FROM employee e WHERE e.login = ?), |
|
92 |
(SELECT id FROM currencies WHERE name = ?), (SELECT taxzone_id FROM vendor WHERE id = ?) )|; |
|
93 |
do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $::myconfig{login}, $form->{currency}, $form->{vendor_id}); |
|
94 |
|
|
95 |
} |
|
96 |
} |
|
97 |
# check default or record exchangerate |
|
75 | 98 |
if ($form->{currency} eq $form->{defaultcurrency}) { |
76 | 99 |
$form->{exchangerate} = 1; |
77 | 100 |
} else { |
... | ... | |
91 | 114 |
0, $form->{exchangerate}, $form->{id}, 'ap'); |
92 | 115 |
} |
93 | 116 |
} |
94 |
|
|
95 | 117 |
# get the charts selected |
96 | 118 |
$form->{AP_amounts}{"amount_$_"} = $form->{"AP_amount_chart_id_$_"} for (1 .. $form->{rowcount}); |
97 | 119 |
|
... | ... | |
124 | 146 |
$form->{payables} = $form->{invtotal}; |
125 | 147 |
|
126 | 148 |
if (!$payments_only) { |
127 |
# if we have an id delete old records |
|
128 |
if ($form->{id}) { |
|
129 |
|
|
130 |
# delete detail records |
|
131 |
$query = qq|DELETE FROM acc_trans WHERE trans_id = ?|; |
|
132 |
do_query($form, $dbh, $query, $form->{id}); |
|
133 |
|
|
134 |
} else { |
|
135 |
|
|
136 |
($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|); |
|
137 |
|
|
138 |
$query = |
|
139 |
qq|INSERT INTO ap (id, invnumber, employee_id,currency_id, taxzone_id) | . |
|
140 |
qq|VALUES (?, ?, (SELECT e.id FROM employee e WHERE e.login = ?), |
|
141 |
(SELECT id FROM currencies WHERE name = ?), (SELECT taxzone_id FROM vendor WHERE id = ?) )|; |
|
142 |
do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $::myconfig{login}, $form->{currency}, $form->{vendor_id}); |
|
143 |
|
|
144 |
} |
|
145 |
|
|
146 | 149 |
$query = qq|UPDATE ap SET invnumber = ?, |
147 | 150 |
transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?, |
148 | 151 |
amount = ?, duedate = ?, deliverydate = ?, tax_point = ?, paid = ?, netamount = ?, |
Auch abrufbar als: Unified diff
ARAP _post_transaction Anlegen der id am Anfang wie bei den Rechnungsmasken
Nicht ganz sauber getrennt, ein bisschen Refactor ist im Vor-Commit