Revision e2f0105f
Von Moritz Bunkus vor etwa 4 Jahren hinzugefügt
SL/DB/Helper/ZUGFeRD.pm | ||
---|---|---|
|
||
my %standards_ids = (
|
||
PROFILE_FACTURX_EXTENDED() => 'urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended',
|
||
PROFILE_XRECHNUNG() => 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0',
|
||
);
|
||
|
||
sub _is_profile {
|
||
my ($self, @profiles) = @_;
|
||
return any { $self->{_zugferd}->{profile} == $_ } @profiles;
|
||
... | ... | |
$description =~ s{<\%$_\%>}{ $params{vars}->{$_} }ge for keys %{ $params{vars} };
|
||
$description =~ s{<\%$_\%>}{ $params{formatted_amounts}->{$_} }ge for keys %{ $params{formatted_amounts} };
|
||
|
||
if (_is_profile($self, PROFILE_XRECHNUNG())) {
|
||
my @terms;
|
||
|
||
if ($self->payment_terms->terms_skonto && ($self->payment_terms->percent_skonto * 1)) {
|
||
push @terms, sprintf("#SKONTO#TAGE=\%d#PROZENT=\%.2f#\n", $self->payment_terms->terms_skonto, $self->payment_terms->percent_skonto * 100);
|
||
}
|
||
|
||
$description =~ s{#}{_}g;
|
||
$description = join('', @terms) . $description;
|
||
}
|
||
|
||
return $description;
|
||
}
|
||
|
||
... | ... | |
$params{xml}->endTag;
|
||
# </ram:DueDateDateTime>
|
||
|
||
if ($self->payment_terms->percent_skonto && $self->payment_terms->terms_skonto) {
|
||
if ( _is_profile($self, PROFILE_FACTURX_EXTENDED())
|
||
&& $self->payment_terms->percent_skonto
|
||
&& $self->payment_terms->terms_skonto) {
|
||
my $currency_id = _u8(SL::Helper::ISO4217::map_currency_name_to_code($self->currency->name) // 'EUR');
|
||
|
||
# <ram:ApplicableTradePaymentDiscountTerms>
|
||
... | ... | |
$params{xml}->startTag("rsm:ExchangedDocument");
|
||
|
||
$params{xml}->dataElement("ram:ID", _u8($self->invnumber));
|
||
$params{xml}->dataElement("ram:Name", _u8(_type_name($self)));
|
||
$params{xml}->dataElement("ram:Name", _u8(_type_name($self))) if _is_profile($self, PROFILE_FACTURX_EXTENDED());
|
||
$params{xml}->dataElement("ram:TypeCode", _u8(_type_code($self)));
|
||
|
||
# <ram:IssueDateTime>
|
||
... | ... | |
$params{xml}->endTag;
|
||
# </ram:IssueDateTime>
|
||
|
||
if ($self->language && (($self->language->template_code // '') =~ m{^(de|en)}i)) {
|
||
if ( _is_profile($self, PROFILE_FACTURX_EXTENDED())
|
||
&& $self->language
|
||
&& (($self->language->template_code // '') =~ m{^(de|en)}i)) {
|
||
$params{xml}->dataElement("ram:LanguageID", uc($1));
|
||
}
|
||
|
||
... | ... | |
# <ram:ApplicableHeaderTradeAgreement>
|
||
$params{xml}->startTag("ram:ApplicableHeaderTradeAgreement");
|
||
|
||
$params{xml}->dataElement("ram:BuyerReference", _u8($self->customer->c_vendor_routing_id)) if $self->customer->c_vendor_routing_id;
|
||
|
||
_seller_trade_party($self, %params);
|
||
_buyer_trade_party($self, %params);
|
||
|
||
... | ... | |
}
|
||
}
|
||
|
||
if (_is_profile($self, PROFILE_XRECHNUNG())) {
|
||
if (!$self->customer->c_vendor_routing_id) {
|
||
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'));
|
||
}
|
||
}
|
||
|
||
return %result;
|
||
}
|
||
|
SL/ZUGFeRD.pm | ||
---|---|---|
use SL::Locale::String qw(t8);
|
||
|
||
use parent qw(Exporter);
|
||
our @EXPORT_PROFILES = qw(PROFILE_FACTURX_EXTENDED);
|
||
our @EXPORT_PROFILES = qw(PROFILE_FACTURX_EXTENDED PROFILE_XRECHNUNG);
|
||
our @EXPORT_OK = (@EXPORT_PROFILES);
|
||
our %EXPORT_TAGS = (PROFILES => \@EXPORT_PROFILES);
|
||
|
||
use constant PROFILE_FACTURX_EXTENDED => 0;
|
||
use constant PROFILE_XRECHNUNG => 1;
|
||
|
||
use constant RES_OK => 0;
|
||
use constant RES_ERR_FILE_OPEN => 1;
|
||
... | ... | |
[ 0, t8('Do not create Factur-X/ZUGFeRD invoices') ],
|
||
[ PROFILE_FACTURX_EXTENDED() * 2 + 1, t8('Create with profile \'Factur-X 1.0.05/ZUGFeRD 2.1.1 extended\'') ],
|
||
[ PROFILE_FACTURX_EXTENDED() * 2 + 2, t8('Create with profile \'Factur-X 1.0.05/ZUGFeRD 2.1.1 extended\' (test mode)') ],
|
||
[ PROFILE_XRECHNUNG() * 2 + 1, t8('Create with profile \'XRechnung 2.0.0\'') ],
|
||
[ PROFILE_XRECHNUNG() * 2 + 2, t8('Create with profile \'XRechnung 2.0.0\' (test mode)') ],
|
||
);
|
||
|
||
sub convert_customer_setting {
|
locale/de/all | ||
---|---|---|
'Create tables' => 'Tabellen anlegen',
|
||
'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«',
|
||
'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)',
|
||
'Create with profile \'XRechnung 2.0.0\'' => 'Mit Profil »XRechnung 2.0.0«',
|
||
'Create with profile \'XRechnung 2.0.0\' (test mode)' => 'Mit Profil »XRechnung 2.0.0« (Test-Modus)',
|
||
'Created by' => 'Erstellt von',
|
||
'Created for' => 'Erstellt für',
|
||
'Created on' => 'Erstellt am',
|
||
... | ... | |
'The user has been deleted.' => 'Der Benutzer wurde gelöscht.',
|
||
'The user has been saved.' => 'Der Benutzer wurde gespeichert.',
|
||
'The value \'#1\' is not a valid IBAN.' => 'Der Wert \'#1\' ist keine gültige IBAN.',
|
||
'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.',
|
||
'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',
|
||
'The vendor name is missing.' => 'Der Liefeantenname fehlt.',
|
||
'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«