X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=0dabe9ec10a3e5a8ce58ba281ac6813fe8b62fd3;hb=505322c4b9b99beb3c0f1246edbfc54ff3a36790;hp=b6c22624c8c2b30f04a34bfe6538d78e510088db;hpb=b832f3446db5b6132bdf8e96ddeb11ff5edd681d;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index b6c22624c..0dabe9ec1 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -343,12 +343,12 @@ sub form_header { # label subs my $employee_list_query_gen = sub { $::form->{$_[0]} ? [ or => [ id => $::form->{$_[0]}, deleted => 0 ] ] : [ deleted => 0 ] }; - $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => $employee_list_query_gen->('employee_id')); - $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => $employee_list_query_gen->('salesman_id')); - $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all(query => [ + $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => $employee_list_query_gen->('employee_id')); + $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => $employee_list_query_gen->('salesman_id')); + $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [ or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ] ]); - $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all(query => [ + $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [ or => [ cp_cv_id => $::form->{"$::form->{vc}_id"} * 1, and => [ @@ -415,7 +415,7 @@ sub form_header { $::request->{layout}->add_javascripts_inline("alert('$credittext');"); } - $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup})"); + $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});"); $TMPL_VAR{dateformat} = $myconfig{dateformat}; $TMPL_VAR{numberformat} = $myconfig{numberformat}; @@ -429,9 +429,7 @@ sub form_header { } } - $form->{javascript} .= qq||; - $form->{javascript} .= qq||; - $form->{javascript} .= qq||; + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details ckeditor/ckeditor ckeditor/adapters/jquery)); $form->header; if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) { @@ -441,7 +439,7 @@ sub form_header { qw(id action type vc formname media format proforma queued printed emailed title creditlimit creditremaining tradediscount business max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode - CFDD_shipto shipto_id CFDD_shipto_id shiptocity shiptocountry shiptocontact shiptophone shiptofax + CFDD_shipto CFDD_shipto_id shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptodepartment_1 shiptodepartment_2 shiptoemail shiptocp_gender message email subject cc bcc taxpart taxservice taxaccounts cursor_fokus show_details), @@ -730,7 +728,7 @@ sub search { "$form->{vc}s" => "ALL_VC", "taxzones" => "ALL_TAXZONES", "business_types" => "ALL_BUSINESS_TYPES",); - $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); # constants and subs for template $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; @@ -789,9 +787,10 @@ sub orders { my @columns = ( "transdate", "reqdate", "id", $ordnumber, - "customernumber", + "cusordnumber", "customernumber", "name", "netamount", "tax", "amount", + "remaining_netamount", "remaining_amount", "curr", "employee", "salesman", "shipvia", "globalprojectnumber", @@ -836,7 +835,7 @@ sub orders { my $report = SL::ReportGenerator->new(\%myconfig, $form); my @hidden_variables = map { "l_${_}" } @columns; - push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber + push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber cusordnumber transaction_description transdatefrom transdateto type vc employee_id salesman_id reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive business_id shippingpoint taxzone_id); @@ -853,11 +852,14 @@ sub orders { 'id' => { 'text' => $locale->text('ID'), }, 'ordnumber' => { 'text' => $locale->text('Order'), }, 'quonumber' => { 'text' => $form->{type} eq "request_quotation" ? $locale->text('RFQ') : $locale->text('Quotation'), }, + 'cusordnumber' => { 'text' => $locale->text('Customer Order Number'), }, 'name' => { 'text' => $form->{vc} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), }, 'customernumber' => { 'text' => $locale->text('Customer Number'), }, 'netamount' => { 'text' => $locale->text('Amount'), }, 'tax' => { 'text' => $locale->text('Tax'), }, 'amount' => { 'text' => $locale->text('Total'), }, + 'remaining_amount' => { 'text' => $locale->text('Remaining Amount'), }, + 'remaining_netamount' => { 'text' => $locale->text('Remaining Net Amount'), }, 'curr' => { 'text' => $locale->text('Curr'), }, 'employee' => { 'text' => $locale->text('Employee'), }, 'salesman' => { 'text' => $locale->text('Salesman'), }, @@ -876,12 +878,12 @@ sub orders { 'taxzone' => { 'text' => $locale->text('Steuersatz'), }, ); - foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia transaction_description shippingpoint taxzone)) { + foreach my $name (qw(id transdate reqdate quonumber ordnumber cusordnumber name employee salesman shipvia transaction_description shippingpoint taxzone)) { my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } - my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr); + my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr remaining_amount remaining_netamount); $form->{"l_type"} = "Y"; map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns; @@ -899,6 +901,7 @@ sub orders { push @options, $locale->text('Vendor') . " : $form->{vendor}" if $form->{vendor}; push @options, $locale->text('Department') . " : $department" if $form->{department}; push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if $form->{ordnumber}; + push @options, $locale->text('Customer Order Number') . " : $form->{cusordnumber}" if $form->{cusordnumber}; push @options, $locale->text('Notes') . " : $form->{notes}" if $form->{notes}; push @options, $locale->text('Transaction description') . " : $form->{transaction_description}" if $form->{transaction_description}; push @options, $locale->text('Shipping Point') . " : $form->{shippingpoint}" if $form->{shippingpoint}; @@ -942,7 +945,7 @@ sub orders { # escape callback for href my $callback = $form->escape($href); - my @subtotal_columns = qw(netamount amount marge_total marge_percent); + my @subtotal_columns = qw(netamount amount marge_total marge_percent remaining_amount remaining_netamount); my %totals = map { $_ => 0 } @subtotal_columns; my %subtotals = map { $_ => 0 } @subtotal_columns; @@ -965,7 +968,7 @@ sub orders { $subtotals{marge_percent} = $subtotals{netamount} ? ($subtotals{marge_total} * 100 / $subtotals{netamount}) : 0; $totals{marge_percent} = $totals{netamount} ? ($totals{marge_total} * 100 / $totals{netamount} ) : 0; - map { $oe->{$_} = $form->format_amount(\%myconfig, $oe->{$_}, 2) } qw(netamount tax amount marge_total marge_percent); + map { $oe->{$_} = $form->format_amount(\%myconfig, $oe->{$_}, 2) } qw(netamount tax amount marge_total marge_percent remaining_amount remaining_netamount); my $row = { }; @@ -1355,8 +1358,7 @@ sub invoice { $exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate, $buysell); if (!$exchangerate) { - &backorder_exchangerate($orddate, $buysell); - ::end_of_request(); + $exchangerate = 0; } } @@ -1447,75 +1449,6 @@ sub invoice { $main::lxdebug->leave_sub(); } -sub backorder_exchangerate { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - check_oe_access(); - - my ($orddate, $buysell) = @_; - - $form->header; - - print qq| -
{script}> -|; - - # delete action variable - map { delete $form->{$_} } qw(action header exchangerate); - - foreach my $key (keys %$form) { - next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); - $form->{$key} =~ s/\"/"/g; - print qq|\n|; - } - - $form->{title} = $locale->text('Add Exchangerate'); - - print qq| - - - - - - - - - - -
$form->{title}
- - - - - - - - - - - - - -
| . $locale->text('Currency') . qq|$form->{currency}
| . $locale->text('Date') . qq|$orddate
| . $locale->text('Exchangerate') . qq|
-
- -
- -
- - - - -
-|; - - $main::lxdebug->leave_sub(); -} - sub save_exchangerate { $main::lxdebug->enter_sub(); @@ -2065,6 +1998,7 @@ sub _oe_remove_delivered_or_billed_rows { my %handled_base_qtys; foreach my $record (@{ $ord_quot->linked_records(%args) }) { next if $ord_quot->is_sales != $record->is_sales; + next if $record->type eq 'invoice' && $record->storno; foreach my $item (@{ $record->items }) { my $key = $item->parts_id;