From: Moritz Bunkus Date: Thu, 2 Aug 2007 09:04:01 +0000 (+0000) Subject: Preisfatkoren implementiert. X-Git-Tag: release-2.6.0beta1~531 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1e25131315e72036aa6df1d626011a761218d233;p=kivitendo-erp.git Preisfatkoren implementiert. --- diff --git a/SL/AM.pm b/SL/AM.pm index 742a92bb3..bb83c7956 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -2228,6 +2228,77 @@ sub delete_tax { $main::lxdebug->leave_sub(); } +sub save_price_factor { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form) = @_; + + # connect to database + my $dbh = $form->get_standard_dbh($myconfig); + + my $query; + my @values = ($form->{description}, conv_i($form->{factor})); + + if ($form->{id}) { + $query = qq|UPDATE price_factors SET description = ?, factor = ? WHERE id = ?|; + push @values, conv_i($form->{id}); + + } else { + $query = qq|INSERT INTO price_factors (description, factor, sortkey) VALUES (?, ?, (SELECT COALESCE(MAX(sortkey), 0) + 1 FROM price_factors))|; + } + + do_query($form, $dbh, $query, @values); + + $dbh->commit(); + + $main::lxdebug->leave_sub(); +} + +sub get_all_price_factors { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form) = @_; + + # connect to database + my $dbh = $form->get_standard_dbh($myconfig); + + $form->{PRICE_FACTORS} = selectall_hashref_query($form, $dbh, qq|SELECT * FROM price_factors ORDER BY sortkey|); + + $main::lxdebug->leave_sub(); +} + +sub get_price_factor { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form) = @_; + + # connect to database + my $dbh = $form->get_standard_dbh($myconfig); + + my $query = qq|SELECT description, factor, + ((SELECT COUNT(*) FROM parts WHERE price_factor_id = ?) + + (SELECT COUNT(*) FROM invoice WHERE price_factor_id = ?) + + (SELECT COUNT(*) FROM orderitems WHERE price_factor_id = ?)) = 0 AS orphaned + FROM price_factors WHERE id = ?|; + + ($form->{description}, $form->{factor}, $form->{orphaned}) = selectrow_query($form, $dbh, $query, (conv_i($form->{id})) x 4); + + $main::lxdebug->leave_sub(); +} + +sub delete_price_factor { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form) = @_; + + # connect to database + my $dbh = $form->get_standard_dbh($myconfig); + + do_query($form, $dbh, qq|DELETE FROM price_factors WHERE id = ?|, conv_i($form->{id})); + $dbh->commit(); + + $main::lxdebug->leave_sub(); +} 1; diff --git a/SL/Form.pm b/SL/Form.pm index 8c816f729..c4c7951f9 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1876,6 +1876,20 @@ sub _get_departments { $main::lxdebug->leave_sub(); } +sub _get_price_factors { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key ||= "all_price_factors"; + + my $query = qq|SELECT * FROM price_factors ORDER BY sortkey|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $main::lxdebug->leave_sub(); +} + sub get_lists { $main::lxdebug->enter_sub(); @@ -1958,6 +1972,10 @@ sub get_lists { $self->_get_departments($dbh, $params{"departments"}); } + if ($params{price_factors}) { + $self->_get_price_factors($dbh, $params{price_factors}); + } + $main::lxdebug->leave_sub(); } diff --git a/SL/IC.pm b/SL/IC.pm index 78dfc5f93..241ba5870 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -422,7 +422,8 @@ sub save { ean = ?, not_discountable = ?, microfiche = ?, - partsgroup_id = ? + partsgroup_id = ?, + price_factor_id = ? WHERE id = ?|; @values = ($form->{partnumber}, $form->{description}, @@ -451,6 +452,7 @@ sub save { $form->{not_discountable} ? 't' : 'f', $form->{microfiche}, conv_i($partsgroup_id), + conv_i($form->{price_factor_id}), conv_i($form->{id}) ); do_query($form, $dbh, $query, @values); @@ -850,8 +852,9 @@ sub all_parts { # my @inactive_flags = qw(l_subtotal short l_linetotal); my %joins = ( - partsgroup => 'LEFT JOIN partsgroup pg ON p.partsgroup_id = pg.id', - makemodel => 'LEFT JOIN makemodel mm ON mm.parts_id = p.id', + partsgroup => 'LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)', + makemodel => 'LEFT JOIN makemodel mm ON (mm.parts_id = p.id)', + pfac => 'LEFT JOIN price_factors pfac ON (pfac.id = p.price_factor_id)', invoice_oi => q|LEFT JOIN ( SELECT parts_id, description, serialnumber, trans_id, unit, sellprice, qty, assemblyitem, 'invoice' AS ioi FROM invoice UNION @@ -869,12 +872,12 @@ sub all_parts { SELECT id, name, 'vendor' AS cv FROM vendor ) AS cv ON cv.id = apoe.customer_id OR cv.id = apoe.vendor_id|, ); - my @join_order = qw(partsgroup makemodel invoice_oi apoe cv); - my %joins_needed = (0) x scalar keys %joins; + my @join_order = qw(partsgroup makemodel invoice_oi apoe cv pfac); + my %joins_needed; #===== switches and simple filters ========# - my @select_tokens = qw(id); + my @select_tokens = qw(id factor); my @where_tokens = qw(1=1); my @group_tokens = (); @@ -945,6 +948,7 @@ sub all_parts { push @where_tokens, join ' OR ', map { "($_)" } @bsooqr_tokens if $bsooqr; $joins_needed{partsgroup} = 1; + $joins_needed{pfac} = 1; $joins_needed{makemodel} = 1 if grep { $form->{$_} || $form->{"l_$_"} } @makemodel_filters; $joins_needed{cv} = 1 if $bsooqr; $joins_needed{apoe} = 1 if $joins_needed{cv} || grep { $form->{$_} || $form->{"l_$_"} } @apoe_filters; @@ -967,7 +971,7 @@ sub all_parts { if ($form->{l_soldtotal}) { push @where_tokens, 'ioi.qty >= 0'; push @group_tokens, @select_tokens; - push @select_tokens, 'SUM(ioi.qty) AS soldtotal'; + push @select_tokens, 'SUM(ioi.qty)'; } #============= build query ================# @@ -979,17 +983,25 @@ sub all_parts { ordnumber => 'apoe.', make => 'mm.', quonumber => 'apoe.', model => 'mm.', invnumber => 'apoe.', partsgroup => 'pg.', - 'SUM(ioi.qty) AS soldtotal' => ' ', + factor => 'pfac.', + 'SUM(ioi.qty)' => ' ', + ); + + my %renamed_columns = ( + 'factor' => 'price_factor', + 'SUM(ioi.qty)' => 'soldtotal', ); map { $table_prefix{$_} = 'ioi.' } qw(description serialnumber qty unit) if $joins_needed{invoice_oi}; + map { $renamed_columns{$_} = ' AS ' . $renamed_columns{$_} } keys %renamed_columns; - my $select_clause = join ', ', map { ($table_prefix{$_} || "p.") . $_ } @select_tokens; + my $select_clause = join ', ', map { ($table_prefix{$_} || "p.") . $_ . $renamed_columns{$_} } @select_tokens; my $join_clause = join ' ', @joins{ grep $joins_needed{$_}, @join_order }; my $where_clause = join ' AND ', map { "($_)" } @where_tokens; my $group_clause = ' GROUP BY ' . join ', ', map { ($table_prefix{$_} || "p.") . $_ } @group_tokens if scalar @group_tokens; my $query = qq|SELECT DISTINCT $select_clause FROM parts p $join_clause WHERE $where_clause $group_clause $order_clause $limit_clause|; + $form->{parts} = selectall_hashref_query($form, $dbh, $query, @bind_vars); ## my $where = qq|1 = 1|; diff --git a/SL/IR.pm b/SL/IR.pm index ab092de52..656140491 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -82,6 +82,10 @@ sub post_invoice { my $q_item_unit = qq|SELECT unit FROM parts WHERE id = ?|; my $h_item_unit = prepare_query($form, $dbh, $q_item_unit); + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; + my $price_factor; + for my $i (1 .. $form->{rowcount}) { next unless $form->{"id_$i"}; @@ -119,9 +123,11 @@ sub post_invoice { map { $taxrate += $form->{"${_}_rate"} } @taxaccounts; + $price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1; + if ($form->{"inventory_accno_$i"}) { - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2); + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); if ($form->{taxincluded}) { $taxamount = $linetotal * ($taxrate / (1 + $taxrate)); @@ -151,8 +157,8 @@ sub post_invoice { } # add purchase to inventory, this one is without the tax! - $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate}; - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) * $form->{exchangerate}; + $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate} / $price_factor; + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2) * $form->{exchangerate}; $linetotal = $form->round_amount($linetotal, 2); # this is the difference for the inventory @@ -230,9 +236,9 @@ sub post_invoice { $sth->finish(); - } else { + } else { # if ($form->{"inventory_accno_id_$i"}) - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2); + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); if ($form->{taxincluded}) { $taxamount = $linetotal * ($taxrate / (1 + $taxrate)); @@ -258,8 +264,8 @@ sub post_invoice { map { $form->{amount}{ $form->{id} }{$_} -= $taxamount * $form->{"${_}_rate"} / $taxrate } @taxaccounts; } - $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate}; - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) * $form->{exchangerate}; + $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate} / $price_factor; + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2) * $form->{exchangerate}; $linetotal = $form->round_amount($linetotal, 2); # this is the difference for expense @@ -286,13 +292,14 @@ sub post_invoice { $query = qq|INSERT INTO invoice (trans_id, parts_id, description, qty, base_qty, sellprice, fxsellprice, allocated, unit, deliverydate, - project_id, serialnumber) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; + project_id, serialnumber, price_factor_id, price_factor, marge_price_factor) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT factor FROM price_factors WHERE id = ?), ?)|; @values = (conv_i($form->{id}), conv_i($form->{"id_$i"}), $form->{"description_$i"}, $form->{"qty_$i"} * -1, $baseqty * -1, $form->{"sellprice_$i"}, $fxsellprice, $allocated, $form->{"unit_$i"}, conv_date($form->{deliverydate}), - conv_i($form->{"project_id_$i"}), $form->{"serialnumber_$i"}); + conv_i($form->{"project_id_$i"}), $form->{"serialnumber_$i"}, + conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"marge_price_factor_$i"})); do_query($form, $dbh, $query, @values); } @@ -728,7 +735,8 @@ sub retrieve_invoice { c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from AS expense_valid, i.description, i.qty, i.fxsellprice AS sellprice, i.parts_id AS id, i.unit, i.deliverydate, i.project_id, i.serialnumber, - p.partnumber, p.inventory_accno_id AS part_inventory_accno_id, p.bin, pr.projectnumber, pg.partsgroup + i.price_factor_id, i.price_factor, i.marge_price_factor, + p.partnumber, p.inventory_accno_id AS part_inventory_accno_id, p.bin, pr.projectnumber, pg.partsgroup FROM invoice i JOIN parts p ON (i.parts_id = p.id) @@ -947,7 +955,9 @@ sub retrieve_item { p.id, p.partnumber, p.description, p.lastcost AS sellprice, p.listprice, p.unit, p.assembly, p.bin, p.onhand, p.formel, p.notes AS partnotes, p.notes AS longdescription, p.not_discountable, - p.inventory_accno_id, + p.inventory_accno_id, p.price_factor_id, + + pfac.factor AS price_factor, c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, @@ -977,6 +987,7 @@ sub retrieve_item { FROM buchungsgruppen WHERE id = p.buchungsgruppen_id) = c3.id) LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id) + LEFT JOIN price_factors pfac ON (pfac.id = p.price_factor_id) WHERE $where|; my $sth = prepare_execute_query($form, $dbh, $query, @values); diff --git a/SL/IS.pm b/SL/IS.pm index 8947fe9bc..e559286d2 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -60,6 +60,15 @@ sub invoice_details { push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"}); + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + my %price_factors; + + foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) { + $price_factors{$pfac->{id}} = $pfac; + $pfac->{factor} *= 1; + $pfac->{formatted_factor} = $form->format_amount($myconfig, $pfac->{factor}); + } + # sort items by partsgroup for $i (1 .. $form->{rowcount}) { $partsgroup = ""; @@ -123,7 +132,8 @@ sub invoice_details { deliverydate_oe ordnumber_oe transdate_oe licensenumber validuntil partnotes serialnumber reqdate sellprice listprice netprice discount p_discount discount_sub nodiscount_sub - linetotal nodiscount_linetotal tax_rate projectnumber); + linetotal nodiscount_linetotal tax_rate projectnumber + price_factor price_factor_name); my @tax_arrays = qw(taxbase tax taxdescription taxrate taxnumber); @@ -157,21 +167,25 @@ sub invoice_details { $position++; } - push @{ $form->{runningnumber} }, $position; - push @{ $form->{number} }, $form->{"partnumber_$i"}; - push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; - push @{ $form->{bin} }, $form->{"bin_$i"}; - push @{ $form->{"partnotes"} }, $form->{"partnotes_$i"}; - push @{ $form->{description} }, $form->{"description_$i"}; - push @{ $form->{longdescription} }, $form->{"longdescription_$i"}; - push @{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"}); - push @{ $form->{unit} }, $form->{"unit_$i"}; - push @{ $form->{deliverydate_oe} }, $form->{"deliverydate_$i"}; - push @{ $form->{sellprice} }, $form->{"sellprice_$i"}; - push @{ $form->{ordnumber_oe} }, $form->{"ordnumber_$i"}; - push @{ $form->{transdate_oe} }, $form->{"transdate_$i"}; - push @{ $form->{invnumber} }, $form->{"invnumber"}; - push @{ $form->{invdate} }, $form->{"invdate"}; + my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || { 'factor' => 1 }; + + push @{ $form->{runningnumber} }, $position; + push @{ $form->{number} }, $form->{"partnumber_$i"}; + push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; + push @{ $form->{bin} }, $form->{"bin_$i"}; + push @{ $form->{"partnotes"} }, $form->{"partnotes_$i"}; + push @{ $form->{description} }, $form->{"description_$i"}; + push @{ $form->{longdescription} }, $form->{"longdescription_$i"}; + push @{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"}); + push @{ $form->{unit} }, $form->{"unit_$i"}; + push @{ $form->{deliverydate_oe} }, $form->{"deliverydate_$i"}; + push @{ $form->{sellprice} }, $form->{"sellprice_$i"}; + push @{ $form->{ordnumber_oe} }, $form->{"ordnumber_$i"}; + push @{ $form->{transdate_oe} }, $form->{"transdate_$i"}; + push @{ $form->{invnumber} }, $form->{"invnumber"}; + push @{ $form->{invdate} }, $form->{"invdate"}; + push @{ $form->{price_factor} }, $price_factor->{formatted_factor}; + push @{ $form->{price_factor_name} }, $price_factor->{description}; if ($form->{lizenzen}) { if ($form->{"licensenumber_$i"}) { @@ -193,9 +207,9 @@ sub invoice_details { my ($dec) = ($sellprice =~ /\.(\d+)/); my $decimalplaces = max 2, length($dec); - my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100, $decimalplaces); - my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100, 2); - my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice, 2); + my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100 / $price_factor->{factor}, $decimalplaces); + my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100 / $price_factor->{factor}, 2); + my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2); $form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); push @{ $form->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : ''; @@ -517,6 +531,10 @@ sub post_invoice { my %baseunits; + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; + my $price_factor; + foreach my $i (1 .. $form->{rowcount}) { if ($form->{type} eq "credit_note") { $form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}) * -1; @@ -577,7 +595,8 @@ sub post_invoice { $form->{"sellprice_$i"} = $fxsellprice * (1 - $form->{"discount_$i"}); # round linetotal to 2 decimal places - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2); + $price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1; + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); if ($form->{taxincluded}) { $taxamount = $linetotal * ($taxrate / (1 + $taxrate)); @@ -597,12 +616,9 @@ sub post_invoice { } # add amount to income, $form->{amount}{trans_id}{accno} - $amount = - $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate}; + $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate} / $price_factor; - $linetotal = - $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) * - $form->{exchangerate}; + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2) * $form->{exchangerate}; $linetotal = $form->round_amount($linetotal, 2); # this is the difference from the inventory @@ -662,8 +678,10 @@ sub post_invoice { sellprice, fxsellprice, discount, allocated, assemblyitem, unit, deliverydate, project_id, serialnumber, pricegroup_id, ordnumber, transdate, cusordnumber, base_qty, subtotal, - marge_percent, marge_total, lastcost) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; + marge_percent, marge_total, lastcost, + price_factor_id, price_factor, marge_price_factor) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + (SELECT factor FROM price_factors WHERE id = ?), ?)|; @values = (conv_i($form->{id}), conv_i($form->{"id_$i"}), $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"}, @@ -674,7 +692,9 @@ sub post_invoice { $form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}), $form->{"cusordnumber_$i"}, $baseqty, $form->{"subtotal_$i"} ? 't' : 'f', $form->{"marge_percent_$i"}, $form->{"marge_absolut_$i"}, - $form->{"lastcost_$i"}); + $form->{"lastcost_$i"}, + conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), + conv_i($form->{"marge_price_factor_$i"})); do_query($form, $dbh, $query, @values); if ($form->{lizenzen} && $form->{"licensenumber_$i"}) { @@ -1387,6 +1407,7 @@ sub retrieve_invoice { i.description, i.longdescription, i.qty, i.fxsellprice AS sellprice, i.discount, i.parts_id AS id, i.unit, i.deliverydate, i.project_id, i.serialnumber, i.id AS invoice_pos, i.pricegroup_id, i.ordnumber, i.transdate, i.cusordnumber, i.subtotal, i.lastcost, + i.price_factor_id, i.price_factor, i.marge_price_factor, p.partnumber, p.assembly, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, p.formel, pr.projectnumber, pg.partsgroup, prg.pricegroup @@ -1687,6 +1708,9 @@ sub retrieve_item { p.unit, p.assembly, p.bin, p.onhand, p.notes AS partnotes, p.notes AS longdescription, p.not_discountable, p.formel, p.payment_id AS part_payment_id, + p.price_factor_id, + + pfac.factor AS price_factor, pg.partsgroup @@ -1704,6 +1728,7 @@ sub retrieve_item { FROM buchungsgruppen WHERE id = p.buchungsgruppen_id) = c3.id) LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id) + LEFT JOIN price_factors pfac ON (pfac.id = p.price_factor_id) WHERE $where|; my $sth = prepare_execute_query($form, $dbh, $query, @values); diff --git a/SL/OE.pm b/SL/OE.pm index b61ffb61a..4f84b50a7 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -230,6 +230,10 @@ sub save { my %taxaccounts; my $netamount = 0; + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; + my $price_factor; + for my $i (1 .. $form->{rowcount}) { map({ $form->{"${_}_$i"} = @@ -275,8 +279,8 @@ sub save { $form->{"inventory_accno_$i"} *= 1; $form->{"expense_accno_$i"} *= 1; - $linetotal = - $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2); + $price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1; + $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); @taxaccounts = split(/ /, $form->{"taxaccounts_$i"}); $taxrate = 0; @@ -324,7 +328,7 @@ sub save { } } - $netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"}; + $netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor; $reqdate = ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef; @@ -342,13 +346,14 @@ sub save { $query .= qq|trans_id, parts_id, description, longdescription, qty, base_qty, | . qq|sellprice, discount, unit, reqdate, project_id, serialnumber, ship, | . qq|pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, | . - qq|marge_percent, marge_total, lastcost) | . + qq|marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor) | . qq|VALUES (|; if($form->{"orderitems_id_$i"}) { $query .= qq|?,|; push(@values, $form->{"orderitems_id_$i"}); } - $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; + $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + (SELECT factor FROM price_factors WHERE id = ?), ?)|; push(@values, conv_i($form->{id}), conv_i($form->{"id_$i"}), $form->{"description_$i"}, $form->{"longdescription_$i"}, @@ -359,7 +364,9 @@ sub save { $form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}), $form->{"cusordnumber_$i"}, $form->{"subtotal_$i"} ? 't' : 'f', $form->{"marge_percent_$i"}, $form->{"marge_absolut_$i"}, - $form->{"lastcost_$i"}); + $form->{"lastcost_$i"}, + conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}), + conv_i($form->{"marge_price_factor_$i"})); do_query($form, $dbh, $query, @values); $form->{"sellprice_$i"} = $fxsellprice; @@ -724,6 +731,7 @@ sub retrieve { o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, o.reqdate, o.project_id, o.serialnumber, o.ship, o.lastcost, o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription, + o.price_factor_id, o.price_factor, o.marge_price_factor, pr.projectnumber, p.formel, pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup FROM orderitems o @@ -873,6 +881,15 @@ sub order_details { push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"}); + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + my %price_factors; + + foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) { + $price_factors{$pfac->{id}} = $pfac; + $pfac->{factor} *= 1; + $pfac->{formatted_factor} = $form->format_amount($myconfig, $pfac->{factor}); + } + # sort items by partsgroup for $i (1 .. $form->{rowcount}) { $partsgroup = ""; @@ -900,7 +917,8 @@ sub order_details { qw(runningnumber number description longdescription qty ship unit bin partnotes serialnumber reqdate sellprice listprice netprice discount p_discount discount_sub nodiscount_sub - linetotal nodiscount_linetotal tax_rate projectnumber); + linetotal nodiscount_linetotal tax_rate projectnumber + price_factor price_factor_name); my $sameitem = ""; foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) { @@ -933,27 +951,31 @@ sub order_details { $position++; } - push @{ $form->{runningnumber} }, $position; - push @{ $form->{number} }, $form->{"partnumber_$i"}; - push @{ $form->{description} }, $form->{"description_$i"}; - push @{ $form->{longdescription} }, $form->{"longdescription_$i"}; - push @{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"}); - push @{ $form->{ship} }, $form->format_amount($myconfig, $form->{"ship_$i"}); - push @{ $form->{unit} }, $form->{"unit_$i"}; - push @{ $form->{bin} }, $form->{"bin_$i"}; - push @{ $form->{partnotes} }, $form->{"partnotes_$i"}; - push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; - push @{ $form->{reqdate} }, $form->{"reqdate_$i"}; - push @{ $form->{sellprice} }, $form->{"sellprice_$i"}; - push @{ $form->{listprice} }, $form->{"listprice_$i"}; + my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || { 'factor' => 1 }; + + push @{ $form->{runningnumber} }, $position; + push @{ $form->{number} }, $form->{"partnumber_$i"}; + push @{ $form->{description} }, $form->{"description_$i"}; + push @{ $form->{longdescription} }, $form->{"longdescription_$i"}; + push @{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"}); + push @{ $form->{ship} }, $form->format_amount($myconfig, $form->{"ship_$i"}); + push @{ $form->{unit} }, $form->{"unit_$i"}; + push @{ $form->{bin} }, $form->{"bin_$i"}; + push @{ $form->{partnotes} }, $form->{"partnotes_$i"}; + push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; + push @{ $form->{reqdate} }, $form->{"reqdate_$i"}; + push @{ $form->{sellprice} }, $form->{"sellprice_$i"}; + push @{ $form->{listprice} }, $form->{"listprice_$i"}; + push @{ $form->{price_factor} }, $price_factor->{formatted_factor}; + push @{ $form->{price_factor_name} }, $price_factor->{description}; my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); my ($dec) = ($sellprice =~ /\.(\d+)/); my $decimalplaces = max 2, length($dec); - my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100, $decimalplaces); - my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100, 2); - my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice, 2); + my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100 / $price_factor->{factor}, $decimalplaces); + my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100 / $price_factor->{factor}, 2); + my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2); $form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); push @{ $form->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : ''; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index c28656795..137243877 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -3244,3 +3244,99 @@ sub delete_tax { $lxdebug->leave_sub(); } + +sub add_price_factor { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text('Add Price Factor'); + $form->{callback} ||= build_std_url('action=add_price_factor'); + $form->{fokus} = 'description'; + + $form->header(); + print $form->parse_html_template2('am/edit_price_factor'); + + $lxdebug->leave_sub(); +} + +sub edit_price_factor { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text('Edit Price Factor'); + $form->{callback} ||= build_std_url('action=add_price_factor'); + $form->{fokus} = 'description'; + + AM->get_price_factor(\%myconfig, $form); + + $form->{factor} = $form->format_amount(\%myconfig, $form->{factor} * 1); + + $form->header(); + print $form->parse_html_template2('am/edit_price_factor'); + + $lxdebug->leave_sub(); +} + +sub list_price_factors { + $lxdebug->enter_sub(); + + AM->get_all_price_factors(\%myconfig, \%$form); + + my $previous; + foreach my $current (@{ $form->{PRICE_FACTORS} }) { + if ($previous) { + $previous->{next_id} = $current->{id}; + $current->{previous_id} = $previous->{id}; + } + + $current->{factor} = $form->format_amount(\%myconfig, $current->{factor} * 1); + + $previous = $current; + } + + $form->{callback} = build_std_url('action=list_price_factors'); + $form->{title} = $locale->text('Price Factors'); + $form->{url_base} = build_std_url('callback'); + + $form->header(); + print $form->parse_html_template2('am/list_price_factors'); + + $lxdebug->leave_sub(); +} + +sub save_price_factor { + $lxdebug->enter_sub(); + + $form->isblank("description", $locale->text('Description missing!')); + $form->isblank("factor", $locale->text('Factor missing!')); + + $form->{factor} = $form->parse_amount(\%myconfig, $form->{factor}); + + AM->save_price_factor(\%myconfig, $form); + + $form->{callback} .= '&MESSAGE=' . $form->escape($locale->text('Price factor saved!')) if ($form->{callback}); + + $form->redirect($locale->text('Price factor saved!')); + + $lxdebug->leave_sub(); +} + +sub delete_price_factor { + $lxdebug->enter_sub(); + + AM->delete_price_factor(\%myconfig, \%$form); + + $form->{callback} .= '&MESSAGE=' . $form->escape($locale->text('Price factor deleted!')) if ($form->{callback}); + + $form->redirect($locale->text('Price factor deleted!')); + + $lxdebug->leave_sub(); +} + +sub swap_price_factors { + $lxdebug->enter_sub(); + + AM->swap_sortkeys(\%myconfig, $form, 'price_factors'); + list_price_factors(); + + $lxdebug->leave_sub(); +} + diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index abd36a84d..28d41f3b3 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1736,10 +1736,11 @@ sub generate_report { # fresh row, for inserting later my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns }; - $ref->{exchangerate} = 1 unless $ref->{exchangerate}; - $ref->{sellprice} *= $ref->{exchangerate}; - $ref->{listprice} *= $ref->{exchangerate}; - $ref->{lastcost} *= $ref->{exchangerate}; + $ref->{exchangerate} ||= 1; + $ref->{price_factor} ||= 1; + $ref->{sellprice} *= $ref->{exchangerate} / $ref->{price_factor}; + $ref->{listprice} *= $ref->{exchangerate} / $ref->{price_factor}; + $ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor}; # use this for assemblies my $onhand = $ref->{onhand}; @@ -1986,6 +1987,7 @@ sub form_header { my ($notdiscountableok, $notdiscountable); my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop); + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) } qw(sellprice listprice lastcost gv)); @@ -2326,6 +2328,22 @@ sub form_header { $unit_select .= AM->unit_select_html($units, "unit", $form->{"unit"}); } + my $price_factor; + 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 = + qq|| + . $locale->text('Price Factor') + . qq|| + . NTI($cgi->popup_menu('-name' => 'price_factor_id', + '-default' => $form->{price_factor_id}, + '-values' => \@values, + '-labels' => \%labels)) + . qq||; + } + $form->{fokus} = "ic.partnumber"; $form->header; @@ -2439,6 +2457,7 @@ sub form_header { {sellprice}> $lastcost + $price_factor | . $locale->text('Unit') . qq| $unit_select @@ -2892,7 +2911,7 @@ sub save { # now take it apart and restore original values foreach my $item (split /&/, $previousform) { - my ($key, $value) = split /=/, $item, 2; + my ($key, $value) = split m/=/, $item, 2; $value =~ s/%26/&/g; $form->{$key} = $value; } @@ -2912,8 +2931,7 @@ sub save { $form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"}; # change/add values for assembly item - map { $form->{"${_}_$i"} = $newform{$_} } - qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno); + map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id); $form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"}; $form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"}; @@ -2924,15 +2942,17 @@ sub save { $i = $form->{rowcount}; $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"}); - map { $form->{"${_}_$i"} = $newform{$_} } - qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice); + map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id); + $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id}); + if ($form->{exchangerate} != 0) { $form->{"sellprice_$i"} /= $form->{exchangerate}; } + $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|); - map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, - $newform{taxaccount}; + + map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount}; chop $form->{"taxaccounts_$i"}; foreach my $item (qw(description rate taxnumber)) { my $index = $form->{"taxaccounts_$i"} . "_$item"; @@ -2940,26 +2960,28 @@ sub save { } # credit remaining calculation - $amount = - $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * - $form->{"qty_$i"}; - map { $form->{"${_}_base"} += $amount } - (split / /, $form->{"taxaccounts_$i"}); - map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } - split / /, $form->{"taxaccounts_$i"} - if !$form->{taxincluded}; + $amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"}; + + map { $form->{"${_}_base"} += $amount } (split / /, $form->{"taxaccounts_$i"}); + map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded}; $form->{creditremaining} -= $amount; # redo number formatting, because invoice parse them! - $i = $form->{rowcount}; - map { - $form->{"${_}_$i"} = - $form->format_amount(\%myconfig, $form->{"${_}_$i"}) - } qw(weight listprice sellprice rop); + map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } qw(weight listprice sellprice rop); } $form->{"id_$i"} = $parts_id; + + # Get the actual price factor (not just the ID) for the marge calculation. + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) { + next if ($pfac->{id} != $newform{price_factor_id}); + $form->{"marge_price_factor_$i"} = $pfac->{factor}; + last; + } + delete $form->{ALL_PRICE_FACTORS}; + delete $form->{action}; # restore original callback diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 6091a9468..bb3d2054b 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -121,6 +121,8 @@ sub display_row { 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 @@ -303,18 +305,22 @@ sub display_row { ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); $decimalplaces = max length($dec), 2; - $discount = (100 - $form->{"discount_$i"} * 1) / 100; - $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} * $discount, $decimalplaces); + $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; + 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"}) * 100 / $real_sellprice; + $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"} && @@ -328,9 +334,9 @@ sub display_row { } 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_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note; $form->{"marge_total"} += $form->{"marge_absolut_$i"}; - $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$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_absolut marge_percent); @@ -387,7 +393,22 @@ sub display_row { $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"} = "" . + $price_factor_select . AM->unit_select_html($is_part || $is_assembly ? $dimension_units : $is_assigned ? $service_units : $all_units, "unit_$i", $this_unit, @@ -474,7 +495,8 @@ sub display_row { "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_absolut_$i", "marge_percent_$i", "lastcost_$i")); + "longdescription_$i", "basefactor_$i", "marge_absolut_$i", "marge_percent_$i", "lastcost_$i", + "marge_price_factor_$i")); ######################################## # Eintrag fuer Version 2.2.0 geaendert # @@ -530,10 +552,18 @@ sub display_row { |; 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_absolut_$i"}  $form->{"marge_percent_$i"} % ${marge_font_end} + ${marge_font_start}| . $locale->text('Ertrag') . qq| $form->{"marge_absolut_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}  | . $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); +  | . $locale->text('EK') . qq| | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) . $marge_price_factor; } print qq| @@ -695,7 +725,7 @@ sub select_item { my @new_fields = qw(bin listprice inventory_accno income_accno expense_accno unit weight assembly taxaccounts partsgroup formel longdescription not_discountable - part_payment_id partnotes id lastcost); + part_payment_id partnotes id lastcost price_factor_id price_factor); push(@new_fields, "lizenzen") if ($lizenzen); print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields; @@ -751,10 +781,16 @@ sub item_selected { # if there was a price entered, override it $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); - map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } + my @new_fields = qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts - partsgroup formel longdescription not_discountable partnotes lastcost); + partsgroup formel longdescription not_discountable partnotes lastcost + price_factor_id price_factor); + + map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new_fields; + + $form->{"marge_price_factor_$i"} = $form->{"new_price_factor_$j"}; + if ($form->{"part_payment_id_$i"} ne "") { $form->{payment_id} = $form->{"part_payment_id_$i"}; } @@ -804,8 +840,7 @@ sub item_selected { # delete all the new_ variables for $i (1 .. $form->{lastndx}) { - map { delete $form->{"new_${_}_$i"} } - qw(partnumber description sellprice bin listprice inventory_accno income_accno expense_accno unit assembly taxaccounts id); + map { delete $form->{"new_${_}_$i"} } @new_fields; } map { delete $form->{$_} } qw(ndx lastndx nextsub); @@ -871,7 +906,7 @@ sub new_item { 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); + 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| @@ -992,10 +1027,7 @@ sub check_form { $lxdebug->enter_sub(); my @a = (); my $count = 0; - my @flds = ( - qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor marge_absolut marge_percent lastcost ) - ); - + my @flds = (qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor marge_absolut marge_percent marge_price_factor lastcost price_factor_id)); # remove any makes or model rows if ($form->{item} eq 'part') { @@ -1796,7 +1828,7 @@ sub print_form { } keys(%{$form}))); reformat_numbers($output_numberformat, undef, - qw(qty), + qw(qty price_factor), grep({ /^qty_\d+$/ } keys(%{$form}))); diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 9cdb6d7d9..ad8508922 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -61,7 +61,7 @@ sub add { sub edit { $lxdebug->enter_sub(); - + $form->{"Watchdog::qty_1"} = 1; # show history button $form->{javascript} = qq||; #/show hhistory button @@ -243,14 +243,15 @@ sub form_header { my @old_project_ids = ($form->{"globalproject_id"}); map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"}; - $form->get_lists("contacts" => "ALL_CONTACTS", - "projects" => { "key" => "ALL_PROJECTS", - "all" => 0, - "old_id" => \@old_project_ids }, - "taxzones" => "ALL_TAXZONES", - "employees" => "ALL_SALESMEN", - "currencies" => "ALL_CURRENCIES", - "vendors" => "ALL_VENDORS"); + $form->get_lists("contacts" => "ALL_CONTACTS", + "projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }, + "taxzones" => "ALL_TAXZONES", + "employees" => "ALL_SALESMEN", + "currencies" => "ALL_CURRENCIES", + "vendors" => "ALL_VENDORS", + "price_factors" => "ALL_PRICE_FACTORS"); my %labels; my @values = (undef); @@ -890,6 +891,8 @@ sub update { map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit); map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] }; + $form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor}; + ($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/; $decimalplaces = max 2, length $1; diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index bfcad9e42..f802c948b 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -312,15 +312,16 @@ sub form_header { my @old_project_ids = ($form->{"globalproject_id"}); map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"}; - $form->get_lists("contacts" => "ALL_CONTACTS", - "shipto" => "ALL_SHIPTO", - "projects" => { "key" => "ALL_PROJECTS", - "all" => 0, - "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN", - "taxzones" => "ALL_TAXZONES", - "currencies" => "ALL_CURRENCIES", - "customers" => "ALL_CUSTOMERS"); + $form->get_lists("contacts" => "ALL_CONTACTS", + "shipto" => "ALL_SHIPTO", + "projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }, + "employees" => "ALL_SALESMEN", + "taxzones" => "ALL_TAXZONES", + "currencies" => "ALL_CURRENCIES", + "customers" => "ALL_CUSTOMERS", + "price_factors" => "ALL_PRICE_FACTORS"); my %labels; my @values = (undef); @@ -1226,6 +1227,8 @@ sub update { $form->{payment_id} = $form->{"part_payment_id_$i"} if $form->{"part_payment_id_$i"} ne ""; $form->{"discount_$i"} = 0 if $form->{"not_discountable_$i"}; + $form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor}; + ($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/; $decimalplaces = max 2, length $1; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 5cc5418d6..c0d826bb3 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -403,12 +403,13 @@ sub form_header { "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)); + "employees" => "ALL_EMPLOYEES", + "salesmen" => "ALL_SALESMEN", + "taxzones" => "ALL_TAXZONES", + "payments" => "ALL_PAYMENTS", + "currencies" => "ALL_CURRENCIES", + $vc => "ALL_" . uc($vc), + "price_factors" => "ALL_PRICE_FACTORS"); my %labels; my @values = (undef); @@ -1162,6 +1163,8 @@ sub update { map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] }; $form->{payment_id} = $form->{"part_payment_id_$i"} if $form->{"part_payment_id_$i"} ne ""; + $form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor}; + ($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/; $decimalplaces = max 2, length $1; diff --git a/doc/dokumentenvorlagen-und-variablen.html b/doc/dokumentenvorlagen-und-variablen.html index 8dffd5b6c..5516de8d1 100644 --- a/doc/dokumentenvorlagen-und-variablen.html +++ b/doc/dokumentenvorlagen-und-variablen.html @@ -708,6 +708,14 @@ td { partsgroup Warengruppe + + price_factor + Der Preisfaktor als Zahl, sofern einer eingestellt ist + + + price_factor_name + Der Name des Preisfaktors, sofern einer eingestellt ist + projectnumber Projektnummer diff --git a/locale/de/all b/locale/de/all index c970c9e71..e099e7343 100644 --- a/locale/de/all +++ b/locale/de/all @@ -109,6 +109,7 @@ $self->{texts} = { 'Add License' => 'Lizenz erfassen', 'Add Part' => 'Ware erfassen', 'Add Payment Terms' => 'Zahlungskonditionen hinzufügen', + 'Add Price Factor' => 'Preisfaktor erfassen', 'Add Pricegroup' => 'Preisgruppe erfassen', 'Add Printer' => 'Drucker hinzufügen', 'Add Project' => 'Projekt erfassen', @@ -448,6 +449,7 @@ aktualisieren wollen?', 'Edit Part' => 'Ware bearbeiten', 'Edit Payment Terms' => 'Zahlungskonditionen bearbeiten', 'Edit Preferences for' => 'Benutzereinstellungen für', + 'Edit Price Factor' => 'Preisfaktor bearbeiten', 'Edit Pricegroup' => 'Preisgruppe bearbeiten', 'Edit Printer' => 'Drucker bearbeiten', 'Edit Project' => 'Projekt bearbeiten', @@ -505,6 +507,7 @@ aktualisieren wollen?', 'Extended' => 'Gesamt', 'Extension Of Time' => 'Dauerfristverlängerung', 'Factor' => 'Faktor', + 'Factor missing!' => 'Der Faktor fehlt.', 'Falsches Datumsformat!' => 'Falsches Datumsformat!', 'Fax' => 'Fax', 'Feb' => 'Feb', @@ -667,6 +670,7 @@ aktualisieren wollen?', 'List Lead' => 'Kundenquelle anzeigen', 'List Payment Terms' => 'Zahlungskonditionen anzeigen', 'List Price' => 'Listenpreis', + 'List Price Factors' => 'Preisfaktoren anzeigen', 'List Pricegroups' => 'Preisgruppen anzeigen', 'List Printer' => 'Drucker anzeigen', 'List Tax' => 'Bearbeiten', @@ -878,6 +882,10 @@ aktualisieren wollen?', 'Previous transdate text' => 'wurde gespeichert am', 'Previous transnumber text' => 'Letzte Buchung mit der Buchungsnummer', 'Price' => 'Preis', + 'Price Factor' => 'Preisfaktor', + 'Price Factors' => 'Preisfaktoren', + 'Price factor deleted!' => 'Preisfaktor gelöscht.', + 'Price factor saved!' => 'Preisfaktor gespeichert.', 'Pricegroup' => 'Preisgruppe', 'Pricegroup deleted!' => 'Preisgruppe gelöscht!', 'Pricegroup missing!' => 'Preisgruppe fehlt!', diff --git a/locale/de/am b/locale/de/am index 9497b505c..12a3ea302 100644 --- a/locale/de/am +++ b/locale/de/am @@ -53,6 +53,7 @@ $self->{texts} = { 'Add Language' => 'Sprache hinzufügen', 'Add Lead' => 'Kundenquelle erfassen', 'Add Payment Terms' => 'Zahlungskonditionen hinzufügen', + 'Add Price Factor' => 'Preisfaktor erfassen', 'Add Printer' => 'Drucker hinzufügen', 'Add and edit %s' => '%s hinzufügen und bearbeiten', 'Address' => 'Adresse', @@ -118,6 +119,7 @@ $self->{texts} = { 'Edit Lead' => 'Kundenquelle bearbeiten', 'Edit Payment Terms' => 'Zahlungskonditionen bearbeiten', 'Edit Preferences for' => 'Benutzereinstellungen für', + 'Edit Price Factor' => 'Preisfaktor bearbeiten', 'Edit Printer' => 'Drucker bearbeiten', 'Enforce transaction reversal for all dates' => 'Gegenbuchungen für jeden Zeitraum aktualisieren', 'Enter longdescription' => 'Langtext eingeben', @@ -128,6 +130,7 @@ $self->{texts} = { 'Expense Account' => 'Aufwandskonto', 'Expenses EU with UStId' => 'Aufwand EU m. UStId', 'Expenses EU without UStId' => 'Erlöse EU o. UStId', + 'Factor missing!' => 'Der Faktor fehlt.', 'Fax' => 'Fax', 'File' => 'Datei', 'Foreign Exchange Gain' => 'Wechselkurserträge', @@ -208,6 +211,9 @@ $self->{texts} = { 'Please enter values' => 'Bitte Werte eingeben', 'Postscript' => 'Postscript', 'Preferences saved!' => 'Einstellungen gespeichert!', + 'Price Factors' => 'Preisfaktoren', + 'Price factor deleted!' => 'Preisfaktor gelöscht.', + 'Price factor saved!' => 'Preisfaktor gespeichert.', 'Print options' => 'Druckoptionen', 'Printer' => 'Drucker', 'Printer Command' => 'Druckbefehl', @@ -327,6 +333,7 @@ $self->{subs} = { 'add_language' => 'add_language', 'add_lead' => 'add_lead', 'add_payment' => 'add_payment', + 'add_price_factor' => 'add_price_factor', 'add_printer' => 'add_printer', 'add_tax' => 'add_tax', 'add_unit' => 'add_unit', @@ -346,6 +353,7 @@ $self->{subs} = { 'delete_language' => 'delete_language', 'delete_lead' => 'delete_lead', 'delete_payment' => 'delete_payment', + 'delete_price_factor' => 'delete_price_factor', 'delete_printer' => 'delete_printer', 'delete_tax' => 'delete_tax', 'delivery_customer_selection' => 'delivery_customer_selection', @@ -359,6 +367,7 @@ $self->{subs} = { 'edit_language' => 'edit_language', 'edit_lead' => 'edit_lead', 'edit_payment' => 'edit_payment', + 'edit_price_factor' => 'edit_price_factor', 'edit_printer' => 'edit_printer', 'edit_tax' => 'edit_tax', 'edit_units' => 'edit_units', @@ -376,6 +385,7 @@ $self->{subs} = { 'list_language' => 'list_language', 'list_lead' => 'list_lead', 'list_payment' => 'list_payment', + 'list_price_factors' => 'list_price_factors', 'list_printer' => 'list_printer', 'list_tax' => 'list_tax', 'mark_as_paid_common' => 'mark_as_paid_common', @@ -393,6 +403,7 @@ $self->{subs} = { 'save_lead' => 'save_lead', 'save_payment' => 'save_payment', 'save_preferences' => 'save_preferences', + 'save_price_factor' => 'save_price_factor', 'save_printer' => 'save_printer', 'save_tax' => 'save_tax', 'save_unit' => 'save_unit', @@ -408,6 +419,7 @@ $self->{subs} = { 'show_vc_details' => 'show_vc_details', 'swap_buchungsgruppen' => 'swap_buchungsgruppen', 'swap_payment_terms' => 'swap_payment_terms', + 'swap_price_factors' => 'swap_price_factors', 'swap_units' => 'swap_units', 'vendor_selection' => 'vendor_selection', 'erfassen' => 'add', diff --git a/locale/de/ic b/locale/de/ic index 5fc762811..b947abda6 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -185,6 +185,7 @@ aktualisieren wollen?', 'Preis' => 'Preis', 'Preisklasse' => 'Preisgruppe', 'Price' => 'Preis', + 'Price Factor' => 'Preisfaktor', 'Pricegroup' => 'Preisgruppe', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', diff --git a/locale/de/ir b/locale/de/ir index b0009023e..708273928 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -231,7 +231,6 @@ $self->{texts} = { '[email]' => '[email]', 'bin_list' => 'Lagerliste', 'button' => '?', - 'ea' => 'St.', 'emailed to' => 'gemailt an', 'history' => 'Historie', 'invoice' => 'Rechnung', diff --git a/locale/de/is b/locale/de/is index 48172ba85..05919b52d 100644 --- a/locale/de/is +++ b/locale/de/is @@ -257,7 +257,6 @@ $self->{texts} = { '[email]' => '[email]', 'bin_list' => 'Lagerliste', 'button' => '?', - 'ea' => 'St.', 'emailed to' => 'gemailt an', 'history' => 'Historie', 'invoice' => 'Rechnung', diff --git a/locale/de/menu b/locale/de/menu index 0955727d7..1ea504ff9 100644 --- a/locale/de/menu +++ b/locale/de/menu @@ -20,6 +20,7 @@ $self->{texts} = { 'Add License' => 'Lizenz erfassen', 'Add Part' => 'Ware erfassen', 'Add Payment Terms' => 'Zahlungskonditionen hinzufügen', + 'Add Price Factor' => 'Preisfaktor erfassen', 'Add Pricegroup' => 'Preisgruppe erfassen', 'Add Printer' => 'Drucker hinzufügen', 'Add Project' => 'Projekt erfassen', @@ -69,6 +70,7 @@ $self->{texts} = { 'List Languages' => 'Sprachen anzeigen', 'List Lead' => 'Kundenquelle anzeigen', 'List Payment Terms' => 'Zahlungskonditionen anzeigen', + 'List Price Factors' => 'Preisfaktoren anzeigen', 'List Pricegroups' => 'Preisgruppen anzeigen', 'List Printer' => 'Drucker anzeigen', 'List Tax' => 'Bearbeiten', @@ -80,6 +82,7 @@ $self->{texts} = { 'Payment Terms' => 'Zahlungskonditionen', 'Payments' => 'Zahlungsausgänge', 'Preferences' => 'Benutzereinstellungen', + 'Price Factors' => 'Preisfaktoren', 'Pricegroups' => 'Preisgruppen', 'Printer' => 'Drucker', 'Programm' => 'Programm', diff --git a/locale/de/menunew b/locale/de/menunew index d24bb6287..7a8d0fdbb 100644 --- a/locale/de/menunew +++ b/locale/de/menunew @@ -19,6 +19,7 @@ $self->{texts} = { 'Add License' => 'Lizenz erfassen', 'Add Part' => 'Ware erfassen', 'Add Payment Terms' => 'Zahlungskonditionen hinzufügen', + 'Add Price Factor' => 'Preisfaktor erfassen', 'Add Pricegroup' => 'Preisgruppe erfassen', 'Add Printer' => 'Drucker hinzufügen', 'Add Project' => 'Projekt erfassen', @@ -68,6 +69,7 @@ $self->{texts} = { 'List Languages' => 'Sprachen anzeigen', 'List Lead' => 'Kundenquelle anzeigen', 'List Payment Terms' => 'Zahlungskonditionen anzeigen', + 'List Price Factors' => 'Preisfaktoren anzeigen', 'List Pricegroups' => 'Preisgruppen anzeigen', 'List Printer' => 'Drucker anzeigen', 'List Tax' => 'Bearbeiten', @@ -79,6 +81,7 @@ $self->{texts} = { 'Payment Terms' => 'Zahlungskonditionen', 'Payments' => 'Zahlungsausgänge', 'Preferences' => 'Benutzereinstellungen', + 'Price Factors' => 'Preisfaktoren', 'Pricegroups' => 'Preisgruppen', 'Printer' => 'Drucker', 'Programm' => 'Programm', diff --git a/locale/de/oe b/locale/de/oe index 9b73775ee..614d444ea 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -273,7 +273,6 @@ $self->{texts} = { '[email]' => '[email]', 'bin_list' => 'Lagerliste', 'button' => '?', - 'ea' => 'St.', 'emailed to' => 'gemailt an', 'history' => 'Historie', 'invoice' => 'Rechnung', diff --git a/menu.ini b/menu.ini index a0f28606c..f74685013 100644 --- a/menu.ini +++ b/menu.ini @@ -436,6 +436,19 @@ module=am.pl action=edit_units unit_type=service +[System--Price Factors] +module=menu.pl +action=acc_menu +target=acc_menu +submenu=1 + +[System--Price Factors--Add Price Factor] +module=am.pl +action=add_price_factor + +[System--Price Factors--List Price Factors] +module=am.pl +action=list_price_factors [System--Departments] module=menu.pl diff --git a/sql/Pg-upgrade2/price_factors.sql b/sql/Pg-upgrade2/price_factors.sql new file mode 100644 index 000000000..3d45a8916 --- /dev/null +++ b/sql/Pg-upgrade2/price_factors.sql @@ -0,0 +1,36 @@ +-- @tag: price_factors +-- @description: Tabellen und Spalten für Preisfaktoren +-- @depends: release_2_4_3 + +CREATE TABLE price_factors ( + "id" integer DEFAULT nextval('id'::text), + "description" text, + "factor" numeric(15,5), + "sortkey" integer, + + PRIMARY KEY (id) + ); + +ALTER TABLE parts ADD COLUMN price_factor_id integer; + +ALTER TABLE invoice ADD COLUMN price_factor_id integer; +ALTER TABLE invoice ADD COLUMN price_factor numeric(15,5); +ALTER TABLE invoice ALTER COLUMN price_factor SET DEFAULT 1; +UPDATE invoice SET price_factor = 1; + +ALTER TABLE invoice ADD COLUMN marge_price_factor numeric(15,5); +ALTER TABLE invoice ALTER COLUMN marge_price_factor SET DEFAULT 1; +UPDATE invoice SET marge_price_factor = 1; + +ALTER TABLE orderitems ADD COLUMN price_factor_id integer; +ALTER TABLE orderitems ADD COLUMN price_factor numeric(15,5); +ALTER TABLE orderitems ALTER COLUMN price_factor SET DEFAULT 1; +UPDATE orderitems SET price_factor = 1; + +ALTER TABLE orderitems ADD COLUMN marge_price_factor numeric(15,5); +ALTER TABLE orderitems ALTER COLUMN marge_price_factor SET DEFAULT 1; +UPDATE orderitems SET marge_price_factor = 1; + +INSERT INTO price_factors (description, factor, sortkey) VALUES ('pro 10', 10, 1); +INSERT INTO price_factors (description, factor, sortkey) VALUES ('pro 100', 100, 2); +INSERT INTO price_factors (description, factor, sortkey) VALUES ('pro 1.000', 1000, 3); diff --git a/templates/webpages/am/edit_price_factor_de.html b/templates/webpages/am/edit_price_factor_de.html new file mode 100644 index 000000000..3ed19a5e9 --- /dev/null +++ b/templates/webpages/am/edit_price_factor_de.html @@ -0,0 +1,37 @@ +[% USE HTML %] + + [% IF MESSAGE %]

