163 |
163 |
do_query($form, $dbh, $query, $form->{id});
|
164 |
164 |
|
165 |
165 |
} else {
|
166 |
|
my $uid = rand() . time;
|
167 |
|
|
168 |
|
$uid .= $form->{login};
|
169 |
|
|
170 |
|
$uid = substr($uid, 2, 75);
|
171 |
166 |
|
|
167 |
($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|);
|
|
168 |
|
172 |
169 |
$query =
|
173 |
|
qq|INSERT INTO ap (invnumber, employee_id,currency_id) | .
|
174 |
|
qq|VALUES (?, (SELECT e.id FROM employee e WHERE e.login = ?),
|
|
170 |
qq|INSERT INTO ap (id, invnumber, employee_id,currency_id) | .
|
|
171 |
qq|VALUES (?, ?, (SELECT e.id FROM employee e WHERE e.login = ?),
|
175 |
172 |
(SELECT id FROM currencies WHERE name = ?) )|;
|
176 |
|
do_query($form, $dbh, $query, $uid, $form->{login}, $form->{currency});
|
|
173 |
do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $form->{login}, $form->{currency});
|
177 |
174 |
|
178 |
|
$query = qq|SELECT a.id FROM ap a
|
179 |
|
WHERE a.invnumber = ?|;
|
180 |
|
($form->{id}) = selectrow_query($form, $dbh, $query, $uid);
|
181 |
175 |
}
|
182 |
176 |
|
183 |
|
$form->{invnumber} = $form->{id} unless $form->{invnumber};
|
184 |
|
|
185 |
177 |
$query = qq|UPDATE ap SET
|
186 |
|
invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?,
|
|
178 |
transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?,
|
187 |
179 |
amount = ?, duedate = ?, paid = ?, netamount = ?,
|
188 |
180 |
currency_id = (SELECT id FROM currencies WHERE name = ?), notes = ?, department_id = ?, storno = ?, storno_id = ?,
|
189 |
181 |
globalproject_id = ?, direct_debit = ?
|
190 |
182 |
WHERE id = ?|;
|
191 |
|
@values = ($form->{invnumber}, conv_date($form->{transdate}),
|
|
183 |
@values = (conv_date($form->{transdate}),
|
192 |
184 |
$form->{ordnumber}, conv_i($form->{vendor_id}),
|
193 |
185 |
$form->{taxincluded} ? 't' : 'f', $form->{invtotal},
|
194 |
186 |
conv_date($form->{duedate}), $form->{invpaid},
|
Kreditorenbuchung erzwingt jetzt Eingabe der Rechnungsnummer
Behebt #2426
Damit ist das Verhalten wie bei der Einkaufsrechnung.
Vorher wurde bei leer gelassener Rechnungsnummer die trans_id als
Rechnungsnummer genommen.