From: Martin Helmling mh@waldpark.octosoft.eu Date: Mon, 26 Oct 2015 16:24:18 +0000 (+0100) Subject: Artikel-Klassifizierung: Neue Option "Preis separat ausweisen" X-Git-Tag: release-3.5.4~1860 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=815c3639a21ed53b288fd8bbb231e741c8e67ce5;p=kivitendo-erp.git Artikel-Klassifizierung: Neue Option "Preis separat ausweisen" - neuer boolcher Wert in der Tabelle parts_classification: "report_separate" - editierbar unter Artikelklassifikation - In Aufträgen und Rechnungen werden die Zwischensummen LaTeX zur Verfügung gestellt. - <%separate_XXX_subtotal%> wobei XXX die Abkürzung der Klassifikation ist. - <%non_separate_subtotal%> der Rest der Positionen, z.B. reiner Warenwert. Hintergrund: Preise von Artikeln wie "Verpackung" oder "Transport" müssen oftmals separat ausgewiesen werden, genau so wie der reine Warenwert. --- diff --git a/SL/DB/Manager/PartsClassification.pm b/SL/DB/Manager/PartsClassification.pm index 23558dc07..de11aa878 100644 --- a/SL/DB/Manager/PartsClassification.pm +++ b/SL/DB/Manager/PartsClassification.pm @@ -19,4 +19,10 @@ sub get_abbreviation { return $obj->abbreviation?$obj->abbreviation:undef; } +sub get_separate_abbreviation { + my ($class,$id) = @_; + my $obj = $class->get_first(query => [ id => $id ]); + return $obj->report_separate?$obj->abbreviation:''; +} + 1; diff --git a/SL/DB/MetaSetup/PartsClassification.pm b/SL/DB/MetaSetup/PartsClassification.pm index 18e1dff81..108e2914b 100644 --- a/SL/DB/MetaSetup/PartsClassification.pm +++ b/SL/DB/MetaSetup/PartsClassification.pm @@ -12,6 +12,7 @@ __PACKAGE__->meta->columns( abbreviation => { type => 'text' }, description => { type => 'text' }, id => { type => 'serial', not_null => 1 }, + report_separate => { type => 'boolean', default => 'false' }, used_for_purchase => { type => 'boolean', default => 'true' }, used_for_sale => { type => 'boolean', default => 'true' }, ); diff --git a/SL/IC.pm b/SL/IC.pm index 2163bf817..ce5e31e09 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -1757,6 +1757,7 @@ sub prepare_parts_for_printing { my $type_abbr = $::request->presenter->type_abbreviation($prt->part_type); push @{ $template_arrays{part_type} }, $type_abbr; push @{ $template_arrays{type_and_classific}}, $type_abbr.$::request->presenter->classification_abbreviation($prt->classification_id); + push @{ $template_arrays{separate} }, $::request->presenter->separate_abbreviation($prt->classification_id); } $main::lxdebug->leave_sub(); diff --git a/SL/IS.pm b/SL/IS.pm index b55cd7f28..818698603 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -149,6 +149,7 @@ sub invoice_details { # so that they can be sorted in later my %prepared_template_arrays = IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); my @prepared_arrays = keys %prepared_template_arrays; + my @separate_totals = qw(non_separate_subtotal); my $ic_cvar_configs = CVar->get_configs(module => 'IC'); my $project_cvar_configs = CVar->get_configs(module => 'Projects'); @@ -332,6 +333,17 @@ sub invoice_details { push @{ $form->{TEMPLATE_ARRAYS}->{discount_nofmt} }, ($discount != 0) ? $discount * -1 : ''; push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"}; + if ( $prepared_template_arrays{separate}[$i - 1] ) { + my $pabbr = $prepared_template_arrays{separate}[$i - 1]; + if ( ! $form->{"separate_${pabbr}_subtotal"} ) { + push @separate_totals , "separate_${pabbr}_subtotal"; + $form->{"separate_${pabbr}_subtotal"} = 0; + } + $form->{"separate_${pabbr}_subtotal"} += $linetotal; + } else { + $form->{non_separate_subtotal} += $linetotal; + } + $form->{total} += $linetotal; $form->{nodiscount_total} += $nodiscount_linetotal; $form->{discount_total} += $discount; @@ -539,6 +551,7 @@ sub invoice_details { $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id}; $form->{username} = $myconfig->{name}; + $form->{$_} = $form->format_amount($myconfig, $form->{$_}, 2) for @separate_totals; $main::lxdebug->leave_sub(); } diff --git a/SL/OE.pm b/SL/OE.pm index 24e88f004..b4b7d7d82 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1331,6 +1331,7 @@ sub order_details { # so that they can be sorted in later my %prepared_template_arrays = IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); my @prepared_arrays = keys %prepared_template_arrays; + my @separate_totals = qw(non_separate_subtotal); $form->{TEMPLATE_ARRAYS} = { }; @@ -1437,6 +1438,17 @@ sub order_details { push @{ $form->{TEMPLATE_ARRAYS}->{discount_nofmt} }, ($discount != 0) ? $discount * -1 : ''; push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"}; + if ( $prepared_template_arrays{separate}[$i - 1] ) { + my $pabbr = $prepared_template_arrays{separate}[$i - 1]; + if ( ! $form->{"separate_${pabbr}_subtotal"} ) { + push @separate_totals , "separate_${pabbr}_subtotal"; + $form->{"separate_${pabbr}_subtotal"} = 0; + } + $form->{"separate_${pabbr}_subtotal"} += $linetotal; + } else { + $form->{non_separate_subtotal} += $linetotal; + } + $form->{ordtotal} += $linetotal; $form->{nodiscount_total} += $nodiscount_linetotal; $form->{discount_total} += $discount; @@ -1610,6 +1622,7 @@ sub order_details { $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id}; $form->{order} = SL::DB::Manager::Order->find_by(id => $form->{id}) if $form->{id}; + $form->{$_} = $form->format_amount($myconfig, $form->{$_}, 2) for @separate_totals; $main::lxdebug->leave_sub(); } diff --git a/SL/Presenter/Part.pm b/SL/Presenter/Part.pm index c3bbea2bc..08c425ba6 100644 --- a/SL/Presenter/Part.pm +++ b/SL/Presenter/Part.pm @@ -6,7 +6,7 @@ use SL::DB::Part; use SL::DB::Manager::PartsClassification; use Exporter qw(import); -our @EXPORT = qw(part_picker part select_classification classification_abbreviation type_abbreviation type_and_classification); +our @EXPORT = qw(part_picker part select_classification classification_abbreviation type_abbreviation separate_abbreviation); use Carp; @@ -80,6 +80,11 @@ sub classification_abbreviation { return $::locale->text(SL::DB::Manager::PartsClassification->get_abbreviation($id)); } +sub separate_abbreviation { + my ($self, $id) = @_; + return $::locale->text(SL::DB::Manager::PartsClassification->get_separate_abbreviation($id)); +} + sub select_classification { my ($self, $name, %attributes) = @_; $attributes{value_key} = 'id'; diff --git a/doc/changelog b/doc/changelog index 12327db49..fc1d9d022 100644 --- a/doc/changelog +++ b/doc/changelog @@ -37,6 +37,18 @@ große Features: nun wird alternativ zur 'type'-Spalte die 'pclass'-Spalte mit zwei Buchstaben geparsed und entsprechend classification_id,assembly sowie inventory_accno_id gesetzt (oder type_id falls neue Implementierung eingebaut). +- Option "Preis separat ausweisen" als neue Artikel-Klassifizierung + + - neuer boolcher Wert in parts_classification "report_separate" + - editierbar unter Artikelklassifikation + - In Aufträgen und Rechnungen werden die Zwischensummen LaTeX zur Verfügung gestellt. + - <%partsclass_XXX_subtotal%> wobei XXX die Abkürzung der Klassifikation ist. + - <%merchandise_value_subtotal%> der Rest der Positionen. + + Hintergrund: + Preise von Artikeln wie "Verpackung" oder "Transport" müssen + oftmals separat ausgewiesen werden, genau so wie der reine Warenwert. + kleinere neue Features und Detailverbesserungen: - SEPA Überweisungen zusätzlich Kunden- oder Lieferantennummer im Verwendungszweck vorbelegen diff --git a/locale/de/all b/locale/de/all index 3f837bbc0..cd143fd3e 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2356,6 +2356,7 @@ $self->{texts} = { 'Report and misc. Preferences' => 'Sonstige Einstellungen', 'Report date' => 'Berichtsdatum', 'Report for' => 'Bericht für', + 'Report seperately' => 'Preis separat ausweisen', 'Reports' => 'Berichte', 'Representative' => 'Vertreter', 'Representative for Customer' => 'Vertreter für Kunden', diff --git a/sql/Pg-upgrade2/partsclassification_report_separate.sql b/sql/Pg-upgrade2/partsclassification_report_separate.sql new file mode 100644 index 000000000..3e98b5135 --- /dev/null +++ b/sql/Pg-upgrade2/partsclassification_report_separate.sql @@ -0,0 +1,4 @@ +-- @tag: partsclassification_report_seperate +-- @description: "Artikelklassifikation mit weiterer boolschen Variable für seperat ausweisen" +-- @depends: parts_classifications +ALTER TABLE parts_classifications ADD COLUMN report_separate BOOLEAN DEFAULT 'f'; diff --git a/templates/webpages/parts_classification/form.html b/templates/webpages/parts_classification/form.html index 26760b43e..f6181eed3 100755 --- a/templates/webpages/parts_classification/form.html +++ b/templates/webpages/parts_classification/form.html @@ -22,6 +22,10 @@ [% LxERP.t8('Used for Sale') %] [% L.checkbox_tag("parts_classification.used_for_sale", checked=(SELF.parts_classification.used_for_sale ? 1:'')) %] + + [% LxERP.t8('Report seperately') %] + [% L.checkbox_tag("parts_classification.report_separate", checked=(SELF.parts_classification.report_separate ? 1:'')) %] +

diff --git a/templates/webpages/parts_classification/list.html b/templates/webpages/parts_classification/list.html index 9226dc2f6..e18b43bfe 100644 --- a/templates/webpages/parts_classification/list.html +++ b/templates/webpages/parts_classification/list.html @@ -18,6 +18,7 @@ [%- LxERP.t8('TypeAbbreviation') %] [%- LxERP.t8('Used for Purchase') %] [%- LxERP.t8('Used for Sale') %] + [%- LxERP.t8('Report seperately') %] @@ -33,6 +34,7 @@ [%- HTML.escape(LxERP.t8(parts_classification.abbreviation)) %] [% IF parts_classification.used_for_purchase %][% LxERP.t8('Yes') %][% ELSE %][% LxERP.t8('No') %][% END %] [% IF parts_classification.used_for_sale %][% LxERP.t8('Yes') %][% ELSE %][% LxERP.t8('No') %][% END %] + [% IF parts_classification.report_separate %][% LxERP.t8('Yes') %][% ELSE %][% LxERP.t8('No') %][% END %] [%- END %]