Revision 2d2a5559
Von Cem Aydin vor etwa 2 Jahren hinzugefügt
SL/Helper/QrBillFunctions.pm | ||
---|---|---|
31 | 31 |
|
32 | 32 |
my $bank_id = $_[0]; |
33 | 33 |
my $customer_number = $_[1]; |
34 |
my $order_number = $_[2] // "0"; |
|
35 |
my $invoice_number = $_[3] // "0"; |
|
34 |
my $invoice_number = $_[2] // "0"; |
|
36 | 35 |
|
37 | 36 |
# check values (analog to checks in makro) |
38 | 37 |
# - bank_id |
... | ... | |
52 | 51 |
# fill with zeros |
53 | 52 |
$customer_number = sprintf "%06d", $customer_number; |
54 | 53 |
|
55 |
# - order_number |
|
56 |
# input: prefix (letters) + up to 7 digits, may be zero |
|
57 |
# output: prefix removed, 7 digits, filled with leading zeros |
|
58 |
$order_number = remove_letters_prefix($order_number); |
|
59 |
if (!check_digits_and_max_length($order_number, 7)) { |
|
60 |
return undef, $::locale->text('Order number invalid. Must be less then or equal to 7 digits after prefix.'); |
|
61 |
} |
|
62 |
# fill with zeros |
|
63 |
$order_number = sprintf "%07d", $order_number; |
|
64 |
|
|
65 | 54 |
# - invoice_number |
66 |
# input: prefix (letters) + up to 7 digits, may be zero
|
|
67 |
# output: prefix removed, 7 digits, filled with leading zeros
|
|
55 |
# input: prefix (letters) + up to 14 digits, may be zero
|
|
56 |
# output: prefix removed, 14 digits, filled with leading zeros
|
|
68 | 57 |
$invoice_number = remove_letters_prefix($invoice_number); |
69 |
if (!check_digits_and_max_length($invoice_number, 7)) {
|
|
70 |
return undef, $::locale->text('Invoice number invalid. Must be less then or equal to 7 digits after prefix.');
|
|
58 |
if (!check_digits_and_max_length($invoice_number, 14)) {
|
|
59 |
return undef, $::locale->text('Invoice number invalid. Must be less then or equal to 14 digits after prefix.');
|
|
71 | 60 |
} |
72 | 61 |
# fill with zeros |
73 |
$invoice_number = sprintf "%07d", $invoice_number;
|
|
62 |
$invoice_number = sprintf "%014d", $invoice_number;
|
|
74 | 63 |
|
75 | 64 |
# assemble ref. number |
76 |
my $ref_number = $bank_id . $customer_number . $order_number . $invoice_number;
|
|
65 |
my $ref_number = $bank_id . $customer_number . $invoice_number; |
|
77 | 66 |
|
78 | 67 |
# calculate check digit |
79 | 68 |
my $ref_number_cpl = $ref_number . calculate_check_digit($ref_number); |
... | ... | |
187 | 176 |
my ($ref_number, $error) = assemble_ref_number( |
188 | 177 |
$qr_account->{'bank_account_id'}, |
189 | 178 |
$form->{'customernumber'}, |
190 |
$form->{'ordnumber'}, |
|
191 | 179 |
$form->{'invnumber'}, |
192 | 180 |
); |
193 | 181 |
|
... | ... | |
233 | 221 |
|
234 | 222 |
Kivitendo customer number. Prefix (letters) and up to 6 digits. |
235 | 223 |
|
236 |
=item C<order_number> |
|
237 |
|
|
238 |
Kivitendo order number. Prefix (letters) and up to 7 digits, may be zero. |
|
239 |
|
|
240 | 224 |
=item C<invoice_number> |
241 | 225 |
|
242 |
Kivitendo invoice number. Prefix (letters) and up to 7 digits, may be zero.
|
|
226 |
Kivitendo invoice number. Prefix (letters) and up to 14 digits, may be zero.
|
|
243 | 227 |
|
244 | 228 |
=back |
245 | 229 |
|
Auch abrufbar als: Unified diff
Swiss QR-Bill: QR-Referenz ohne Auftragsnummer erzeugen, dafür Rechnungsnummer 14-stellig