Revision e2f0105f
Von Moritz Bunkus vor fast 4 Jahren hinzugefügt
SL/DB/Helper/ZUGFeRD.pm | ||
---|---|---|
27 | 27 |
|
28 | 28 |
my %standards_ids = ( |
29 | 29 |
PROFILE_FACTURX_EXTENDED() => 'urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended', |
30 |
PROFILE_XRECHNUNG() => 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0', |
|
31 |
); |
|
32 |
|
|
30 | 33 |
sub _is_profile { |
31 | 34 |
my ($self, @profiles) = @_; |
32 | 35 |
return any { $self->{_zugferd}->{profile} == $_ } @profiles; |
... | ... | |
288 | 291 |
$description =~ s{<\%$_\%>}{ $params{vars}->{$_} }ge for keys %{ $params{vars} }; |
289 | 292 |
$description =~ s{<\%$_\%>}{ $params{formatted_amounts}->{$_} }ge for keys %{ $params{formatted_amounts} }; |
290 | 293 |
|
294 |
if (_is_profile($self, PROFILE_XRECHNUNG())) { |
|
295 |
my @terms; |
|
296 |
|
|
297 |
if ($self->payment_terms->terms_skonto && ($self->payment_terms->percent_skonto * 1)) { |
|
298 |
push @terms, sprintf("#SKONTO#TAGE=\%d#PROZENT=\%.2f#\n", $self->payment_terms->terms_skonto, $self->payment_terms->percent_skonto * 100); |
|
299 |
} |
|
300 |
|
|
301 |
$description =~ s{#}{_}g; |
|
302 |
$description = join('', @terms) . $description; |
|
303 |
} |
|
304 |
|
|
291 | 305 |
return $description; |
292 | 306 |
} |
293 | 307 |
|
... | ... | |
309 | 323 |
$params{xml}->endTag; |
310 | 324 |
# </ram:DueDateDateTime> |
311 | 325 |
|
312 |
if ($self->payment_terms->percent_skonto && $self->payment_terms->terms_skonto) { |
|
326 |
if ( _is_profile($self, PROFILE_FACTURX_EXTENDED()) |
|
327 |
&& $self->payment_terms->percent_skonto |
|
328 |
&& $self->payment_terms->terms_skonto) { |
|
313 | 329 |
my $currency_id = _u8(SL::Helper::ISO4217::map_currency_name_to_code($self->currency->name) // 'EUR'); |
314 | 330 |
|
315 | 331 |
# <ram:ApplicableTradePaymentDiscountTerms> |
... | ... | |
376 | 392 |
$params{xml}->startTag("rsm:ExchangedDocument"); |
377 | 393 |
|
378 | 394 |
$params{xml}->dataElement("ram:ID", _u8($self->invnumber)); |
379 |
$params{xml}->dataElement("ram:Name", _u8(_type_name($self))); |
|
395 |
$params{xml}->dataElement("ram:Name", _u8(_type_name($self))) if _is_profile($self, PROFILE_FACTURX_EXTENDED());
|
|
380 | 396 |
$params{xml}->dataElement("ram:TypeCode", _u8(_type_code($self))); |
381 | 397 |
|
382 | 398 |
# <ram:IssueDateTime> |
... | ... | |
385 | 401 |
$params{xml}->endTag; |
386 | 402 |
# </ram:IssueDateTime> |
387 | 403 |
|
388 |
if ($self->language && (($self->language->template_code // '') =~ m{^(de|en)}i)) { |
|
404 |
if ( _is_profile($self, PROFILE_FACTURX_EXTENDED()) |
|
405 |
&& $self->language |
|
406 |
&& (($self->language->template_code // '') =~ m{^(de|en)}i)) { |
|
389 | 407 |
$params{xml}->dataElement("ram:LanguageID", uc($1)); |
390 | 408 |
} |
391 | 409 |
|
... | ... | |
507 | 525 |
# <ram:ApplicableHeaderTradeAgreement> |
508 | 526 |
$params{xml}->startTag("ram:ApplicableHeaderTradeAgreement"); |
509 | 527 |
|
528 |
$params{xml}->dataElement("ram:BuyerReference", _u8($self->customer->c_vendor_routing_id)) if $self->customer->c_vendor_routing_id; |
|
529 |
|
|
510 | 530 |
_seller_trade_party($self, %params); |
511 | 531 |
_buyer_trade_party($self, %params); |
512 | 532 |
|
... | ... | |
620 | 640 |
} |
621 | 641 |
} |
622 | 642 |
|
643 |
if (_is_profile($self, PROFILE_XRECHNUNG())) { |
|
644 |
if (!$self->customer->c_vendor_routing_id) { |
|
645 |
SL::X::ZUGFeRDValidation->throw(message => $prefix . $::locale->text('The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.', 'XRechnung 2.0')); |
|
646 |
} |
|
647 |
} |
|
648 |
|
|
623 | 649 |
return %result; |
624 | 650 |
} |
625 | 651 |
|
SL/ZUGFeRD.pm | ||
---|---|---|
12 | 12 |
use SL::Locale::String qw(t8); |
13 | 13 |
|
14 | 14 |
use parent qw(Exporter); |
15 |
our @EXPORT_PROFILES = qw(PROFILE_FACTURX_EXTENDED); |
|
15 |
our @EXPORT_PROFILES = qw(PROFILE_FACTURX_EXTENDED PROFILE_XRECHNUNG);
|
|
16 | 16 |
our @EXPORT_OK = (@EXPORT_PROFILES); |
17 | 17 |
our %EXPORT_TAGS = (PROFILES => \@EXPORT_PROFILES); |
18 | 18 |
|
19 | 19 |
use constant PROFILE_FACTURX_EXTENDED => 0; |
20 |
use constant PROFILE_XRECHNUNG => 1; |
|
20 | 21 |
|
21 | 22 |
use constant RES_OK => 0; |
22 | 23 |
use constant RES_ERR_FILE_OPEN => 1; |
... | ... | |
29 | 30 |
[ 0, t8('Do not create Factur-X/ZUGFeRD invoices') ], |
30 | 31 |
[ PROFILE_FACTURX_EXTENDED() * 2 + 1, t8('Create with profile \'Factur-X 1.0.05/ZUGFeRD 2.1.1 extended\'') ], |
31 | 32 |
[ PROFILE_FACTURX_EXTENDED() * 2 + 2, t8('Create with profile \'Factur-X 1.0.05/ZUGFeRD 2.1.1 extended\' (test mode)') ], |
33 |
[ PROFILE_XRECHNUNG() * 2 + 1, t8('Create with profile \'XRechnung 2.0.0\'') ], |
|
34 |
[ PROFILE_XRECHNUNG() * 2 + 2, t8('Create with profile \'XRechnung 2.0.0\' (test mode)') ], |
|
32 | 35 |
); |
33 | 36 |
|
34 | 37 |
sub convert_customer_setting { |
locale/de/all | ||
---|---|---|
779 | 779 |
'Create tables' => 'Tabellen anlegen', |
780 | 780 |
'Create with profile \'Factur-X 1.0.05/ZUGFeRD 2.1.1 extended\'' => 'Mit Profil »Factur-X 1.0.05/ZUGFeRD 2.1.1 extended«', |
781 | 781 |
'Create with profile \'Factur-X 1.0.05/ZUGFeRD 2.1.1 extended\' (test mode)' => 'Mit Profil »Factur-X 1.0.05/ZUGFeRD 2.1.1 extended« (Test-Modus)', |
782 |
'Create with profile \'XRechnung 2.0.0\'' => 'Mit Profil »XRechnung 2.0.0«', |
|
783 |
'Create with profile \'XRechnung 2.0.0\' (test mode)' => 'Mit Profil »XRechnung 2.0.0« (Test-Modus)', |
|
782 | 784 |
'Created by' => 'Erstellt von', |
783 | 785 |
'Created for' => 'Erstellt für', |
784 | 786 |
'Created on' => 'Erstellt am', |
... | ... | |
3556 | 3558 |
'The user has been deleted.' => 'Der Benutzer wurde gelöscht.', |
3557 | 3559 |
'The user has been saved.' => 'Der Benutzer wurde gespeichert.', |
3558 | 3560 |
'The value \'#1\' is not a valid IBAN.' => 'Der Wert \'#1\' ist keine gültige IBAN.', |
3561 |
'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => 'Der Wert »unsere Leitweg-ID beim Kunden« muss in den Kundenstammdaten gesetzt sein für Profil #1.', |
|
3559 | 3562 |
'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => 'Der Variablenname darf nur aus Zeichen (keine Umlaute), Ziffern und Unterstrichen bestehen. Er muss mit einem Buchstaben beginnen. Beispiel: weihnachtsgruss_verschicken', |
3560 | 3563 |
'The vendor name is missing.' => 'Der Liefeantenname fehlt.', |
3561 | 3564 |
'The version number is missing.' => 'Die Versionsnummer fehlt.', |
Auch abrufbar als: Unified diff
Factur-X/ZUGFeRD: Unterstütztung für Profil »XRechnung 2.0.0«