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;
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' },
);
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();
# 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');
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;
$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();
}
# 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} = { };
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;
$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();
}
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;
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';
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
'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',
--- /dev/null
+-- @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';
<td>[% LxERP.t8('Used for Sale') %]</td>
<td>[% L.checkbox_tag("parts_classification.used_for_sale", checked=(SELF.parts_classification.used_for_sale ? 1:'')) %]</td>
</tr>
+ <tr>
+ <td>[% LxERP.t8('Report seperately') %]</td>
+ <td>[% L.checkbox_tag("parts_classification.report_separate", checked=(SELF.parts_classification.report_separate ? 1:'')) %]</td>
+ </tr>
</table>
<p>
<th>[%- LxERP.t8('TypeAbbreviation') %]</th>
<th>[%- LxERP.t8('Used for Purchase') %]</th>
<th>[%- LxERP.t8('Used for Sale') %]</th>
+ <th>[%- LxERP.t8('Report seperately') %]</th>
</tr>
</thead>
<td>[%- HTML.escape(LxERP.t8(parts_classification.abbreviation)) %]</td>
<td>[% IF parts_classification.used_for_purchase %][% LxERP.t8('Yes') %][% ELSE %][% LxERP.t8('No') %][% END %]</td>
<td>[% IF parts_classification.used_for_sale %][% LxERP.t8('Yes') %][% ELSE %][% LxERP.t8('No') %][% END %]</td>
+ <td>[% IF parts_classification.report_separate %][% LxERP.t8('Yes') %][% ELSE %][% LxERP.t8('No') %][% END %]</td>
</tr>
[%- END %]
</tbody>