Revision d9c9bc22
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
34 | 34 |
|
35 | 35 |
package IS; |
36 | 36 |
|
37 |
use List::Util qw(max); |
|
38 |
|
|
37 | 39 |
use SL::AM; |
38 | 40 |
use SL::Common; |
39 | 41 |
use SL::DBUtils; |
... | ... | |
154 | 156 |
$position = int($position); |
155 | 157 |
$position++; |
156 | 158 |
} |
157 |
push(@{ $form->{runningnumber} }, $position); |
|
158 |
push(@{ $form->{number} }, qq|$form->{"partnumber_$i"}|); |
|
159 |
push(@{ $form->{serialnumber} }, qq|$form->{"serialnumber_$i"}|); |
|
160 |
push(@{ $form->{bin} }, qq|$form->{"bin_$i"}|); |
|
161 |
push(@{ $form->{"partnotes"} }, qq|$form->{"partnotes_$i"}|); |
|
162 |
push(@{ $form->{description} }, qq|$form->{"description_$i"}|); |
|
163 |
push(@{ $form->{longdescription} }, qq|$form->{"longdescription_$i"}|); |
|
164 |
push(@{ $form->{qty} }, |
|
165 |
$form->format_amount($myconfig, $form->{"qty_$i"})); |
|
166 |
push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|); |
|
167 |
push(@{ $form->{deliverydate_oe} }, qq|$form->{"deliverydate_$i"}|); |
|
168 |
|
|
169 |
push(@{ $form->{sellprice} }, $form->{"sellprice_$i"}); |
|
170 |
push(@{ $form->{ordnumber_oe} }, qq|$form->{"ordnumber_$i"}|); |
|
171 |
push(@{ $form->{transdate_oe} }, qq|$form->{"transdate_$i"}|); |
|
172 |
push(@{ $form->{invnumber} }, qq|$form->{"invnumber"}|); |
|
173 |
push(@{ $form->{invdate} }, qq|$form->{"invdate"}|); |
|
159 |
|
|
160 |
push @{ $form->{runningnumber} }, $position; |
|
161 |
push @{ $form->{number} }, $form->{"partnumber_$i"}; |
|
162 |
push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; |
|
163 |
push @{ $form->{bin} }, $form->{"bin_$i"}; |
|
164 |
push @{ $form->{"partnotes"} }, $form->{"partnotes_$i"}; |
|
165 |
push @{ $form->{description} }, $form->{"description_$i"}; |
|
166 |
push @{ $form->{longdescription} }, $form->{"longdescription_$i"}; |
|
167 |
push @{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"}); |
|
168 |
push @{ $form->{unit} }, $form->{"unit_$i"}; |
|
169 |
push @{ $form->{deliverydate_oe} }, $form->{"deliverydate_$i"}; |
|
170 |
push @{ $form->{sellprice} }, $form->{"sellprice_$i"}; |
|
171 |
push @{ $form->{ordnumber_oe} }, $form->{"ordnumber_$i"}; |
|
172 |
push @{ $form->{transdate_oe} }, $form->{"transdate_$i"}; |
|
173 |
push @{ $form->{invnumber} }, $form->{"invnumber"}; |
|
174 |
push @{ $form->{invdate} }, $form->{"invdate"}; |
|
174 | 175 |
|
175 | 176 |
if ($form->{lizenzen}) { |
176 | 177 |
if ($form->{"licensenumber_$i"}) { |
... | ... | |
188 | 189 |
# listprice |
189 | 190 |
push(@{ $form->{listprice} }, $form->{"listprice_$i"}); |
190 | 191 |
|
191 |
my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
|
192 |
my ($dec) = ($sellprice =~ /\.(\d+)/); |
|
193 |
$dec = length $dec; |
|
194 |
my $decimalplaces = ($dec > 2) ? $dec : 2; |
|
195 |
|
|
196 |
my $i_discount = |
|
197 |
$form->round_amount( |
|
198 |
$sellprice * $form->parse_amount($myconfig, |
|
199 |
$form->{"discount_$i"}) / 100, |
|
200 |
$decimalplaces); |
|
201 |
|
|
202 |
my $discount = |
|
203 |
$form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); |
|
192 |
my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
|
193 |
my ($dec) = ($sellprice =~ /\.(\d+)/); |
|
194 |
my $decimalplaces = max 2, length($dec); |
|
204 | 195 |
|
205 |
# keep a netprice as well, (sellprice - discount) |
|
206 |
$form->{"netprice_$i"} = $sellprice - $i_discount; |
|
196 |
my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100, $decimalplaces); |
|
197 |
my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100, 2); |
|
198 |
my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice, 2); |
|
199 |
$form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); |
|
207 | 200 |
|
208 |
push(@{ $form->{netprice} }, |
|
209 |
($form->{"netprice_$i"} != 0) |
|
210 |
? $form->format_amount( |
|
211 |
$myconfig, $form->{"netprice_$i"}, |
|
212 |
$decimalplaces |
|
213 |
) |
|
214 |
: " "); |
|
201 |
push @{ $form->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : ''; |
|
215 | 202 |
|
216 |
my $linetotal = |
|
217 |
$form->round_amount($form->{"qty_$i"} * $form->{"netprice_$i"}, 2); |
|
203 |
$linetotal = ($linetotal != 0) ? $linetotal : ''; |
|
218 | 204 |
|
219 |
my $nodiscount_linetotal =
|
|
220 |
$form->round_amount($form->{"qty_$i"} * $sellprice, 2);
|
|
205 |
push @{ $form->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, $decimalplaces) : '';
|
|
206 |
push @{ $form->{p_discount} }, $form->{"discount_$i"};
|
|
221 | 207 |
|
222 |
$discount = |
|
223 |
($discount != 0) |
|
224 |
? $form->format_amount($myconfig, $discount * -1, $decimalplaces) |
|
225 |
: " "; |
|
226 |
$linetotal = ($linetotal != 0) ? $linetotal : " "; |
|
208 |
$form->{total} += $linetotal; |
|
209 |
$form->{nodiscount_total} += $nodiscount_linetotal; |
|
210 |
$form->{discount_total} += $discount; |
|
227 | 211 |
|
228 |
push(@{ $form->{discount} }, $discount); |
|
229 |
push(@{ $form->{p_discount} }, $form->{"discount_$i"}); |
|
230 |
if (($form->{"discount_$i"} ne "") && ($form->{"discount_$i"} != 0)) { |
|
231 |
$form->{discount_p} = $form->{"discount_$i"}; |
|
212 |
if ($subtotal_header) { |
|
213 |
$discount_subtotal += $linetotal; |
|
214 |
$nodiscount_subtotal += $nodiscount_linetotal; |
|
232 | 215 |
} |
233 |
$form->{total} += $linetotal; |
|
234 |
$discount_subtotal += $linetotal; |
|
235 |
$form->{nodiscount_total} += $nodiscount_linetotal; |
|
236 |
$nodiscount_subtotal += $nodiscount_linetotal; |
|
237 |
$form->{discount_total} += $form->parse_amount($myconfig, $discount); |
|
238 | 216 |
|
239 | 217 |
if ($form->{"subtotal_$i"} && $subtotal_header && ($subtotal_header != $i)) { |
240 |
$discount_subtotal = $form->format_amount($myconfig, $discount_subtotal, 2); |
|
241 |
push(@{ $form->{discount_sub} }, $discount_subtotal); |
|
242 |
$nodiscount_subtotal = $form->format_amount($myconfig, $nodiscount_subtotal, 2); |
|
243 |
push(@{ $form->{nodiscount_sub} }, $nodiscount_subtotal); |
|
244 |
$discount_subtotal = 0; |
|
218 |
push @{ $form->{discount_sub} }, $form->format_amount($myconfig, $discount_subtotal, 2); |
|
219 |
push @{ $form->{nodiscount_sub} }, $form->format_amount($myconfig, $nodiscount_subtotal, 2); |
|
220 |
|
|
221 |
$discount_subtotal = 0; |
|
245 | 222 |
$nodiscount_subtotal = 0; |
246 |
$subtotal_header = 0; |
|
223 |
$subtotal_header = 0; |
|
224 |
|
|
247 | 225 |
} else { |
248 |
push(@{ $form->{discount_sub} }, "");
|
|
249 |
push(@{ $form->{nodiscount_sub} }, "");
|
|
226 |
push @{ $form->{discount_sub} }, "";
|
|
227 |
push @{ $form->{nodiscount_sub} }, "";
|
|
250 | 228 |
} |
251 | 229 |
|
252 |
if ($linetotal == $netto_linetotal) {
|
|
230 |
if (!$form->{"discount_$i"}) {
|
|
253 | 231 |
$nodiscount += $linetotal; |
254 | 232 |
} |
255 | 233 |
|
256 |
push(@{ $form->{linetotal} }, |
|
257 |
$form->format_amount($myconfig, $linetotal, 2)); |
|
258 |
push(@{ $form->{nodiscount_linetotal} }, |
|
259 |
$form->format_amount($myconfig, $nodiscount_linetotal, 2)); |
|
234 |
push @{ $form->{linetotal} }, $form->format_amount($myconfig, $linetotal, 2); |
|
235 |
push @{ $form->{nodiscount_linetotal} }, $form->format_amount($myconfig, $nodiscount_linetotal, 2); |
|
260 | 236 |
|
261 | 237 |
push(@{ $form->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}}); |
262 | 238 |
|
... | ... | |
376 | 352 |
else { |
377 | 353 |
$form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2); |
378 | 354 |
} |
379 |
$yesdiscount = $form->{nodiscount_total} - $nodiscount; |
|
355 |
|
|
380 | 356 |
$form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2); |
381 |
$form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2); |
|
382 |
$form->{nodiscount} = $form->format_amount($myconfig, $nodiscount, 2); |
|
383 |
$form->{yesdiscount} = $form->format_amount($myconfig, $yesdiscount, 2);
|
|
357 |
$form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2);
|
|
358 |
$form->{nodiscount} = $form->format_amount($myconfig, $nodiscount, 2);
|
|
359 |
$form->{yesdiscount} = $form->format_amount($myconfig, $form->{nodiscount_total} - $nodiscount, 2);
|
|
384 | 360 |
|
385 |
$form->{invtotal} = |
|
386 |
($form->{taxincluded}) ? $form->{total} : $form->{total} + $tax; |
|
387 |
$form->{total} = |
|
388 |
$form->format_amount($myconfig, $form->{invtotal} - $form->{paid}, 2); |
|
361 |
$form->{invtotal} = ($form->{taxincluded}) ? $form->{total} : $form->{total} + $tax; |
|
362 |
$form->{total} = $form->format_amount($myconfig, $form->{invtotal} - $form->{paid}, 2); |
|
389 | 363 |
|
390 | 364 |
$form->{invtotal} = $form->format_amount($myconfig, $form->{invtotal}, 2); |
391 |
$form->{paid} = $form->format_amount($myconfig, $form->{paid}, 2); |
|
365 |
$form->{paid} = $form->format_amount($myconfig, $form->{paid}, 2); |
|
366 |
|
|
392 | 367 |
$form->set_payment_options($myconfig, $form->{invdate}); |
393 | 368 |
|
394 | 369 |
$form->{username} = $myconfig->{name}; |
... | ... | |
581 | 556 |
} |
582 | 557 |
$baseqty = $form->{"qty_$i"} * $basefactor; |
583 | 558 |
|
584 |
# undo discount formatting |
|
585 |
$form->{"discount_$i"} = |
|
586 |
$form->parse_amount($myconfig, $form->{"discount_$i"}) / 100; |
|
587 |
|
|
588 | 559 |
my ($allocated, $taxrate) = (0, 0); |
589 | 560 |
my $taxamount; |
590 | 561 |
|
562 |
# add tax rates |
|
563 |
map { $taxrate += $form->{"${_}_rate"} } split(/ /, $form->{"taxaccounts_$i"}); |
|
564 |
|
|
591 | 565 |
# keep entered selling price |
592 | 566 |
my $fxsellprice = |
593 | 567 |
$form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
... | ... | |
596 | 570 |
$dec = length $dec; |
597 | 571 |
my $decimalplaces = ($dec > 2) ? $dec : 2; |
598 | 572 |
|
599 |
# deduct discount |
|
600 |
my $discount = |
|
601 |
$form->round_amount($fxsellprice * $form->{"discount_$i"}, |
|
602 |
$decimalplaces); |
|
603 |
$form->{"sellprice_$i"} = $fxsellprice - $discount; |
|
573 |
# undo discount formatting |
|
574 |
$form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100; |
|
604 | 575 |
|
605 |
# add tax rates |
|
606 |
map({ $taxrate += $form->{"${_}_rate"} } split(/ /, |
|
607 |
$form->{"taxaccounts_$i"})); |
|
576 |
# deduct discount |
|
577 |
$form->{"sellprice_$i"} = $fxsellprice * (1 - $form->{"discount_$i"}); |
|
608 | 578 |
|
609 | 579 |
# round linetotal to 2 decimal places |
610 |
$linetotal = |
|
611 |
$form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2); |
|
580 |
$linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2); |
|
612 | 581 |
|
613 | 582 |
if ($form->{taxincluded}) { |
614 | 583 |
$taxamount = $linetotal * ($taxrate / (1 + $taxrate)); |
SL/OE.pm | ||
---|---|---|
34 | 34 |
|
35 | 35 |
package OE; |
36 | 36 |
|
37 |
use List::Util qw(max); |
|
38 |
|
|
37 | 39 |
use SL::AM; |
38 | 40 |
use SL::Common; |
39 | 41 |
use SL::DBUtils; |
... | ... | |
931 | 933 |
$position++; |
932 | 934 |
} |
933 | 935 |
|
934 |
push(@{ $form->{runningnumber} }, $i); |
|
935 |
push(@{ $form->{number} }, qq|$form->{"partnumber_$i"}|); |
|
936 |
push(@{ $form->{description} }, qq|$form->{"description_$i"}|); |
|
937 |
push(@{ $form->{longdescription} }, qq|$form->{"longdescription_$i"}|); |
|
938 |
push(@{ $form->{qty} }, |
|
939 |
$form->format_amount($myconfig, $form->{"qty_$i"})); |
|
940 |
push(@{ $form->{ship} }, |
|
941 |
$form->format_amount($myconfig, $form->{"ship_$i"})); |
|
942 |
push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|); |
|
943 |
push(@{ $form->{bin} }, qq|$form->{"bin_$i"}|); |
|
944 |
push(@{ $form->{"partnotes"} }, qq|$form->{"partnotes_$i"}|); |
|
945 |
push(@{ $form->{serialnumber} }, qq|$form->{"serialnumber_$i"}|); |
|
946 |
push(@{ $form->{reqdate} }, qq|$form->{"reqdate_$i"}|); |
|
947 |
|
|
948 |
push(@{ $form->{sellprice} }, $form->{"sellprice_$i"}); |
|
949 |
|
|
950 |
push(@{ $form->{listprice} }, $form->{"listprice_$i"}); |
|
951 |
|
|
952 |
my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
|
953 |
my ($dec) = ($sellprice =~ /\.(\d+)/); |
|
954 |
$dec = length $dec; |
|
955 |
my $decimalplaces = ($dec > 2) ? $dec : 2; |
|
956 |
|
|
957 |
my $i_discount = |
|
958 |
$form->round_amount( |
|
959 |
$sellprice * $form->parse_amount($myconfig, |
|
960 |
$form->{"discount_$i"}) / 100, |
|
961 |
$decimalplaces); |
|
962 |
|
|
963 |
my $discount = |
|
964 |
$form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); |
|
965 |
|
|
966 |
# keep a netprice as well, (sellprice - discount) |
|
967 |
#$form->{"netprice_$i"} = $sellprice - $discount; |
|
968 |
$form->{"netprice_$i"} = $sellprice - $i_discount; |
|
969 |
my $nodiscount_linetotal = |
|
970 |
$form->round_amount($form->{"qty_$i"} * $sellprice, 2); |
|
971 |
my $linetotal = |
|
972 |
$form->round_amount($form->{"qty_$i"} * $form->{"netprice_$i"}, 2); |
|
973 |
|
|
974 |
push(@{ $form->{netprice} }, |
|
975 |
($form->{"netprice_$i"} != 0) |
|
976 |
? $form->format_amount( |
|
977 |
$myconfig, $form->{"netprice_$i"}, |
|
978 |
$decimalplaces |
|
979 |
) |
|
980 |
: " "); |
|
981 |
|
|
982 |
$discount = |
|
983 |
($discount != 0) |
|
984 |
? $form->format_amount($myconfig, $discount * -1, $decimalplaces) |
|
985 |
: " "; |
|
986 |
$linetotal = ($linetotal != 0) ? $linetotal : " "; |
|
987 |
|
|
988 |
push(@{ $form->{discount} }, $discount); |
|
989 |
push(@{ $form->{p_discount} }, $form->{"discount_$i"}); |
|
990 |
|
|
991 |
$form->{ordtotal} += $linetotal; |
|
992 |
$discount_subtotal += $linetotal; |
|
936 |
push @{ $form->{runningnumber} }, $position; |
|
937 |
push @{ $form->{number} }, $form->{"partnumber_$i"}; |
|
938 |
push @{ $form->{description} }, $form->{"description_$i"}; |
|
939 |
push @{ $form->{longdescription} }, $form->{"longdescription_$i"}; |
|
940 |
push @{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"}); |
|
941 |
push @{ $form->{ship} }, $form->format_amount($myconfig, $form->{"ship_$i"}); |
|
942 |
push @{ $form->{unit} }, $form->{"unit_$i"}; |
|
943 |
push @{ $form->{bin} }, $form->{"bin_$i"}; |
|
944 |
push @{ $form->{partnotes} }, $form->{"partnotes_$i"}; |
|
945 |
push @{ $form->{serialnumber} }, $form->{"serialnumber_$i"}; |
|
946 |
push @{ $form->{reqdate} }, $form->{"reqdate_$i"}; |
|
947 |
push @{ $form->{sellprice} }, $form->{"sellprice_$i"}; |
|
948 |
push @{ $form->{listprice} }, $form->{"listprice_$i"}; |
|
949 |
|
|
950 |
my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
|
951 |
my ($dec) = ($sellprice =~ /\.(\d+)/); |
|
952 |
my $decimalplaces = max 2, length($dec); |
|
953 |
|
|
954 |
my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $form->{"discount_$i"} / 100, $decimalplaces); |
|
955 |
my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $form->{"discount_$i"}) / 100, 2); |
|
956 |
my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice, 2); |
|
957 |
$form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); |
|
958 |
|
|
959 |
push @{ $form->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : ''; |
|
960 |
|
|
961 |
$linetotal = ($linetotal != 0) ? $linetotal : ''; |
|
962 |
|
|
963 |
push @{ $form->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, $decimalplaces) : ''; |
|
964 |
push @{ $form->{p_discount} }, $form->{"discount_$i"}; |
|
965 |
|
|
966 |
$form->{ordtotal} += $linetotal; |
|
993 | 967 |
$form->{nodiscount_total} += $nodiscount_linetotal; |
994 |
$nodiscount_subtotal += $nodiscount_linetotal; |
|
995 |
$form->{discount_total} += $form->parse_amount($myconfig, $discount); |
|
968 |
$form->{discount_total} += $discount; |
|
969 |
|
|
970 |
if ($subtotal_header) { |
|
971 |
$discount_subtotal += $linetotal; |
|
972 |
$nodiscount_subtotal += $nodiscount_linetotal; |
|
973 |
} |
|
996 | 974 |
|
997 | 975 |
if ($form->{"subtotal_$i"} && $subtotal_header && ($subtotal_header != $i)) { |
998 |
$discount_subtotal = $form->format_amount($myconfig, $discount_subtotal, 2); |
|
999 |
push(@{ $form->{discount_sub} }, $discount_subtotal); |
|
1000 |
$nodiscount_subtotal = $form->format_amount($myconfig, $nodiscount_subtotal, 2); |
|
1001 |
push(@{ $form->{nodiscount_sub} }, $nodiscount_subtotal); |
|
1002 |
$discount_subtotal = 0; |
|
976 |
push @{ $form->{discount_sub} }, $form->format_amount($myconfig, $discount_subtotal, 2); |
|
977 |
push @{ $form->{nodiscount_sub} }, $form->format_amount($myconfig, $nodiscount_subtotal, 2); |
|
978 |
|
|
979 |
$discount_subtotal = 0; |
|
1003 | 980 |
$nodiscount_subtotal = 0; |
1004 |
$subtotal_header = 0; |
|
981 |
$subtotal_header = 0; |
|
982 |
|
|
1005 | 983 |
} else { |
1006 |
push(@{ $form->{discount_sub} }, "");
|
|
1007 |
push(@{ $form->{nodiscount_sub} }, "");
|
|
984 |
push @{ $form->{discount_sub} }, "";
|
|
985 |
push @{ $form->{nodiscount_sub} }, "";
|
|
1008 | 986 |
} |
1009 | 987 |
|
1010 |
if ($linetotal == $netto_linetotal) {
|
|
988 |
if (!$form->{"discount_$i"}) {
|
|
1011 | 989 |
$nodiscount += $linetotal; |
1012 | 990 |
} |
1013 |
push(@{ $form->{linetotal} }, |
|
1014 |
$form->format_amount($myconfig, $linetotal, 2)); |
|
1015 |
push(@{ $form->{nodiscount_linetotal} }, |
|
1016 |
$form->format_amount($myconfig, $nodiscount_linetotal, 2)); |
|
991 |
|
|
992 |
push @{ $form->{linetotal} }, $form->format_amount($myconfig, $linetotal, 2); |
|
993 |
push @{ $form->{nodiscount_linetotal} }, $form->format_amount($myconfig, $nodiscount_linetotal, 2); |
|
1017 | 994 |
|
1018 | 995 |
push(@{ $form->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}}); |
1019 | 996 |
|
... | ... | |
1101 | 1078 |
$form->format_amount($myconfig, $form->{"${item}_rate"} * 100)); |
1102 | 1079 |
push(@{ $form->{taxnumber} }, $form->{"${item}_taxnumber"}); |
1103 | 1080 |
} |
1104 |
$yesdiscount = $form->{nodiscount_total} - $nodiscount; |
|
1081 |
|
|
1105 | 1082 |
$form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2); |
1106 |
$form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2); |
|
1107 |
$form->{nodiscount} = $form->format_amount($myconfig, $nodiscount, 2); |
|
1108 |
$form->{yesdiscount} = $form->format_amount($myconfig, $yesdiscount, 2);
|
|
1083 |
$form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2);
|
|
1084 |
$form->{nodiscount} = $form->format_amount($myconfig, $nodiscount, 2);
|
|
1085 |
$form->{yesdiscount} = $form->format_amount($myconfig, $form->{nodiscount_total} - $nodiscount, 2);
|
|
1109 | 1086 |
|
1110 | 1087 |
if($form->{taxincluded}) { |
1111 | 1088 |
$form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal} - $tax, 2); |
1112 |
} |
|
1113 |
else { |
|
1089 |
} else { |
|
1114 | 1090 |
$form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2); |
1115 | 1091 |
} |
1116 |
$form->{ordtotal} = |
|
1117 |
($form->{taxincluded}) ? $form->{ordtotal} : $form->{ordtotal} + $tax;
|
|
1092 |
|
|
1093 |
$form->{ordtotal} = ($form->{taxincluded}) ? $form->{ordtotal} : $form->{ordtotal} + $tax;
|
|
1118 | 1094 |
|
1119 | 1095 |
# format amounts |
1120 |
$form->{quototal} = $form->{ordtotal} = |
|
1121 |
$form->format_amount($myconfig, $form->{ordtotal}, 2); |
|
1096 |
$form->{quototal} = $form->{ordtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2); |
|
1122 | 1097 |
|
1123 | 1098 |
if ($form->{type} =~ /_quotation/) { |
1124 | 1099 |
$form->set_payment_options($myconfig, $form->{quodate}); |
bin/mozilla/io.pl | ||
---|---|---|
33 | 33 |
# |
34 | 34 |
####################################################################### |
35 | 35 |
|
36 |
use CGI; |
|
37 |
use CGI::Ajax; |
|
38 |
use List::Util qw(max); |
|
39 |
|
|
36 | 40 |
use SL::Common; |
37 | 41 |
use SL::CT; |
38 | 42 |
use SL::IC; |
39 |
use CGI::Ajax; |
|
40 |
use CGI; |
|
41 | 43 |
|
42 | 44 |
require "bin/mozilla/common.pl"; |
43 | 45 |
|
... | ... | |
297 | 299 |
$form->{"unit_old_$i"} = $form->{"selected_unit_$i"}; |
298 | 300 |
} |
299 | 301 |
} |
302 |
|
|
300 | 303 |
($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); |
301 |
$dec = length $dec; |
|
302 |
$decimalplaces = ($dec > 2) ? $dec : 2; |
|
303 |
|
|
304 |
$discount = |
|
305 |
$form->round_amount( |
|
306 |
$form->{"sellprice_$i"} * $form->{"discount_$i"} / 100, |
|
307 |
$decimalplaces); |
|
308 |
|
|
309 |
$linetotal = |
|
310 |
$form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces); |
|
311 |
$linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2); |
|
312 |
my $real_sellprice = $form->{"sellprice_$i"} - $discount; |
|
304 |
$decimalplaces = max length($dec), 2; |
|
305 |
|
|
306 |
$discount = (100 - $form->{"discount_$i"} * 1) / 100; |
|
307 |
$linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} * $discount, $decimalplaces); |
|
308 |
|
|
309 |
my $real_sellprice = $form->{"sellprice_$i"} * $discount; |
|
313 | 310 |
|
314 | 311 |
# marge calculations |
315 | 312 |
my ($marge_font_start, $marge_font_end); |
Auch abrufbar als: Unified diff
Bugfix Rabattberechnung: Berechnung so umgestellt, dass der Rabatt von der Zeilensumme genommen wird und nicht vom Einzelpreis (Rundung). Fix für Bug 325.
Bugfix Zwischensummen: Bei Belegen aus OE.pm (Angebote, Aufträge, Anfragen) wurde die Variable <%runningnumber%> innerhalb eines Zwischensummenblocks nicht "1.1, 1.2, 1.3" etc hochgezählt, sondern normal "1, 2, 3" etc.
Bugfix Zwischensummen: Bei manchen Browsern wurden die Checkboxen "Zwischensumme" nach "Erneuern" oder neuem Aufrufen eines Beleges nicht richtig vorausgewählt, auch wenn der Status in der Datenbank richtig war.
Kosmetik: Einrückung, Ausrichtung.