$self->{warehouse_id} ||= $self->{WAREHOUSES}->[$max -1]->{id};
$self->{bin_id} ||= $self->{WAREHOUSES}->[$max -1]->{BINS}->[0]->{id};
}
+
+ $self->{show_weight} = SL::DB::Default->get->show_weight;
+
$self->render('client_config/form', title => $::locale->text('Client Configuration'));
}
map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete);
+<<<<<<< HEAD
# undef warehouse_id if the empty value is selected
if ( ($::form->{warehouse_id} == 0) && ($::form->{bin_id} == 0) ) {
undef $::form->{warehouse_id};
undef $::form->{bin_id};
}
map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(warehouse_id bin_id);
+=======
+ SL::DB::Default->get->update_attributes('show_weight' => $::form->{show_weight});
+>>>>>>> gewicht
flash_later('info', $::locale->text('Client Configuration saved!'));
$form->{"id_${idx}"} = $item->parts_id;
$form->{"partnumber_${idx}"} = $item->part->partnumber;
+ $form->{"weight_${idx}"} = $item->part->weight;
_copy($item, $form, '', "_${idx}", 0, qw(description project_id ship serialnumber pricegroup_id ordnumber cusordnumber unit
subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate));
_copy($item, $form, '', "_${idx}", $format_amounts, qw(qty sellprice marge_total marge_percent lastcost));
warehouse_id => { type => 'integer' },
bin_id => { type => 'integer' },
currency_id => { type => 'integer', not_null => 1 },
+ show_weight => { type => 'boolean', default => 'false', not_null => 1 },
],
primary_key_columns => [ 'id' ],
qw(runningnumber number description longdescription qty unit
partnotes serialnumber reqdate projectnumber projectdescription
si_runningnumber si_number si_description
- si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit);
+ si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit weight lineweight);
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays);
$form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} };
+ my $totalweight = 0;
my $sameitem = "";
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
push @{ $form->{TEMPLATE_ARRAYS}{projectdescription} },
$projectdescriptions{$form->{"project_id_$i"}};
+ my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"};
+ $totalweight += $lineweight;
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight;
+
if ($form->{"assembly_$i"}) {
$sameitem = "";
for @{ $ic_cvar_configs };
}
+ $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3);
+ $form->{totalweight_nofmt} = $totalweight;
+ my $defaults = AM->get_defaults();
+ $form->{weightunit} = $defaults->{weightunit};
+
$h_pg->finish();
$h_bin_wh->finish();
partnotes serialnumber reqdate sellprice listprice netprice
discount p_discount discount_sub nodiscount_sub
linetotal nodiscount_linetotal tax_rate projectnumber projectdescription
- price_factor price_factor_name partsgroup);
+ price_factor price_factor_name partsgroup weight lineweight);
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays, @payment_arrays);
+ my $totalweight = 0;
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}});
+ my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"};
+ $totalweight += $lineweight;
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight;
+
@taxaccounts = split(/ /, $form->{"taxaccounts_$i"});
$taxrate = 0;
$taxdiff = 0;
}
}
+ $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3);
+ $form->{totalweight_nofmt} = $totalweight;
+ my $defaults = AM->get_defaults();
+ $form->{weightunit} = $defaults->{weightunit};
+
foreach my $item (sort keys %taxaccounts) {
$tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
p.unit, p.assembly, p.onhand,
p.notes AS partnotes, p.notes AS longdescription,
p.not_discountable, p.formel, p.payment_id AS part_payment_id,
- p.price_factor_id,
+ p.price_factor_id, p.weight,
pfac.factor AS price_factor,
partnotes serialnumber reqdate sellprice listprice netprice
discount p_discount discount_sub nodiscount_sub
linetotal nodiscount_linetotal tax_rate projectnumber projectdescription
- price_factor price_factor_name partsgroup);
+ price_factor price_factor_name partsgroup weight lineweight);
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays);
+ my $totalweight = 0;
my $sameitem = "";
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}});
+ my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"};
+ $totalweight += $lineweight;
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3);
+ push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight;
+
my ($taxamount, $taxbase);
my $taxrate = 0;
}
}
+ $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3);
+ $form->{totalweight_nofmt} = $totalweight;
+ my $defaults = AM->get_defaults();
+ $form->{weightunit} = $defaults->{weightunit};
+
my $tax = 0;
foreach $item (sort keys %taxaccounts) {
$tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
my ($stock_in_out, $stock_in_out_title);
+ my $defaults = AM->get_defaults();
+ $form->{show_weight} = $defaults->{show_weight};
+ $form->{weightunit} = $defaults->{weightunit};
+
my $is_purchase = (first { $_ eq $form->{type} } qw(request_quotation purchase_order purchase_delivery_order)) || ($form->{script} eq 'ir.pl');
my $show_min_order_qty = first { $_ eq $form->{type} } qw(request_quotation purchase_order);
my $is_delivery_order = $form->{type} =~ /_delivery_order$/;
}
# column_index
- my @header_sort = qw(runningnumber partnumber description ship qty unit sellprice_pg sellprice discount linetotal);
+ my @header_sort = qw(runningnumber partnumber description ship qty unit weight sellprice_pg sellprice discount linetotal);
my @HEADER = (
{ id => 'runningnumber', width => 5, value => $locale->text('No.'), display => 1, },
{ id => 'partnumber', width => 8, value => $locale->text('Number'), display => 1, },
{ id => 'qty', width => 5, value => $locale->text('Qty'), display => 1, },
{ id => 'price_factor', width => 5, value => $locale->text('Price Factor'), display => !$is_delivery_order, },
{ id => 'unit', width => 5, value => $locale->text('Unit'), display => 1, },
+ { id => 'weight', width => 5, value => $locale->text('Weight'), display => $defaults->{show_weight}, },
{ id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, },
{ id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, },
{ id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, },
my $deliverydate = $locale->text('Required by');
# special alignings
- my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal stock_in_out);
+ my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal stock_in_out weight);
my %nowrap = map { $_ => 1 } qw(description unit);
$form->{marge_total} = 0;
$form->{sellprice_total} = 0;
$form->{lastcost_total} = 0;
+ $form->{totalweight} = 0;
my %projectnumber_labels = ();
my @projectnumber_values = ("");
_update_ship() if ($is_s_p_order);
_update_custom_variables();
+ my $totalweight = 0;
+
# rows
my @ROWS;
} else {
$column_data{price_factor} = ' ';
}
+ $form->{"weight_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"partunit_$i"}, $all_units) || 1;
$column_data{"unit"} = AM->unit_select_html($all_units, "unit_$i", $this_unit, $form->{"id_$i"} ? $form->{"unit_$i"} : undef);
# / unit ending
$column_data{linetotal} = $form->format_amount(\%myconfig, $linetotal, 2);
$column_data{bin} = $form->{"bin_$i"};
+ $column_data{weight} = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $form->{"weight_$i"}, 3) . ' ' . $defaults->{weightunit} if $defaults->{show_weight};
+
if ($is_delivery_order) {
$column_data{stock_in_out} = calculate_stock_in_out($i);
}
if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ || $form->{type} =~ /invoice/) ;
# / marge calculations ending
+# Calculate total weight
+ $totalweight += ($form->{"qty_$i"} * $form->{"weight_$i"});
+
# calculate onhand
if ($form->{"id_$i"}) {
my $part = IC->get_basic_part_info(id => $form->{"id_$i"});
map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" }
(qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes
income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber
- longdescription basefactor marge_absolut marge_percent marge_price_factor), @hidden_vars)
+ longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars)
);
map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"}));
push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, };
}
+ $form->{totalweight} = $totalweight;
+
print $form->parse_html_template('oe/sales_order', { ROWS => \@ROWS,
HEADER => \@HEADER,
});
my $info = $form->{PART_INFORMATION}->{$form->{"id_${i}"}} || { };
$form->{"partunit_${i}"} = $info->{unit};
+ $form->{"weight_$i"} = $info->{weight};
}
$main::lxdebug->leave_sub();
'Show old dunnings' => 'Alte Mahnungen anzeigen',
'Show overdue sales quotations and requests for quotations...' => 'Überfällige Angebote und Preisanfragen anzeigen...',
'Show settings' => 'Einstellungen anzeigen',
+ 'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => 'Sollen Warengewichte und Gesamtgewicht in Aufträgen, Rechnungen und Lieferscheinen angezeigt werden?',
+ 'Show weights' => 'Gewichte anzeigen',
'Show your TODO list after loggin in' => 'Aufgabenliste nach dem Anmelden anzeigen',
'Signature' => 'Unterschrift',
'Since bin is not enforced in the parts data, please specify a bin where goods without a specified bin will be put.' => 'Da Lagerplätze kein Pflichtfeld sind, geben Sie bitte einen Lagerplatz an, in dem Waren ohne spezifizierten Lagerplatz eingelagert werden sollen.',
'Total Fees' => 'Kumulierte Gebühren',
'Total stock value' => 'Gesamter Bestandswert',
'Total sum' => 'Gesamtsumme',
+ 'Total weight' => 'Gesamtgewicht',
'Totals' => 'Summen',
'Trade Discount' => 'Rabatt',
'Trans Id' => 'Trans-ID',
--- /dev/null
+-- @tag: gewichte
+-- @description: Je nach Mandantenkonfiguration können Warengewichte in Angeboten/Aufträgen/Lieferscheinen/Rechnungen angezeigt werden oder nicht.
+-- @depends: release_3_0_0
+-- @charset: utf-8
+
+ALTER TABLE defaults ADD show_weight BOOLEAN NOT NULL DEFAULT FALSE;
</tr>
+ <tr class='listheading'>
+ <th colspan="3">[% 'Weight' | $T8 %]</th>
+ </tr>
+ <tr>
+ <td align="right">[% 'Show weights' | $T8 %]</td>
+ <td>
+ [% L.yes_no_tag('show_weight', SELF.show_weight) %]
+ </td>
+ <td>
+ [% 'Show the weights of articles and the total weight in orders, invoices and delivery notes?' | $T8 %]<br>
+ </td>
+ </tr>
</table>
<br>
</td>
</tr>
+[%- IF show_weight %]
+ <tr>
+ <td>
+ <table width="100%">
+ <tr valign="bottom">
+ <td align="right">
+ <table>
+ <tr>
+ <th align="left">[% 'Total weight' | $T8 %]</th>
+ <td align="right">
+ [% LxERP.format_amount(totalweight, 3) %] [% HTML.escape(weightunit) %]
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+[%- END %]
</table>
</p>
[%- END %]
</table>
</td>
+[%- IF show_weight %]
+ <td>
+ <table>
+ <tr>
+ <th align=left>[% 'Total weight' | $T8 %]</th>
+ <td>
+ [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %]
+ </td>
+ </tr>
+ </table>
+ </td>
+[%- END %]
<td align="right">
[%- IF taxaccounts %]
<input name="taxincluded" class="checkbox" type="checkbox" [% IF taxincluded %]checked[% END %]>
[%- END %]
</table>
</td>
+[%- IF show_weight %]
+ <td>
+ <table>
+ <tr>
+ <th align=left>[% 'Total weight' | $T8 %]</th>
+ <td>
+ [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %]
+ </td>
+ </tr>
+ </table>
+ </td>
+[%- END %]
<td>
<table>
<tr>
[%- END %]
</table>
</td>
+ [%- IF show_weight %]
+ <td>
+ <table>
+ <tr>
+ <th align="left">[% 'Total weight' | $T8 %]</th>
+ <td align="right">
+ [% LxERP.format_amount(totalweight, 3) %] [% HTML.escape(weightunit) %]
+ </td>
+ </tr>
+ </table>
+ </td>
+ [%- END %]
[%- IF is_sales %]
<td>
<table>