Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision db101cc6

Von Cem Aydin vor etwa 2 Jahren hinzugefügt

  • ID db101cc6810a2250cac479b6f653bf084c625adf
  • Vorgänger 64ba4cbb
  • Nachfolger 2d2a5559

Swiss QR-Bill: QR-Referenz soll in der jeweiligen Rechnung gespeichert werden

Unterschiede anzeigen:

SL/IS.pm
53 53
use SL::IO;
54 54
use SL::TransNumber;
55 55
use SL::DB::Chart;
56
use SL::DB::Customer;
56 57
use SL::DB::Default;
57 58
use SL::DB::Draft;
58 59
use SL::DB::Tax;
......
60 61
use SL::TransNumber;
61 62
use SL::DB;
62 63
use SL::Presenter::Part qw(type_abbreviation classification_abbreviation);
64
use SL::Helper::QrBillFunctions qw(get_qrbill_account assemble_ref_number);
63 65
use Data::Dumper;
64 66

  
65 67
use strict;
......
1467 1469

  
1468 1470
  $amount = $form->round_amount( $netamount + $tax, 2, 1);
1469 1471

  
1472
  # qr reference
1473
  my $qr_reference;
1474
  if ($form->{has_qr_reference}) {
1475
    # (re-)generate reference number
1476

  
1477
    # get qr-account data
1478
    my ($qr_account, $error) = get_qrbill_account();
1479
    die $error if !$qr_account;
1480

  
1481
    # get customer object
1482
    my $customer_obj = SL::DB::Customer->load_cached(conv_i($form->{customer_id}));
1483

  
1484
    # assemble reference number with check digit
1485
    ($qr_reference, $error) = assemble_ref_number($qr_account->{bank_account_id},
1486
                                                  $customer_obj->{customernumber},
1487
                                                  $form->{ordnumber},
1488
                                                  $form->{invnumber});
1489
    die $error if !$qr_reference;
1490
  } else {
1491
    # if the reference number has been previously defined keep it
1492
    if (defined $form->{qr_reference}) {
1493
      $qr_reference = $form->{qr_reference};
1494
    } else {
1495
      $qr_reference = undef;
1496
    }
1497
  }
1498

  
1470 1499
  # save AR record
1471 1500
  #erweiterung fuer lieferscheinnummer (donumber) 12.02.09 jb
1472 1501

  
......
1484 1513
                globalproject_id               = ?, delivery_customer_id             = ?,
1485 1514
                transaction_description        = ?, delivery_vendor_id               = ?,
1486 1515
                donumber    = ?, invnumber_for_credit_note = ?,        direct_debit  = ?, qrbill_without_amount = ?,
1487
                delivery_term_id = ?
1516
                qr_reference = ?, delivery_term_id = ?
1488 1517
              WHERE id = ?|;
1489 1518
  @values = (          $form->{"invnumber"},           $form->{"ordnumber"},             $form->{"quonumber"},          $form->{"cusordnumber"},
1490 1519
             conv_date($form->{"invdate"}),  conv_date($form->{"orddate"}),    conv_date($form->{"quodate"}), conv_date($form->{tax_point}), conv_i($form->{"customer_id"}),
......
1498 1527
                conv_i($form->{"globalproject_id"}),                              conv_i($form->{"delivery_customer_id"}),
1499 1528
                       $form->{transaction_description},                          conv_i($form->{"delivery_vendor_id"}),
1500 1529
                       $form->{"donumber"}, $form->{"invnumber_for_credit_note"},        $form->{direct_debit} ? 't' : 'f', $form->{qrbill_without_amount} ? 't' : 'f',
1501
                conv_i($form->{delivery_term_id}),
1530
                $qr_reference, conv_i($form->{delivery_term_id}),
1502 1531
                conv_i($form->{"id"}));
1503 1532
  do_query($form, $dbh, $query, @values);
1504 1533

  
......
2251 2280
           a.mtime, a.itime,
2252 2281
           a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
2253 2282
           a.transaction_description, a.donumber, a.invnumber_for_credit_note,
2254
           a.marge_total, a.marge_percent, a.direct_debit, a.qrbill_without_amount, a.delivery_term_id,
2283
           a.marge_total, a.marge_percent, a.direct_debit, a.qrbill_without_amount, a.qr_reference, a.delivery_term_id,
2255 2284
           dc.dunning_description,
2256 2285
           e.name AS employee
2257 2286
         FROM ar a
SL/Template/OpenDocument.pm
13 13

  
14 14
use SL::DB::BankAccount;
15 15
use SL::Helper::QrBill;
16
use SL::Helper::QrBillFunctions qw(get_qrbill_account assemble_ref_number
17
  get_ref_number_formatted get_iban_formatted get_amount_formatted);
16
use SL::Helper::QrBillFunctions qw(get_qrbill_account get_ref_number_formatted
17
  get_iban_formatted get_amount_formatted);
18 18
use SL::Helper::ISO3166;
19 19

  
20 20
use Cwd;
......
538 538

  
539 539
  my %ref_nr_data;
