X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=2a90fc6df0873af7d70069a64beb9af993bf560f;hb=d707f7ac60b9dbe7da50d733db1e73eae84952f7;hp=de1722e60db0e26cc8a8ec7f41f4d11a3f6e8bee;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index de1722e60..2a90fc6df 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -33,12 +33,13 @@ use POSIX qw(strftime); +use SL::FU; use SL::OE; use SL::IR; use SL::IS; use SL::PE; use SL::ReportGenerator; -use List::Util qw(max reduce); +use List::Util qw(max reduce sum); require "bin/mozilla/io.pl"; require "bin/mozilla/arap.pl"; @@ -431,6 +432,19 @@ sub form_header { $credittext = $locale->text('Credit Limit exceeded!!!'); + my $follow_up_vc = $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' }; + $follow_up_vc =~ s/--.*?//; + $TMPL_VAR{follow_up_trans_info} = ($form->{type} =~ /_quotation$/ ? $form->{quonumber} : $form->{ordnumber}) . " ($follow_up_vc)"; + + if ($form->{id}) { + my $follow_ups = FU->follow_ups('trans_id' => $form->{id}); + + if (scalar @{ $follow_ups }) { + $TMPL_VAR{num_follow_ups} = scalar @{ $follow_ups }; + $TMPL_VAR{num_due_follow_ups} = sum map { $_->{due} * 1 } @{ $follow_ups }; + } + } + $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()" : ($form->{resubmit}) ? "document.oe.submit()" : ($creditwarning) ? "alert('$credittext')" @@ -439,7 +453,7 @@ sub form_header { $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; $TMPL_VAR{onload} = $onload; - + $form->{javascript} .= qq||; $form->{javascript} .= qq||; $form->{javascript} .= qq||; @@ -545,7 +559,7 @@ sub update { set_headings($form->{"id"} ? "edit" : "add"); - map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining) unless $recursive_call; + map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate) unless $recursive_call; $form->{update} = 1; $payment_id = $form->{payment_id} if $form->{payment_id}; @@ -1579,9 +1593,6 @@ sub invoice { map { $form->{"select$_"} = "" } ($form->{vc}, currency); - map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } - qw(creditlimit creditremaining); - $currency = $form->{currency}; &invoice_links; @@ -1951,14 +1962,58 @@ sub poso { qw(partnumber description unit); } - map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") } - qw(creditlimit creditremaining); - &update; $lxdebug->leave_sub(); } +sub delivery_order { + $lxdebug->enter_sub(); + + if ($form->{type} =~ /^sales/) { + $auth->assert('sales_delivery_order_edit'); + + $form->{vc} = 'customer'; + $form->{type} = 'sales_delivery_order'; + + } else { + $auth->assert('purchase_delivery_order_edit'); + + $form->{vc} = 'vendor'; + $form->{type} = 'purchase_delivery_order'; + } + + require "bin/mozilla/do.pl"; + + $form->{cp_id} *= 1; + $form->{transdate} = $form->current_date(\%myconfig); + delete $form->{duedate}; + + $form->{closed} = 0; + + $form->{old_employee_id} = $form->{employee_id}; + $form->{old_salesman_id} = $form->{salesman_id}; + + # reset + map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal); + + for $i (1 .. $form->{rowcount}) { + map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor); + } + + my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor); + + order_links(); + + prepare_order(); + + map { $form->{$_} = $old_values{$_} if ($old_values{$_}) } keys %old_values; + + update(); + + $lxdebug->leave_sub(); +} + sub e_mail { $lxdebug->enter_sub(); @@ -1995,6 +2050,8 @@ sub display_form { check_oe_access(); + retrieve_partunits() if ($form->{type} =~ /_delivery_order$/); + $form->{"taxaccounts"} =~ s/\s*$//; $form->{"taxaccounts"} =~ s/^\s*//; foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) { @@ -2023,3 +2080,21 @@ sub display_form { $lxdebug->leave_sub(); } +sub report_for_todo_list { + $lxdebug->enter_sub(); + + my $quotations = OE->transactions_for_todo_list(); + my $content; + + if (@{ $quotations }) { + my $edit_url = build_std_url('script=oe.pl', 'action=edit', 'type=sales_quotation', 'vc=customer'); + + $content = $form->parse_html_template('oe/report_for_todo_list', { 'QUOTATIONS' => $quotations, + 'edit_url' => $edit_url }); + } + + $lxdebug->leave_sub(); + + return $content; +} +