[% MESSAGE %]

[% END %] + +
[% title %]
+ +
+ +

+ + + + + + + + + + +
Beschreibung
Faktor
+

+ +

+ + + + + + + + + [% IF id %][% IF orphaned %][% END %][% END %] +

+
+ + + diff --git a/templates/webpages/am/edit_price_factor_master.html b/templates/webpages/am/edit_price_factor_master.html new file mode 100644 index 000000000..261122f96 --- /dev/null +++ b/templates/webpages/am/edit_price_factor_master.html @@ -0,0 +1,37 @@ +[% USE HTML %] + + [% IF MESSAGE %]

[% MESSAGE %]

[% END %] + +
[% title %]
+ +
+ +

+ + + + + + + + + + +
Description
Factor
+

+ +

+ + + + + + + + + [% IF id %][% IF orphaned %][% END %][% END %] +

+
+ + + diff --git a/templates/webpages/am/list_price_factors_de.html b/templates/webpages/am/list_price_factors_de.html new file mode 100644 index 000000000..a20ae1708 --- /dev/null +++ b/templates/webpages/am/list_price_factors_de.html @@ -0,0 +1,41 @@ +[% USE HTML %] + + [% IF MESSAGE %]

[% MESSAGE %]

[% END %] + +
[% title %]
+ +

+ + + + + + + + + [% SET row_odd = '1' %][% FOREACH factor = PRICE_FACTORS %] + + + + + + + [% END %] +
BeschreibungFaktor
[% IF factor.previous_id %][% END %][% IF factor.next_id %][% END %][% HTML.escape(factor.description) %][% HTML.escape(factor.factor) %]
+

+ +
+ +

+

+ + + + + + +
+

+ + + diff --git a/templates/webpages/am/list_price_factors_master.html b/templates/webpages/am/list_price_factors_master.html new file mode 100644 index 000000000..867aed3c7 --- /dev/null +++ b/templates/webpages/am/list_price_factors_master.html @@ -0,0 +1,41 @@ +[% USE HTML %] + + [% IF MESSAGE %]

[% MESSAGE %]

[% END %] + +
[% title %]
+ +

+ + + + + + + + + [% SET row_odd = '1' %][% FOREACH factor = PRICE_FACTORS %] + + + + + + + [% END %] +
DescriptionFactor
[% IF factor.previous_id %][% END %][% IF factor.next_id %][% END %][% HTML.escape(factor.description) %][% HTML.escape(factor.factor) %]
+

+ +
+ +

+

+ + + + + + +
+

+ + +