540 540
  if ($::instance_conf->get_create_qrbill_invoices == 1) {
541
    # generate ref.-no. with check digit
542
    my ($ref_number, $error) = assemble_ref_number(
543
      $qr_account->{'bank_account_id'},
544
      $form->{'customernumber'},
545
      $form->{'ordnumber'},
546
      $form->{'invnumber'},
547
    );
548
    if (!$ref_number) {
549
      $::form->error($error);
550
    }
551 541
    %ref_nr_data = (
552 542
      'type' => 'QRR',
553
      'ref_number' => $ref_number,
543
      'ref_number' => $form->{'qr_reference'},
554 544
    );
555 545
    # get ref. number/iban formatted with spaces and set into form for template
556 546
    # processing
557
    $form->{'ref_number'} = $ref_number;
558
    $form->{'ref_number_formatted'} = get_ref_number_formatted($ref_number);
547
    $form->{'ref_number'} = $form->{'qr_reference'};
548
    $form->{'ref_number_formatted'} = get_ref_number_formatted($form->{'qr_reference'});
559 549
  } elsif ($::instance_conf->get_create_qrbill_invoices == 2) {
560 550
    %ref_nr_data = (
561 551
      'type' => 'NON',
bin/mozilla/is.pl
53 53
use SL::DB::Invoice;
54 54
use SL::DB::PaymentTerm;
55 55
use SL::DB::ValidityToken;
56
use SL::Helper::QrBillFunctions qw(get_ref_number_formatted);
56 57

  
57 58
require "bin/mozilla/common.pl";
58 59
require "bin/mozilla/io.pl";
......
624 625
  $TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
625 626
  $TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
626 627

  
628
# qr reference
629
my $has_qr_reference = $::instance_conf->get_create_qrbill_invoices == 1 &&
630
                       $form->{formname} eq 'invoice' ? 1 : 0;
631
$TMPL_VAR{has_qr_reference} = $has_qr_reference;
632

  
633
if ($has_qr_reference && defined $form->{qr_reference}) {
634
  $TMPL_VAR{qr_reference_formatted} = get_ref_number_formatted($form->{qr_reference});
635
}
636

  
627 637
# set option selected
628 638
  foreach my $item (qw(AR)) {
629 639
    $form->{"select$item"} =~ s/ selected//;
locale/de/all
2781 2781
  'Purpose (if field names purpose, purpose1, purpose2 ... exist they will all combined into the field "purpose")' => 'Verwendungszweck (wenn die Spalten purpose, purpose1, purpose2 ... existieren werden diese zum Feld "purpose" zusammengefügt)',
2782 2782
  'Purpose/Reference'           => 'Verwendungszweck und Referenz',
2783 2783
  'QR bill without amount'      => 'QR-Rechnung ohne Betrag',
2784
  'QR reference'                => 'QR-Referenz',
2784 2785
  'QR-Code placeholder image: QRCodePlaceholder not found in template.' => 'QR-Code Platzhalter Bild: QRCodePlaceholder nicht in Druckvorlage gefunden.',
2785 2786
  'QR-Image generation failed: ' => 'QR-Code Erzeugung fehlgeschlagen: ',
2786 2787
  'QUEUED'                      => 'In Warteschlange',
locale/en/all
2781 2781
  'Purpose (if field names purpose, purpose1, purpose2 ... exist they will all combined into the field "purpose")' => '',
2782 2782
  'Purpose/Reference'           => '',
2783 2783
  'QR bill without amount'      => '',
2784
  'QR reference'                => '',
2784 2785
  'QR-Code placeholder image: QRCodePlaceholder not found in template.' => '',
2785 2786
  'QR-Image generation failed: ' => '',
2786 2787
  'QUEUED'                      => '',
templates/webpages/is/form_header.html
19 19
<input type="hidden" name="follow_up_rowcount" id="follow_up_rowcount" value="1">
20 20
<input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
21 21
<input type="hidden" name="already_printed_flag" id="already_printed_flag" value="0">
22
<input type="hidden" name="has_qr_reference" id="has_qr_reference" value="[% has_qr_reference %]">
23
[%- IF qr_reference %]
24
[%   L.hidden_tag("qr_reference", qr_reference) %]
25
[%- END %]
22 26
[% IF !id %]
23 27
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
24 28
[% END %]
......
313 317
            [%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key = 'projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %]
314 318
          </td>
315 319
        </tr>
320
        [%- IF has_qr_reference %]
321
        <tr>
322
          <th align="right" nowrap>[% 'QR reference' | $T8 %]</th>
323
          <td>
324
            [%- IF qr_reference %]
325
              [% HTML.escape(qr_reference_formatted) %]
326
            [%- ELSE %]
327
              [% LxERP.t8("will be set upon posting") %]
328
            [%- END %]
329
          </td>
330
        </tr>
331
        [%- END %]
316 332
      </table>
317 333
    </td>
318 334
  </tr>

Auch abrufbar als: Unified diff