X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=dbb74a9f9ec674876a96cf94b45cef7cdb860e69;hb=626e02403cbcee241b2be41f3c2d827663864523;hp=44bfbd49d68c39a6202ace05b5db9867d8e71f30;hpb=0576299f2aa98125991c4ffcd2f75073ea583d7d;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 44bfbd49d..dbb74a9f9 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1,4 +1,4 @@ -#===================================================================== +# #===================================================================== # LX-Office ERP # Copyright (C) 2004 # Based on SQL-Ledger Version 2.1.9 @@ -77,6 +77,22 @@ sub add { sub edit { $lxdebug->enter_sub(); + # editing without stuff to edit? try adding it first + if ($form->{rowcount}) { + map {$id++ if $form->{"id_$_"}} (1 .. $form->{rowcount}); + if (!$id) { + # reset rowcount + undef $form->{rowcount}; + &add; + return; + } + } else { + if (!$form->{id}) { + &add; + return; + } + } + if ($form->{type} eq 'purchase_order') { $form->{title} = $locale->text('Edit Purchase Order'); $form->{heading} = $locale->text('Purchase Order'); @@ -115,11 +131,20 @@ sub order_links { # retrieve order/quotation $form->{webdav} = $webdav; + # set jscalendar $form->{jscalendar} = $jscalendar; OE->retrieve(\%myconfig, \%$form); + # if multiple rowcounts (== collective order) then check if the + # there were more than one customer (in that case OE::retrieve removes + # the content from the field) + if ($form->{rowcount} && $form->{type} eq 'sales_order' && $form->{customer} eq '') { +# $main::lxdebug->message(0, "Detected Edit order with concurrent customers"); + $form->error($locale->text('Collective Orders only work for orders from one customer!')); + } + $taxincluded = $form->{taxincluded}; $form->{shipto} = 1 if $form->{id}; @@ -196,31 +221,34 @@ sub prepare_order { $form->{media} = "screen"; $form->{formname} = $form->{type}; - if ($form->{id}) { - map { $form->{$_} =~ s/\"/"/g } qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact); foreach $ref (@{ $form->{form_details} }) { - $i++; + $form->{rowcount} = ++$i; + map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; - $form->{"discount_$i"} = + } + + for my $i (1 .. $form->{rowcount}) { + $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); - ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); + ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); $dec = length $dec; $decimalplaces = ($dec > 2) ? $dec : 2; $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); - $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); + + (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); + $dec_qty = length $dec_qty; + $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit); - $form->{rowcount} = $i; } - } $lxdebug->leave_sub(); } @@ -241,14 +269,12 @@ sub form_header { $button1 = qq| {transdate}> text('button') - . qq|> + . $locale->text('button') . qq|> |; $button2 = qq| {reqdate}> text('button') - . qq|> + . $locale->text('button') . qq|> |; #write Trigger @@ -272,11 +298,9 @@ sub form_header { + . $locale->text('Open') . qq| + . $locale->text('Closed') . qq|
| - . $locale->text('Open') - . qq| | - . $locale->text('Closed') - . qq|
@@ -345,8 +369,7 @@ sub form_header { | . $locale->text('Terms: Net') . qq| {terms}> | - . $locale->text('days') - . qq| + . $locale->text('days') . qq| |; @@ -371,14 +394,12 @@ sub form_header { | - . $locale->text('Quotation Number') - . qq| + . $locale->text('Quotation Number') . qq| | - . $locale->text('Customer Order Number') - . qq| + . $locale->text('Customer Order Number') . qq| @@ -419,8 +440,7 @@ sub form_header { $ordnumber = qq| | - . $locale->text('Quotation Number') - . qq| + . $locale->text('Quotation Number') . qq| @@ -471,6 +491,7 @@ sub form_header { if ($form->{type} eq 'sales_order') { if ($form->{selectemployee}) { $employee = qq| + {customer_klass}> | . $locale->text('Salesperson') . qq| @@ -481,6 +502,7 @@ sub form_header { } } else { $employee = qq| + {customer_klass}> | . $locale->text('Employee') . qq| @@ -537,8 +559,7 @@ sub form_header { {vc}_id value=$form->{"$form->{vc}_id"}> {vc}"}"> | - . $locale->text('Contact Person') - . qq| + . $locale->text('Contact Person') . qq| $contact $creditremaining @@ -633,8 +654,7 @@ sub form_footer { if ($form->{taxaccounts}) { $taxincluded = qq| {taxincluded}> | - . $locale->text('Tax Included') - . qq|

+ . $locale->text('Tax Included') . qq|

|; } @@ -843,7 +863,16 @@ Bearbeiten des $form->{heading}
. $locale->text('Order') . qq|"> |; } + } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount}) { + print qq| +
Workflow $form->{heading}
+ + +|; } + if ($form->{menubar}) { require "$form->{path}/menu.pl"; @@ -888,7 +917,9 @@ sub update { \%myconfig, $form->{currency}, $form->{transdate}, $buysell ))); - my $i = $form->{rowcount}; + # for pricegroups + $i = $form->{rowcount}; + $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1; if ( ($form->{"partnumber_$i"} eq "") @@ -940,6 +971,7 @@ sub update { $form->{"sellprice_$i"} = $sellprice; } else { + $form->{"sellprice_$i"} *= (1 - $form->{tradediscount}); # if there is an exchange rate adjust sellprice $form->{"sellprice_$i"} /= $exchangerate; } @@ -960,7 +992,13 @@ sub update { $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); $form->{"qty_$i"} = - $form->format_amount(\%myconfig, $form->{"qty_$i"}); + $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); + + # get pricegroups for parts + IS->get_pricegroups_for_parts(\%myconfig, \%$form); + + # build up html code for prices_$i + &set_pricegroup($i); } &display_form; @@ -986,6 +1024,8 @@ sub update { } } } + + $lxdebug->leave_sub(); } @@ -1046,7 +1086,8 @@ sub search { $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|; map { - $form->{selectwarehouse} .= "