Revision 1e251313
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
$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;
|
SL/Form.pm | ||
---|---|---|
$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();
|
||
|
||
... | ... | |
$self->_get_departments($dbh, $params{"departments"});
|
||
}
|
||
|
||
if ($params{price_factors}) {
|
||
$self->_get_price_factors($dbh, $params{price_factors});
|
||
}
|
||
|
||
$main::lxdebug->leave_sub();
|
||
}
|
||
|
SL/IC.pm | ||
---|---|---|
ean = ?,
|
||
not_discountable = ?,
|
||
microfiche = ?,
|
||
partsgroup_id = ?
|
||
partsgroup_id = ?,
|
||
price_factor_id = ?
|
||
WHERE id = ?|;
|
||
@values = ($form->{partnumber},
|
||
$form->{description},
|
||
... | ... | |
$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);
|
||
... | ... | |
# 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
|
||
... | ... | |
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 = ();
|
||
|
||
... | ... | |
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;
|
||
... | ... | |
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 ================#
|
||
... | ... | |
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|;
|
SL/IR.pm | ||
---|---|---|
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"};
|
||
|
||
... | ... | |
|
||
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));
|
||
... | ... | |
}
|
||
|
||
# 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
|
||
... | ... | |
|
||
$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));
|
||
... | ... | |
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
|
||
... | ... | |
$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);
|
||
}
|
||
|
||
... | ... | |
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)
|
||
... | ... | |
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,
|
||
... | ... | |
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);
|
||
|
SL/IS.pm | ||
---|---|---|
|
||
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 = "";
|
||
... | ... | |
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);
|
||
... | ... | |
$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"}) {
|
||
... | ... | |
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) : '';
|
||
... | ... | |
|
||
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;
|
||
... | ... | |
$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));
|
||
... | ... | |
}
|
||
|
||
# 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
|
||
... | ... | |
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"},
|
||
... | ... | |
$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"}) {
|
||
... | ... | |
|
||
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
|
||
|
||
... | ... | |
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
|
||
|
||
... | ... | |
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);
|
||
|
SL/OE.pm | ||
---|---|---|
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"} =
|
||
... | ... | |
$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;
|
||
... | ... | |
}
|
||
}
|
||
|
||
$netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"};
|
||
$netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor;
|
||
|
||
$reqdate =
|
||
($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef;
|
||
... | ... | |
$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"},
|
||
... | ... | |
$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;
|
||
... | ... | |
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
|
||
... | ... | |
|
||
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 = "";
|
||
... | ... | |
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) {
|
||
... | ... | |
$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) : '';
|
bin/mozilla/am.pl | ||
---|---|---|
|
||
$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();
|
||
}
|
||
|
bin/mozilla/ic.pl | ||
---|---|---|
# 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};
|
||
... | ... | |
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));
|
||
... | ... | |
$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|<tr><th align="right">|
|
||
. $locale->text('Price Factor')
|
||
. qq|</th><td>|
|
||
. NTI($cgi->popup_menu('-name' => 'price_factor_id',
|
||
'-default' => $form->{price_factor_id},
|
||
'-values' => \@values,
|
||
'-labels' => \%labels))
|
||
. qq|</td></tr>|;
|
||
}
|
||
|
||
$form->{fokus} = "ic.partnumber";
|
||
$form->header;
|
||
|
||
... | ... | |
<td><input name=sellprice size=11 value=$form->{sellprice}></td>
|
||
</tr>
|
||
$lastcost
|
||
$price_factor
|
||
<tr>
|
||
<th align="right" nowrap="true">| . $locale->text('Unit') . qq|</th>
|
||
<td>$unit_select</td>
|
||
... | ... | |
|
||
# 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;
|
||
}
|
||
... | ... | |
$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"};
|
||
... | ... | |
$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";
|
||
... | ... | |
}
|
||
|
||
# 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
|
bin/mozilla/io.pl | ||
---|---|---|
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
|
||
... | ... | |
($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"} &&
|
||
... | ... | |
}
|
||
|
||
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);
|
||
... | ... | |
$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"} = "<td>" .
|
||
$price_factor_select .
|
||
AM->unit_select_html($is_part || $is_assembly ? $dimension_units :
|
||
$is_assigned ? $service_units : $all_units,
|
||
"unit_$i", $this_unit,
|
||
... | ... | |
"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 #
|
||
... | ... | |
|;
|
||
|
||
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}<b>| . $locale->text('Ertrag') . qq|</b> $form->{"marge_absolut_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}
|
||
${marge_font_start}<b>| . $locale->text('Ertrag') . qq|</b> $form->{"marge_absolut_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}
|
||
<b>| . $locale->text('LP') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq|
|
||
<b>| . $locale->text('EK') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2);
|
||
<b>| . $locale->text('EK') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) . $marge_price_factor;
|
||
}
|
||
|
||
print qq|
|
||
... | ... | |
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;
|
||
... | ... | |
# 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"};
|
||
}
|
||
... | ... | |
|
||
# 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);
|
||
... | ... | |
|
||
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|
|
||
... | ... | |
$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') {
|
||
... | ... | |
} keys(%{$form})));
|
||
|
||
reformat_numbers($output_numberformat, undef,
|
||
qw(qty),
|
||
qw(qty price_factor),
|
||
grep({ /^qty_\d+$/
|
||
} keys(%{$form})));
|
||
|
bin/mozilla/ir.pl | ||
---|---|---|
|
||
sub edit {
|
||
$lxdebug->enter_sub();
|
||
|
||
$form->{"Watchdog::qty_1"} = 1;
|
||
# show history button
|
||
$form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
|
||
#/show hhistory button
|
||
... | ... | |
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);
|
||
... | ... | |
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;
|
||
|
bin/mozilla/is.pl | ||
---|---|---|
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);
|
||
... | ... | |
$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;
|
||
|
bin/mozilla/oe.pl | ||
---|---|---|
"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);
|
||
... | ... | |
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;
|
||
|
doc/dokumentenvorlagen-und-variablen.html | ||
---|---|---|
<td><code>partsgroup</code></td>
|
||
<td>Warengruppe</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>price_factor</code></td>
|
||
<td>Der Preisfaktor als Zahl, sofern einer eingestellt ist</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>price_factor_name</code></td>
|
||
<td>Der Name des Preisfaktors, sofern einer eingestellt ist</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>projectnumber</code></td>
|
||
<td>Projektnummer</td>
|
locale/de/all | ||
---|---|---|
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'Extended' => 'Gesamt',
|
||
'Extension Of Time' => 'Dauerfristverl?ngerung',
|
||
'Factor' => 'Faktor',
|
||
'Factor missing!' => 'Der Faktor fehlt.',
|
||
'Falsches Datumsformat!' => 'Falsches Datumsformat!',
|
||
'Fax' => 'Fax',
|
||
'Feb' => 'Feb',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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!',
|
locale/de/am | ||
---|---|---|
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'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',
|
locale/de/ic | ||
---|---|---|
'Preis' => 'Preis',
|
||
'Preisklasse' => 'Preisgruppe',
|
||
'Price' => 'Preis',
|
||
'Price Factor' => 'Preisfaktor',
|
||
'Pricegroup' => 'Preisgruppe',
|
||
'Printer' => 'Drucker',
|
||
'Proforma Invoice' => 'Proformarechnung',
|
locale/de/ir | ||
---|---|---|
'[email]' => '[email]',
|
||
'bin_list' => 'Lagerliste',
|
||
'button' => '?',
|
||
'ea' => 'St.',
|
||
'emailed to' => 'gemailt an',
|
||
'history' => 'Historie',
|
||
'invoice' => 'Rechnung',
|
locale/de/is | ||
---|---|---|
'[email]' => '[email]',
|
||
'bin_list' => 'Lagerliste',
|
||
'button' => '?',
|
||
'ea' => 'St.',
|
||
'emailed to' => 'gemailt an',
|
||
'history' => 'Historie',
|
||
'invoice' => 'Rechnung',
|
locale/de/menu | ||
---|---|---|
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'Payment Terms' => 'Zahlungskonditionen',
|
||
'Payments' => 'Zahlungsausg?nge',
|
||
'Preferences' => 'Benutzereinstellungen',
|
||
'Price Factors' => 'Preisfaktoren',
|
||
'Pricegroups' => 'Preisgruppen',
|
||
'Printer' => 'Drucker',
|
||
'Programm' => 'Programm',
|
locale/de/menunew | ||
---|---|---|
'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',
|
||
... | ... | |
'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',
|
||
... | ... | |
'Payment Terms' => 'Zahlungskonditionen',
|
||
'Payments' => 'Zahlungsausg?nge',
|
||
'Preferences' => 'Benutzereinstellungen',
|
||
'Price Factors' => 'Preisfaktoren',
|
||
'Pricegroups' => 'Preisgruppen',
|
||
'Printer' => 'Drucker',
|
||
'Programm' => 'Programm',
|
locale/de/oe | ||
---|---|---|
'[email]' => '[email]',
|
||
'bin_list' => 'Lagerliste',
|
||
'button' => '?',
|
||
'ea' => 'St.',
|
||
'emailed to' => 'gemailt an',
|
||
'history' => 'Historie',
|
||
'invoice' => 'Rechnung',
|
menu.ini | ||
---|---|---|
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
|
sql/Pg-upgrade2/price_factors.sql | ||
---|---|---|
-- @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);
|
Auch abrufbar als: Unified diff
Preisfatkoren implementiert.