Revision 342c174c
Von Stephan Köhler vor etwa 19 Jahren hinzugefügt
bin/mozilla/io.pl | ||
---|---|---|
103 | 103 |
push @column_index, qw(unit); |
104 | 104 |
|
105 | 105 |
#for pricegroups column |
106 |
if ($form->{type} =~ (/sales_quotation/) or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) or ($form->{type} =~ /sales_order/)) { |
|
106 |
if ( $form->{type} =~ (/sales_quotation/) |
|
107 |
or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) |
|
108 |
or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) |
|
109 |
or ($form->{type} =~ /sales_order/)) { |
|
107 | 110 |
push @column_index, qw(sellprice_drag); |
108 | 111 |
} |
109 | 112 |
|
... | ... | |
252 | 255 |
} |
253 | 256 |
|
254 | 257 |
$column_data{qty} = |
255 |
qq|<td align=right><input name="qty_$i" size=5 value=|.$form->format_amount(\%myconfig, $form->{"qty_$i"},0).qq|></td>|; |
|
258 |
qq|<td align=right><input name="qty_$i" size=5 value=| |
|
259 |
. $form->format_amount(\%myconfig, $form->{"qty_$i"}, 0) |
|
260 |
. qq|></td>|; |
|
256 | 261 |
$column_data{ship} = |
257 | 262 |
qq|<td align=right><input name="ship_$i" size=5 value=| |
258 | 263 |
. $form->format_amount(\%myconfig, $form->{"ship_$i"}) |
... | ... | |
260 | 265 |
$column_data{unit} = |
261 | 266 |
qq|<td><input name="unit_$i" size=5 value="$form->{"unit_$i"}"></td>|; |
262 | 267 |
|
263 |
|
|
264 |
|
|
265 | 268 |
# build in dragdrop for pricesgroups |
266 | 269 |
if ($form->{"prices_$i"}) { |
267 |
$price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, 2); |
|
270 |
$price_tmp = |
|
271 |
$form->format_amount(\%myconfig, $form->{"price_new_$i"}, 2); |
|
268 | 272 |
|
269 | 273 |
$column_data{sellprice_drag} = |
270 | 274 |
qq|<td align=right><select name="sellprice_drag_$i">$form->{"prices_$i"}</select></td>|; |
271 | 275 |
$column_data{sellprice} = |
272 | 276 |
qq|<td><input name="sellprice_$i" size=5 value=$price_tmp></td>|; |
273 | 277 |
} else { |
278 |
|
|
274 | 279 |
# for last row and report |
275 | 280 |
# set pricegroup dragdrop from report menu |
276 | 281 |
if ($form->{"sellprice_$i"} != 0) { |
277 | 282 |
$prices = |
278 |
qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|;
|
|
283 |
qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|; |
|
279 | 284 |
|
280 | 285 |
$form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"}; |
281 | 286 |
|
282 | 287 |
$column_data{sellprice_drag} = |
283 | 288 |
qq|<td align=right><select name="sellprice_drag_$i">$prices</select></td>|; |
284 | 289 |
|
285 |
}else { |
|
286 |
# for last row |
|
287 |
$column_data{sellprice_drag} = |
|
288 |
qq|<td align=right><input name="sellprice_$i" size=9 value=| |
|
289 |
. $form->format_amount(\%myconfig, $form->{"prices_$i"}, |
|
290 |
$decimalplaces) |
|
291 |
. qq|></td>|; |
|
292 |
} |
|
290 |
} else { |
|
291 |
|
|
292 |
# for last row |
|
293 |
$column_data{sellprice_drag} = |
|
294 |
qq|<td align=right><input name="sellprice_$i" size=9 value=| |
|
295 |
. $form->format_amount(\%myconfig, $form->{"prices_$i"}, |
|
296 |
$decimalplaces) |
|
297 |
. qq|></td>|; |
|
298 |
} |
|
293 | 299 |
|
294 | 300 |
$column_data{sellprice} = |
295 | 301 |
qq|<td><input name="sellprice_$i" size=5 value=| |
... | ... | |
335 | 341 |
|
336 | 342 |
<input type=hidden name="pricegroup_old_$i" value=$form->{"pricegroup_old_$i"}> |
337 | 343 |
<input type=hidden name="price_old_$i" value=$form->{"price_old_$i"}> |
338 |
<input type=hidden name="price_new_$i" value=|.$form->format_amount(\%myconfig,$form->{"price_new_$i"}).qq|> |
|
344 |
<input type=hidden name="price_new_$i" value=| |
|
345 |
. $form->format_amount(\%myconfig, $form->{"price_new_$i"}) . qq|> |
|
339 | 346 |
|
340 | 347 |
<input type=hidden name="id_$i" value=$form->{"id_$i"}> |
341 | 348 |
<input type=hidden name="inventory_accno_$i" value=$form->{"inventory_accno_$i"}> |
... | ... | |
414 | 421 |
for $j (1 .. $rowcount) { |
415 | 422 |
|
416 | 423 |
my $pricegroup_old = $form->{"pricegroup_old_$i"}; |
417 |
if ($form->{PRICES}{ $j }) {
|
|
424 |
if ($form->{PRICES}{$j}) {
|
|
418 | 425 |
$len = 0; |
419 | 426 |
$prices = ''; |
420 |
$price = 0; |
|
421 |
foreach $item (@{ $form->{PRICES}{ $j } }) {
|
|
422 |
$price = $form->round_amount($myconfig, $item->{price},5);
|
|
423 |
$price = $form->format_amount($myconfig, $item->{price},2);
|
|
424 |
$price = $item->{price};
|
|
427 |
$price = 0;
|
|
428 |
foreach $item (@{ $form->{PRICES}{$j} }) {
|
|
429 |
$price = $form->round_amount($myconfig, $item->{price}, 5);
|
|
430 |
$price = $form->format_amount($myconfig, $item->{price}, 2);
|
|
431 |
$price = $item->{price}; |
|
425 | 432 |
$pricegroup_id = $item->{pricegroup_id}; |
426 | 433 |
$pricegroup = $item->{pricegroup}; |
434 |
|
|
427 | 435 |
# build dragdrop for pricegroups |
428 | 436 |
$prices .= |
429 |
qq|<option value="$price--$pricegroup_id"$item->{selected}>$pricegroup</option>\n|;
|
|
437 |
qq|<option value="$price--$pricegroup_id"$item->{selected}>$pricegroup</option>\n|; |
|
430 | 438 |
|
431 | 439 |
$len += 1; |
440 |
|
|
432 | 441 |
# set new selectedpricegroup_id and prices for "Preis" |
433 | 442 |
if ($item->{selected}) { |
434 | 443 |
$form->{"pricegroup_old_$j"} = $pricegroup_id; |
435 |
$form->{"price_new_$j"} = $price; |
|
436 |
$form->{"sellprice_$j"} = $price;
|
|
444 |
$form->{"price_new_$j"} = $price;
|
|
445 |
$form->{"sellprice_$j"} = $price;
|
|
437 | 446 |
} |
438 | 447 |
if ($len >= 1) { |
439 | 448 |
$form->{"prices_$j"} = $prices; |
... | ... | |
441 | 450 |
} |
442 | 451 |
} |
443 | 452 |
} |
453 |
|
|
454 |
#print (STDERR "HIER", Dumper($prices) ); |
|
444 | 455 |
$lxdebug->leave_sub(); |
445 | 456 |
} |
446 | 457 |
|
... | ... | |
497 | 508 |
} |
498 | 509 |
|
499 | 510 |
map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description unit); |
500 |
#sk tradediscount |
|
511 |
|
|
512 |
#sk tradediscount |
|
501 | 513 |
$ref->{sellprice} = |
502 | 514 |
$form->round_amount($ref->{sellprice} * (1 - $form->{tradediscount}), 2); |
503 | 515 |
$column_data{ndx} = |
... | ... | |
581 | 593 |
|
582 | 594 |
sub item_selected { |
583 | 595 |
$lxdebug->enter_sub(); |
596 |
|
|
584 | 597 |
# replace the last row with the checked row |
585 | 598 |
$i = $form->{rowcount}; |
586 | 599 |
$i = $form->{assembly_rows} if ($form->{item} eq 'assembly'); |
... | ... | |
655 | 668 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
656 | 669 |
|
657 | 670 |
# build up html code for prices_$i |
658 |
set_pricegroup(); |
|
671 |
set_pricegroup($form->{rowcount});
|
|
659 | 672 |
|
660 | 673 |
&display_form; |
661 | 674 |
|
... | ... | |
760 | 773 |
$form->{second_run} = 1; |
761 | 774 |
$form->{action} = "display_form"; |
762 | 775 |
$form->{rowcount}--; |
763 |
my $rowcount = $form->{rowcount}; |
|
776 |
my $rowcount = $form->{rowcount}; |
|
777 |
|
|
764 | 778 |
# get pricegroups for parts |
765 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form, "new"); |
|
779 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
780 |
|
|
766 | 781 |
# build up html code for prices_$i |
767 | 782 |
set_pricegroup($rowcount); |
768 |
|
|
769 | 783 |
|
770 | 784 |
$form->{resubmit} = 1; |
771 | 785 |
|
... | ... | |
776 | 790 |
$subroutine = "display_row"; |
777 | 791 |
|
778 | 792 |
if ($form->{item} eq 'part') { |
793 |
|
|
779 | 794 |
#set preisgruppenanzahl |
780 | 795 |
$numrows = $form->{price_rows}; |
781 | 796 |
$subroutine = "price_row"; |
... | ... | |
921 | 936 |
|
922 | 937 |
} |
923 | 938 |
} |
924 |
|
|
925 |
#sk
|
|
939 |
|
|
940 |
#sk |
|
926 | 941 |
# if pricegroups |
927 |
if ($form->{type} =~ (/sales_quotation/) or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) or ($form->{type} =~ /sales_order/)) { |
|
928 |
|
|
929 |
# get pricegroups for parts |
|
930 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
942 |
if ( $form->{type} =~ (/sales_quotation/) |
|
943 |
or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/)) |
|
944 |
or (($form->{level} eq undef) and ($form->{type} =~ /invoice/)) |
|
945 |
or ($form->{type} =~ /sales_order/)) { |
|
946 |
|
|
947 |
# get pricegroups for parts |
|
948 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
949 |
|
|
950 |
# build up html code for prices_$i |
|
951 |
set_pricegroup($form->{rowcount}); |
|
931 | 952 |
|
932 |
# build up html code for prices_$i |
|
933 |
set_pricegroup(); |
|
934 |
|
|
935 | 953 |
} |
936 | 954 |
|
937 | 955 |
&display_form; |
... | ... | |
979 | 997 |
|
980 | 998 |
sub validate_items { |
981 | 999 |
$lxdebug->enter_sub(); |
1000 |
|
|
982 | 1001 |
# check if items are valid |
983 | 1002 |
if ($form->{rowcount} == 1) { |
984 | 1003 |
&update; |
... | ... | |
1105 | 1124 |
$lxdebug->enter_sub(); |
1106 | 1125 |
if ($form->{second_run}) { |
1107 | 1126 |
$form->{print_and_post} = 0; |
1108 |
$form->{resubmit} = 0; |
|
1127 |
$form->{resubmit} = 0;
|
|
1109 | 1128 |
} |
1110 | 1129 |
if ($myconfig{role} eq 'admin') { |
1111 | 1130 |
$bcc = qq| |
... | ... | |
1377 | 1396 |
if ($form->{second_run}) { |
1378 | 1397 |
$form->{print_and_post} = 0; |
1379 | 1398 |
} |
1399 |
|
|
1380 | 1400 |
# if this goes to the printer pass through |
1381 | 1401 |
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') { |
1382 | 1402 |
$form->error($locale->text('Select postscript or PDF!')) |
... | ... | |
1395 | 1415 |
$lxdebug->enter_sub(); |
1396 | 1416 |
my ($old_form) = @_; |
1397 | 1417 |
|
1398 |
$inv = "inv"; |
|
1399 |
$due = "due"; |
|
1418 |
$inv = "inv";
|
|
1419 |
$due = "due";
|
|
1400 | 1420 |
$numberfld = "invnumber"; |
1401 | 1421 |
|
1402 | 1422 |
$display_form = |
... | ... | |
1488 | 1508 |
if (!$form->{"${inv}number"} && !$form->{preview}) { |
1489 | 1509 |
$form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld); |
1490 | 1510 |
if ($form->{media} ne 'email') { |
1491 |
|
|
1492 |
$i = $form->{rowcount}; |
|
1493 |
# get pricegroups for parts |
|
1494 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
1495 | 1511 |
|
1496 |
# build up html code for prices_$i |
|
1497 |
set_pricegroup(); |
|
1512 |
# get pricegroups for parts |
|
1513 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
1514 |
|
|
1515 |
# build up html code for prices_$i |
|
1516 |
set_pricegroup($form->{rowcount}); |
|
1498 | 1517 |
|
1499 | 1518 |
$form->{rowcount}--; |
1500 | 1519 |
|
... | ... | |
1728 | 1747 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
1729 | 1748 |
qw(exchangerate creditlimit creditremaining); |
1730 | 1749 |
|
1731 |
|
|
1732 | 1750 |
# get details for name |
1733 | 1751 |
&{"$form->{vc}_details"}; |
1734 | 1752 |
|
... | ... | |
1737 | 1755 |
? $locale->text('Customer Number') |
1738 | 1756 |
: $locale->text('Vendor Number'); |
1739 | 1757 |
|
1740 |
$i = $form->{rowcount}; |
|
1741 | 1758 |
# get pricegroups for parts |
1742 | 1759 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
1743 | 1760 |
|
1744 | 1761 |
# build up html code for prices_$i |
1745 |
set_pricegroup(); |
|
1762 |
set_pricegroup($form->{rowcount});
|
|
1746 | 1763 |
|
1747 | 1764 |
$nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form"; |
1748 | 1765 |
|
Auch abrufbar als: Unified diff
Bugfix Preisgruppen - nach Update wurden die Preisgruppen nicht aufgebaut
und Perltidy