From: Niclas Zimmermann Date: Thu, 20 Sep 2012 13:55:57 +0000 (+0200) Subject: Merge branch 'master' of vc.linet-services.de:public/lx-office-erp X-Git-Tag: release-3.0.0beta1~232 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/ecf1e7ec32290b1614a414086f04485a987c5f98?hp=8adb211a4983c297ce4b9b6e59136ffb141a5421 Merge branch 'master' of vc.linet-services.de:public/lx-office-erp --- diff --git a/SL/Controller/DeliveryPlan.pm b/SL/Controller/DeliveryPlan.pm index 5ce462b40..5937c5b7f 100644 --- a/SL/Controller/DeliveryPlan.pm +++ b/SL/Controller/DeliveryPlan.pm @@ -26,19 +26,20 @@ __PACKAGE__->make_paginated( ); __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 { @@ -131,21 +132,22 @@ sub prepare_report { 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; diff --git a/SL/IS.pm b/SL/IS.pm index 22080c7e6..82226ee52 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -933,18 +933,16 @@ sub post_invoice { # 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; @@ -963,35 +961,32 @@ sub post_invoice { 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 diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index 885c88e62..a8caa526b 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -346,6 +346,9 @@ sub update { } } + 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}; diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 7d5c36ab6..f909d86f6 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -316,7 +316,8 @@ sub form_header { my @values = map { $_ } @{ $form->{ALL_CURRENCIES} }; my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} }; $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; - $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency}; + # show_exchangerate is also later needed in another template + $form->{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency}; $TMPL_VAR{currencies} = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"}, '-values' => \@values, '-labels' => \%labels, '-onchange' => "document.getElementById('update_button').click();" diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 4716f60e3..56162d543 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -517,6 +517,9 @@ sub update { for my $i (1 .. $form->{paidaccounts}) { next unless $form->{"paid_$i"}; map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate); + if (!$form->{"forex_$i"}) { #read exchangerate from input field (not hidden) + $form->{exchangerate} = $form->{"exchangerate_$i"}; + } $form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'); $form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"}; } diff --git a/locale/de/all b/locale/de/all index 5740fd074..9fbd29bbb 100644 --- a/locale/de/all +++ b/locale/de/all @@ -2336,6 +2336,7 @@ $self->{texts} = { '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', diff --git a/templates/webpages/ir/_payments.html b/templates/webpages/ir/_payments.html index 1677219d4..6d7db5ea0 100644 --- a/templates/webpages/ir/_payments.html +++ b/templates/webpages/ir/_payments.html @@ -75,9 +75,9 @@ [% SET forex = 'forex_' _ i %] [% SET exchangerate = 'exchangerate_' _ i %] - [% IF forex %] + [% IF $forex %] - [% LxERP.format_amount(exchangerate, 2) %] + [% LxERP.format_amount($forex, 2) %] [% ELSE %] [% IF $changeable %] @@ -86,7 +86,7 @@ [% LxERP.format_amount($exchangerate, 2, 1) %] [% END %] [% END %] - ; + [% END %] diff --git a/templates/webpages/is/_payments.html b/templates/webpages/is/_payments.html index a87221502..41b018615 100644 --- a/templates/webpages/is/_payments.html +++ b/templates/webpages/is/_payments.html @@ -78,7 +78,7 @@ [% SET forex = 'forex_' _ i %] [% SET exchangerate = 'exchangerate_' _ i %] - [% IF forex %] + [% IF $forex %] [% LxERP.format_amount($forex, 2) %] [% ELSE %]