pdonumber = ?,
yearend = ?,
curr = ?,
- businessnumber = ?|;
+ businessnumber = ?,
+ weightunit = ?|;
my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno},
$accnos{fxgain_accno}, $accnos{fxloss_accno},
$form->{invnumber}, $form->{cnnumber},
$form->{articlenumber}, $form->{servicenumber},
$form->{sdonumber}, $form->{pdonumber},
$form->{yearend}, $currency,
- $form->{businessnumber});
+ $form->{businessnumber}, $form->{weightunit});
do_query($form, $dbh, $query, @values);
$dbh->commit();
return $rc;
}
+sub get_defaults {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ my $myconfig = \%main::myconfig;
+ my $form = $main::form;
+
+ my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
+
+ my $defaults = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM defaults|) || {};
+
+ $defaults->{weightunit} ||= 'kg';
+
+ $main::lxdebug->leave_sub();
+
+ return $defaults;
+}
+
sub defaultaccounts {
$main::lxdebug->enter_sub();
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- $form->{defaults} = $sth->fetchrow_hashref(NAME_lc);
- $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id};
- $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id};
- $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id};
- $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id};
- $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id};
+ $form->{defaults} = $sth->fetchrow_hashref(NAME_lc);
+ $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id};
+ $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id};
+ $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id};
+ $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id};
+ $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id};
+
+ $form->{defaults}{weightunit} ||= 'kg';
$sth->finish;
use POSIX qw(strftime);
use List::Util qw(max);
+use SL::AM;
use SL::IC;
use SL::ReportGenerator;
my $idx = 0;
my $same_item = $form->{parts}[0]{ $form->{sort} } if (scalar @{ $form->{parts} });
+ my $defaults = AM->get_defaults();
+
# postprocess parts
foreach my $ref (@{ $form->{parts} }) {
map { $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}); } qw(onhand rop weight soldtotal);
+ $row->{weight}->{data} .= ' ' . $defaults->{weightunit};
+
if (!$ref->{assemblyitem}) {
foreach my $col (@subtotal_columns) {
$totals{$col} += $onhand * $ref->{$col};
$form->get_lists('price_factors' => 'ALL_PRICE_FACTORS',
'partsgroup' => 'all_partsgroup',
- 'vendors' => 'ALL_VENDORS',);
+ 'vendors' => 'ALL_VENDORS',);
IC->retrieve_buchungsgruppen(\%myconfig, $form);
$units = AM->retrieve_units(\%myconfig, $form);
$form->{ALL_UNITS} = [ map +{ name => $_ }, sort { $units->{$a}{sortkey} <=> $units->{$b}{sortkey} } keys %$units ];
+ $form->{defaults} = AM->get_defaults();
+
$form->{fokus} = "ic.partnumber";
$form->header;
'Warnings during template upgrade' => 'Warnungen bei Aktualisierung der Dokumentenvorlagen',
'WebDAV link' => 'WebDAV-Link',
'Weight' => 'Gewicht',
+ 'Weight unit' => 'Gewichtseinheit',
'What type of item is this?' => 'Was ist dieser Artikel?',
'What\'s the <b>term</b> you\'re looking for?' => 'Nach welchem <b>Begriff</b> wollen Sie suchen?',
'With Extension Of Time' => 'mit Dauerfristverlängerung',