From b6dc5623d93c1be1c54248d4512e80f495af2899 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 22 Oct 2007 15:33:48 +0000 Subject: [PATCH] * Auslagerung der OE-Masken in Templates * Diese Patch ist ein Merge der Revisionen 2866, 5349, 5365, 5370, 5408, 5413, 5470, 5473, 5475, 5519, 5520, 5521, 5524, 5526, 5591, 5618, 5622, 5814, 5881, 5882 und 5961 in das Unstable. Hintergrund ist die Auslagerung der OE-Masken, das heisst aller Masken, die fuer Auftraege, Angebote und teilweise Rechnungen zustaendig sind. Dadurch vereinfacht sich der Code an vielen Stellen deutlich, ausserdem konnten viele Berechnungen verkleinert werden, weil der Code fuer Angebote/Auftraege jetzt getrennt von Rechnungen liegt. Ein Grossteil der bin/mozilla/io.pl wurde dafuer dubliziert, die Methoden die fuer Auftraege noetig sind liegen jetzt in der bin/mozilla/oe.pl (vor allem display_form und display_row, aber auch ein paar andere), ihr jeweiliges Pendant fuer Rechnungen wurde unveraendert in eine Datei invoice_io.pl ausgelagert die von den Skripten die sie benoetigen zusaetzlich zur io.pl eingelesen wird. Wie der Name der Templates andeutet ist der Patch im Verkaufsbaum entstanden, im Verlauf der Programmierung habe cih aber nicht genug Unterschiede gefunden um separate Templates fuer Verkauf und Einkauf zu rechtfertigen. Eventuell werden die Templates noch umbenannt. Komplexe Maskenaenderungen wie der Austausch von Drop-Down Menues bei zu grosser Anzahl durch Eingabefelder werden ebenfalls noch manuell gemacht. Auch das wird in der naechsten Version ausgelagert um den Backend Code schlanker zu machen. Die Berechnung fuer Units und Steuern wurde vereinfacht, und dabei einige unschoene Bugs gefixt, die aus der unvollstaendigen Abdeckung von Verzweigungen resultierten. Zuletzt wurden noch fast alle serverseitigen Datenformatierungen ausgelagert in ein Templateplugin, welches Zahlen waehrend des Templatings formatiert (mehr dazu in der Dakumentation zu Template.pm). Der Patch beinhaltet ausserdem die ueblichen Codekosmetika. --- SL/AM.pm | 11 + SL/Form.pm | 18 +- SL/IC.pm | 15 +- SL/IR.pm | 57 ++- SL/OE.pm | 93 ++-- am.pl | 7 +- bin/mozilla/ic.pl | 30 +- bin/mozilla/io.pl | 762 ++--------------------------- bin/mozilla/ir.pl | 1 + bin/mozilla/is.pl | 1 + bin/mozilla/oe.pl | 1192 ++++++++++++++++----------------------------- bin/mozilla/rp.pl | 2 +- locale/de/all | 1 + locale/de/dn | 27 - locale/de/ic | 4 - locale/de/io | 4 - locale/de/ir | 4 - locale/de/is | 4 - locale/de/oe | 30 -- 19 files changed, 601 insertions(+), 1662 deletions(-) diff --git a/SL/AM.pm b/SL/AM.pm index 980226974..fa6e128ea 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1880,6 +1880,17 @@ sub units_in_use { $main::lxdebug->leave_sub(); } +# if $a is translatable to $b, return the factor between them. +# else return 1 +sub convert_unit { + $main::lxdebug->enter_sub(2); + ($this, $a, $b, $all_units) = @_; + + $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a} && $all_units->{$b}; + $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a}{base_unit} eq $all_units->{$b}{base_unit}; + $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor}; +} + sub unit_select_data { $main::lxdebug->enter_sub(); diff --git a/SL/Form.pm b/SL/Form.pm index 2236a94ee..e4c4dd5b7 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -586,6 +586,7 @@ sub parse_html_template2 { 'EVAL_PERL' => 0, 'ABSOLUTE' => 1, 'CACHE_SIZE' => 0, + 'PLUGIN_BASE' => 'SL::Template::Plugin', }) || die; map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self }; @@ -1865,11 +1866,12 @@ $main::lxdebug->enter_sub(); sub _get_customers { $main::lxdebug->enter_sub(); - my ($self, $dbh, $key) = @_; + my ($self, $dbh, $key, $limit) = @_; $key = "all_customers" unless ($key); + $limit_clause = "LIMIT $limit" if $limit; - my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name|; + my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name $limit_clause|; $self->{$key} = selectall_hashref_query($self, $dbh, $query); @@ -1985,11 +1987,19 @@ sub get_lists { } if($params{"customers"}) { - $self->_get_customers($dbh, $params{"customers"}); + if (ref $params{"customers"} eq 'HASH') { + $self->_get_customers($dbh, $params{"customers"}{key}, $params{"customers"}{limit}); + } else { + $self->_get_customers($dbh, $params{"customers"}); + } } if($params{"vendors"}) { - $self->_get_vendors($dbh, $params{"vendors"}); + if (ref $params{"vendors"} eq 'HASH') { + $self->_get_vendors($dbh, $params{"vendors"}{key}, $params{"vendors"}{limit}); + } else { + $self->_get_vendors($dbh, $params{"vendors"}); + } } if($params{"payments"}) { diff --git a/SL/IC.pm b/SL/IC.pm index 8520f5091..8494152f8 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -930,7 +930,17 @@ sub all_parts { my @sort_cols = (@simple_filters, qw(id bin priceupdate onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate)); $form->{sort} = 'id' unless grep { $form->{"l_$_"} } grep { $form->{sort} eq $_ } @sort_cols; - my $order_clause = " ORDER BY $form->{sort} " . ($form->{revers} ? 'DESC' : 'ASC'); + + my $sort_order = ($form->{revers} ? ' DESC' : ' ASC'); + + # special case: sorting by partnumber + # since partnumbers are expected to be prefixed integers, a special sorting is implemented sorting first lexically by prefix and then by suffix. + # and yes, that expression is designed to hold that array of regexes only once, so the map is kinda messy, sorry about that. + # ToDO: implement proper functional sorting + $form->{sort} = join ', ', map { push @select_tokens, $_; ($table_prefix{$_} = "substring(partnumber,'[") . $_ } qw|^[:digit:]]+') [:digit:]]+')::INTEGER| + if $form->{sort} eq 'partnumber'; + + my $order_clause = " ORDER BY $form->{sort} $sort_order"; my $limit_clause = " LIMIT 100" if $form->{top100}; @@ -980,7 +990,8 @@ sub all_parts { #============= build query ================# - my %table_prefix = ( + %table_prefix = ( + %table_prefix, deliverydate => 'apoe.', serialnumber => 'ioi.', transdate => 'apoe.', trans_id => 'ioi.', module => 'apoe.', name => 'cv.', diff --git a/SL/IR.pm b/SL/IR.pm index 3a8c4654c..1d4b90348 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -811,7 +811,10 @@ sub retrieve_invoice { sub get_vendor { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form) = @_; + my ($self, $myconfig, $form, $params) = @_; + + $params = $form unless defined $params && ref $params eq "HASH"; + $main::lxdebug->message(0, Dumper($params)); # connect to database my $dbh = $form->dbconnect($myconfig); @@ -819,17 +822,27 @@ sub get_vendor { my $dateformat = $myconfig->{dateformat}; $dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/; - my $vid = conv_i($form->{vendor_id}); + my $vid = conv_i($params->{vendor_id}); + my $vnr = conv_i($params->{vendornumber}); my $duedate = - ($form->{invdate}) - ? "to_date(" . $dbh->quote($form->{invdate}) . ", '$dateformat')" + ($params->{invdate}) + ? "to_date(" . $dbh->quote($params->{invdate}) . ", '$dateformat')" : "current_date"; # get vendor + @values = (); + if ($vid) { + $where .= 'AND v.id = ?'; + push @values, $vid; + } + if ($vnr) { + $where .= 'AND v.vendornumber = ?'; + push @values, $vnr; + } my $query = qq|SELECT - v.name AS vendor, v.creditlimit, v.terms, v.notes AS intnotes, + v.id, v.name AS vendor, v.creditlimit, v.terms, v.notes AS intnotes, v.email, v.cc, v.bcc, v.language_id, v.payment_id, v.street, v.zipcode, v.city, v.country, v.taxzone_id, $duedate + COALESCE(pt.terms_netto, 0) AS duedate, @@ -837,15 +850,15 @@ sub get_vendor { FROM vendor v LEFT JOIN business b ON (b.id = v.business_id) LEFT JOIN payment_terms pt ON (v.payment_id = pt.id) - WHERE v.id = ?|; - $ref = selectfirst_hashref_query($form, $dbh, $query, $vid); - map { $form->{$_} = $ref->{$_} } keys %$ref; + WHERE 1=1 $where|; + $ref = selectfirst_hashref_query($form, $dbh, $query, @values); + map { $params->{$_} = $ref->{$_} } keys %$ref; - $form->{creditremaining} = $form->{creditlimit}; + $params->{creditremaining} = $params->{creditlimit}; $query = qq|SELECT SUM(amount - paid) FROM ap WHERE vendor_id = ?|; my ($unpaid_invoices) = selectfirst_array_query($form, $dbh, $query, $vid); - $form->{creditremaining} -= $unpaid_invoices; + $params->{creditremaining} -= $unpaid_invoices; $query = qq|SELECT o.amount, (SELECT e.sell @@ -857,21 +870,21 @@ sub get_vendor { my $sth = prepare_execute_query($form, $dbh, $query, $vid); while (my ($amount, $exch) = $sth->fetchrow_array()) { $exch = 1 unless $exch; - $form->{creditremaining} -= $amount * $exch; + $params->{creditremaining} -= $amount * $exch; } $sth->finish(); # get shipto if we do not convert an order or invoice - if (!$form->{shipto}) { - delete @{$form}{qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail)}; + if (!$params->{shipto}) { + delete @{$params}{qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail)}; $query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module= 'CT')|; $ref = selectfirst_hashref_query($form, $dbh, $query, $vid); - @{$form}{keys %$ref} = @{$ref}{keys %$ref}; - map { $form->{$_} = $ref->{$_} } keys %$ref; + @{$params}{keys %$ref} = @{$ref}{keys %$ref}; + map { $params->{$_} = $ref->{$_} } keys %$ref; } - if (!$form->{id} && $form->{type} !~ /_(order|quotation)/) { + if (!$params->{id} && $params->{type} !~ /_(order|quotation)/) { # setup last accounts used $query = qq|SELECT c.id, c.accno, c.description, c.link, c.category @@ -888,24 +901,24 @@ sub get_vendor { if ($ref->{category} eq 'E') { $i++; - if ($form->{initial_transdate}) { + if ($params->{initial_transdate}) { my $tax_query = qq|SELECT tk.tax_id, t.rate FROM taxkeys tk LEFT JOIN tax t ON (tk.tax_id = t.id) WHERE (tk.chart_id = ?) AND (startdate <= ?) ORDER BY tk.startdate DESC LIMIT 1|; - my ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $form->{initial_transdate}); - $form->{"taxchart_$i"} = "${tax_id}--${rate}"; + my ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $params->{initial_transdate}); + $params->{"taxchart_$i"} = "${tax_id}--${rate}"; } - $form->{"AP_amount_$i"} = "$ref->{accno}--$tax_id"; + $params->{"AP_amount_$i"} = "$ref->{accno}--$tax_id"; } if ($ref->{category} eq 'L') { - $form->{APselected} = $form->{AP_1} = $ref->{accno}; + $params->{APselected} = $params->{AP_1} = $ref->{accno}; } } - $form->{rowcount} = $i if ($i && !$form->{type}); + $params->{rowcount} = $i if ($i && !$params->{type}); } $dbh->disconnect(); diff --git a/SL/OE.pm b/SL/OE.pm index 7bea468e7..2e7a6bebb 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -244,8 +244,7 @@ sub save { for my $i (1 .. $form->{rowcount}) { - map({ $form->{"${_}_$i"} = - $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship)); + map({ $form->{"${_}_$i"} = $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship)); if ($form->{"id_$i"}) { @@ -256,8 +255,7 @@ sub save { my $basefactor = 1; if (defined($all_units->{$item_unit}->{factor}) && (($all_units->{$item_unit}->{factor} * 1) != 0)) { - $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} / - $all_units->{$item_unit}->{factor}; + $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} / $all_units->{$item_unit}->{factor}; } my $baseqty = $form->{"qty_$i"} * $basefactor; @@ -266,23 +264,17 @@ sub save { $form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1; # set values to 0 if nothing entered - $form->{"discount_$i"} = - $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100; + $form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100; - $form->{"sellprice_$i"} = - $form->parse_amount($myconfig, $form->{"sellprice_$i"}); + $form->{"sellprice_$i"} = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); $fxsellprice = $form->{"sellprice_$i"}; my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); $dec = length($dec); my $decimalplaces = ($dec > 2) ? $dec : 2; - $discount = - $form->round_amount($form->{"sellprice_$i"} * $form->{"discount_$i"}, - $decimalplaces); - $form->{"sellprice_$i"} = - $form->round_amount($form->{"sellprice_$i"} - $discount, - $decimalplaces); + $discount = $form->round_amount($form->{"sellprice_$i"} * $form->{"discount_$i"}, $decimalplaces); + $form->{"sellprice_$i"} = $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces); $form->{"inventory_accno_$i"} *= 1; $form->{"expense_accno_$i"} *= 1; @@ -311,15 +303,10 @@ sub save { if ($form->round_amount($taxrate, 7) == 0) { if ($form->{taxincluded}) { foreach $item (@taxaccounts) { - $taxamount = - $form->round_amount($linetotal * $form->{"${item}_rate"} / - (1 + abs($form->{"${item}_rate"})), - 2); - + $taxamount = $form->round_amount($linetotal * $form->{"${item}_rate"} / (1 + abs($form->{"${item}_rate"})), 2); $taxaccounts{$item} += $taxamount; $taxdiff += $taxamount; - - $taxbase{$item} += $taxbase; + $taxbase{$item} += $taxbase; } $taxaccounts{ $taxaccounts[0] } += $taxdiff; } else { @@ -330,16 +317,14 @@ sub save { } } else { foreach $item (@taxaccounts) { - $taxaccounts{$item} += - $taxamount * $form->{"${item}_rate"} / $taxrate; + $taxaccounts{$item} += $taxamount * $form->{"${item}_rate"} / $taxrate; $taxbase{$item} += $taxbase; } } $netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor; - $reqdate = - ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef; + $reqdate = ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef; # get pricegroup_id and save ist ($null, my $pricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"}); @@ -362,7 +347,7 @@ sub save { } $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT factor FROM price_factors WHERE id = ?), ?)|; - push(@values, + push(@values, conv_i($form->{id}), conv_i($form->{"id_$i"}), $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"}, $baseqty, @@ -394,17 +379,10 @@ sub save { if ($form->{currency} eq $form->{defaultcurrency}) { $form->{exchangerate} = 1; } else { - $exchangerate = - $form->check_exchangerate($myconfig, - $form->{currency}, - $form->{transdate}, - ($form->{vc} eq 'customer') ? 'buy' : 'sell'); + $exchangerate = $form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, ($form->{vc} eq 'customer') ? 'buy' : 'sell'); } - $form->{exchangerate} = - ($exchangerate) - ? $exchangerate - : $form->parse_amount($myconfig, $form->{exchangerate}); + $form->{exchangerate} = ($exchangerate) ? $exchangerate : $form->parse_amount($myconfig, $form->{exchangerate}); my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't'; @@ -456,12 +434,10 @@ sub save { if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) { if ($form->{vc} eq 'customer') { - $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, - $form->{exchangerate}, 0); + $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, $form->{exchangerate}, 0); } if ($form->{vc} eq 'vendor') { - $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, - 0, $form->{exchangerate}); + $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, 0, $form->{exchangerate}); } } @@ -471,14 +447,14 @@ sub save { &adj_onhand($dbh, $form, $ml * -1); } - my $rc = $dbh->commit; - $dbh->disconnect; - $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"}; Common::webdav_folder($form) if ($main::webdav); + my $rc = $dbh->commit; + $dbh->disconnect; + $main::lxdebug->leave_sub(); return $rc; @@ -918,8 +894,7 @@ sub order_details { $sth->finish(); } - $form->{"globalprojectnumber"} = - $projectnumbers{$form->{"globalproject_id"}}; + $form->{"globalprojectnumber"} = $projectnumbers{$form->{"globalproject_id"}}; my @arrays = qw(runningnumber number description longdescription qty ship unit bin @@ -1041,9 +1016,8 @@ sub order_details { if ($taxamount != 0) { foreach my $item (split / /, $form->{"taxaccounts_$i"}) { - $taxaccounts{$item} += - $taxamount * $form->{"${item}_rate"} / $taxrate; - $taxbase{$item} += $taxbase; + $taxaccounts{$item} += $taxamount * $form->{"${item}_rate"} / $taxrate; + $taxbase{$item} += $taxbase; } } @@ -1056,8 +1030,7 @@ sub order_details { # get parts and push them onto the stack my $sortorder = ""; if ($form->{groupitems}) { - $sortorder = - qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|; + $sortorder = qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|; } else { $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|; } @@ -1075,19 +1048,13 @@ sub order_details { while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) { - map({ push(@{ $form->{$_} }, "") } - grep({ $_ ne "description" } @arrays)); + map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays)); $sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--"; push(@{ $form->{description} }, $sameitem); } - push(@{ $form->{description} }, - $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"} - ) - . qq|, $ref->{partnumber}, $ref->{description}|); - - map({ push(@{ $form->{$_} }, "") } - grep({ $_ ne "description" } @arrays)); + push(@{ $form->{description} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq|, $ref->{partnumber}, $ref->{description}|); + map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays)); } $sth->finish; } @@ -1195,17 +1162,13 @@ sub adj_onhand { my ($item_unit) = selectrow_query($form, $dbh, $query, $ref->{parts_id}); my $basefactor = 1; - if (defined($all_units->{$item_unit}->{factor}) && - (($all_units->{$item_unit}->{factor} * 1) != 0)) { - $basefactor = $all_units->{$ref->{unit}}->{factor} / - $all_units->{$item_unit}->{factor}; + if (defined($all_units->{$item_unit}->{factor}) && (($all_units->{$item_unit}->{factor} * 1) != 0)) { + $basefactor = $all_units->{$ref->{unit}}->{factor} / $all_units->{$item_unit}->{factor}; } my $baseqty = $ref->{ship} * $basefactor; # adjust onhand in parts table - $form->update_balance($dbh, "parts", "onhand", - qq|id = $ref->{parts_id}|, - $baseqty * $ml); + $form->update_balance($dbh, "parts", "onhand", qq|id = $ref->{parts_id}|, $baseqty * $ml); } } diff --git a/am.pl b/am.pl index ac0a98a58..d35b4a900 100755 --- a/am.pl +++ b/am.pl @@ -47,7 +47,7 @@ $| = 1; use SL::LXDebug; $lxdebug = LXDebug->new(); -use CGI; +use CGI qw( -no_xhtml); use SL::Form; use SL::Locale; @@ -64,6 +64,11 @@ if (defined($latex) && !defined($latex_templates)) { $form = new Form; $cgi = new CGI(''); +# this prevents most of the tabindexes being created by CGI. +# note: most. popup menus and selecttables will still have tabindexes +# use common.pl's NTI function to get rid of those +local $CGI::TABINDEX = 0; + # name of this script $0 =~ tr/\\/\//; $pos = rindex $0, '/'; diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 3a73d421d..fc0da269e 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -46,6 +46,7 @@ use SL::ReportGenerator; our ($form, $locale, %myconfig, $lxdebug); require "bin/mozilla/io.pl"; +require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; @@ -109,44 +110,33 @@ sub search { |; #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", - "transdateto", "BL", "trigger2"); + $jsscript = Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", "transdateto", "BL", "trigger2"); } else { # without JavaScript Calendar - $button1 = qq| - |; - $button2 = qq| - |; + $button1 = qq| |; + $button2 = qq| |; } unless ($form->{searchitems} eq 'service') { - $onhand = qq| -  | - . $locale->text('On Hand') . qq| -  | - . $locale->text('Short') . qq| + $onhand = qq|  | . $locale->text('On Hand') . qq| +  | . $locale->text('Short') . qq| |; $makemodel = qq| - | . $locale->text('Make') . qq| - - | . $locale->text('Model') . qq| - + | . $locale->text('Make') . qq| + | . $locale->text('Model') . qq| |; $serialnumber = qq| - | . $locale->text('Serial Number') . qq| - + | . $locale->text('Serial Number') . qq| |; $l_serialnumber = qq| -  | - . $locale->text('Serial Number') . qq| +  | . $locale->text('Serial Number') . qq| |; } diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 9820f8b30..a24c0e232 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -90,509 +90,6 @@ use Data::Dumper; # Eintrag fuer Version 2.2.0 geaendert # # neue Optik im Rechnungsformular # ######################################## -sub display_row { - $lxdebug->enter_sub(); - my $numrows = shift; - - my $is_sales = - (substr($form->{type}, 0, 6) eq "sales_") - || (($form->{type} eq "invoice") && ($form->{script} eq "is.pl")) - || ($form->{type} eq 'credit_note'); - - if ($lizenzen && $form->{vc} eq "customer") { - if ($form->{type} =~ /sales_order/) { - @column_index = (runningnumber, partnumber, description, ship, qty); - } elsif ($form->{type} =~ /sales_quotation/) { - @column_index = (runningnumber, partnumber, description, qty); - } else { - @column_index = (runningnumber, partnumber, description, qty); - } - } else { - if ( ($form->{type} =~ /purchase_order/) - || ($form->{type} =~ /sales_order/)) { - @column_index = (runningnumber, partnumber, description, ship, qty); - } else { - @column_index = (runningnumber, partnumber, description, qty); - } - } -############## ENDE Neueintrag ################## - - my $dimension_units = AM->retrieve_units(\%myconfig, $form, "dimension"); - my $service_units = AM->retrieve_units(\%myconfig, $form, "service"); - my $all_units = AM->retrieve_units(\%myconfig, $form); - - my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; - - push @column_index, qw(unit); - - #for pricegroups column - if ( $form->{type} =~ (/sales_quotation/) - or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) - or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) - or ($form->{type} =~ /sales_order/)) { - push @column_index, qw(sellprice_pg); - } - - push @column_index, qw(sellprice); - - if ($form->{vc} eq 'customer') { - push @column_index, qw(discount); - } - - push @column_index, "linetotal"; - - my $colspan = $#column_index + 1; - - $form->{invsubtotal} = 0; - map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts})); - -######################################## - # Eintrag fuer Version 2.2.0 geaendert # - # neue Optik im Rechnungsformular # -######################################## - $column_data{runningnumber} = - qq|| - . $locale->text('No.') - . qq||; - $column_data{partnumber} = - qq|| - . $locale->text('Number') - . qq||; - $column_data{description} = - qq|| - . $locale->text('Part Description') - . qq||; - if ($form->{"type"} eq "purchase_order") { - $column_data{ship} = - qq|| - . $locale->text('Ship rcvd') - . qq||; - } else { - $column_data{ship} = - qq|| - . $locale->text('Ship') - . qq||; - } - $column_data{qty} = - qq|| - . $locale->text('Qty') - . qq||; - $column_data{unit} = - qq|| - . $locale->text('Unit') - . qq||; - $column_data{license} = - qq|| - . $locale->text('License') - . qq||; - $column_data{serialnr} = - qq|| - . $locale->text('Serial No.') - . qq||; - $column_data{projectnr} = - qq|| - . $locale->text('Project') - . qq||; - $column_data{sellprice} = - qq|| - . $locale->text('Price') - . qq||; - $column_data{sellprice_pg} = - qq|| - . $locale->text('Pricegroup') - . qq||; - $column_data{discount} = - qq|| - . $locale->text('Discount') - . qq||; - $column_data{linetotal} = - qq|| - . $locale->text('Extended') - . qq||; - $column_data{bin} = - qq|| - . $locale->text('Bin') - . qq||; -############## ENDE Neueintrag ################## - - $myconfig{"show_form_details"} = 1 - unless (defined($myconfig{"show_form_details"})); - $form->{"show_details"} = $myconfig{"show_form_details"} - unless (defined($form->{"show_details"})); - $form->{"show_details"} = $form->{"show_details"} ? 1 : 0; - my $show_details_new = 1 - $form->{"show_details"}; - my $show_details_checked = $form->{"show_details"} ? "checked" : ""; - - print qq| - - | . $cgi->hidden("-name" => "show_details", "-value" => $form->{show_details}) . qq| - -
- - |; - - map { print "\n$column_data{$_}" } @column_index; - - print qq| - -|; - - $runningnumber = $locale->text('No.'); - $deliverydate = $locale->text('Delivery Date'); - $serialnumber = $locale->text('Serial No.'); - $projectnumber = $locale->text('Project'); - $partsgroup = $locale->text('Group'); - $reqdate = $locale->text('Reqdate'); - - $delvar = 'deliverydate'; - - if ($form->{type} =~ /_order$/ || $form->{type} =~ /_quotation$/) { - $deliverydate = $locale->text('Required by'); - $delvar = 'reqdate'; - } - - $form->{marge_total} = 0; - $form->{sellprice_total} = 0; - $form->{lastcost_total} = 0; - my %projectnumber_labels = (); - my @projectnumber_values = (""); - foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { - push(@projectnumber_values, $item->{"id"}); - $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"}; - } - - for $i (1 .. $numrows) { - - # undo formatting - map { - $form->{"${_}_$i"} = - $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) - } qw(qty ship discount sellprice price_new price_old) unless ($form->{simple_save}); - - if (!$form->{"unit_old_$i"}) { - # Neue Ware aus der Datenbank. In diesem Fall ist unit_$i die - # Einheit, wie sie in den Stammdaten hinterlegt wurde. - # Es sollte also angenommen werden, dass diese ausgewaehlt war. - $form->{"unit_old_$i"} = $form->{"unit_$i"}; - } - - # Die zuletzt ausgewaehlte mit der aktuell ausgewaehlten Einheit - # vergleichen und bei Unterschied den Preis entsprechend umrechnen. - $form->{"selected_unit_$i"} = $form->{"unit_$i"} unless ($form->{"selected_unit_$i"}); - - my $check_units = $form->{"inventory_accno_$i"} ? $dimension_units : $service_units; - if (!$check_units->{$form->{"selected_unit_$i"}} || - ($check_units->{$form->{"selected_unit_$i"}}->{"base_unit"} ne - $all_units->{$form->{"unit_old_$i"}}->{"base_unit"})) { - # Die ausgewaehlte Einheit ist fuer diesen Artikel nicht gueltig - # (z.B. Dimensionseinheit war ausgewaehlt, es handelt sich aber - # um eine Dienstleistung). Dann keinerlei Umrechnung vornehmen. - $form->{"unit_old_$i"} = $form->{"selected_unit_$i"} = $form->{"unit_$i"}; - } - if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) { - if ($form->{"unit_old_$i"} ne $form->{"selected_unit_$i"}) { - my $basefactor = 1; - if (defined($all_units->{$form->{"unit_old_$i"}}->{"factor"}) && - $all_units->{$form->{"unit_old_$i"}}->{"factor"}) { - $basefactor = $all_units->{$form->{"selected_unit_$i"}}->{"factor"} / - $all_units->{$form->{"unit_old_$i"}}->{"factor"}; - } - $form->{"sellprice_$i"} *= $basefactor; - $form->{"unit_old_$i"} = $form->{"selected_unit_$i"}; - } - } - - ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); - $decimalplaces = max length($dec), 2; - - $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1; - $discount = (100 - $form->{"discount_$i"} * 1) / 100; - - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} * $discount / $price_factor, $decimalplaces); - - my $real_sellprice = $form->{"sellprice_$i"} * $discount / $price_factor; - - # marge calculations - my ($marge_font_start, $marge_font_end); - - $form->{"lastcost_$i"} *= 1; - - $marge_price_factor = $form->{"marge_price_factor_$i"} * 1 || 1; - - if ($real_sellprice && ($form->{"qty_$i"} * 1)) { - $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * 100 / $real_sellprice; - $myconfig{"marge_percent_warn"} = 15 unless (defined($myconfig{"marge_percent_warn"})); - - if ($form->{"id_$i"} && - ($form->{"marge_percent_$i"} < (1 * $myconfig{"marge_percent_warn"}))) { - $marge_font_start = ""; - $marge_font_end = ""; - } - - } else { - $form->{"marge_percent_$i"} = 0; - } - - my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1; - $form->{"marge_total_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note; - $form->{"marge_total"} += $form->{"marge_total_$i"}; - $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"} / $marge_price_factor; - $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"}; - - map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_total marge_percent); - - # convert " to " - map { $form->{"${_}_$i"} =~ s/\"/"/g } - qw(partnumber description unit unit_old); - -######################################## - # Eintrag fuer Version 2.2.0 geaendert # - # neue Optik im Rechnungsformular # -######################################## - $column_data{runningnumber} = - qq||; # HuT -############## ENDE Neueintrag ################## - - $column_data{partnumber} = - qq||; - - if (($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) { - $column_data{description} = - qq||; - } else { - $column_data{description} = - qq||; - } - - (my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/); - $qty_dec = length $qty_dec; - - $column_data{qty} = - qq||; - $column_data{ship} = - qq||; - - my $is_part = $form->{"inventory_accno_$i"}; - my $is_assembly = $form->{"assembly_$i"}; - my $is_assigned = $form->{"id_$i"}; - my $this_unit = $form->{"unit_$i"}; - if ($form->{"selected_unit_$i"} && $this_unit && - $all_units->{$form->{"selected_unit_$i"}} && $all_units->{$this_unit} && - ($all_units->{$form->{"selected_unit_$i"}}->{"base_unit"} eq $all_units->{$this_unit}->{"base_unit"})) { - $this_unit = $form->{"selected_unit_$i"}; - } elsif (!$is_assigned || - ($is_part && !$this_unit && ($all_units->{$this_unit} && ($all_units->{$this_unit}->{"base_unit"} eq $all_units->{"kg"}->{"base_unit"})))) { - $this_unit = "kg"; - } - - my $price_factor_select; - if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) { - my @values = ('', map { $_->{id} } @{ $form->{ALL_PRICE_FACTORS} }); - my %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} }; - - $price_factor_select = - NTI($cgi->popup_menu('-name' => "price_factor_id_$i", - '-default' => $form->{"price_factor_id_$i"}, - '-values' => \@values, - '-labels' => \%labels, - '-style' => 'width:90px')) - . ' '; - } - - $column_data{"unit"} = ""; - - # build in drop down list for pricesgroups - if ($form->{"prices_$i"}) { - if ($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"}) { - $price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces); - } else { - $price_tmp = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); - } - - $column_data{sellprice_pg} = - qq||; - $column_data{sellprice} = - qq||; - } else { - - # for last row and report - # set pricegroup drop down list from report menu - if ($form->{"sellprice_$i"} != 0) { - $prices = - qq|\n|; - - $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"}; - - $column_data{sellprice_pg} = - qq||; - - } else { - - # for last row - $column_data{sellprice_pg} = qq||; - } - - $column_data{sellprice} = - qq||; - } - $column_data{discount} = - qq||; - $column_data{linetotal} = - qq||; - $column_data{bin} = qq||; - -######################################## - # Eintrag fuer Version 2.2.0 geaendert # - # neue Optik im Rechnungsformular # -######################################## - # if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") { - # $column_data{license} = qq||; - # } - # - # if ($form->{type} !~ /_quotation/) { - # $column_data{serialnr} = qq||; - # } - # - # $column_data{projectnr} = qq||; -############## ENDE Neueintrag ################## - my $j = $i % 2; - print qq| - - |; - - map { print "\n$column_data{$_}" } @column_index; - - print("\n" . - $cgi->hidden("-name" => "unit_old_$i", - "-value" => $form->{"selected_unit_$i"}) - . "\n" . - $cgi->hidden("-name" => "price_new_$i", - "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"})) - . "\n"); - map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_}) . "\n"); } - ("orderitems_id_$i", "bo_$i", "pricegroup_old_$i", "price_old_$i", - "id_$i", "inventory_accno_$i", "bin_$i", "partsgroup_$i", "partnotes_$i", - "income_accno_$i", "expense_accno_$i", "listprice_$i", "assembly_$i", - "taxaccounts_$i", "ordnumber_$i", "transdate_$i", "cusordnumber_$i", - "longdescription_$i", "basefactor_$i", "marge_total_$i", "marge_percent_$i", "lastcost_$i", - "marge_price_factor_$i")); - -######################################## - # Eintrag fuer Version 2.2.0 geaendert # - # neue Optik im Rechnungsformular # -######################################## - - my $row_style_attr = - 'style="display:none;"' if (!$form->{"show_details"}); - - # print second row - print qq| - - - -|; - -############## ENDE Neueintrag ################## - - map { $form->{"${_}_base"} += $linetotal } - (split(/ /, $form->{"taxaccounts_$i"})); - - $form->{invsubtotal} += $linetotal; - } - - print qq| -
|; - if ($form->{"formel_$i"}) { - $column_data{qty} .= qq|| - . $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"}); - } - $column_data{qty} .= qq|" . - $price_factor_select . - AM->unit_select_html($is_part || $is_assembly ? $dimension_units : - $is_assigned ? $service_units : $all_units, - "unit_$i", $this_unit, - $is_assigned ? $form->{"unit_$i"} : undef) - . " | - . $form->format_amount(\%myconfig, $linetotal, 2) - . qq|$form->{"bin_$i"}
-|; - if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") { - my $selected = $form->{"licensenumber_$i"}; - my $lizenzen_quoted; - $form->{"lizenzen_$i"} =~ s/ selected//g; - $form->{"lizenzen_$i"} =~ - s/value="${selected}"\>/value="${selected}" selected\>/; - $lizenzen_quoted = $form->{"lizenzen_$i"}; - $lizenzen_quoted =~ s/\"/"/g; - print qq| - Lizenz\#  - -|; - } - if ($form->{type} !~ /_quotation/) { - print qq| - $serialnumber |; - } - - print qq|$projectnumber | . - NTI($cgi->popup_menu('-name' => "project_id_$i", - '-values' => \@projectnumber_values, - '-labels' => \%projectnumber_labels, - '-default' => $form->{"project_id_$i"})); - - if ($form->{type} eq 'invoice' or $form->{type} =~ /order/) { - my $reqdate_term = - ($form->{type} eq 'invoice') - ? 'deliverydate' - : 'reqdate'; # invoice uses a different term for the same thing. - print qq| - ${$reqdate_term}  -|; - } - my $subtotalchecked = ($form->{"subtotal_$i"}) ? "checked" : ""; - print qq| - |.$locale->text('Subtotal').qq|  -|; - - if ($form->{"id_$i"} && $is_sales) { - my $marge_price_factor; - - $form->{"marge_price_factor_$i"} *= 1; - - if ($form->{"marge_price_factor_$i"} && (1 != $form->{"marge_price_factor_$i"})) { - $marge_price_factor = '/' . $form->format_amount(\%myconfig, $form->{"marge_price_factor_$i"}); - } - - print qq| - ${marge_font_start}| . $locale->text('Ertrag') . qq| $form->{"marge_total_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}|; - } - print qq| -  | . $locale->text('LP') . qq| | . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq| -  | . $locale->text('EK') . qq| | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) . $marge_price_factor; - - - print qq| -
- - -|; - - if (0 != ($form->{sellprice_total} * 1)) { - $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100; - } - - $lxdebug->leave_sub(); -} ################################################## # build html-code for pricegroups in variable $form->{prices_$j} @@ -601,41 +98,17 @@ sub set_pricegroup { $lxdebug->enter_sub(); my $rowcount = shift; for $j (1 .. $rowcount) { - my $pricegroup_old = $form->{"pricegroup_old_$i"}; - if ($form->{PRICES}{$j}) { - $len = 0; - $prices = ''; - $price = 0; - foreach $item (@{ $form->{PRICES}{$j} }) { - - #$price = $form->round_amount($myconfig, $item->{price}, 5); - #$price = $form->format_amount($myconfig, $item->{price}, 2); - $price = $item->{price}; - $pricegroup_id = $item->{pricegroup_id}; - $pricegroup = $item->{pricegroup}; - - # build drop down list for pricegroups - $prices .= - qq|\n|; - - $len += 1; - - # map { - # $form->{"${_}_$j"} = - # $form->format_amount(\%myconfig, $form->{"${_}_$j"}) - # } qw(sellprice price_new price_old); - - # set new selectedpricegroup_id and prices for "Preis" - if ($item->{selected} && ($pricegroup_id != 0)) { - $form->{"pricegroup_old_$j"} = $pricegroup_id; - $form->{"price_new_$j"} = $price; - $form->{"sellprice_$j"} = $price; - } - if ($pricegroup_id == 0) { - $form->{"price_new_$j"} = $form->{"sellprice_$j"}; - } - } - $form->{"prices_$j"} = $prices; + next unless $form->{PRICES}{$j}; + # build drop down list for pricegroups + my $option_tmpl = qq||; + $form->{"prices_$j"} = join '', map { sprintf $option_tmpl, @$_{qw(price pricegroup_id selected pricegroup)} } + (+{ pricegroup => $locale->text("none (pricegroup)") }, @{ $form->{PRICES}{$j} }); + + foreach $item (@{ $form->{PRICES}{$j} }) { + # set new selectedpricegroup_id and prices for "Preis" + $form->{"pricegroup_old_$j"} = $item->{pricegroup_id} if $item->{selected} && $item->{pricegroup_id}; + $form->{"sellprice_$j"} = $item->{price} if $item->{selected} && $item->{pricegroup_id}; + $form->{"price_new_$j"} = $form->{"sellprice_$j"} if $item->{selected} || !$item->{pricegroup_id}; } } $lxdebug->leave_sub(); @@ -870,158 +343,21 @@ sub new_item { # change callback $form->{old_callback} = $form->escape($form->{callback}, 1); - $form->{callback} = $form->escape("$form->{script}?action=display_form", 1); - - # delete action - delete $form->{action}; - - # save all other form variables in a previousform variable - foreach $key (keys %$form) { + $form->{callback} = $form->escape("$form->{script}?action=display_form", 1); - # escape ampersands - $form->{$key} =~ s/&/%26/g; - $previousform .= qq|$key=$form->{$key}&|; - } - chop $previousform; - $previousform = $form->escape($previousform, 1); + # save all form variables except action in a previousform variable + my $previousform = join '&', map { $form->{$_} =~ s/&/%26/; "$_=$form->{$_}" } grep { !/action/ } keys %$form; - $i = $form->{rowcount}; - map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description); + map { $form->{"${_}_$form->{rowcount}"} =~ s/\"/"/g } qw(partnumber description); $form->header; - print qq| - - -

