);
__PACKAGE__->make_sorted(
- MODEL => 'OrderItem',
- ONLY => [ qw(list) ],
-
- DEFAULT_BY => 'reqdate',
- DEFAULT_DIR => 1,
-
- reqdate => t8('Reqdate'),
- description => t8('Description'),
- partnumber => t8('Part Number'),
- qty => t8('Qty'),
- shipped_qty => t8('shipped'),
- ordnumber => t8('Order'),
- customer => t8('Customer'),
+ MODEL => 'OrderItem',
+ ONLY => [ qw(list) ],
+
+ DEFAULT_BY => 'reqdate',
+ DEFAULT_DIR => 1,
+
+ reqdate => t8('Reqdate'),
+ description => t8('Description'),
+ partnumber => t8('Part Number'),
+ qty => t8('Qty'),
+ shipped_qty => t8('shipped'),
+ not_shipped_qty => t8('not shipped'),
+ ordnumber => t8('Order'),
+ customer => t8('Customer'),
);
sub action_list {
my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
$self->{report} = $report;
- my @columns = qw(reqdate customer ordnumber partnumber description qty shipped_qty);
+ my @columns = qw(reqdate customer ordnumber partnumber description qty shipped_qty not_shipped_qty);
my @sortable = qw(reqdate customer ordnumber partnumber description );
my %column_defs = (
- reqdate => { sub => sub { $_[0]->reqdate_as_date || $_[0]->order->reqdate_as_date } },
- description => { sub => sub { $_[0]->description },
- obj_link => sub { $self->link_to($_[0]->part) } },
- partnumber => { sub => sub { $_[0]->part->partnumber },
- obj_link => sub { $self->link_to($_[0]->part) } },
- qty => { sub => sub { $_[0]->qty_as_number . ' ' . $_[0]->unit } },
- shipped_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->shipped_qty, 2) . ' ' . $_[0]->unit } },
- ordnumber => { sub => sub { $_[0]->order->ordnumber },
- obj_link => sub { $self->link_to($_[0]->order) } },
- customer => { sub => sub { $_[0]->order->customer->name },
- obj_link => sub { $self->link_to($_[0]->order->customer) } },
+ reqdate => { sub => sub { $_[0]->reqdate_as_date || $_[0]->order->reqdate_as_date } },
+ description => { sub => sub { $_[0]->description },
+ obj_link => sub { $self->link_to($_[0]->part) } },
+ partnumber => { sub => sub { $_[0]->part->partnumber },
+ obj_link => sub { $self->link_to($_[0]->part) } },
+ qty => { sub => sub { $_[0]->qty_as_number . ' ' . $_[0]->unit } },
+ shipped_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->shipped_qty, 2) . ' ' . $_[0]->unit } },
+ not_shipped_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->qty - $_[0]->shipped_qty, 2) . ' ' . $_[0]->unit } },
+ ordnumber => { sub => sub { $_[0]->order->ordnumber },
+ obj_link => sub { $self->link_to($_[0]->order) } },
+ customer => { sub => sub { $_[0]->order->customer->name },
+ obj_link => sub { $self->link_to($_[0]->order->customer) } },
);
map { $column_defs{$_}->{text} = $::locale->text( $self->get_sort_spec->{$_}->{title} ) } keys %column_defs;
# this is easy to confuse, so keep in mind: before this comment no s///, m//, concat or other strong ops on
# $amount. after this comment no +,-,*,/,abs. it will only introduce subtle bugs.
- $amount =~ s/0*$//; # cull trailing 0s
+ $amount =~ s/0*$// unless defined $places && $places == 0; # cull trailing 0s
my @d = map { s/\d//g; reverse split // } my $tmp = $myconfig->{numberformat}; # get delim chars
my @p = split(/\./, $amount); # split amount at decimal point
# exchangerate difference
$form->{fx}{$accno}{ $form->{"datepaid_$i"} } +=
- $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $diff;
+ $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $diff;
# gain/loss
$amount =
- $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
- $form->{"exchangerate_$i"};
+ $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
+ $form->{"exchangerate_$i"};
if ($amount > 0) {
- $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
+ $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } += $amount;
} else {
- $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
+ $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } += $amount;
}
$diff = 0;
IO->set_datepaid(table => 'ar', id => $form->{id}, dbh => $dbh);
- if ($payments_only) {
- $query = qq|UPDATE ar SET paid = ? WHERE id = ?|;
- do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id}));
-
- $dbh->commit if !$provided_dbh;
-
- $main::lxdebug->leave_sub();
- return;
- }
-
# record exchange rate differences and gains/losses
foreach my $accno (keys %{ $form->{fx} }) {
foreach my $transdate (keys %{ $form->{fx}{$accno} }) {
- if (
- ($form->{fx}{$accno}{$transdate} =
- $form->round_amount($form->{fx}{$accno}{$transdate}, 2)
- ) != 0
- ) {
+ $form->{fx}{$accno}{$transdate} = $form->round_amount($form->{fx}{$accno}{$transdate}, 2);
+ if ( $form->{fx}{$accno}{$transdate} != 0 ) {
$query =
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1',
(SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
- @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, $project_id);
+ @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, conv_i($project_id));
do_query($form, $dbh, $query, @values);
}
}
}
+ if ($payments_only) {
+ $query = qq|UPDATE ar SET paid = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id}));
+
+ $dbh->commit if !$provided_dbh;
+
+ $main::lxdebug->leave_sub();
+ return;
+ }
+
$amount = $netamount + $tax;
# save AR record
{ name => "Config::Std", url => "http://search.cpan.org/~dconway/", debian => 'libconfig-std-perl' },
{ name => "DateTime", url => "http://search.cpan.org/~drolsky/", debian => 'libdatetime-perl' },
{ name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/", debian => 'libdbi-perl' },
- { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/", debian => 'libdbd-pg' },
+ { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/", debian => 'libdbd-pg-perl' },
{ name => "Email::Address", url => "http://search.cpan.org/~rjbs/", debian => 'libemail-address-perl' },
{ name => "FCGI", version => '0.72', url => "http://search.cpan.org/~mstrout/", debian => 'libfcgi-perl' },
{ name => "JSON", url => "http://search.cpan.org/~makamaka", debian => 'libjson-perl' },
}
}
+ if (!$form->{forex}) { # read exchangerate from input field (not hidden)
+ $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
+ }
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{datepaid}, $buysell);
$form->{exchangerate} = $form->{forex} if $form->{forex};
}
sub _do_save {
- $main::auth->assert('customer_vendor_edit & ' .
- '(general_ledger | invoice_edit | vendor_invoice_edit | ' .
- ' request_quotation_edit | sales_quotation_edit | sales_order_edit | purchase_order_edit)');
+ $main::auth->assert('customer_vendor_edit');
$::form->isblank("name", $::locale->text("Name missing!"));
'not logged in' => 'nicht eingeloggt',
'not running' => 'läuft nicht',
'not set' => 'nicht gesetzt',
+ 'not shipped' => 'nicht geliefert',
'not transferred in yet' => 'noch nicht eingelagert',
'not transferred out yet' => 'noch nicht ausgelagert',
'not yet executed' => 'Noch nicht ausgeführt',
$master_templates = './templates/print/';
}
+unless (eval { require Config::Std; 1 }){
+ print STDERR <<EOL ;
++------------------------------------------------------------------------------+
+ Perl Modul Config::Std could not be loaded.
+
+ Debian: you may install the needed *.deb package with:
+ apt-get install libconfig-std-perl
+
+ RPM: There is a rpm package "perl-Config-Std"
+
+ Suse: you may install the needed *.rpm package with:
+ zypper install perl-Config-Std
+
++------------------------------------------------------------------------------+
+EOL
+
+ exit 72;
+}
+
use SL::InstallationCheck;
use SL::LxOfficeConf;
+
my %check;
Getopt::Long::Configure ("bundling");
GetOptions(
is($::form->format_amount($config, 1, -2), '1.00', 'negative places 3');
# bugs amd edge cases
+$config->{numberformat} = '1.000,00';
is($::form->format_amount({ numberformat => '1.000,00' }, 0.00005), '0,00005', 'messing with small numbers and no precision');
is($::form->format_amount({ numberformat => '1.000,00' }, undef), '0', 'undef');
is($::form->format_amount($config, 1.00), '1', 'autotrim to 0 places');
+is($::form->format_amount($config, 10), '10', 'autotrim does not harm integers');
+is($::form->format_amount($config, 10, 2), '10,00' , 'autotrim does not harm integers 2');
+is($::form->format_amount($config, 10, -2), '10,00' , 'autotrim does not harm integers 3');
+is($::form->format_amount($config, 10, 0), '10', 'autotrim does not harm integers 4');
+
+is($::form->format_amount($config, 0, 0), '0' , 'trivial zero');
# dash stuff
<input class="submit" type="submit" name="action" value="[% 'Delete' | $T8 %]">
<input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
[% END %]
-
- [%- UNLESS locked %]
- <input class="submit" type="submit" name="action" value="[% 'Order' | $T8 %]">
- [%- END %]
-
+ <input class="submit" type="submit" name="action" value="[% 'Order' | $T8 %]">
<input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
[% ELSE # no id %]
<tr>
<th align="right">[%- LxERP.t8('Record in') %]</th>
<td valign="top">
- [% L.select_tag("ar_chart_id", AR, title_key => 'description', default => ar_chart_id)) %]
+ [% L.select_tag("ar_chart_id", AR, title_key => 'description', default => ar_chart_id) %]
</td>
</tr>