";
+
+ # build in drop down list for pricesgroups
if ($form->{"prices_$i"}) {
- $price_tmp =
- $form->format_amount(\%myconfig, $form->{"price_new_$i"}, 2);
+ if ($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"}) {
+ $price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces);
+ } else {
+ $price_tmp = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
+ }
- $column_data{sellprice_drag} =
- qq|
|;
+ $column_data{sellprice_pg} =
+ qq|
|;
$column_data{sellprice} =
- qq|
|;
+ qq|
|;
} else {
# for last row and report
- # set pricegroup dragdrop from report menu
+ # set pricegroup drop down list from report menu
if ($form->{"sellprice_$i"} != 0) {
$prices =
qq|\n|;
$form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
- $column_data{sellprice_drag} =
- qq|
|;
+ $column_data{sellprice_pg} =
+ qq|
|;
} else {
# for last row
- $column_data{sellprice_drag} =
- qq|
|;
if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
@@ -399,13 +463,17 @@ sub display_row {
|;
if ($form->{type} eq 'invoice' or $form->{type} =~ /order/) {
- my $reqdate_term = ($form->{type} eq 'invoice')?'deliverydate':'reqdate'; # invoice uses a different term for the same thing.
+ my $reqdate_term =
+ ($form->{type} eq 'invoice')
+ ? 'deliverydate'
+ : 'reqdate'; # invoice uses a different term for the same thing.
print qq|
${$reqdate_term}
|;
}
-
+ my $subtotalchecked = ($form->{"subtotal_$i"}) ? "checked" : "";
print qq|
+ |.$locale->text('Subtotal').qq|
@@ -432,30 +500,32 @@ sub display_row {
# build html-code for pricegroups in variable $form->{prices_$j}
sub set_pricegroup {
- my $rowcount = shift;
$lxdebug->enter_sub();
+ my $rowcount = shift;
for $j (1 .. $rowcount) {
my $pricegroup_old = $form->{"pricegroup_old_$i"};
if ($form->{PRICES}{$j}) {
$len = 0;
- $prices = '';
+ $prices = '';
$price = 0;
foreach $item (@{ $form->{PRICES}{$j} }) {
+
#$price = $form->round_amount($myconfig, $item->{price}, 5);
#$price = $form->format_amount($myconfig, $item->{price}, 2);
- $price = $item->{price};
+ $price = $item->{price};
$pricegroup_id = $item->{pricegroup_id};
$pricegroup = $item->{pricegroup};
- # build dragdrop for pricegroups
+ # build drop down list for pricegroups
$prices .=
qq|\n|;
$len += 1;
-# map {
-# $form->{"${_}_$j"} =
-# $form->format_amount(\%myconfig, $form->{"${_}_$j"})
-# } qw(sellprice price_new price_old);
+
+ # map {
+ # $form->{"${_}_$j"} =
+ # $form->format_amount(\%myconfig, $form->{"${_}_$j"})
+ # } qw(sellprice price_new price_old);
# set new selectedpricegroup_id and prices for "Preis"
if ($item->{selected} && ($pricegroup_id != 0)) {
@@ -466,10 +536,8 @@ sub set_pricegroup {
if ($pricegroup_id == 0) {
$form->{"price_new_$j"} = $form->{"sellprice_$j"};
}
- if ($len > 1) {
- $form->{"prices_$j"} = $prices;
- }
}
+ $form->{"prices_$j"} = $prices;
}
}
$lxdebug->leave_sub();
@@ -567,6 +635,12 @@ sub select_item {
+
+
+
+
+
+
{id}>
@@ -629,7 +703,10 @@ sub item_selected {
$sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} }
- qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts partsgroup);
+ qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts partsgroup formel alu longdescription not_discountable adr_description);
+ if ($form->{"part_payment_id_$i"} ne "") {
+ $form->{payment_id} = $form->{"part_payment_id_$i"};
+ }
if ($lizenzen) {
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } qw(lizenzen);
@@ -656,6 +733,10 @@ sub item_selected {
$form->{sellprice} += ($form->{"sellprice_$i"} * $form->{"qty_$i"});
$form->{weight} += ($form->{"weight_$i"} * $form->{"qty_$i"});
+
+ if ($form->{"not_discountable_$i"}) {
+ $form->{"discount_$i"} = 0;
+ }
$amount =
$form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
@@ -765,45 +846,47 @@ sub new_item {
sub display_form {
$lxdebug->enter_sub();
+ $form->language_payment(\%myconfig);
# if we have a display_form
if ($form->{display_form}) {
&{"$form->{display_form}"};
exit;
}
-# if ( $form->{print_and_post}
-# && $form->{second_run}
-# && ($form->{action} eq "display_form")) {
-# for (keys %$form) { $old_form->{$_} = $form->{$_} }
-# $old_form->{rowcount}++;
-#
-# #$form->{rowcount}--;
-# #$form->{rowcount}--;
-#
-# $form->{print_and_post} = 0;
-#
-# &print_form($old_form);
-# exit;
-# }
-#
-# $form->{action} = "";
-# $form->{resubmit} = 0;
-#
-# if ($form->{print_and_post} && !$form->{second_run}) {
-# $form->{second_run} = 1;
-# $form->{action} = "display_form";
-# $form->{rowcount}--;
-# my $rowcount = $form->{rowcount};
-#
-# # get pricegroups for parts
-# IS->get_pricegroups_for_parts(\%myconfig, \%$form);
-#
-# # build up html code for prices_$i
-# set_pricegroup($rowcount);
-#
-# $form->{resubmit} = 1;
-#
-# }
+
+ # if ( $form->{print_and_post}
+ # && $form->{second_run}
+ # && ($form->{action} eq "display_form")) {
+ # for (keys %$form) { $old_form->{$_} = $form->{$_} }
+ # $old_form->{rowcount}++;
+ #
+ # #$form->{rowcount}--;
+ # #$form->{rowcount}--;
+ #
+ # $form->{print_and_post} = 0;
+ #
+ # &print_form($old_form);
+ # exit;
+ # }
+ #
+ # $form->{action} = "";
+ # $form->{resubmit} = 0;
+ #
+ # if ($form->{print_and_post} && !$form->{second_run}) {
+ # $form->{second_run} = 1;
+ # $form->{action} = "display_form";
+ # $form->{rowcount}--;
+ # my $rowcount = $form->{rowcount};
+ #
+ # # get pricegroups for parts
+ # IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ #
+ # # build up html code for prices_$i
+ # set_pricegroup($rowcount);
+ #
+ # $form->{resubmit} = 1;
+ #
+ # }
&form_header;
$numrows = ++$form->{rowcount};
@@ -821,7 +904,7 @@ sub display_form {
$subroutine = "makemodel_row";
}
if ($form->{item} eq 'assembly') {
- $numrows = ++$form->{price_rows};
+ $numrows = $form->{price_rows};
$subroutine = "price_row";
&{$subroutine}($numrows);
@@ -857,9 +940,10 @@ sub check_form {
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)
+ 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 adr_id language_values)
);
+
# remove any makes or model rows
if ($form->{item} eq 'part') {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
@@ -1058,7 +1142,6 @@ sub order {
$form->{rowcount}--;
- ($null, $form->{cp_id}) = split /--/, $form->{contact};
$form->{cp_id} *= 1;
require "$form->{path}/$form->{script}";
@@ -1106,7 +1189,6 @@ sub quotation {
$buysell = 'buy';
}
- ($null, $form->{cp_id}) = split /--/, $form->{contact};
$form->{cp_id} *= 1;
$form->{script} = 'oe.pl';
@@ -1264,7 +1346,7 @@ sub print_options {
$form->{DF}{ $form->{format} } = "selected";
$form->{OP}{ $form->{media} } = "selected";
$form->{SM}{ $form->{sendmode} } = "selected";
- print(STDERR $form->{format} , " Format\n");
+
if ($form->{type} eq 'purchase_order') {
$type = qq|