| . $locale->text('Item not on file!') . qq| - -

-| . $locale->text('What type of item is this?') . qq|

- -
- -

- -  | - . $locale->text('Part') . qq|
-  | - . $locale->text('Service'); - - print $cgi->hidden("-name" => "previousform", "-value" => $previousform); - map { print $cgi->hidden("-name" => $_, "-value" => $form->{$_}); } qw(rowcount vc login password); - map { print $cgi->hidden("-name" => $_, "-value" => $form->{"${_}_$i"}); } qw(partnumber description unit sellprice price_factor_id); - print $cgi->hidden("-name" => "taxaccount2", "-value" => $form->{taxaccounts}); - -print qq| - - -

- -

- - - -|; - - $lxdebug->leave_sub(); -} - -sub display_form { - $lxdebug->enter_sub(); - - relink_accounts(); - - my $new_rowcount = $form->{"rowcount"} * 1 + 1; - $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"}; - - $form->language_payment(\%myconfig); - - # if we have a display_form - if ($form->{display_form}) { - call_sub($form->{"display_form"}); - exit; - } - - Common::webdav_folder($form) if ($webdav); - - # if ( $form->{print_and_post} - # && $form->{second_run} - # && ($form->{action} eq "display_form")) { - # for (keys %$form) { $old_form->{$_} = $form->{$_} } - # $old_form->{rowcount}++; - # - # #$form->{rowcount}--; - # #$form->{rowcount}--; - # - # $form->{print_and_post} = 0; - # - # &print_form($old_form); - # exit; - # } - # - # $form->{action} = ""; - # $form->{resubmit} = 0; - # - # if ($form->{print_and_post} && !$form->{second_run}) { - # $form->{second_run} = 1; - # $form->{action} = "display_form"; - # $form->{rowcount}--; - # my $rowcount = $form->{rowcount}; - # - # # get pricegroups for parts - # IS->get_pricegroups_for_parts(\%myconfig, \%$form); - # - # # build up html code for prices_$i - # set_pricegroup($rowcount); - # - # $form->{resubmit} = 1; - # - # } - &form_header; - - $numrows = ++$form->{rowcount}; - $subroutine = "display_row"; - - if ($form->{item} eq 'part') { - - #set preisgruppenanzahl - $numrows = $form->{price_rows}; - $subroutine = "price_row"; - - &{$subroutine}($numrows); - - $numrows = ++$form->{makemodel_rows}; - $subroutine = "makemodel_row"; - } - if ($form->{item} eq 'assembly') { - $numrows = $form->{price_rows}; - $subroutine = "price_row"; - - &{$subroutine}($numrows); - - $numrows = ++$form->{makemodel_rows}; - $subroutine = "makemodel_row"; - - # create makemodel rows - &{$subroutine}($numrows); - - $numrows = ++$form->{assembly_rows}; - $subroutine = "assembly_row"; - } - if ($form->{item} eq 'service') { - $numrows = $form->{price_rows}; - $subroutine = "price_row"; - - &{$subroutine}($numrows); - - $numrows = 0; - } - - # create rows - &{$subroutine}($numrows) if $numrows; + push @HIDDENS, { value => $cgi->hidden("-name" => "previousform", "-value" => $form->escape($previousform, 1)) }; + push @HIDDENS, map +{ value => $cgi->hidden("-name" => $_, "-value" => $form->{$_}) }, qw(rowcount vc login password); + push @HIDDENS, map +{ value => $cgi->hidden("-name" => $_, "-value" => $form->{"${_}_$form->{rowcount}"}) }, qw(partnumber description unit sellprice); + push @HIDDENS, { value => $cgi->hidden("-name" => "taxaccount2", "-value" => $form->{taxaccounts}) }; - &form_footer; + print $form->parse_html_template("generic/new_item", { HIDDENS => \@HIDDENS} ); $lxdebug->leave_sub(); } @@ -1415,8 +751,8 @@ sub print_options { # note: "||"-selection is only correct for values where "0" is _not_ a correct entry $form->{sendmode} = "attachment"; $form->{format} = $form->{format} || $myconfig{template_format} || "pdf"; - $form->{copies} = $form->{copies} || $myconfig{copies} || 3; - $form->{media} = $form->{media} || $myconfig{default_media} || "screen"; + $form->{copies} = $form->{copies} || $myconfig{copies} || 3; + $form->{media} = $form->{media} || $myconfig{default_media} || "screen"; $form->{printer_id} = defined $form->{printer_id} ? $form->{printer_id} : defined $myconfig{default_printer_id} ? $myconfig{default_printer_id} : ""; @@ -1427,56 +763,56 @@ sub print_options { push @FORMNAME, grep $_, ($form->{type} eq 'purchase_order') ? ( - opthash("purchase_order", $form->{PD}{purchase_order}, $locale->text('Purchase Order')), - opthash("bin_list", $form->{PD}{bin_list}, $locale->text('Bin List')) + opthash("purchase_order", $form->{PD}{purchase_order}, $locale->text('Purchase Order')), + opthash("bin_list", $form->{PD}{bin_list}, $locale->text('Bin List')) ) : undef, ($form->{type} eq 'credit_note') ? - opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef, + opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef, ($form->{type} eq 'sales_order') ? ( - opthash("sales_order", $form->{PD}{sales_order}, $locale->text('Confirmation')), - opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')), - opthash("pick_list", $form->{PD}{pick_list}, $locale->text('Pick List')), - opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List')) + opthash("sales_order", $form->{PD}{sales_order}, $locale->text('Confirmation')), + opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')), + opthash("pick_list", $form->{PD}{pick_list}, $locale->text('Pick List')), + opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List')) ) : undef, ($form->{type} =~ /_quotation$/) ? - opthash("$`_quotation", $form->{PD}{"$`_quotation"}, $locale->text('Quotation')) : undef, + opthash("$`_quotation", $form->{PD}{"$`_quotation"}, $locale->text('Quotation')) : undef, ($form->{type} eq 'invoice') ? ( - opthash("invoice", $form->{PD}{invoice}, $locale->text('Invoice')), - opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')), - opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List')) + opthash("invoice", $form->{PD}{invoice}, $locale->text('Invoice')), + opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')), + opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List')) ) : undef, ($form->{type} eq 'invoice' && $form->{storno}) ? ( - opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')), + opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')), opthash("storno_packing_list", $form->{PD}{storno_packing_list}, $locale->text('Storno Packing List')) ) : undef, ($form->{type} eq 'credit_note') ? - opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef; + opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef; push @SENDMODE, - opthash("attachment", $form->{SM}{attachment}, $locale->text('Attachment')), - opthash("inline", $form->{SM}{inline}, $locale->text('In-line')) + opthash("attachment", $form->{SM}{attachment}, $locale->text('Attachment')), + opthash("inline", $form->{SM}{inline}, $locale->text('In-line')) if ($form->{media} eq 'email'); push @MEDIA, grep $_, - opthash("screen", $form->{OP}{screen}, $locale->text('Screen')), + opthash("screen", $form->{OP}{screen}, $locale->text('Screen')), (scalar @{ $form->{printers} } && $latex_templates) ? - opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef, - ($latex_templates && !$options{no_queue}) ? - opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef + opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef, + ($latex_templates && !$options->{no_queue}) ? + opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef if ($form->{media} ne 'email'); push @FORMAT, grep $_, ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin) - && !$options{no_opendocument_pdf}) ? - opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef, + && !$options->{no_opendocument_pdf}) ? + opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef, ($latex_templates) ? - opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef, - ($latex_templates && !$options{no_postscript}) ? - opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef, - (!$options{no_html}) ? + opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef, + ($latex_templates && !$options->{no_postscript}) ? + opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef, + (!$options->{no_html}) ? opthash("html", $form->{DF}{html}, "HTML") : undef, - ($opendocument_templates && !$options{no_opendocument}) ? - opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef; + ($opendocument_templates && !$options->{no_opendocument}) ? + opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef; push @LANGUAGE_ID, map { opthash($_->{id}, ($_->{id} eq $form->{language_id} ? 'selected' : ''), $_->{description}) } +{}, @{ $form->{languages} } diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index aa61bb07b..f4345c1fe 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -37,6 +37,7 @@ use SL::PE; use List::Util qw(max); require "bin/mozilla/io.pl"; +require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 3fc4b2caa..65cc0609d 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -37,6 +37,7 @@ use Data::Dumper; use List::Util qw(max); require "bin/mozilla/io.pl"; +require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/arap.pl"; require "bin/mozilla/drafts.pl"; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index e359b5506..7b7fae9d9 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 @@ -38,7 +38,7 @@ use SL::IR; use SL::IS; use SL::PE; use SL::ReportGenerator; -use List::Util qw(max); +use List::Util qw(max reduce); require "bin/mozilla/io.pl"; require "bin/mozilla/arap.pl"; @@ -162,8 +162,7 @@ sub edit { sub order_links { $lxdebug->enter_sub(); # get customer/vendor - $form->all_vc(\%myconfig, $form->{vc}, - ($form->{vc} eq 'customer') ? "AR" : "AP"); + $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); # retrieve order/quotation $form->{webdav} = $webdav; @@ -245,8 +244,7 @@ sub order_links { } $form->{intnotes} = $intnotes if $intnotes; ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} }; - $form->{"old$form->{vc}"} = - qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; + $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; # build the popup menus if (@{ $form->{"all_$form->{vc}"} }) { @@ -265,9 +263,8 @@ sub order_links { $form->{department} = "$form->{department}--$form->{department_id}"; map { - $form->{selectdepartment} .= - "\n" - } (@{ $form->{all_departments} }); + $form->{selectdepartment} .= "\n" + } @{ $form->{all_departments} }; } $form->{employee} = "$form->{employee}--$form->{employee_id}"; @@ -287,36 +284,14 @@ sub prepare_order { my $i = 0; foreach $ref (@{ $form->{form_details} }) { $form->{rowcount} = ++$i; - map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; } for my $i (1 .. $form->{rowcount}) { - if ($form->{id}) { - $form->{"discount_$i"} = - $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); - } else { - $form->{"discount_$i"} = - $form->format_amount(\%myconfig, $form->{"discount_$i"}); - } - ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); - $dec = length $dec; - $decimalplaces = ($dec > 2) ? $dec : 2; - - # copy reqdate from deliverydate for invoice -> order conversion - $form->{"reqdate_$i"} = $form->{"deliverydate_$i"} - unless $form->{"reqdate_$i"}; - - $form->{"sellprice_$i"} = - $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, - $decimalplaces); - - (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->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"}; + $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * ($form->{id} ? 100 : 1)); + $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}); + $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); + map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit); } $lxdebug->leave_sub(); @@ -324,9 +299,8 @@ sub prepare_order { sub form_header { $lxdebug->enter_sub(); - - my $checkedclosed = $form->{"closed"} ? "checked" : ""; - my $checkeddelivered = $form->{"delivered"} ? "checked" : ""; + my @custom_hiddens; + %TMPL_VAR = (); $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id}; $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id}; @@ -340,47 +314,30 @@ sub form_header { qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptodepartment_1 shiptodepartment_2); - + # use JavaScript Calendar or not $form->{jsscript} = 1; - $jsscript = ""; - - $button1 = qq| + $TMPL_VAR{button1} = qq| - text('button') . qq|> + text('button') . qq|> |; - $button2 = qq| + $TMPL_VAR{button2} = qq| - text('button') . qq|> + text('button') . qq|> |; - #write Trigger - $jsscript = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2"); + $TMPL_VAR{jsscript} = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2"); + # openclosed checkboxes my @tmp; - - if (($form->{"type"} eq "sales_order") || - ($form->{"type"} eq "purchase_order")) { - push(@tmp, qq| - |); - } - - if ($form->{id}) { - push(@tmp, qq| - |); - } - - if (@tmp) { - $openclosed .= qq| - | . join("\n", @tmp) . qq| - - \n|; - } + push @tmp, sprintf qq||, + $form->{"delivered"} ? "checked" : "", $locale->text('Delivered') if $form->{"type"} =~ /_order$/; + push @tmp, sprintf qq||, + $form->{"closed"} ? "checked" : "", $locale->text('Closed') if $form->{id}; + $TMPL_VAR{openclosed} = sprintf qq|%s\n|, 2 * scalar @tmp, join "\n", @tmp if @tmp; # set option selected - foreach $item ($form->{vc}, currency, department, ($form->{vc} eq "customer" ? customer : vendor)) { + foreach $item ($form->{vc}, 'currency', 'department', ($form->{vc} eq "customer" ? 'customer' : 'vendor')) { $form->{"select$item"} =~ s/ selected//; $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } @@ -391,305 +348,98 @@ sub form_header { #substitute \n and \r to \s (bug 543) $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g; - my @old_project_ids = ($form->{"globalproject_id"}); - map({ push(@old_project_ids, $form->{"project_id_$_"}) - if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + my @old_project_ids = ($form->{"globalproject_id"}, grep { $_ } map { $form->{"project_id_$_"} } 1..$form->{"rowcount"}); my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; - $form->get_lists("contacts" => "ALL_CONTACTS", - "shipto" => "ALL_SHIPTO", - "projects" => { - "key" => "ALL_PROJECTS", - "all" => 0, - "old_id" => \@old_project_ids - }, + $form->get_lists("contacts" => "ALL_CONTACTS", + "shipto" => "ALL_SHIPTO", + "projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }, "employees" => "ALL_EMPLOYEES", "salesmen" => "ALL_SALESMEN", "taxzones" => "ALL_TAXZONES", "payments" => "ALL_PAYMENTS", "currencies" => "ALL_CURRENCIES", - $vc => "ALL_" . uc($vc), + $vc => { key => "ALL_" . uc($vc), + limit => $myconfig{vclimit} + 1 }, "price_factors" => "ALL_PRICE_FACTORS"); - my %labels; - my @values = (undef); - foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { - push(@values, $item->{"cp_id"}); - $labels{$item->{"cp_id"}} = $item->{"cp_name"} . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : ""); - } - - my $contact; - if (scalar @values > 1) { - $contact = qq| - - | . $locale->text('Contact Person') . qq| - | . - NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px', - '-labels' => \%labels, '-default' => $form->{"cp_id"})) - . qq| - - |; - } - - %labels = (); - @values = (); - - foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) { - push(@values, $item->{"name"}.qq|--|.$item->{"id"}); - $labels{$item->{"name"}.qq|--|.$item->{"id"}} = $item->{name}; - } - - $vc = qq| - {vc}_id"}) . qq|"> - {vc}"}) . qq|"> - | . $locale->text(ucfirst($form->{vc})) . qq| - | . - (($myconfig{vclimit} <= scalar(@values)) - ? qq|{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">| - : (NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, - '-onChange' => 'document.getElementById(\'update_button\').click();', - '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| - - {vc}"}) . qq|">|; - - if ($form->{vc} eq 'customer') { - $vc .= qq||; - } - - %labels = (); - @values = (""); - foreach my $item (@{ $form->{"ALL_PAYMENTS"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"description"}; - } - - $payments = qq| - | . $locale->text('Payment Terms') . qq| - | . - NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px', - '-labels' => \%labels, '-default' => $form->{payment_id})) - . qq||; - - %labels = (); - @values = (""); - foreach my $item (@{ $form->{"ALL_SHIPTO"} }) { - push(@values, $item->{"shipto_id"}); - $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city); - } - - my $shipto; - if (scalar @values > 1) { - $shipto = qq| - - | . $locale->text('Shipping Address') . qq| - | . - NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px', - '-labels' => \%labels, '-default' => $form->{"shipto_id"})) - . qq||; - } - - %labels = (); - @values = (""); - foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"projectnumber"}; - } - my $globalprojectnumber = NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values, - '-labels' => \%labels, - '-default' => $form->{"globalproject_id"})); + # contacts + @values = ("", map { $_->{cp_id} } @{ $form->{ALL_CONTACTS} }); + %labels = map { $_->{cp_id} => $_->{"cp_name"} . ($_->{cp_abteilung} ? " ($_->{cp_abteilung})" : "") } @{ $form->{ALL_CONTACTS} }; + $TMPL_VAR{contact} = NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px', + '-labels' => \%labels, '-default' => $form->{"cp_id"})) if scalar @values > 1; + + # vendor/customer + @values = map { "$_->{name}--$_->{id}" } @{ $form->{uc "all_$form->{vc}s" } }; + %labels = map { +"$_->{name}--$_->{id}" => $_->{name} } @{ $form->{uc "all_$form->{vc}s" } }; + push @custom_hiddens, "$form->{vc}_id"; + push @custom_hiddens, "old$form->{vc}"; + push @custom_hiddens, "select$form->{vc}"; + $TMPL_VAR{vc} = sprintf qq|%s%s|, + $locale->text(ucfirst $form->{vc}), + ($myconfig{vclimit} <= scalar(@values)) + ? $cgi->textfield(-value => H($form->{"old$form->{vc}"} =~ /^(.*)\-\-.*$/), -name => $form->{vc}) + : NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, + '-onChange' => 'document.getElementById(\'update_button\').click();', + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')); + + # payments (for footer) + @values = ("", map { $_->{id} } @{ $form->{ALL_PAYMENTS} }); + %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PAYMENTS} }; + $TMPL_VAR{payments} = NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px', + '-labels' => \%labels, '-default' => $form->{payment_id})); + + # shipto + @values = ("", map { $_->{shipto_id} } @{ $form->{ALL_SHIPTO} }); + %labels = map { my $item=$_; $_->{shipto_id} => join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city) } @{ $form->{ALL_SHIPTO} }; + $TMPL_VAR{shipto} = NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px', + '-labels' => \%labels, '-default' => $form->{"shipto_id"})) if scalar @values > 1; + + # projects + @values = ("", map { $_->{id} } @{ $form->{ALL_PROJECTS} }); + %labels = map { $_->{id} => $_->{projectnumber} } @{ $form->{ALL_PROJECTS} }; + $TMPL_VAR{globalprojectnumber} = NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values, + '-labels' => \%labels, '-default' => $form->{"globalproject_id"})); - my $salesmen = ""; - %labels = (); - @values = (); - if ($form->{type} =~ /^sales_/) { - foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = ($item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}); - } - $salesmen = - qq| - | . $locale->text('Salesman') . qq| - | . - NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"}, - '-values' => \@values, '-labels' => \%labels)) - . qq| - |; - } - - %labels = (); - @values = (); - foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; - } - - my $employee = qq| - - | . $locale->text('Employee') . qq| - | . - NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, - '-values' => \@values, '-labels' => \%labels)) . qq| - - |; - - %labels = (); - @values = (); - foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"description"}; - } - - $taxzone = qq| - - | . $locale->text('Steuersatz') . qq| - | . - NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, - '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq| - - |; - - %labels = (); - @values = (); - my $i = 0; - foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) { - push(@values, $item); - $labels{$item} = $item; - } - - $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; - my $currencies; - if (scalar @values) { - $currencies = qq| - - | . $locale->text('Currency') . qq| - | . - NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"}, - '-values' => \@values, '-labels' => \%labels)) . qq| - - |; - } - - $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); - $form->{exchangerate} = "" unless $form->{exchangerate}; - + # salesmen + @values = map { $_->{id} } @{ $form->{ALL_SALESMEN} }; + %labels = map { $_->{id} => ($_->{name} || $_->{login}) } @{ $form->{ALL_SALESMEN} }; + $TMPL_VAR{salesmen} = NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) if $form->{type} =~ /^sales_/ && scalar @values; + + # employees + @values = map { $_->{id} } @{ $form->{ALL_EMPLOYEES} }; + %labels = map { $_->{id} => $_->{name} || $_->{login} } @{ $form->{ALL_EMPLOYEES} }; + $TMPL_VAR{employee} = NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)); + + # taxzone + @values = map { $_->{id} } @{ $form->{ALL_TAXZONES} }; + %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_TAXZONES} }; + $TMPL_VAR{taxzone} = NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')); + + # currencies and exchangerate + @values = map { $_ } @{ $form->{ALL_CURRENCIES} }; + %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} }; + $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; + $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency} && $form->{exchangerate}; + $TMPL_VAR{currencies} = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"}, + '-values' => \@values, '-labels' => \%labels)) if scalar @values; + push @custom_hiddens, "forex"; + push @custom_hiddens, "exchangerate" if $form->{forex}; + + # credit remaining $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0; + $TMPL_VAR{is_credit_remaining_negativ} = ($form->{creditremaining} =~ /-/) ? "0" : "1"; + + # business + $TMPL_VAR{business_label} = ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type')); - $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); - $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); - - $exchangerate = qq|\n{forex}>\n|; - - if ($form->{currency} ne $form->{defaultcurrency}) { - if ($form->{forex}) { - $exchangerate .= - qq|| . $locale->text('Exchangerate') - . qq|$form->{exchangerate} - {exchangerate}> -|; - } else { - $exchangerate .= - qq|| . $locale->text('Exchangerate') - . qq|{exchangerate}>|; - } - } - - if ($form->{business}) { - $business = qq| - - | . ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type')) . qq| - $form->{business}; | . $locale->text('Trade Discount') . qq| | - . $form->format_amount(\%myconfig, $form->{tradediscount} * 100) - . qq| % - -|; - } - - if ($form->{max_dunning_level}) { - $dunning = qq| - - | . $locale->text('Max. Dunning Level') . qq|: - - $form->{max_dunning_level}; - | . $locale->text('Dunning Amount') . qq|: | - . $form->format_amount(\%myconfig, $form->{dunning_amount},2) - . qq| - - -|; - } - - if ($form->{type} !~ /_quotation$/) { - $ordnumber = qq| - - | . $locale->text('Order Number') . qq| - - - - | - . $locale->text('Quotation Number') . qq| - - - - | - . $locale->text('Customer Order Number') . qq| - - - - | . $locale->text('Order Date') . qq| - $button1 - - - - | . $locale->text('Required by') . qq| - $button2 - -|; - - $n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; - - $creditremaining = qq| - $shipto - - | . $locale->text('Credit Limit') . qq| - $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} - - -|; - } else { - $reqlabel = ($form->{type} eq 'sales_quotation') ? $locale->text('Valid until') : $locale->text('Required by'); - if ($form->{type} eq 'sales_quotation') { - $ordnumber = qq| - - | - . $locale->text('Quotation Number') . qq| - - - -|; - } else { - $ordnumber = qq| - - | . $locale->text('RFQ Number') . qq| - - - -|; - - } - - $ordnumber .= qq| | . $locale->text('Quotation Date') . qq| $button1 - $reqlabel $button2 \n|; - $creditremaining = qq| $shipto |; - } - - $department = qq| - - | . $locale->text('Department') . qq| - - - - | if $form->{selectdepartment}; + push @custom_hiddens, "ordnumber" if $form->{type} =~ /_quotation$/; + push @custom_hiddens, "customer_klass" if $form->{vc} eq 'customer'; $credittext = $locale->text('Credit Limit exceeded!!!'); @@ -700,6 +450,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||; @@ -707,103 +458,27 @@ sub form_header { $form->header; - print qq| - - -
{script}> - - - - - -|; - - $form->hide_form(qw(id action type vc formname media format proforma queued printed emailed - title discount creditlimit creditremaining tradediscount business - max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode - shiptocity shiptocountry shiptocontact shiptophone shiptofax - shiptodepartment_1 shiptodepartment_2 shiptoemail - message email subject cc bcc taxpart taxservice taxaccounts), - map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ); - print qq| - - - - - - - - - - -$jsscript + $TMPL_VAR{HIDDENS} = [ map { name => $_, value => $form->{$_} }, + 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 + shiptocity shiptocountry shiptocontact shiptophone shiptofax + shiptodepartment_1 shiptodepartment_2 shiptoemail + message email subject cc bcc taxpart taxservice taxaccounts), + @custom_hiddens, + map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ]; # deleted: discount + + %TMPL_VAR = ( + %TMPL_VAR, + is_sales => scalar ($form->{type} =~ /^sales_/), # these vars are exported, so that the template + is_order => scalar ($form->{type} =~ /_order$/), # may determine what to show + is_sales_quo => scalar ($form->{type} =~ /sales_quotation$/), + is_req_quo => scalar ($form->{type} =~ /request_quotation$/), + is_sales_ord => scalar ($form->{type} =~ /sales_order$/), + is_pur_ord => scalar ($form->{type} =~ /purchase_order$/), + ); -|; + print $form->parse_html_template2("oe/orders_header", { %TMPL_VAR }); $lxdebug->leave_sub(); } @@ -813,289 +488,61 @@ sub form_footer { $form->{invtotal} = $form->{invsubtotal}; - if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) { - $rows = 2; - } - if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) { - $introws = 2; - } - $rows = ($rows > $introws) ? $rows : $introws; - $notes = - qq||; - $intnotes = - qq||; - - $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; + $rows = max 2, $form->numtextrows($form->{notes}, 25, 8); + $introws = max 2, $form->numtextrows($form->{intnotes}, 35, 8); + $rows = max $rows, $introws; - $taxincluded = ""; - if ($form->{taxaccounts}) { - $taxincluded = qq| - {taxincluded}> | - . $locale->text('Tax Included') . qq|

-|; - } + $TMPL_VAR{notes} = qq||; + $TMPL_VAR{intnotes} = qq||; if (!$form->{taxincluded}) { foreach $item (split / /, $form->{taxaccounts}) { if ($form->{"${item}_base"}) { - $form->{invtotal} += $form->{"${item}_total"} = - $form->round_amount( - $form->{"${item}_base"} * $form->{"${item}_rate"}, - 2); - $form->{"${item}_total"} = - $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2); - - $tax .= qq| + $form->{invtotal} += $form->{"${item}_total"} = $form->round_amount( $form->{"${item}_base"} * $form->{"${item}_rate"}, 2); + $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2); + + $TMPL_VAR{tax} .= qq| - + - -|; + |; } } - $form->{invsubtotal} = - $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); - - $subtotal = qq| - - - - -|; - - } + $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); - if ($form->{taxincluded}) { + } else { foreach $item (split / /, $form->{taxaccounts}) { if ($form->{"${item}_base"}) { - $form->{"${item}_total"} = - $form->round_amount( - ($form->{"${item}_base"} * $form->{"${item}_rate"} / - (1 + $form->{"${item}_rate"}) - ), - 2); - $form->{"${item}_netto"} = - $form->round_amount( - ($form->{"${item}_base"} - $form->{"${item}_total"}), - 2); - $form->{"${item}_total"} = - $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2); - $form->{"${item}_netto"} = - $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2); - - $tax .= qq| + $form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"} / (1 + $form->{"${item}_rate"})), 2); + $form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2); + $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2); + $form->{"${item}_netto"} = $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2); + + $TMPL_VAR{tax} .= qq| - + - -|; + |; } } - } $form->{oldinvtotal} = $form->{invtotal}; - $form->{invtotal} = - $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0); - - print qq| - - - -{oldinvtotal}> - - - - -|; - - if ($webdav) { - $webdav_list = qq| - - - - -
$form->{title}
- - - - - -
- - - $vc - $contact - $creditremaining - $business - $dunning - $taxzone - $department - - $currencies - $exchangerate - - - - - - - - - - - - - |; -# -# -# -print qq|
| . $locale->text('Shipping Point') . qq|
| . $locale->text('Ship via') . qq|
| . $locale->text('Transaction description') . qq|
-# -# -# -# -# -# -# -# -# -#
-# -# -#
-# -# -#
-#
-
- - $openclosed - $employee - $salesmen - $ordnumber - - - - -
| . $locale->text('Project Number') . qq|$globalprojectnumber
-
-
$form->{"${item}_description"} | - . $form->{"${item}_rate"} * 100 .qq|%$form->{"${item}_description"} | . $form->{"${item}_rate"} * 100 .qq|% $form->{"${item}_total"}
| . $locale->text('Subtotal') . qq|$form->{invsubtotal}
Enthaltene $form->{"${item}_description"} | - . $form->{"${item}_rate"} * 100 .qq|%Enthaltene $form->{"${item}_description"} | . $form->{"${item}_rate"} * 100 .qq|% $form->{"${item}_total"}
Nettobetrag $form->{"${item}_netto"}
- - - - - - -
- - - - - - - - - - - $payments - -
| . $locale->text('Notes') . qq|| . $locale->text('Internal Notes') . qq|
$notes$intnotes
-
- -|; - - if ($form->{type} =~ /^sales_/) { - print qq| - - - - - - - - -|; - } - - print qq| - - -
| . $locale->text('Ertrag') . qq|| . $form->format_amount(\%myconfig, $form->{marge_total}, 2, 0) . qq|
| . $locale->text('Ertrag prozentual') . qq|| . $form->format_amount(\%myconfig, $form->{marge_percent}, 2, 0) . qq| %
-
- $taxincluded - - $subtotal - $tax - - - - -
| . $locale->text('Total') . qq|$form->{invtotal}
-
-

Dokumente im Webdav-Repository
- - -|; - foreach $file (@{ $form->{WEBDAV} }) { - $webdav_list .= qq| - - - - -|; - } - $webdav_list .= qq| -
DateinameWebdavlink
$file->{name}$file->{type}
- - -
- -|; - - print $webdav_list; - } - - print qq| - - -|; - print_options(); - print qq| - - - + print $form->parse_html_template2("oe/orders_footer", { + %TMPL_VAR, + webdav => $webdav, + print_options => print_options(inline => 1), + label_edit => $locale->text("Edit the $form->{type}"), + label_workflow => $locale->text("Workflow $form->{type}"), + }); -| . $locale->text("Edit the $form->{type}") . qq|
- - - - - - -|; - - if (($form->{id})) { - print qq| - - -
| . $locale->text("Workflow $form->{type}") . qq|
- -|; - if (($form->{type} =~ /sales_quotation$/)) { - print qq| -|; - } - if ($form->{type} =~ /request_quotation$/) { - print qq| -|; - } - print qq| - -|; - - if ($form->{type} =~ /sales_order$/) { - print qq| -
$form->{heading} als neue Vorlage verwenden für
- - -|; - - } elsif ($form->{type} =~ /purchase_order$/) { - print qq| -
$form->{heading} als neue Vorlage verwenden für
- - -|; - - } else { - print qq| -
$form->{heading} als neue Vorlage verwenden für
- -|; - } - } - - $form->hide_form("saved_xyznumber"); - - print qq| - -{rowcount}> - - - -{login}> -{password}> - -
- - - -|; $lxdebug->leave_sub(); } @@ -1120,11 +567,11 @@ sub update { $form->{exchangerate} = $exchangerate if $form->{forex} = $exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, $buysell); - # for pricegroups - $i = $form->{rowcount}; - $exchangerate = $form->{exchangerate} || 1; +##################### process items ###################################### + # for pricegroups + $i = $form->{rowcount}; if ( ($form->{"partnumber_$i"} eq "") && ($form->{"description_$i"} eq "") && ($form->{"partsgroup_$i"} eq "")) { @@ -1134,13 +581,10 @@ sub update { } else { - if ( $form->{type} eq 'purchase_order' - || $form->{type} eq 'request_quotation') { - IR->retrieve_item(\%myconfig, \%$form); - } - if ( $form->{type} eq 'sales_order' - || $form->{type} eq 'sales_quotation') { + if ($form->{type} =~ /^sales/) { IS->retrieve_item(\%myconfig, \%$form); + } else { + IR->retrieve_item(\%myconfig, \%$form); } my $rows = scalar @{ $form->{item_list} }; @@ -1192,8 +636,7 @@ sub update { &set_pricegroup($i); } - &display_form; - + display_form(); } else { # ok, so this is a new part @@ -1204,14 +647,16 @@ sub update { && ($form->{"description_$i"} eq "")) { $form->{rowcount}--; $form->{"discount_$i"} = ""; - display_form(); + display_form(); } else { $form->{"id_$i"} = 0; new_item(); } } } +##################### process items ###################################### + $lxdebug->leave_sub(); } @@ -1343,11 +788,7 @@ sub search { my $employee_block = qq| | . $locale->text('Employee') . qq| - | . - NTI($cgi->popup_menu('-name' => 'employee_id', - '-values' => \@values, - '-labels' => \%labels)) . qq| - + | . NTI($cgi->popup_menu('-name' => 'employee_id', '-values' => \@values, '-labels' => \%labels)) . qq| | . $locale->text('Salesman') . qq| @@ -1394,12 +835,12 @@ sub search { $vc_label $vc - $department +$department $ordlabel - $employee_block +$employee_block | . $locale->text('Transaction description') . qq| @@ -1409,10 +850,8 @@ sub search { $projectnumber - | . $locale->text('From') . qq| - $button1 - | . $locale->text('Bis') . qq| - $button2 + | . $locale->text('From') . qq| $button1 + | . $locale->text('Bis') . qq| $button2 @@ -1420,53 +859,38 @@ sub search { - - + + $delivered - + - - + + - + - - - + + + - - + + - - + + - - + +
- -
- | . $locale->text('ID') . qq| | . $locale->text('ID') . qq| $ordlabel | - . $locale->text('Date') . qq| | - . $locale->text('Required by') . qq| | . $locale->text('Date') . qq| | . $locale->text('Required by') . qq|
$vc_label $employee | - . $locale->text('Ship via') . qq| | . $locale->text('Ship via') . qq|
| - . $locale->text('Amount') . qq| | - . $locale->text('Tax') . qq| | - . $locale->text('Total') . qq| | . $locale->text('Amount') . qq| | . $locale->text('Tax') . qq| | . $locale->text('Total') . qq|
| - . $locale->text('Ertrag') . qq| | - . $locale->text('Ertrag prozentual') . qq| | . $locale->text('Ertrag') . qq| | . $locale->text('Ertrag prozentual') . qq|
| - . $locale->text('Project Number') . qq| | - . $locale->text('Transaction description') . qq| | . $locale->text('Project Number') . qq| | . $locale->text('Transaction description') . qq|
| - . $locale->text('Subtotal') . qq| | - . $locale->text('Salesman') . qq| | . $locale->text('Subtotal') . qq| | . $locale->text('Salesman') . qq|
@@ -2535,3 +1959,249 @@ sub yes { sub no { call_sub($form->{no_nextsub}); } + +###################################################################################################### +# IO ENTKOPPLUNG +# ############################################################################################### +sub display_form { + $lxdebug->enter_sub(); + + $form->{"taxaccounts"} =~ s/\s*$//; + $form->{"taxaccounts"} =~ s/^\s*//; + foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) { + map({ delete($form->{"${accno}_${_}"}); } qw(rate description taxnumber)); + } + $form->{"taxaccounts"} = ""; + + for my $i (1 .. $form->{"rowcount"}) { + IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1) if $form->{"id_$i"}; + } + + $form->{rowcount}++; + $form->{"project_id_$form->{rowcount}"} = $form->{globalproject_id}; + + $form->language_payment(\%myconfig); + + Common::webdav_folder($form) if ($webdav); + + &form_header; + + # create rows + display_row($form->{rowcount}) if $form->{rowcount}; + + &form_footer; + + $lxdebug->leave_sub(); +} + +sub display_row { + $lxdebug->enter_sub(); + my $numrows = shift; + + # column_index + my @header_sort = qw(runningnumber partnumber description ship qty unit sellprice_pg sellprice discount linetotal); + my @HEADER = ( + { id => 'runningnumber', width => 5, value => $locale->text('No.'), display => 1, }, + { id => 'partnumber', width => 12, value => $locale->text('Number'), display => 1, }, + { id => 'description', width => 30, value => $locale->text('Part Description'), display => 1, }, + { id => 'ship', width => 5, value => ($form->{type} eq 'purchase_order' ? $locale->text('Ship rcvd') : $locale->text('Ship')), + display => $form->{type} =~ /sales_order/ || ($form->{type} =~ /purchase_order/ && !($lizenzen && $form->{vc} eq "customer")) , }, + { id => 'qty', width => 5, value => $locale->text('Qty'), display => 1, }, + { id => 'unit', width => 5, value => $locale->text('Unit'), display => 1, }, + { id => 'license', width => 10, value => $locale->text('License'), display => 0, }, + { id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, }, + { id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, }, + { id => 'sellprice', width => 15, value => $locale->text('Price'), display => 1, }, + { id => 'sellprice_pg', width => 15, value => $locale->text('Pricegroup'), display => $form->{type} =~ /^sales_/, }, + { id => 'discount', width => undef, value => $locale->text('Discount'), display => $form->{vc} eq 'customer', }, + { id => 'linetotal', width => 10, value => $locale->text('Extended'), display => 1, }, + { id => 'bin', width => 10, value => $locale->text('Bin'), display => 0, }, + ); + my @column_index = map { $_->{id} } grep { $_->{display} } @HEADER; + + # cache units + my $dimension_units = AM->retrieve_units(\%myconfig, $form, "dimension"); + my $service_units = AM->retrieve_units(\%myconfig, $form, "service"); + my $all_units = AM->retrieve_units(\%myconfig, $form); + + my $colspan = scalar @column_index; + + $form->{invsubtotal} = 0; + map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts})); + + # about details + $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details})); + $form->{show_details} = $myconfig{show_form_details} unless (defined($form->{show_details})); + # /about details + + # translations, unused commented out +# $runningnumber = $locale->text('No.'); + $deliverydate = $locale->text('Delivery Date'); + $serialnumber = $locale->text('Serial No.'); + $projectnumber = $locale->text('Project'); +# $partsgroup = $locale->text('Group'); + $reqdate = $locale->text('Reqdate'); + $deliverydate = $locale->text('Required by'); + + # special alignings + my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal); + + $form->{marge_total} = 0; + $form->{sellprice_total} = 0; + $form->{lastcost_total} = 0; + my %projectnumber_labels = (); + my @projectnumber_values = (""); + + foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { + push(@projectnumber_values, $item->{"id"}); + $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"}; + } + + # rows + for $i (1 .. $numrows) { + + # undo formatting + map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty ship discount sellprice price_new price_old) unless ($form->{simple_save}); + +# unit begin + $form->{"unit_old_$i"} ||= $form->{"unit_$i"}; + $form->{"selected_unit_$i"} ||= $form->{"unit_$i"}; + + my $local_units = $form->{"inventory_accno_$i"} || $form->{"assembly_$i"} ? $dimension_units + : $form->{"id_$i"} ? $service_units + : $all_units; + if ( !$local_units->{$form->{"selected_unit_$i"}} # Die ausgewaehlte Einheit ist fuer diesen Artikel nicht gueltig + || !AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units)) { # (z.B. Dimensionseinheit war ausgewaehlt, es handelt sich aber + $form->{"unit_old_$i"} = $form->{"selected_unit_$i"} = $form->{"unit_$i"}; # um eine Dienstleistung). Dann keinerlei Umrechnung vornehmen. + } + # adjust prices by unit, ignore if pricegroup changed + if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) { + $form->{"sellprice_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1; + $form->{"unit_old_$i"} = $form->{"selected_unit_$i"}; + } + my $this_unit = $form->{"unit_$i"}; + $this_unit = $form->{"selected_unit_$i"} if AM->convert_unit($this_unit, $form->{"selected_unit_$i"}, $all_units); + $this_unit ||= "kg"; + + $column_data{"unit"} = AM->unit_select_html($local_units, "unit_$i", $this_unit, $form->{"id_$i"} ? $form->{"unit_$i"} : undef); +# / unit ending + + $form->{"sellprice_$i"} =~ /\.(\d+)/; + $decimalplaces = max 2, length $1; + + $discount = $form->round_amount($form->{"sellprice_$i"} * $form->{"discount_$i"} / 100, $decimalplaces); + $linetotal = $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces); + $linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2); + + # convert " to " + map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit unit_old); + + $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -size => 5, -value => $i); # HuT + $column_data{partnumber} = $cgi->textfield(-name => "partnumber_$i", -size => 12, -value => $form->{"partnumber_$i"}); + $column_data{description} = ((($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) # if description is too large, use a textbox instead + ? $cgi->textarea( -name => "description_$i", -default => H($form->{"description_$i"}), -rows => $rows, -columns => 30) + : $cgi->textfield(-name => "description_$i", -size => 30, -value => $form->quote($form->{"description_$i"}))) + . $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')"); + + $form->{"qty_$i"} =~ /\.(\d+)/; + my $qty_dec = length $1; + + $column_data{qty} = $cgi->textfield(-name => "qty_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)); + $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)", -value => $locale->text('*/')) + . $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"}) + if $form->{"formel_$i"}; + $column_data{ship} = $cgi->textfield(-name => "ship_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"ship_$i"})); + + # build in drop down list for pricesgroups + if ($form->{"prices_$i"}) { + $column_data{sellprice_pg} = qq||; + $column_data{sellprice} = $cgi->textfield(-name => "sellprice_$i", -size => 10, -onBlur => 'check_right_number_format(this)', -value => + (($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"}) + ? $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces) + : $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces))); + } else { + # for last row and report + # set pricegroup drop down list from report menu + if ($form->{"sellprice_$i"} != 0) { + $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"}; + my $default_option = $form->{"sellprice_$i"}.'--'.$form->{"pricegroup_id_$i"}; + $column_data{sellprice_pg} = NTI($cgi->popup_menu("sellpricepg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' })); + } else { + $column_data{sellprice_pg} = qq| |; + } + $column_data{sellprice} = $cgi->textfield(-name => "sellprice_$i", -size => 10, -onBlur => "check_right_number_format(this)", -value => + $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces)); + } + $column_data{discount} = $cgi->textfield(-name => "discount_$i", -size => 3, -value => $form->format_amount(\%myconfig, $form->{"discount_$i"})); + $column_data{linetotal} = $form->format_amount(\%myconfig, $linetotal, 2); + $column_data{bin} = $form->{"bin_$i"}; + + my @ROW1 = map { value => $column_data{$_}, align => $align{$_} }, @column_index; + + # second row + my @ROW2 = (); + push @ROW2, { value => qq|$serialnumber | } + if $form->{type} !~ /_quotation/; + push @ROW2, { value => qq|$projectnumber | . NTI($cgi->popup_menu('-name' => "project_id_$i", '-values' => \@projectnumber_values, + '-labels' => \%projectnumber_labels, '-default' => $form->{"project_id_$i"})) }; + push @ROW2, { value => qq|$reqdate | } + if $form->{type} =~ /order/; + push @ROW2, { value => sprintf qq|%s |, + $locale->text('Subtotal'), $form->{"subtotal_$i"} ? 'checked' : '' }; + +# begin marge calculations + my $marge_color; + my $real_sellprice = $form->{"sellprice_$i"} - $discount; + + $form->{"lastcost_$i"} *= 1; + $form->{"marge_percent_$i"} = 0; + + if ($real_sellprice && ($form->{"qty_$i"} * 1)) { + $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * 100 / $real_sellprice; + $myconfig{marge_percent_warn} ||= 15; + $marge_color = 'color="#ff0000"' if $form->{"id_$i"} && ($form->{"marge_percent_$i"} < (1 * $myconfig{marge_percent_warn})); + } + + my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1; + $form->{"marge_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"} * $marge_adjust_credit_note; + $form->{"marge_total"} += $form->{"marge_absolut_$i"}; + $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"}; + $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"}; + + map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent); + + push @ROW2, { value => sprintf qq|%s %s  %s%%  %s %s  %s %s|, + $marge_color, $locale->text('Ertrag'),$form->{"marge_absolut_$i"}, $form->{"marge_percent_$i"}, + $locale->text('LP'), $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2), + $locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) } + if $form->{"id_$i"} && $form->{type} =~ /^sales_/; +# / marge calculations ending + + my @HIDDENS = map { value => $_}, ( + $cgi->hidden("-name" => "unit_old_$i", "-value" => $form->{"selected_unit_$i"}), + $cgi->hidden("-name" => "price_new_$i", "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"})), + map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" } + qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes + income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber + longdescription basefactor marge_absolut marge_percent lastcost) + ); + + map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"})); + + $form->{invsubtotal} += $linetotal; + + push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, }; + } + + print $form->parse_html_template('oe/sales_order', { ROWS => \@ROWS, + HEADER => \@HEADER, + show_details_checked => ($form->{show_details} ? "checked" : ""), + show_details_new => !$form->{show_details}, + }); + + if (0 != ($form->{sellprice_total} * 1)) { + $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100; + } + + $lxdebug->leave_sub(); +} diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 731c3cbcf..1a2999bde 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -1443,7 +1443,7 @@ sub aging { if ($form->{arap} eq 'ar') { $raw_top_info_text = $form->parse_html_template('rp/aging_ar_top'); $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx, - 'PRINT_OPTIONS' => print_options(1), }); + 'PRINT_OPTIONS' => print_options(inline => 1), }); $report->set_options('raw_top_info_text' => $raw_top_info_text, 'raw_bottom_info_text' => $raw_bottom_info_text); } diff --git a/locale/de/all b/locale/de/all index 20100dea1..89c61e21d 100644 --- a/locale/de/all +++ b/locale/de/all @@ -725,6 +725,7 @@ aktualisieren wollen?', 'Monat' => 'Monat', 'Monthly' => 'monatlich', 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.', + 'Motiv' => 'Motiv', 'Multibyte Encoding' => 'Schriftsatz', 'MwSt. inkl.' => 'MwSt. inkl.', 'Name' => 'Name', diff --git a/locale/de/dn b/locale/de/dn index b91132790..96e9e0b2e 100644 --- a/locale/de/dn +++ b/locale/de/dn @@ -1,6 +1,5 @@ $self->{texts} = { ' Date missing!' => ' Datum fehlt!', - '*/' => '*/', 'ADDED' => 'Hinzugefügt', 'Add Purchase Order' => 'Lieferantenauftrag erfassen', 'Add Quotation' => 'Angebot erfassen', @@ -17,7 +16,6 @@ $self->{texts} = { 'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung für Gebühren und Zinsen zu Mahnung %s', 'Bcc' => 'Bcc', 'Billing Address' => 'Rechnungsadresse', - 'Bin' => 'Lagerplatz', 'Bin List' => 'Lagerliste', 'CANCELED' => 'Storniert', 'CSV export -- options' => 'CSV-Export -- Optionen', @@ -46,12 +44,10 @@ $self->{texts} = { 'Date' => 'Datum', 'Dec' => 'Dez', 'December' => 'Dezember', - 'Delivery Date' => 'Lieferdatum', 'Department' => 'Abteilung', 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:', 'Description' => 'Beschreibung', 'Directory' => 'Verzeichnis', - 'Discount' => 'Rabatt', 'Dunning Date' => 'Mahndatum', 'Dunning Description missing in row ' => 'Mahnstufenbeschreibung fehlt in Zeile ', 'Dunning Duedate' => 'Zahlbar bis', @@ -62,19 +58,15 @@ $self->{texts} = { 'Dunning overview' => 'Mahnungsübersicht', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'EK' => 'EK', 'ELSE' => 'Zusatz', 'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten', 'Enter longdescription' => 'Langtext eingeben', 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s', - 'Ertrag' => 'Ertrag', - 'Extended' => 'Gesamt', 'Falsches Datumsformat!' => 'Falsches Datumsformat!', 'Fax' => 'Fax', 'Feb' => 'Feb', 'February' => 'Februar', 'File' => 'Datei', - 'Group' => 'Warengruppe', 'History' => 'Historie', 'In-line' => 'im Text', 'Interest' => 'Zinsen', @@ -84,16 +76,12 @@ $self->{texts} = { 'Invoice Date missing!' => 'Rechnungsdatum fehlt!', 'Invoice Duedate' => 'Fälligkeitsdatum', 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', - 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', 'Jul' => 'Jul', 'July' => 'Juli', 'Jun' => 'Jun', 'June' => 'Juni', - 'L' => 'L', - 'LP' => 'LP', - 'License' => 'Lizenz', 'MAILED' => 'Gesendet', 'Mar' => 'März', 'March' => 'März', @@ -115,7 +103,6 @@ $self->{texts} = { 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.', 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.', 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.', - 'No.' => 'Position', 'Nov' => 'Nov', 'November' => 'November', 'Number' => 'Nummer', @@ -135,7 +122,6 @@ $self->{texts} = { 'Packing List' => 'Lieferschein', 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!', 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!', - 'Part' => 'Ware', 'Part Description' => 'Artikelbeschreibung', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', @@ -145,11 +131,9 @@ $self->{texts} = { 'Please enter values' => 'Bitte Werte eingeben', 'Postscript' => 'Postscript', 'Price' => 'Preis', - 'Pricegroup' => 'Preisgruppe', 'Print dunnings' => 'Mahnungen drucken', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', - 'Project' => 'Projekt', 'Project Number' => 'Projektnummer', 'Project description' => 'Projektbeschreibung', 'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!', @@ -160,8 +144,6 @@ $self->{texts} = { 'Quotation Date missing!' => 'Angebotsdatum fehlt!', 'Quotation Number missing!' => 'Angebotsnummer fehlt!', 'RFQ' => 'Anfrage', - 'Reqdate' => 'Lieferdatum', - 'Required by' => 'Lieferdatum', 'SAVED' => 'Gespeichert', 'SAVED FOR DUNNING' => 'Gespeichert', 'SCREENED' => 'Angezeigt', @@ -177,20 +159,14 @@ $self->{texts} = { 'Select postscript or PDF!' => 'Postscript oder PDF auswählen!', 'Sep' => 'Sep', 'September' => 'September', - 'Serial No.' => 'Seriennummer', - 'Service' => 'Dienstleistung', 'Set eMail text' => 'eMail Text eingeben', - 'Ship' => 'Lagerausgang', - 'Ship rcvd' => 'Lagereingang', 'Ship to' => 'Lieferadresse', 'Shipping Address' => 'Lieferadresse', - 'Show details' => 'Details anzeigen', 'Start Dunning Process' => 'Mahnprozess starten', 'Storno Invoice' => 'Stornorechnung', 'Storno Packing List' => 'Stornolieferschein', 'Street' => 'Straße', 'Subject' => 'Betreff', - 'Subtotal' => 'Zwischensumme', 'Terms missing in row ' => '+Tage fehlen in Zeile ', 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.', 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', @@ -206,7 +182,6 @@ $self->{texts} = { 'Vendor details' => 'Lieferantendetails', 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', - 'What type of item is this?' => 'Was ist dieser Artikel?', 'Zipcode' => 'PLZ', '[email]' => '[email]', 'bin_list' => 'Lagerliste', @@ -248,8 +223,6 @@ $self->{subs} = { 'continue' => 'continue', 'customer_details' => 'customer_details', 'delivery_customer_selection' => 'delivery_customer_selection', - 'display_form' => 'display_form', - 'display_row' => 'display_row', 'edit_config' => 'edit_config', 'edit_e_mail' => 'edit_e_mail', 'employee_selection_internal' => 'employee_selection_internal', diff --git a/locale/de/ic b/locale/de/ic index 4e1d08e6d..2234ef276 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -101,7 +101,6 @@ aktualisieren wollen?', 'Invoice Number' => 'Rechnungsnummer', 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', 'Item deleted!' => 'Artikel gelöscht!', - 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', 'Jul' => 'Jul', @@ -168,7 +167,6 @@ aktualisieren wollen?', 'Packing List' => 'Lieferschein', 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!', 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!', - 'Part' => 'Ware', 'Part Description' => 'Artikelbeschreibung', 'Part Description missing!' => 'Artikelbezeichnung fehlt!', 'Part Number' => 'Artikelnummer', @@ -223,7 +221,6 @@ aktualisieren wollen?', 'September' => 'September', 'Serial No.' => 'Seriennummer', 'Serial Number' => 'Seriennummer', - 'Service' => 'Dienstleistung', 'Service Number missing!' => 'Dienstleistungsnummer fehlt!', 'Services' => 'Dienstleistungen', 'Set Language Values' => 'Spracheinstellungen', @@ -265,7 +262,6 @@ aktualisieren wollen?', 'Vendor details' => 'Lieferantendetails', 'Verrechnungseinheit' => 'Verrechnungseinheit', 'Weight' => 'Gewicht', - 'What type of item is this?' => 'Was ist dieser Artikel?', 'Zipcode' => 'PLZ', '[email]' => '[email]', 'assembly_list' => 'erzeugnisliste', diff --git a/locale/de/io b/locale/de/io index 9ae059122..418d1c34a 100644 --- a/locale/de/io +++ b/locale/de/io @@ -57,7 +57,6 @@ $self->{texts} = { 'Invoice' => 'Rechnung', 'Invoice Date missing!' => 'Rechnungsdatum fehlt!', 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', - 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', 'Jul' => 'Jul', @@ -106,7 +105,6 @@ $self->{texts} = { 'Packing List' => 'Lieferschein', 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!', 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!', - 'Part' => 'Ware', 'Part Description' => 'Artikelbeschreibung', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', @@ -143,7 +141,6 @@ $self->{texts} = { 'Sep' => 'Sep', 'September' => 'September', 'Serial No.' => 'Seriennummer', - 'Service' => 'Dienstleistung', 'Ship' => 'Lagerausgang', 'Ship rcvd' => 'Lagereingang', 'Ship to' => 'Lieferadresse', @@ -163,7 +160,6 @@ $self->{texts} = { 'Variable' => 'Variable', 'Vendor Number' => 'Lieferantennummer', 'Vendor details' => 'Lieferantendetails', - 'What type of item is this?' => 'Was ist dieser Artikel?', 'Zipcode' => 'PLZ', '[email]' => '[email]', 'bin_list' => 'Lagerliste', diff --git a/locale/de/ir b/locale/de/ir index b94aa8d08..48a51d408 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -90,7 +90,6 @@ $self->{texts} = { 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', 'Invoice deleted!' => 'Rechnung gelöscht!', 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.', - 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', 'Jul' => 'Jul', @@ -144,7 +143,6 @@ $self->{texts} = { 'Packing List' => 'Lieferschein', 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!', 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!', - 'Part' => 'Ware', 'Part Description' => 'Artikelbeschreibung', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', @@ -194,7 +192,6 @@ $self->{texts} = { 'Sep' => 'Sep', 'September' => 'September', 'Serial No.' => 'Seriennummer', - 'Service' => 'Dienstleistung', 'Ship' => 'Lagerausgang', 'Ship rcvd' => 'Lagereingang', 'Ship to' => 'Lieferadresse', @@ -226,7 +223,6 @@ $self->{texts} = { 'Vendor missing!' => 'Lieferant fehlt!', 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', - 'What type of item is this?' => 'Was ist dieser Artikel?', 'Yes' => 'Ja', 'Zipcode' => 'PLZ', '[email]' => '[email]', diff --git a/locale/de/is b/locale/de/is index 1dda438cf..c7b78c293 100644 --- a/locale/de/is +++ b/locale/de/is @@ -107,7 +107,6 @@ $self->{texts} = { 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', 'Invoice deleted!' => 'Rechnung gelöscht!', 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.', - 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', 'Jul' => 'Jul', @@ -163,7 +162,6 @@ $self->{texts} = { 'Packing List' => 'Lieferschein', 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!', 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!', - 'Part' => 'Ware', 'Part Description' => 'Artikelbeschreibung', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', @@ -218,7 +216,6 @@ $self->{texts} = { 'Sep' => 'Sep', 'September' => 'September', 'Serial No.' => 'Seriennummer', - 'Service' => 'Dienstleistung', 'Ship' => 'Lagerausgang', 'Ship rcvd' => 'Lagereingang', 'Ship to' => 'Lieferadresse', @@ -252,7 +249,6 @@ $self->{texts} = { 'Vendor details' => 'Lieferantendetails', 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', - 'What type of item is this?' => 'Was ist dieser Artikel?', 'Yes' => 'Ja', 'Zipcode' => 'PLZ', '[email]' => '[email]', diff --git a/locale/de/oe b/locale/de/oe index 0c2393c0f..110352888 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -32,8 +32,6 @@ $self->{texts} = { 'Cannot save order!' => 'Auftrag kann nicht gespeichert werden!', 'Cannot save quotation!' => 'Angebot kann nicht gespeichert werden!', 'Cc' => 'Cc', - 'Choose Customer' => 'Endkunde wählen:', - 'Choose Vendor' => 'Händler wählen', 'City' => 'Stadt', 'Closed' => 'Geschlossen', 'Collective Orders only work for orders from one customer!' => 'Sammelaufträge funktionieren nur für Aufträge von einem Kunden!', @@ -41,21 +39,18 @@ $self->{texts} = { 'Confirm!' => 'Bestätigen Sie!', 'Confirmation' => 'Auftragsbestätigung', 'Contact' => 'Kontakt', - 'Contact Person' => 'Ansprechpartner', 'Continue' => 'Weiter', 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.', 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.', 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.', 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.', 'Country' => 'Land', - 'Credit Limit' => 'Kreditlimit', 'Credit Limit exceeded!!!' => 'Kreditlimit überschritten!', 'Credit Note' => 'Gutschrift', 'Curr' => 'Währung', 'Currency' => 'Währung', 'Customer' => 'Kunde', 'Customer Number' => 'Kundennummer', - 'Customer Order Number' => 'Bestellnummer des Kunden', 'Customer details' => 'Kundendetails', 'Customer missing!' => 'Kundenname fehlt!', 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.', @@ -67,7 +62,6 @@ $self->{texts} = { 'Date' => 'Datum', 'Dec' => 'Dez', 'December' => 'Dezember', - 'Delete' => 'Löschen', 'Delivered' => 'Geliefert', 'Delivery Date' => 'Lieferdatum', 'Department' => 'Abteilung', @@ -75,7 +69,6 @@ $self->{texts} = { 'Description' => 'Beschreibung', 'Directory' => 'Verzeichnis', 'Discount' => 'Rabatt', - 'Dunning Amount' => 'gemahnter Betrag', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', 'EK' => 'EK', @@ -107,11 +100,9 @@ $self->{texts} = { 'ID' => 'Buchungsnummer', 'In-line' => 'im Text', 'Include in Report' => 'In Bericht aufnehmen', - 'Internal Notes' => 'interne Bemerkungen', 'Invoice' => 'Rechnung', 'Invoice Date missing!' => 'Rechnungsdatum fehlt!', 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', - 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', 'Jul' => 'Jul', @@ -126,7 +117,6 @@ $self->{texts} = { 'March' => 'März', 'Mark as paid?' => 'Als bezahlt markieren?', 'Marked as paid' => 'Als bezahlt markiert', - 'Max. Dunning Level' => 'höchste Mahnstufe', 'May' => 'Mai', 'May ' => 'Mai', 'Message' => 'Nachricht', @@ -155,7 +145,6 @@ $self->{texts} = { 'Open' => 'Offen', 'OpenDocument/OASIS' => 'OpenDocument/OASIS', 'Order' => 'Auftrag', - 'Order Date' => 'Auftragsdatum', 'Order Date missing!' => 'Auftragsdatum fehlt!', 'Order Number' => 'Auftragsnummer', 'Order Number missing!' => 'Auftragsnummer fehlt!', @@ -170,18 +159,15 @@ $self->{texts} = { 'Packing List' => 'Lieferschein', 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!', 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!', - 'Part' => 'Ware', 'Part Description' => 'Artikelbeschreibung', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', - 'Payment Terms' => 'Zahlungskonditionen', 'Phone' => 'Telefon', 'Pick List' => 'Sammelliste', 'Please enter values' => 'Bitte Werte eingeben', 'Postscript' => 'Postscript', 'Price' => 'Preis', 'Pricegroup' => 'Preisgruppe', - 'Print' => 'Drucken', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -193,7 +179,6 @@ $self->{texts} = { 'Qty' => 'Menge', 'Queue' => 'Warteschlange', 'Quotation' => 'Angebot', - 'Quotation Date' => 'Angebotsdatum', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', 'Quotation Number' => 'Angebotsnummer', 'Quotation Number missing!' => 'Angebotsnummer fehlt!', @@ -201,7 +186,6 @@ $self->{texts} = { 'Quotations' => 'Angebote', 'RFQ' => 'Anfrage', 'RFQ Number' => 'Anfragenummer', - 'Remaining' => 'Rest', 'Reqdate' => 'Lieferdatum', 'Request for Quotation' => 'Anfrage', 'Request for Quotations' => 'Anfragen', @@ -212,10 +196,6 @@ $self->{texts} = { 'Sales Order' => 'Kundenauftrag', 'Sales Orders' => 'Aufträge', 'Salesman' => 'Verkäufer/in', - 'Salesperson' => 'Verkäufer', - 'Save' => 'Speichern', - 'Save and Close' => 'Speichern und schließen', - 'Save as new' => 'als neu speichern', 'Screen' => 'Bildschirm', 'Select a Customer' => 'Endkunde auswählen', 'Select a part' => 'Artikel auswählen', @@ -228,33 +208,25 @@ $self->{texts} = { 'Sep' => 'Sep', 'September' => 'September', 'Serial No.' => 'Seriennummer', - 'Service' => 'Dienstleistung', 'Ship' => 'Lagerausgang', 'Ship rcvd' => 'Lagereingang', 'Ship to' => 'Lieferadresse', 'Ship via' => 'Transportmittel', 'Shipping Address' => 'Lieferadresse', - 'Shipping Point' => 'Versandort', - 'Show details' => 'Details anzeigen', - 'Steuersatz' => 'Steuersatz', 'Storno Invoice' => 'Stornorechnung', 'Storno Packing List' => 'Stornolieferschein', 'Street' => 'Straße', 'Subject' => 'Betreff', 'Subtotal' => 'Zwischensumme', 'Tax' => 'Steuer', - 'Tax Included' => 'Steuer im Preis inbegriffen', 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.', 'The list has been printed.' => 'Die Liste wurde ausgedruckt.', 'To (email)' => 'An', 'Total' => 'Summe', - 'Trade Discount' => 'Rabatt', 'Transaction description' => 'Vorgangsbezeichnung', 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.', 'Unit' => 'Einheit', 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.', - 'Update' => 'Erneuern', - 'Valid until' => 'gültig bis', 'Value' => 'Wert', 'Variable' => 'Variable', 'Vendor' => 'Lieferant', @@ -264,7 +236,6 @@ $self->{texts} = { 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', 'Vendor type' => 'Lieferantentyp', - 'What type of item is this?' => 'Was ist dieser Artikel?', 'Workflow purchase_order' => 'Workflow Lieferantenauftrag', 'Workflow request_quotation' => 'Workflow Preisanfrage', 'Workflow sales_order' => 'Workflow Auftrag', @@ -275,7 +246,6 @@ $self->{texts} = { 'bin_list' => 'Lagerliste', 'button' => '?', 'emailed to' => 'gemailt an', - 'history' => 'Historie', 'invoice' => 'Rechnung', 'no' => 'nein', 'none (pricegroup)' => 'keine', -- 2.20.1