Revision 195883fd
Von Stephan Köhler vor etwa 19 Jahren hinzugefügt
bin/mozilla/io.pl | ||
---|---|---|
72 | 72 |
# $locale->text('Oct') |
73 | 73 |
# $locale->text('Nov') |
74 | 74 |
# $locale->text('Dec') |
75 |
use SL::IS; |
|
76 |
use SL::PE; |
|
75 | 77 |
use Data::Dumper; |
76 | 78 |
######################################## |
77 | 79 |
# Eintrag fuer Version 2.2.0 geaendert # |
... | ... | |
80 | 82 |
sub display_row { |
81 | 83 |
$lxdebug->enter_sub(); |
82 | 84 |
my $numrows = shift; |
83 |
|
|
85 |
print STDERR "io.pl-display_row\n"; |
|
84 | 86 |
if ($lizenzen && $form->{vc} eq "customer") { |
85 | 87 |
if ($form->{type} =~ /sales_order/) { |
86 | 88 |
@column_index = (runningnumber, partnumber, description, ship, qty); |
... | ... | |
99 | 101 |
} |
100 | 102 |
############## ENDE Neueintrag ################## |
101 | 103 |
|
102 |
push @column_index, qw(unit sellprice); |
|
104 |
push @column_index, qw(unit); |
|
105 |
|
|
106 |
#for pricegroups column |
|
107 |
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/)) { |
|
108 |
push @column_index, qw(sellprice_drag); |
|
109 |
} |
|
110 |
|
|
111 |
push @column_index, qw(sellprice); |
|
103 | 112 |
|
104 | 113 |
if ($form->{vc} eq 'customer') { |
105 | 114 |
push @column_index, qw(discount); |
... | ... | |
153 | 162 |
. $locale->text('Project') |
154 | 163 |
. qq|</th>|; |
155 | 164 |
$column_data{sellprice} = |
156 |
qq|<th align=left nowrap width=10 class=listheading>|
|
|
165 |
qq|<th align=left nowrap width=15 class=listheading>|
|
|
157 | 166 |
. $locale->text('Price') |
158 | 167 |
. qq|</th>|; |
168 |
$column_data{sellprice_drag} = |
|
169 |
qq|<th align=left nowrap width=15 class=listheading>| |
|
170 |
. $locale->text('Pricegroup') |
|
171 |
. qq|</th>|; |
|
159 | 172 |
$column_data{discount} = |
160 | 173 |
qq|<th align=left class=listheading>| |
161 | 174 |
. $locale->text('Discount') |
... | ... | |
201 | 214 |
map { |
202 | 215 |
$form->{"${_}_$i"} = |
203 | 216 |
$form->parse_amount(\%myconfig, $form->{"${_}_$i"}) |
204 |
} qw(qty ship discount sellprice); |
|
217 |
} qw(qty ship discount sellprice price_new price_old);
|
|
205 | 218 |
|
206 | 219 |
($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); |
207 | 220 |
$dec = length $dec; |
... | ... | |
211 | 224 |
$form->round_amount( |
212 | 225 |
$form->{"sellprice_$i"} * $form->{"discount_$i"} / 100, |
213 | 226 |
$decimalplaces); |
227 |
|
|
214 | 228 |
$linetotal = |
215 | 229 |
$form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces); |
216 | 230 |
$linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2); |
... | ... | |
239 | 253 |
} |
240 | 254 |
|
241 | 255 |
$column_data{qty} = |
242 |
qq|<td align=right><input name="qty_$i" size=5 value=| |
|
243 |
. $form->format_amount(\%myconfig, $form->{"qty_$i"}) |
|
244 |
. qq|></td>|; |
|
256 |
qq|<td align=right><input name="qty_$i" size=5 value=|.$form->format_amount(\%myconfig, $form->{"qty_$i"},0).qq|></td>|; |
|
245 | 257 |
$column_data{ship} = |
246 | 258 |
qq|<td align=right><input name="ship_$i" size=5 value=| |
247 | 259 |
. $form->format_amount(\%myconfig, $form->{"ship_$i"}) |
248 | 260 |
. qq|></td>|; |
249 | 261 |
$column_data{unit} = |
250 | 262 |
qq|<td><input name="unit_$i" size=5 value="$form->{"unit_$i"}"></td>|; |
251 |
$column_data{sellprice} = |
|
252 |
qq|<td align=right><input name="sellprice_$i" size=9 value=| |
|
253 |
. $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, |
|
254 |
$decimalplaces) |
|
255 |
. qq|></td>|; |
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
#print (STDERR "io.pl---111-i-$i", Dumper($form->{PRICES})); |
|
267 |
# build in dragdrop for pricesgroups |
|
268 |
if ($form->{"prices_$i"}) { |
|
269 |
print STDERR " YES prices\n"; |
|
270 |
$price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, 2); |
|
271 |
|
|
272 |
$column_data{sellprice_drag} = |
|
273 |
qq|<td align=right><select name="sellprice_drag_$i">$form->{"prices_$i"}</select></td>|; |
|
274 |
$column_data{sellprice} = |
|
275 |
qq|<td><input name="sellprice_$i" size=5 value=$price_tmp></td>|; |
|
276 |
} else { |
|
277 |
print STDERR " NO prices\n"; |
|
278 |
# for last row and report |
|
279 |
# set pricegroup dragdrop from report menu |
|
280 |
if ($form->{"sellprice_$i"} != 0) { |
|
281 |
print STDERR " HIER NOCH F?R RECHNUNGSAUFRUFE\n"; |
|
282 |
print (STDERR "sellprice_$i ", Dumper($form->{"sellprice_$i"}), " pricegroup_id_$i ", Dumper($form->{"pricegroup_id_$i"})); |
|
283 |
$prices = |
|
284 |
qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|; |
|
285 |
|
|
286 |
$form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"}; |
|
287 |
|
|
288 |
$column_data{sellprice_drag} = |
|
289 |
qq|<td align=right><select name="sellprice_drag_$i">$prices</select></td>|; |
|
290 |
|
|
291 |
}else { |
|
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 |
} |
|
299 |
|
|
300 |
$column_data{sellprice} = |
|
301 |
qq|<td><input name="sellprice_$i" size=5 value=| |
|
302 |
. $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, |
|
303 |
$decimalplaces) |
|
304 |
. qq|></td>|; |
|
305 |
} |
|
306 |
#print (STDERR "io.pl---555-i-$i", Dumper($form->{"price_old_$i"})); |
|
256 | 307 |
$column_data{discount} = |
257 | 308 |
qq|<td align=right><input name="discount_$i" size=3 value=| |
258 | 309 |
. $form->format_amount(\%myconfig, $form->{"discount_$i"}) |
... | ... | |
289 | 340 |
<input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}> |
290 | 341 |
<input type=hidden name="bo_$i" value=$form->{"bo_$i"}> |
291 | 342 |
|
343 |
<input type=hidden name="pricegroup_old_$i" value=$form->{"pricegroup_old_$i"}> |
|
344 |
<input type=hidden name="price_old_$i" value=$form->{"price_old_$i"}> |
|
345 |
<input type=hidden name="price_new_$i" value=|.$form->format_amount(\%myconfig,$form->{"price_new_$i"}).qq|> |
|
346 |
|
|
292 | 347 |
<input type=hidden name="id_$i" value=$form->{"id_$i"}> |
293 | 348 |
<input type=hidden name="inventory_accno_$i" value=$form->{"inventory_accno_$i"}> |
294 | 349 |
<input type=hidden name="bin_$i" value="$form->{"bin_$i"}"> |
... | ... | |
357 | 412 |
$lxdebug->leave_sub(); |
358 | 413 |
} |
359 | 414 |
|
360 |
sub select_item { |
|
415 |
################################################## |
|
416 |
# build html-code for pricegroups in variable $form->{prices_$j} |
|
417 |
|
|
418 |
sub set_pricegroup { |
|
361 | 419 |
$lxdebug->enter_sub(); |
420 |
print STDERR "io.pl-set_pricegroup-i-$i\n"; |
|
421 |
for $j (1 .. $i) { |
|
422 |
|
|
423 |
my $pricegroup_old = $form->{"pricegroup_old_$i"}; |
|
424 |
if ($form->{PRICES}{ $j }) { |
|
425 |
$len = 0; |
|
426 |
$prices = ''; |
|
427 |
$price = 0; |
|
428 |
foreach $item (@{ $form->{PRICES}{ $j } }) { |
|
429 |
print STDERR "TEST--i--$i--jjj-$j\n"; |
|
430 |
# print STDERR "-VOR PREIS--$item->{price}--PREISGRUOP-$item->{pricegroup_id}\n"; |
|
431 |
$price = $form->round_amount($myconfig, $item->{price},5); |
|
432 |
$price = $form->format_amount($myconfig, $item->{price},2); |
|
433 |
$price = $item->{price}; |
|
434 |
# print STDERR "-NACH PREIS--$price--PREISGRUOP-$item->{pricegroup_id}\n"; |
|
435 |
$pricegroup_id = $item->{pricegroup_id}; |
|
436 |
$pricegroup = $item->{pricegroup}; |
|
437 |
# build dragdrop for pricegroups |
|
438 |
$prices .= |
|
439 |
qq|<option value="$price--$pricegroup_id"$item->{selected}>$pricegroup</option>\n|; |
|
440 |
|
|
441 |
$len += 1; |
|
442 |
# print STDERR "prices---$prices\n"; |
|
443 |
# set new selectedpricegroup_id and prices for "Preis" |
|
444 |
if ($item->{selected}) { |
|
445 |
$form->{"pricegroup_old_$j"} = $pricegroup_id; |
|
446 |
$form->{"price_new_$j"} = $price; |
|
447 |
$form->{"sellprice_$j"} = $price; |
|
448 |
} |
|
449 |
if ($len >= 1) { |
|
450 |
$form->{"prices_$j"} = $prices; |
|
451 |
} |
|
452 |
} |
|
453 |
} |
|
454 |
} |
|
455 |
print (STDERR "", Dumper($form->{PRICES})); |
|
456 |
$lxdebug->leave_sub(); |
|
457 |
} |
|
362 | 458 |
|
459 |
sub select_item { |
|
460 |
$lxdebug->enter_sub(); |
|
461 |
print STDERR "io.pl-select_item\n"; |
|
363 | 462 |
@column_index = qw(ndx partnumber description onhand sellprice); |
364 | 463 |
|
365 | 464 |
$column_data{ndx} = qq|<th> </th>|; |
... | ... | |
411 | 510 |
} |
412 | 511 |
|
413 | 512 |
map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description unit); |
414 |
|
|
513 |
#sk tradediscount |
|
514 |
print STDERR "TRADEDISCOUNT $ref->{sellprice}\n"; |
|
415 | 515 |
$ref->{sellprice} = |
416 | 516 |
$form->round_amount($ref->{sellprice} * (1 - $form->{tradediscount}), 2); |
417 |
|
|
517 |
print STDERR "TRADEDISCOUNT $ref->{sellprice}\n"; |
|
418 | 518 |
$column_data{ndx} = |
419 | 519 |
qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|; |
420 | 520 |
$column_data{partnumber} = |
... | ... | |
496 | 596 |
|
497 | 597 |
sub item_selected { |
498 | 598 |
$lxdebug->enter_sub(); |
499 |
|
|
599 |
print STDERR "io.pl-item_selected\n"; |
|
500 | 600 |
# replace the last row with the checked row |
501 | 601 |
$i = $form->{rowcount}; |
502 | 602 |
$i = $form->{assembly_rows} if ($form->{item} eq 'assembly'); |
... | ... | |
504 | 604 |
# index for new item |
505 | 605 |
$j = $form->{ndx}; |
506 | 606 |
|
607 |
#sk |
|
608 |
#($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"}; |
|
609 |
#$form->{"sellprice_$i"} = $form->{"sellprice_$i"}; |
|
610 |
|
|
507 | 611 |
# if there was a price entered, override it |
508 | 612 |
$sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); |
509 | 613 |
|
... | ... | |
563 | 667 |
$form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) |
564 | 668 |
} qw(sellprice listprice) if $form->{item} ne 'assembly'; |
565 | 669 |
|
670 |
# get pricegroups for parts |
|
671 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
672 |
|
|
673 |
# build up html code for prices_$i |
|
674 |
set_pricegroup(); |
|
675 |
|
|
566 | 676 |
&display_form; |
567 | 677 |
|
568 | 678 |
$lxdebug->leave_sub(); |
... | ... | |
638 | 748 |
|
639 | 749 |
sub display_form { |
640 | 750 |
$lxdebug->enter_sub(); |
641 |
|
|
751 |
print STDERR "io.pl-display_form\n"; |
|
642 | 752 |
# if we have a display_form |
643 | 753 |
if ($form->{display_form}) { |
644 | 754 |
&{"$form->{display_form}"}; |
755 |
print STDERR " --------------------- exit\n"; |
|
645 | 756 |
exit; |
646 | 757 |
} |
647 | 758 |
if ( $form->{print_and_post} |
... | ... | |
676 | 787 |
$subroutine = "display_row"; |
677 | 788 |
|
678 | 789 |
if ($form->{item} eq 'part') { |
790 |
print STDERR " part\n"; |
|
791 |
#set preisgruppenanzahl |
|
792 |
$numrows = $form->{price_rows}; |
|
793 |
$subroutine = "price_row"; |
|
794 |
|
|
795 |
&{$subroutine}($numrows); |
|
796 |
|
|
679 | 797 |
$numrows = ++$form->{makemodel_rows}; |
680 | 798 |
$subroutine = "makemodel_row"; |
681 | 799 |
} |
682 | 800 |
if ($form->{item} eq 'assembly') { |
801 |
print STDERR " assembly\n"; |
|
802 |
$numrows = ++$form->{price_rows}; |
|
803 |
$subroutine = "price_row"; |
|
804 |
|
|
805 |
&{$subroutine}($numrows); |
|
806 |
|
|
683 | 807 |
$numrows = ++$form->{makemodel_rows}; |
684 | 808 |
$subroutine = "makemodel_row"; |
685 | 809 |
|
... | ... | |
690 | 814 |
$subroutine = "assembly_row"; |
691 | 815 |
} |
692 | 816 |
if ($form->{item} eq 'service') { |
817 |
print STDERR " service\n"; |
|
818 |
$numrows = ++$form->{price_rows}; |
|
819 |
$subroutine = "price_row"; |
|
820 |
|
|
821 |
&{$subroutine}($numrows); |
|
822 |
|
|
693 | 823 |
$numrows = 0; |
694 | 824 |
} |
695 | 825 |
|
... | ... | |
707 | 837 |
|
708 | 838 |
sub check_form { |
709 | 839 |
$lxdebug->enter_sub(); |
710 |
|
|
840 |
print STDERR "io.pl-check_form\n"; |
|
711 | 841 |
my @a = (); |
712 | 842 |
my $count = 0; |
713 | 843 |
my @flds = ( |
... | ... | |
752 | 882 |
|
753 | 883 |
map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds; |
754 | 884 |
|
885 |
#($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"}; |
|
886 |
|
|
755 | 887 |
$form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"}); |
756 | 888 |
$form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"}); |
757 | 889 |
$count++; |
... | ... | |
808 | 940 |
|
809 | 941 |
} |
810 | 942 |
} |
943 |
|
|
944 |
#sk |
|
945 |
print STDERR "LEVEL--$form->{level}\n"; |
|
946 |
print STDERR "Type--$form->{type}\n"; |
|
947 |
# if pricegroups |
|
948 |
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/)) { |
|
949 |
|
|
950 |
# get pricegroups for parts |
|
951 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
952 |
|
|
953 |
# build up html code for prices_$i |
|
954 |
set_pricegroup(); |
|
955 |
|
|
956 |
} |
|
811 | 957 |
|
812 | 958 |
&display_form; |
813 | 959 |
|
... | ... | |
829 | 975 |
$discount = $form->parse_amount(\%myconfig, $form->{"discount_$i"}); |
830 | 976 |
$qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}); |
831 | 977 |
|
978 |
#($form->{"sellprice_$i"}, $form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"}; |
|
979 |
|
|
832 | 980 |
$amount = $sellprice * (1 - $discount / 100) * $qty; |
833 | 981 |
map { $form->{"${_}_base"} += $amount } |
834 | 982 |
(split / /, $form->{"taxaccounts_$i"}); |
... | ... | |
852 | 1000 |
|
853 | 1001 |
sub validate_items { |
854 | 1002 |
$lxdebug->enter_sub(); |
855 |
|
|
1003 |
print STDERR "io.pl-validate_items\n"; |
|
856 | 1004 |
# check if items are valid |
857 | 1005 |
if ($form->{rowcount} == 1) { |
858 | 1006 |
&update; |
... | ... | |
1086 | 1234 |
|
1087 | 1235 |
sub print_options { |
1088 | 1236 |
$lxdebug->enter_sub(); |
1089 |
|
|
1237 |
print STDERR "io.pl-print_options\n"; |
|
1090 | 1238 |
$form->{sendmode} = "attachment"; |
1091 | 1239 |
$form->{copies} = 3 unless $form->{copies}; |
1092 | 1240 |
|
... | ... | |
1243 | 1391 |
|
1244 | 1392 |
sub print { |
1245 | 1393 |
$lxdebug->enter_sub(); |
1246 |
|
|
1394 |
print STDERR "io.pl-print\n"; |
|
1247 | 1395 |
# if this goes to the printer pass through |
1248 | 1396 |
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') { |
1249 | 1397 |
$form->error($locale->text('Select postscript or PDF!')) |
... | ... | |
1261 | 1409 |
sub print_form { |
1262 | 1410 |
$lxdebug->enter_sub(); |
1263 | 1411 |
my ($old_form) = @_; |
1264 |
|
|
1412 |
print STDERR "io.pl-print_form\n"; |
|
1265 | 1413 |
$inv = "inv"; |
1266 | 1414 |
$due = "due"; |
1267 |
|
|
1415 |
#print (STDERR "", Dumper($form)); |
|
1268 | 1416 |
$numberfld = "invnumber"; |
1269 | 1417 |
|
1270 | 1418 |
$display_form = |
... | ... | |
1356 | 1504 |
if (!$form->{"${inv}number"} && !$form->{preview}) { |
1357 | 1505 |
$form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld); |
1358 | 1506 |
if ($form->{media} ne 'email') { |
1507 |
|
|
1508 |
$i = $form->{rowcount}; |
|
1509 |
# get pricegroups for parts |
|
1510 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
1511 |
|
|
1512 |
# build up html code for prices_$i |
|
1513 |
set_pricegroup(); |
|
1514 |
|
|
1359 | 1515 |
$form->{rowcount}--; |
1516 |
|
|
1360 | 1517 |
&{"$display_form"}; |
1361 | 1518 |
exit; |
1362 | 1519 |
} |
... | ... | |
1552 | 1709 |
|
1553 | 1710 |
sub customer_details { |
1554 | 1711 |
$lxdebug->enter_sub(); |
1555 |
|
|
1712 |
print STDERR "io.pl-customer_details\n"; |
|
1556 | 1713 |
IS->customer_details(\%myconfig, \%$form); |
1557 | 1714 |
$lxdebug->leave_sub(); |
1558 | 1715 |
} |
... | ... | |
1578 | 1735 |
|
1579 | 1736 |
sub ship_to { |
1580 | 1737 |
$lxdebug->enter_sub(); |
1581 |
|
|
1738 |
print STDERR "io.pl-ship_to\n"; |
|
1582 | 1739 |
$title = $form->{title}; |
1583 | 1740 |
$form->{title} = $locale->text('Ship to'); |
1584 | 1741 |
|
1585 | 1742 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
1586 | 1743 |
qw(exchangerate creditlimit creditremaining); |
1587 |
$form_id = $form->{id}; |
|
1744 |
|
|
1588 | 1745 |
|
1589 | 1746 |
# get details for name |
1590 | 1747 |
&{"$form->{vc}_details"}; |
1591 |
$form->{id} = $form_id; |
|
1592 | 1748 |
|
1593 | 1749 |
$number = |
1594 | 1750 |
($form->{vc} eq 'customer') |
1595 | 1751 |
? $locale->text('Customer Number') |
1596 | 1752 |
: $locale->text('Vendor Number'); |
1597 | 1753 |
|
1754 |
$i = $form->{rowcount}; |
|
1755 |
# get pricegroups for parts |
|
1756 |
IS->get_pricegroups_for_parts(\%myconfig, \%$form); |
|
1757 |
|
|
1758 |
# build up html code for prices_$i |
|
1759 |
set_pricegroup(); |
|
1760 |
|
|
1598 | 1761 |
$nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form"; |
1599 | 1762 |
|
1600 | 1763 |
$form->{rowcount}--; |
Auch abrufbar als: Unified diff
Preisgruppenerweiterung auf Basis von Andres Patch - Thanks
Preisgruppenverwaltung
...-Preiseingabe der Preisgruppen in Masken Waren,etc.
-Auswahl der Preisgruppen in den Verkaufsmasken
Erweiterung Datenbankschema