Revision 081a4f97
Von Moritz Bunkus vor fast 19 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
442 | 442 |
push @a, "employee" if $self->{l_employee}; |
443 | 443 |
my $sortorder = join ', ', $form->sort_columns(@a); |
444 | 444 |
$sortorder = $form->{sort} if $form->{sort}; |
445 |
|
|
445 |
|
|
446 | 446 |
$query .= "WHERE $where |
447 | 447 |
ORDER by $sortorder"; |
448 | 448 |
|
SL/AR.pm | ||
---|---|---|
83 | 83 |
|
84 | 84 |
$form->{amount} = $form->{netamount}; |
85 | 85 |
|
86 |
$form->{tax} = 0; |
|
86 |
$form->{tax} = 0;
|
|
87 | 87 |
$form->{netamount} = 0; |
88 | 88 |
$form->{total_tax} = 0; |
89 |
|
|
89 | 90 |
# taxincluded doesn't make sense if there is no amount |
90 | 91 |
|
91 | 92 |
$form->{taxincluded} = 0 if ($form->{amount} == 0); |
... | ... | |
114 | 115 |
$form->{netamount} += $form->{"amount_$i"}; |
115 | 116 |
} else { |
116 | 117 |
$form->{"tax_$i"} = $form->{"amount_$i"} * $form->{"taxrate_$i"}; |
117 |
$form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2); |
|
118 |
$form->{"tax_$i"} = |
|
119 |
$form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2); |
|
118 | 120 |
$form->{netamount} += $form->{"amount_$i"}; |
119 | 121 |
} |
120 | 122 |
} |
SL/CA.pm | ||
---|---|---|
164 | 164 |
$where .= $fromto; |
165 | 165 |
$AR_PAID = ""; |
166 | 166 |
$AP_PAID = ""; |
167 |
$glwhere = ""; # note! gl will be aliased as "a" later... |
|
167 |
$glwhere = ""; # note! gl will be aliased as "a" later...
|
|
168 | 168 |
} |
169 | 169 |
my $sortorder = join ', ', |
170 | 170 |
$form->sort_columns(qw(transdate reference description)); |
... | ... | |
323 | 323 |
|
324 | 324 |
foreach my $id (@id) { |
325 | 325 |
|
326 |
# NOTE:
|
|
327 |
# Postgres is really picky about the order of implicit CROSS JOINs with ','
|
|
328 |
# if you alias the tables and want to use the alias later in another JOIN.
|
|
329 |
# the alias you want to use has to be the most recent in the list, otherwise
|
|
330 |
# Postgres will overwrite the alias internally and complain.
|
|
331 |
# For this reason, in the next 3 SELECTs, the 'a' alias is last in the list.
|
|
332 |
# Don't change this, and if you do, substitute the ',' with CROSS JOIN
|
|
333 |
# ... that also works.
|
|
326 |
# NOTE:
|
|
327 |
# Postgres is really picky about the order of implicit CROSS JOINs with ',' |
|
328 |
# if you alias the tables and want to use the alias later in another JOIN. |
|
329 |
# the alias you want to use has to be the most recent in the list, otherwise |
|
330 |
# Postgres will overwrite the alias internally and complain. |
|
331 |
# For this reason, in the next 3 SELECTs, the 'a' alias is last in the list. |
|
332 |
# Don't change this, and if you do, substitute the ',' with CROSS JOIN |
|
333 |
# ... that also works. |
|
334 | 334 |
|
335 | 335 |
# get all transactions |
336 | 336 |
$query .= qq|$union |
SL/CT.pm | ||
---|---|---|
232 | 232 |
$form->{"cp_${_}"} = $form->{"selected_cp_${_}"} |
233 | 233 |
if ($form->{"selected_cp_${_}"}); |
234 | 234 |
} qw(title greeting)); |
235 |
# |
|
235 |
|
|
236 |
# |
|
236 | 237 |
# escape ' |
237 | 238 |
map { $form->{$_} =~ s/\'/\'\'/g } |
238 | 239 |
qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language pricegroup); |
... | ... | |
318 | 319 |
ustid = '$form->{ustid}', |
319 | 320 |
username = '$form->{username}', |
320 | 321 |
salesman_id = '$form->{salesman_id}', |
321 |
user_password = | . $dbh->quote($form->{user_password}) .qq|, |
|
322 |
user_password = | . $dbh->quote($form->{user_password}) . qq|,
|
|
322 | 323 |
c_vendor_id = '$form->{c_vendor_id}', |
323 | 324 |
klass = '$form->{klass}' |
324 | 325 |
WHERE id = $form->{id}|; |
SL/DATEV.pm | ||
---|---|---|
588 | 588 |
my $evfile = "EV01"; |
589 | 589 |
my @ed_versionsets; |
590 | 590 |
my $fileno = 0; |
591 |
|
|
591 |
|
|
592 | 592 |
$form->header; |
593 | 593 |
print qq| |
594 | 594 |
<html> |
... | ... | |
616 | 616 |
$remaining_bytes -= length($header); |
617 | 617 |
|
618 | 618 |
while (scalar(@{ $form->{DATEV} }) > 0) { |
619 |
$transaction = shift @{ $form->{DATEV} };
|
|
620 |
$trans_lines = scalar(@{$transaction});
|
|
619 |
$transaction = shift @{ $form->{DATEV} }; |
|
620 |
$trans_lines = scalar(@{$transaction}); |
|
621 | 621 |
$counter++; |
622 | 622 |
if (($counter % 500) == 0) { |
623 | 623 |
print("$counter "); |
... | ... | |
829 | 829 |
print(EV $ed_versionset[$file]); |
830 | 830 |
} |
831 | 831 |
close(EV); |
832 |
print qq|<br>Done. <br></body> |
|
832 |
print qq|<br>Done. <br></body>
|
|
833 | 833 |
</html> |
834 | 834 |
|; |
835 | 835 |
### |
... | ... | |
865 | 865 |
qq|SELECT c.accno, c.description FROM chart c WHERE c.accno >=| |
866 | 866 |
. $dbh->quote($form->{accnofrom}) . qq| |
867 | 867 |
AND c.accno <= | |
868 |
. $dbh->quote($form->{accnoto}) |
|
869 |
. qq| ORDER BY c.accno|; |
|
868 |
. $dbh->quote($form->{accnoto}) . qq| ORDER BY c.accno|; |
|
870 | 869 |
|
871 | 870 |
$sth = $dbh->prepare($query); |
872 | 871 |
$sth->execute || $form->dberror($query); |
SL/Form.pm | ||
---|---|---|
195 | 195 |
sub quote { |
196 | 196 |
my ($self, $str) = @_; |
197 | 197 |
|
198 |
if ($str && ! ref($str)) {
|
|
198 |
if ($str && !ref($str)) { |
|
199 | 199 |
$str =~ s/"/"/g; |
200 | 200 |
} |
201 | 201 |
|
... | ... | |
203 | 203 |
|
204 | 204 |
} |
205 | 205 |
|
206 |
|
|
207 | 206 |
sub unquote { |
208 | 207 |
my ($self, $str) = @_; |
209 | 208 |
|
210 |
if ($str && ! ref($str)) {
|
|
209 |
if ($str && !ref($str)) { |
|
211 | 210 |
$str =~ s/"/"/g; |
212 | 211 |
} |
213 | 212 |
|
... | ... | |
215 | 214 |
|
216 | 215 |
} |
217 | 216 |
|
218 |
|
|
219 | 217 |
sub hide_form { |
220 | 218 |
my $self = shift; |
221 | 219 |
|
222 | 220 |
if (@_) { |
223 |
for (@_) { print qq|<input type=hidden name="$_" value="|.$self->quote($self->{$_}).qq|">\n| } |
|
221 |
for (@_) { |
|
222 |
print qq|<input type=hidden name="$_" value="| |
|
223 |
. $self->quote($self->{$_}) |
|
224 |
. qq|">\n|; |
|
225 |
} |
|
224 | 226 |
} else { |
225 | 227 |
delete $self->{header}; |
226 |
for (sort keys %$self) { print qq|<input type=hidden name="$_" value="|.$self->quote($self->{$_}).qq|">\n| } |
|
228 |
for (sort keys %$self) { |
|
229 |
print qq|<input type=hidden name="$_" value="| |
|
230 |
. $self->quote($self->{$_}) |
|
231 |
. qq|">\n|; |
|
232 |
} |
|
227 | 233 |
} |
228 |
|
|
234 |
|
|
229 | 235 |
} |
230 | 236 |
|
231 | 237 |
sub error { |
... | ... | |
452 | 458 |
push @triggers, qq| |
453 | 459 |
Calendar.setup( |
454 | 460 |
{ |
455 |
inputField : "|.(shift).qq|",
|
|
461 |
inputField : "| . (shift) . qq|",
|
|
456 | 462 |
ifFormat :"$ifFormat", |
457 |
align : "|.(shift).qq|",
|
|
458 |
button : "|.(shift).qq|"
|
|
463 |
align : "| . (shift) . qq|",
|
|
464 |
button : "| . (shift) . qq|"
|
|
459 | 465 |
} |
460 | 466 |
); |
461 | 467 |
|; |
462 | 468 |
} |
463 | 469 |
$jsscript = qq| |
464 | 470 |
<script type="text/javascript"> |
465 |
<!--|.join("", @triggers).qq|//-->
|
|
471 |
<!--| . join("", @triggers) . qq|//-->
|
|
466 | 472 |
</script> |
467 | 473 |
|; |
468 | 474 |
|
... | ... | |
505 | 511 |
$main::lxdebug->enter_sub(); |
506 | 512 |
|
507 | 513 |
my ($self, $myconfig, $amount, $places, $dash) = @_; |
508 |
|
|
514 |
|
|
509 | 515 |
#Workaround for $format_amount calls without $places |
510 |
if (!defined $places){ |
|
511 |
(my $dec) = ($amount =~ /\.(\d+)/); |
|
512 |
$places = length $dec;
|
|
513 |
}
|
|
516 |
if (!defined $places) {
|
|
517 |
(my $dec) = ($amount =~ /\.(\d+)/);
|
|
518 |
$places = length $dec;
|
|
519 |
} |
|
514 | 520 |
|
515 | 521 |
if ($places =~ /\d/) { |
516 | 522 |
$amount = $self->round_amount($amount, $places); |
... | ... | |
518 | 524 |
|
519 | 525 |
# is the amount negative |
520 | 526 |
my $negative = ($amount < 0); |
521 |
my $fillup = ""; |
|
527 |
my $fillup = "";
|
|
522 | 528 |
|
523 | 529 |
if ($amount != 0) { |
524 | 530 |
if ($myconfig->{numberformat} && ($myconfig->{numberformat} ne '1000.00')) |
... | ... | |
532 | 538 |
$amount =~ s/\d{3,}?/$&,/g; |
533 | 539 |
$amount =~ s/,$//; |
534 | 540 |
$amount = join '', reverse split //, $amount; |
535 |
$amount .= "\.$dec".$fillup if ($places ne '' && $places*1 != 0);
|
|
541 |
$amount .= "\.$dec" . $fillup if ($places ne '' && $places * 1 != 0);
|
|
536 | 542 |
} |
537 | 543 |
|
538 | 544 |
if ($myconfig->{numberformat} eq '1.000,00') { |
539 | 545 |
$amount =~ s/\d{3,}?/$&./g; |
540 | 546 |
$amount =~ s/\.$//; |
541 | 547 |
$amount = join '', reverse split //, $amount; |
542 |
$amount .= ",$dec".$fillup if ($places ne '' && $places*1 != 0);
|
|
548 |
$amount .= ",$dec" . $fillup if ($places ne '' && $places * 1 != 0);
|
|
543 | 549 |
} |
544 | 550 |
|
545 | 551 |
if ($myconfig->{numberformat} eq '1000,00') { |
546 | 552 |
$amount = "$whole"; |
547 |
$amount .= ",$dec" .$fillup if ($places ne '' && $places*1 != 0);
|
|
553 |
$amount .= ",$dec" . $fillup if ($places ne '' && $places * 1 != 0);
|
|
548 | 554 |
} |
549 | 555 |
|
550 | 556 |
if ($dash =~ /-/) { |
... | ... | |
576 | 582 |
$main::lxdebug->enter_sub(); |
577 | 583 |
|
578 | 584 |
my ($self, $myconfig, $amount) = @_; |
579 |
$main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount"); |
|
580 |
|
|
581 |
if ($myconfig->{in_numberformat} == 1){ |
|
585 |
$main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount"); |
|
586 |
|
|
587 |
if ($myconfig->{in_numberformat} == 1) { |
|
588 |
|
|
582 | 589 |
# Extra input number format 1000.00 or 1000,00 |
583 |
$main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('1000,00 or 1000.00')); |
|
590 |
$main::lxdebug->message(LXDebug::DEBUG2, |
|
591 |
"in_numberformat: " . $main::locale->text('1000,00 or 1000.00')); |
|
584 | 592 |
$amount =~ s/,/\./g; |
593 |
|
|
585 | 594 |
#$main::lxdebug->message(LXDebug::DEBUG2, "1.Parsed Number: $amount") if ($amount); |
586 | 595 |
$amount = scalar reverse $amount; |
596 |
|
|
587 | 597 |
#$main::lxdebug->message(LXDebug::DEBUG2, "2.Parsed Number: $amount") if ($amount); |
588 | 598 |
$amount =~ s/\./DOT/; |
599 |
|
|
589 | 600 |
#$main::lxdebug->message(LXDebug::DEBUG2, "3.Parsed Number: $amount") if ($amount); |
590 | 601 |
$amount =~ s/\.//g; |
602 |
|
|
591 | 603 |
#$main::lxdebug->message(LXDebug::DEBUG2, "4.Parsed Number: $amount") if ($amount); |
592 | 604 |
$amount =~ s/DOT/\./; |
605 |
|
|
593 | 606 |
#$main::lxdebug->message(LXDebug::DEBUG2, "5.Parsed Number:" . $amount) if ($amount); |
594 |
$amount = scalar reverse $amount ; |
|
595 |
$main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n"); |
|
607 |
$amount = scalar reverse $amount; |
|
608 |
$main::lxdebug->message(LXDebug::DEBUG2, |
|
609 |
"Parsed amount:" . $amount . "\n"); |
|
596 | 610 |
|
597 | 611 |
return ($amount * 1); |
598 | 612 |
|
599 | 613 |
} |
600 |
$main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('equal Outputformat')); |
|
601 |
$main::lxdebug->message(LXDebug::DEBUG2, " = numberformat: $myconfig->{numberformat}"); |
|
614 |
$main::lxdebug->message(LXDebug::DEBUG2, |
|
615 |
"in_numberformat: " . $main::locale->text('equal Outputformat')); |
|
616 |
$main::lxdebug->message(LXDebug::DEBUG2, |
|
617 |
" = numberformat: $myconfig->{numberformat}"); |
|
602 | 618 |
if ( ($myconfig->{numberformat} eq '1.000,00') |
603 | 619 |
|| ($myconfig->{numberformat} eq '1000,00')) { |
604 | 620 |
$amount =~ s/\.//g; |
... | ... | |
606 | 622 |
} |
607 | 623 |
|
608 | 624 |
if ($myconfig->{numberformat} eq "1'000.00") { |
609 |
$amount =~ s/'//g;
|
|
625 |
$amount =~ s/'//g; |
|
610 | 626 |
} |
611 | 627 |
|
612 | 628 |
$amount =~ s/,//g; |
613 |
|
|
614 |
$main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount. "\n") if ($amount); |
|
629 |
|
|
630 |
$main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n") |
|
631 |
if ($amount); |
|
615 | 632 |
$main::lxdebug->leave_sub(); |
616 |
|
|
633 |
|
|
617 | 634 |
return ($amount * 1); |
618 | 635 |
} |
619 | 636 |
|
... | ... | |
625 | 642 |
|
626 | 643 |
# Rounding like "Kaufmannsrunden" |
627 | 644 |
# Descr. http://de.wikipedia.org/wiki/Rundung |
628 |
# Inspired by
|
|
645 |
# Inspired by |
|
629 | 646 |
# http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q4.13.html |
630 | 647 |
# Solves Bug: 189 |
631 | 648 |
# Udo Spallek |
632 |
$amount = $amount * (10 ** ($places));
|
|
633 |
$round_amount = int($amount + .5 * ($amount <=> 0))/(10**($places));
|
|
649 |
$amount = $amount * (10**($places));
|
|
650 |
$round_amount = int($amount + .5 * ($amount <=> 0)) / (10**($places));
|
|
634 | 651 |
|
635 | 652 |
$main::lxdebug->leave_sub(); |
636 | 653 |
|
637 | 654 |
return $round_amount; |
638 |
|
|
639 |
} |
|
640 |
|
|
641 | 655 |
|
656 |
} |
|
642 | 657 |
|
643 | 658 |
sub parse_template { |
644 | 659 |
$main::lxdebug->enter_sub(); |
... | ... | |
754 | 769 |
} |
755 | 770 |
|
756 | 771 |
# Yes we need a manual page break -- or the user has forced one |
757 |
if ((($current_line + $lines) > $lpp) || |
|
758 |
($self->{"_forced_pagebreaks"} && grep(/^${current_row}$/, @{$self->{"_forced_pagebreaks"}}))) { |
|
772 |
if ( |
|
773 |
(($current_line + $lines) > $lpp) |
|
774 |
|| ($self->{"_forced_pagebreaks"} |
|
775 |
&& grep(/^${current_row}$/, @{ $self->{"_forced_pagebreaks"} })) |
|
776 |
) { |
|
759 | 777 |
my $pb = $pagebreak; |
760 | 778 |
|
761 | 779 |
# replace the special variables <%sumcarriedforward%> |
... | ... | |
1042 | 1060 |
my %unique_fields; |
1043 | 1061 |
|
1044 | 1062 |
%unique_fields = map({ $_ => 1 } @fields); |
1045 |
@fields = keys(%unique_fields); |
|
1063 |
@fields = keys(%unique_fields);
|
|
1046 | 1064 |
|
1047 | 1065 |
foreach my $field (@fields) { |
1048 | 1066 |
next unless ($self->{$field} =~ /\<pagebreak\>/); |
... | ... | |
1295 | 1313 |
$main::lxdebug->enter_sub(); |
1296 | 1314 |
|
1297 | 1315 |
my ($self, $dbh, $curr, $transdate, $fld) = @_; |
1298 |
|
|
1316 |
|
|
1299 | 1317 |
unless ($transdate) { |
1300 | 1318 |
$main::lxdebug->leave_sub(); |
1301 | 1319 |
return ""; |
... | ... | |
1348 | 1366 |
my ($self, $dbh, $id) = @_; |
1349 | 1367 |
##LINET |
1350 | 1368 |
my $shipto; |
1351 |
foreach |
|
1352 |
my $item (qw(name department_1 department_2 street zipcode city country contact phone fax email)) { |
|
1369 |
foreach my $item ( |
|
1370 |
qw(name department_1 department_2 street zipcode city country contact phone fax email) |
|
1371 |
) { |
|
1353 | 1372 |
if ($self->{"shipto$item"}) { |
1354 | 1373 |
$shipto = 1 if ($self->{$item} ne $self->{"shipto$item"}); |
1355 | 1374 |
} |
... | ... | |
1357 | 1376 |
} |
1358 | 1377 |
|
1359 | 1378 |
if ($shipto) { |
1360 |
my $query = qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2, shiptostreet, |
|
1379 |
my $query = |
|
1380 |
qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2, shiptostreet, |
|
1361 | 1381 |
shiptozipcode, shiptocity, shiptocountry, shiptocontact, |
1362 | 1382 |
shiptophone, shiptofax, shiptoemail) VALUES ($id, |
1363 | 1383 |
'$self->{shiptoname}', '$self->{shiptodepartment_1}', '$self->{shiptodepartment_2}', '$self->{shiptostreet}', |
... | ... | |
1616 | 1636 |
my %xkeyref = (); |
1617 | 1637 |
|
1618 | 1638 |
# now get the account numbers |
1619 |
$query = |
|
1620 |
qq|SELECT c.accno, c.description, c.link, c.taxkey_id |
|
1639 |
$query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id |
|
1621 | 1640 |
FROM chart c |
1622 | 1641 |
WHERE c.link LIKE '%$module%' |
1623 | 1642 |
ORDER BY c.accno|; |
... | ... | |
1700 | 1719 |
$self->{exchangerate} = |
1701 | 1720 |
$self->get_exchangerate($dbh, $self->{currency}, $self->{transdate}, |
1702 | 1721 |
$fld); |
1703 |
my $index=0;
|
|
1722 |
my $index = 0;
|
|
1704 | 1723 |
|
1705 | 1724 |
# store amounts in {acc_trans}{$key} for multiple accounts |
1706 | 1725 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
1707 | 1726 |
$ref->{exchangerate} = |
1708 | 1727 |
$self->get_exchangerate($dbh, $self->{currency}, $ref->{transdate}, |
1709 | 1728 |
$fld); |
1710 |
if ( !($xkeyref{ $ref->{accno} } =~ /tax/)) {
|
|
1729 |
if (!($xkeyref{ $ref->{accno} } =~ /tax/)) { |
|
1711 | 1730 |
$index++; |
1712 | 1731 |
} |
1713 | 1732 |
$ref->{index} = $index; |
... | ... | |
2143 | 2162 |
$main::lxdebug->leave_sub(); |
2144 | 2163 |
} |
2145 | 2164 |
|
2146 |
|
|
2147 | 2165 |
sub get_pricegroup { |
2148 | 2166 |
$main::lxdebug->enter_sub(); |
2149 | 2167 |
|
... | ... | |
2175 | 2193 |
$main::lxdebug->leave_sub(); |
2176 | 2194 |
} |
2177 | 2195 |
|
2178 |
|
|
2179 | 2196 |
sub audittrail { |
2180 | 2197 |
my ($self, $dbh, $myconfig, $audittrail) = @_; |
2181 |
|
|
2182 |
# table, $reference, $formname, $action, $id, $transdate) = @_; |
|
2198 |
|
|
2199 |
# table, $reference, $formname, $action, $id, $transdate) = @_;
|
|
2183 | 2200 |
|
2184 | 2201 |
my $query; |
2185 | 2202 |
my $rv; |
2186 | 2203 |
my $disconnect; |
2187 | 2204 |
|
2188 |
if (! $dbh) {
|
|
2189 |
$dbh = $self->dbconnect($myconfig); |
|
2205 |
if (!$dbh) { |
|
2206 |
$dbh = $self->dbconnect($myconfig);
|
|
2190 | 2207 |
$disconnect = 1; |
2191 | 2208 |
} |
2192 |
|
|
2209 |
|
|
2193 | 2210 |
# if we have an id add audittrail, otherwise get a new timestamp |
2194 |
|
|
2211 |
|
|
2195 | 2212 |
if ($audittrail->{id}) { |
2196 |
|
|
2213 |
|
|
2197 | 2214 |
$query = qq|SELECT audittrail FROM defaults|; |
2198 |
|
|
2215 |
|
|
2199 | 2216 |
if ($dbh->selectrow_array($query)) { |
2200 | 2217 |
my ($null, $employee_id) = $self->get_employee($dbh); |
2201 | 2218 |
|
2202 | 2219 |
if ($self->{audittrail} && !$myconfig) { |
2203 |
chop $self->{audittrail};
|
|
2204 |
|
|
2205 |
my @a = split /\|/, $self->{audittrail};
|
|
2206 |
my %newtrail = ();
|
|
2207 |
my $key;
|
|
2208 |
my $i;
|
|
2209 |
my @flds = qw(tablename reference formname action transdate);
|
|
2210 |
|
|
2211 |
# put into hash and remove dups
|
|
2212 |
while (@a) {
|
|
2213 |
$key = "$a[2]$a[3]";
|
|
2214 |
$i = 0;
|
|
2215 |
$newtrail{$key} = { map { $_ => $a[$i++] } @flds };
|
|
2216 |
splice @a, 0, 5;
|
|
2217 |
}
|
|
2218 |
|
|
2219 |
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
|
|
2220 |
chop $self->{audittrail};
|
|
2221 |
|
|
2222 |
my @a = split /\|/, $self->{audittrail};
|
|
2223 |
my %newtrail = ();
|
|
2224 |
my $key;
|
|
2225 |
my $i;
|
|
2226 |
my @flds = qw(tablename reference formname action transdate);
|
|
2227 |
|
|
2228 |
# put into hash and remove dups
|
|
2229 |
while (@a) {
|
|
2230 |
$key = "$a[2]$a[3]";
|
|
2231 |
$i = 0;
|
|
2232 |
$newtrail{$key} = { map { $_ => $a[$i++] } @flds };
|
|
2233 |
splice @a, 0, 5;
|
|
2234 |
}
|
|
2235 |
|
|
2236 |
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
|
|
2220 | 2237 |
formname, action, employee_id, transdate) |
2221 | 2238 |
VALUES ($audittrail->{id}, ?, ?, |
2222 | 2239 |
?, ?, $employee_id, ?)|; |
2223 |
my $sth = $dbh->prepare($query) || $self->dberror($query); |
|
2224 |
|
|
2225 |
foreach $key (sort { $newtrail{$a}{transdate} cmp $newtrail{$b}{transdate} } keys %newtrail) { |
|
2226 |
$i = 1; |
|
2227 |
for (@flds) { $sth->bind_param($i++, $newtrail{$key}{$_}) } |
|
2228 |
|
|
2229 |
$sth->execute || $self->dberror; |
|
2230 |
$sth->finish; |
|
2231 |
} |
|
2240 |
my $sth = $dbh->prepare($query) || $self->dberror($query); |
|
2241 |
|
|
2242 |
foreach $key ( |
|
2243 |
sort { |
|
2244 |
$newtrail{$a}{transdate} cmp $newtrail{$b}{transdate} |
|
2245 |
} keys %newtrail |
|
2246 |
) { |
|
2247 |
$i = 1; |
|
2248 |
for (@flds) { $sth->bind_param($i++, $newtrail{$key}{$_}) } |
|
2249 |
|
|
2250 |
$sth->execute || $self->dberror; |
|
2251 |
$sth->finish; |
|
2252 |
} |
|
2232 | 2253 |
} |
2233 | 2254 |
|
2234 |
|
|
2235 | 2255 |
if ($audittrail->{transdate}) { |
2236 |
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
|
|
2256 |
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
|
|
2237 | 2257 |
formname, action, employee_id, transdate) VALUES ( |
2238 | 2258 |
$audittrail->{id}, '$audittrail->{tablename}', | |
2239 |
.$dbh->quote($audittrail->{reference}).qq|,
|
|
2259 |
. $dbh->quote($audittrail->{reference}) . qq|,
|
|
2240 | 2260 |
'$audittrail->{formname}', '$audittrail->{action}', |
2241 | 2261 |
$employee_id, '$audittrail->{transdate}')|; |
2242 | 2262 |
} else { |
2243 |
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
|
|
2263 |
$query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
|
|
2244 | 2264 |
formname, action, employee_id) VALUES ($audittrail->{id}, |
2245 | 2265 |
'$audittrail->{tablename}', | |
2246 |
.$dbh->quote($audittrail->{reference}).qq|,
|
|
2266 |
. $dbh->quote($audittrail->{reference}) . qq|,
|
|
2247 | 2267 |
'$audittrail->{formname}', '$audittrail->{action}', |
2248 | 2268 |
$employee_id)|; |
2249 | 2269 |
} |
2250 | 2270 |
$dbh->do($query); |
2251 | 2271 |
} |
2252 | 2272 |
} else { |
2253 |
|
|
2273 |
|
|
2254 | 2274 |
$query = qq|SELECT current_timestamp FROM defaults|; |
2255 | 2275 |
my ($timestamp) = $dbh->selectrow_array($query); |
2256 | 2276 |
|
2257 |
$rv = "$audittrail->{tablename}|$audittrail->{reference}|$audittrail->{formname}|$audittrail->{action}|$timestamp|"; |
|
2277 |
$rv = |
|
2278 |
"$audittrail->{tablename}|$audittrail->{reference}|$audittrail->{formname}|$audittrail->{action}|$timestamp|"; |
|
2258 | 2279 |
} |
2259 | 2280 |
|
2260 | 2281 |
$dbh->disconnect if $disconnect; |
2261 |
|
|
2282 |
|
|
2262 | 2283 |
$rv; |
2263 |
|
|
2284 |
|
|
2264 | 2285 |
} |
2265 | 2286 |
|
2266 | 2287 |
package Locale; |
SL/GL.pm | ||
---|---|---|
283 | 283 |
$apwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'"; |
284 | 284 |
} |
285 | 285 |
if ($form->{category} ne 'X') { |
286 |
$glwhere .= " AND gl.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
|
287 |
$arwhere .= " AND ar.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
|
288 |
$apwhere .= " AND ap.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
|
286 |
$glwhere .= |
|
287 |
" AND gl.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
|
288 |
$arwhere .= |
|
289 |
" AND ar.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
|
290 |
$apwhere .= |
|
291 |
" AND ap.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))"; |
|
289 | 292 |
} |
290 | 293 |
|
291 | 294 |
if ($form->{accno}) { |
... | ... | |
344 | 347 |
|
345 | 348 |
my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|; |
346 | 349 |
|
347 |
my $sortorder = join ', ', $form->sort_columns(qw(transdate reference source description accno)); |
|
348 |
my %ordinal = ( transdate => 6, |
|
349 |
reference => 4, |
|
350 |
source => 7, |
|
351 |
description => 5 ); |
|
352 |
map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal; |
|
353 |
|
|
354 |
if ($form->{sort}) { |
|
355 |
$sortorder = $form->{sort} . ","; |
|
356 |
} else { |
|
357 |
$sortorder = ""; |
|
358 |
} |
|
359 |
|
|
350 |
my $sortorder = join ', ', |
|
351 |
$form->sort_columns(qw(transdate reference source description accno)); |
|
352 |
my %ordinal = (transdate => 6, |
|
353 |
reference => 4, |
|
354 |
source => 7, |
|
355 |
description => 5); |
|
356 |
map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal; |
|
357 |
|
|
358 |
if ($form->{sort}) { |
|
359 |
$sortorder = $form->{sort} . ","; |
|
360 |
} else { |
|
361 |
$sortorder = ""; |
|
362 |
} |
|
363 |
|
|
360 | 364 |
my $query = |
361 | 365 |
qq|SELECT g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, t.taxkey AS sorttax, |
362 | 366 |
g.description, ac.transdate, ac.source, ac.trans_id, |
... | ... | |
389 | 393 |
ORDER BY $sortorder transdate, trans_id, taxkey DESC, sorttax DESC,oid|; |
390 | 394 |
my $sth = $dbh->prepare($query); |
391 | 395 |
$sth->execute || $form->dberror($query); |
392 |
my $trans_id = ""; |
|
396 |
my $trans_id = "";
|
|
393 | 397 |
my $trans_id2 = ""; |
394 | 398 |
while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) { |
395 | 399 |
$trans_id = $ref0->{id}; |
... | ... | |
398 | 402 |
push @{ $form->{GL} }, $ref; |
399 | 403 |
$balance = 0; |
400 | 404 |
} |
401 |
$ref = $ref0; |
|
405 |
$ref = $ref0;
|
|
402 | 406 |
$trans_id2 = $ref->{id}; |
403 |
|
|
407 |
|
|
404 | 408 |
# gl |
405 | 409 |
if ($ref->{type} eq "gl") { |
406 | 410 |
$ref->{module} = "gl"; |
407 | 411 |
} |
412 |
|
|
408 | 413 |
# ap |
409 | 414 |
if ($ref->{type} eq "ap") { |
410 | 415 |
if ($ref->{invoice}) { |
... | ... | |
413 | 418 |
$ref->{module} = "ap"; |
414 | 419 |
} |
415 | 420 |
} |
416 |
|
|
421 |
|
|
417 | 422 |
# ar |
418 | 423 |
if ($ref->{type} eq "ar") { |
419 | 424 |
if ($ref->{invoice}) { |
... | ... | |
447 | 452 |
} |
448 | 453 |
} |
449 | 454 |
} else { |
450 |
$ref2 = $ref0; |
|
455 |
$ref2 = $ref0;
|
|
451 | 456 |
$trans_id2 = $ref2->{id}; |
452 |
# if ($form->{accno} eq ''){ # flo & udo: if general report, |
|
453 |
# then check balance |
|
454 |
# while (abs($balance) >= 0.015) { |
|
455 |
# my $ref2 = $sth->fetchrow_hashref(NAME_lc) |
|
456 |
# || $form->error("Unbalanced ledger!"); |
|
457 |
# |
|
458 |
$balance = |
|
459 |
(int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000; |
|
460 |
if ($ref2->{amount} < 0) { |
|
461 |
if ($ref2->{chart_id} > 0) { |
|
462 |
if ($ref->{debit_tax_accno}{$i} ne "") { |
|
463 |
$i++; |
|
464 |
} |
|
465 |
$ref->{debit_tax}{$i} = $ref2->{amount} * -1; |
|
466 |
$ref->{debit_tax_accno}{$i} = $ref2->{accno}; |
|
467 |
} else { |
|
468 |
if ($ref->{debit_accno}{$k} ne "") { |
|
469 |
$k++; |
|
470 |
} |
|
471 |
$ref->{debit}{$k} = $ref2->{amount} * -1; |
|
472 |
$ref->{debit_accno}{$k} = $ref2->{accno}; |
|
473 |
$ref->{debit_taxkey}{$k} = $ref2->{taxkey}; |
|
474 |
} |
|
475 |
} else { |
|
476 |
if ($ref2->{chart_id} > 0) { |
|
477 |
if ($ref->{credit_tax_accno}{$j} ne "") { |
|
478 |
$j++; |
|
479 |
} |
|
480 |
$ref->{credit_tax}{$j} = $ref2->{amount}; |
|
481 |
$ref->{credit_tax_accno}{$j} = $ref2->{accno}; |
|
482 |
} else { |
|
483 |
if ($ref->{credit_accno}{$l} ne "") { |
|
484 |
$l++; |
|
485 |
} |
|
486 |
$ref->{credit}{$l} = $ref2->{amount}; |
|
487 |
$ref->{credit_accno}{$l} = $ref2->{accno}; |
|
488 |
$ref->{credit_taxkey}{$l} = $ref2->{taxkey}; |
|
489 |
} |
|
457 |
|
|
458 |
# if ($form->{accno} eq ''){ # flo & udo: if general report, |
|
459 |
# then check balance |
|
460 |
# while (abs($balance) >= 0.015) { |
|
461 |
# my $ref2 = $sth->fetchrow_hashref(NAME_lc) |
|
462 |
# || $form->error("Unbalanced ledger!"); |
|
463 |
# |
|
464 |
$balance = |
|
465 |
(int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000; |
|
466 |
if ($ref2->{amount} < 0) { |
|
467 |
if ($ref2->{chart_id} > 0) { |
|
468 |
if ($ref->{debit_tax_accno}{$i} ne "") { |
|
469 |
$i++; |
|
490 | 470 |
} |
491 |
# } |
|
492 |
# } else { |
|
493 |
# # if account-report, then calculate the Balance?! |
|
494 |
# # ToDo: Calculate the Balance |
|
495 |
# 1; |
|
496 |
# } |
|
471 |
$ref->{debit_tax}{$i} = $ref2->{amount} * -1; |
|
472 |
$ref->{debit_tax_accno}{$i} = $ref2->{accno}; |
|
473 |
} else { |
|
474 |
if ($ref->{debit_accno}{$k} ne "") { |
|
475 |
$k++; |
|
476 |
} |
|
477 |
$ref->{debit}{$k} = $ref2->{amount} * -1; |
|
478 |
$ref->{debit_accno}{$k} = $ref2->{accno}; |
|
479 |
$ref->{debit_taxkey}{$k} = $ref2->{taxkey}; |
|
480 |
} |
|
481 |
} else { |
|
482 |
if ($ref2->{chart_id} > 0) { |
|
483 |
if ($ref->{credit_tax_accno}{$j} ne "") { |
|
484 |
$j++; |
|
485 |
} |
|
486 |
$ref->{credit_tax}{$j} = $ref2->{amount}; |
|
487 |
$ref->{credit_tax_accno}{$j} = $ref2->{accno}; |
|
488 |
} else { |
|
489 |
if ($ref->{credit_accno}{$l} ne "") { |
|
490 |
$l++; |
|
491 |
} |
|
492 |
$ref->{credit}{$l} = $ref2->{amount}; |
|
493 |
$ref->{credit_accno}{$l} = $ref2->{accno}; |
|
494 |
$ref->{credit_taxkey}{$l} = $ref2->{taxkey}; |
|
495 |
} |
|
496 |
} |
|
497 |
|
|
498 |
# } |
|
499 |
# } else { |
|
500 |
# # if account-report, then calculate the Balance?! |
|
501 |
# # ToDo: Calculate the Balance |
|
502 |
# 1; |
|
503 |
# } |
|
497 | 504 |
} |
498 |
|
|
499 | 505 |
|
500 | 506 |
} |
501 | 507 |
push @{ $form->{GL} }, $ref; |
SL/IC.pm | ||
---|---|---|
34 | 34 |
|
35 | 35 |
package IC; |
36 | 36 |
use Data::Dumper; |
37 |
|
|
37 | 38 |
sub get_part { |
38 | 39 |
$main::lxdebug->enter_sub(); |
39 | 40 |
|
... | ... | |
235 | 236 |
$main::lxdebug->enter_sub(); |
236 | 237 |
|
237 | 238 |
my ($self, $myconfig, $form) = @_; |
238 |
my $dbh = $form->dbconnect($myconfig); |
|
239 |
my $i = 1; |
|
239 |
my $dbh = $form->dbconnect($myconfig);
|
|
240 |
my $i = 1;
|
|
240 | 241 |
my @pricegroups_not_used = (); |
241 | 242 |
|
242 | 243 |
# get pricegroups |
... | ... | |
276 | 277 |
$main::lxdebug->leave_sub(); |
277 | 278 |
} |
278 | 279 |
|
279 |
|
|
280 | 280 |
sub save { |
281 | 281 |
$main::lxdebug->enter_sub(); |
282 | 282 |
|
... | ... | |
456 | 456 |
# insert price records only if different to sellprice |
457 | 457 |
for my $i (1 .. $form->{price_rows}) { |
458 | 458 |
if ($form->{"price_$i"} eq "0") { |
459 |
$form->{"price_$i"} = $form->{sellprice};
|
|
459 |
$form->{"price_$i"} = $form->{sellprice}; |
|
460 | 460 |
} |
461 |
if (( $form->{"price_$i"} |
|
462 |
|| $form->{"klass_$i"} |
|
463 |
|| $form->{"pricegroup_id_$i"}) and $form->{"price_$i"} != $form->{sellprice}) { |
|
461 |
if ( |
|
462 |
( $form->{"price_$i"} |
|
463 |
|| $form->{"klass_$i"} |
|
464 |
|| $form->{"pricegroup_id_$i"}) |
|
465 |
and $form->{"price_$i"} != $form->{sellprice} |
|
466 |
) { |
|
464 | 467 |
$klass = $form->parse_amount($myconfig, $form->{"klass_$i"}); |
465 | 468 |
$price = $form->parse_amount($myconfig, $form->{"price_$i"}); |
466 | 469 |
$pricegroup_id = |
... | ... | |
1041 | 1044 |
$ordwhere .= " AND lower(oi.description) LIKE '$var'"; |
1042 | 1045 |
} |
1043 | 1046 |
|
1044 |
$flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1047 |
$flds = |
|
1048 |
qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1045 | 1049 |
oi.qty AS onhand, oi.unit, p.bin, oi.sellprice, |
1046 | 1050 |
p.listprice, p.lastcost, p.rop, p.weight, |
1047 | 1051 |
p.priceupdate, p.image, p.drawing, p.microfiche, |
... | ... | |
1067 | 1071 |
} |
1068 | 1072 |
|
1069 | 1073 |
if ($form->{onorder}) { |
1070 |
$flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1074 |
$flds = |
|
1075 |
qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1071 | 1076 |
oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice, |
1072 | 1077 |
p.listprice, p.lastcost, p.rop, p.weight, |
1073 | 1078 |
p.priceupdate, p.image, p.drawing, p.microfiche, |
... | ... | |
1104 | 1109 |
$quowhere .= " AND lower(oi.description) LIKE '$var'"; |
1105 | 1110 |
} |
1106 | 1111 |
|
1107 |
$flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1112 |
$flds = |
|
1113 |
qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1108 | 1114 |
oi.qty AS onhand, oi.unit, p.bin, oi.sellprice, |
1109 | 1115 |
p.listprice, p.lastcost, p.rop, p.weight, |
1110 | 1116 |
p.priceupdate, p.image, p.drawing, p.microfiche, |
... | ... | |
1130 | 1136 |
} |
1131 | 1137 |
|
1132 | 1138 |
if ($form->{rfq}) { |
1133 |
$flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1139 |
$flds = |
|
1140 |
qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, |
|
1134 | 1141 |
oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice, |
1135 | 1142 |
p.listprice, p.lastcost, p.rop, p.weight, |
1136 | 1143 |
p.priceupdate, p.image, p.drawing, p.microfiche, |
SL/IS.pm | ||
---|---|---|
106 | 106 |
push(@{ $form->{description} }, qq|$form->{"description_$i"}|); |
107 | 107 |
push(@{ $form->{qty} }, |
108 | 108 |
$form->format_amount($myconfig, $form->{"qty_$i"})); |
109 |
push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|); |
|
109 |
push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|);
|
|
110 | 110 |
push(@{ $form->{deliverydate_oe} }, qq|$form->{"deliverydate_$i"}|); |
111 | 111 |
|
112 |
push(@{ $form->{sellprice} }, $form->{"sellprice_$i"}); |
|
112 |
push(@{ $form->{sellprice} }, $form->{"sellprice_$i"});
|
|
113 | 113 |
push(@{ $form->{ordnumber_oe} }, qq|$form->{"ordnumber_$i"}|); |
114 | 114 |
push(@{ $form->{transdate_oe} }, qq|$form->{"transdate_$i"}|); |
115 | 115 |
|
... | ... | |
139 | 139 |
$dec = length $dec; |
140 | 140 |
my $decimalplaces = ($dec > 2) ? $dec : 2; |
141 | 141 |
|
142 |
my $i_discount = $form->round_amount($sellprice * |
|
143 |
$form->parse_amount($myconfig, $form->{"discount_$i"}) / 100, $decimalplaces); |
|
142 |
my $i_discount = |
|
143 |
$form->round_amount( |
|
144 |
$sellprice * $form->parse_amount($myconfig, |
|
145 |
$form->{"discount_$i"}) / 100, |
|
146 |
$decimalplaces); |
|
144 | 147 |
|
145 |
my $discount = $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); |
|
148 |
my $discount = |
|
149 |
$form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); |
|
146 | 150 |
|
147 | 151 |
# keep a netprice as well, (sellprice - discount) |
148 | 152 |
$form->{"netprice_$i"} = $sellprice - $i_discount; |
... | ... | |
164 | 168 |
: " "; |
165 | 169 |
$linetotal = ($linetotal != 0) ? $linetotal : " "; |
166 | 170 |
|
167 |
push(@{ $form->{discount} }, $discount); |
|
171 |
push(@{ $form->{discount} }, $discount);
|
|
168 | 172 |
push(@{ $form->{p_discount} }, $form->{"discount_$i"}); |
169 | 173 |
|
170 | 174 |
$form->{total} += $linetotal; |
... | ... | |
803 | 807 |
# set values which could be empty to 0 |
804 | 808 |
$form->{terms} *= 1; |
805 | 809 |
$form->{taxincluded} *= 1; |
806 |
my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL"; |
|
807 |
my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL"; |
|
808 |
my $deliverydate = ($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL"; |
|
810 |
my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL"; |
|
811 |
my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL"; |
|
812 |
my $deliverydate = |
|
813 |
($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL"; |
|
809 | 814 |
|
810 | 815 |
# fill in subject if there is none |
811 | 816 |
$form->{subject} = qq|$form->{label} $form->{invnumber}| |
SL/LXDebug.pm | ||
---|---|---|
1 | 1 |
package LXDebug; |
2 | 2 |
|
3 |
use constant NONE => 0; |
|
4 |
use constant INFO => 1; |
|
3 |
use constant NONE => 0;
|
|
4 |
use constant INFO => 1;
|
|
5 | 5 |
use constant DEBUG1 => 2; |
6 | 6 |
use constant DEBUG2 => 3; |
7 | 7 |
|
SL/OE.pm | ||
---|---|---|
223 | 223 |
for my $i (1 .. $form->{rowcount}) { |
224 | 224 |
|
225 | 225 |
map { |
226 |
$form->{"${_}_$i"} = $form->parse_amount($myconfig, $form->{"${_}_$i"}) |
|
226 |
$form->{"${_}_$i"} = |
|
227 |
$form->parse_amount($myconfig, $form->{"${_}_$i"}) |
|
227 | 228 |
} qw(qty ship); |
228 | 229 |
|
229 | 230 |
if ($form->{"qty_$i"}) { |
... | ... | |
460 | 461 |
return $rc; |
461 | 462 |
} |
462 | 463 |
|
463 |
# this function closes multiple orders given in $form->{ordnumber_#}.
|
|
464 |
# this function closes multiple orders given in $form->{ordnumber_#}. |
|
464 | 465 |
# use this for multiple orders that don't have to be saved back |
465 | 466 |
# single orders should use OE::save instead. |
466 | 467 |
sub close_orders { |
467 | 468 |
$main::lxdebug->enter_sub(); |
468 | 469 |
|
469 |
my ($self, $myconfig ,$form) = @_;
|
|
470 |
my ($self, $myconfig, $form) = @_;
|
|
470 | 471 |
|
471 | 472 |
for my $i (1 .. $form->{rowcount}) { |
472 | 473 |
|
473 | 474 |
map { |
474 |
$form->{"${_}_$i"} = $form->parse_amount($myconfig, $form->{"${_}_$i"}) |
|
475 |
$form->{"${_}_$i"} = |
|
476 |
$form->parse_amount($myconfig, $form->{"${_}_$i"}) |
|
475 | 477 |
} qw(qty ship); |
476 | 478 |
if ($delete_oe_id) { |
477 | 479 |
$form->{"orderitems_id_$i"} = ""; |
... | ... | |
487 | 489 |
$form->parse_amount($myconfig, $form->{"sellprice_$i"}); |
488 | 490 |
} |
489 | 491 |
} |
492 |
|
|
490 | 493 |
# get ids from $form |
491 |
map { push @ids, $form->{"ordnumber_$_"} if $form->{"ordnumber_$_"} } (1 .. $form->{rowcount}); |
|
492 |
|
|
494 |
map { push @ids, $form->{"ordnumber_$_"} if $form->{"ordnumber_$_"} } |
|
495 |
(1 .. $form->{rowcount}); |
|
496 |
|
|
493 | 497 |
my $dbh = $form->dbconnect($myconfig); |
494 | 498 |
$query = qq|UPDATE oe SET |
495 | 499 |
closed = TRUE |
496 |
WHERE ordnumber IN (|.join(', ', map{ $dbh->quote($_) }@ids).qq|)|; |
|
500 |
WHERE ordnumber IN (| |
|
501 |
. join(', ', map { $dbh->quote($_) } @ids) . qq|)|; |
|
497 | 502 |
$dbh->do($query) || $form->dberror($query); |
498 | 503 |
$dbh->disconnect; |
499 | 504 |
|
... | ... | |
581 | 586 |
my $query, @ids; |
582 | 587 |
|
583 | 588 |
# translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later |
584 |
map { push @ids, $form->{"trans_id_$_"} if ($form->{"id_$_"} and $form->{"trans_id_$_"}) } (1 .. $form->{"rowcount"}); |
|
589 |
map { |
|
590 |
push @ids, $form->{"trans_id_$_"} |
|
591 |
if ($form->{"id_$_"} and $form->{"trans_id_$_"}) |
|
592 |
} (1 .. $form->{"rowcount"}); |
|
585 | 593 |
|
586 |
# if called in multi id mode, and still only got one id, switch back to single id
|
|
594 |
# if called in multi id mode, and still only got one id, switch back to single id |
|
587 | 595 |
if ($form->{"rowcount"} and $#ids == 0) { |
588 | 596 |
$form->{"id"} = $ids[0]; |
589 | 597 |
undef @ids; |
... | ... | |
628 | 636 |
|
629 | 637 |
($form->{currency}) = split /:/, $form->{currencies}; |
630 | 638 |
|
631 |
# set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure
|
|
639 |
# set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure |
|
632 | 640 |
# we come from invoices, feel free. |
633 |
$form->{reqdate} = $form->{deliverydate} if ($form->{deliverydate} and $form->{callback} =~ /action=ar_transactions/); |
|
641 |
$form->{reqdate} = $form->{deliverydate} |
|
642 |
if ( $form->{deliverydate} |
|
643 |
and $form->{callback} =~ /action=ar_transactions/); |
|
634 | 644 |
|
635 | 645 |
if ($form->{id} or @ids) { |
636 | 646 |
|
637 | 647 |
# retrieve order for single id |
638 | 648 |
# NOTE: this query is intended to fetch all information only ONCE. |
639 |
# so if any of these infos is important (or even different) for any item,
|
|
649 |
# so if any of these infos is important (or even different) for any item, |
|
640 | 650 |
# it will be killed out and then has to be fetched from the item scope query further down |
641 | 651 |
$query = qq|SELECT o.cp_id, o.ordnumber, o.transdate, o.reqdate, |
642 | 652 |
o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes, |
... | ... | |
648 | 658 |
JOIN $form->{vc} cv ON (o.$form->{vc}_id = cv.id) |
649 | 659 |
LEFT JOIN employee e ON (o.employee_id = e.id) |
650 | 660 |
LEFT JOIN department d ON (o.department_id = d.id) |
651 |
|. ($form->{id}
|
|
652 |
? qq|WHERE o.id = $form->{id}|
|
|
653 |
: qq|WHERE o.id IN (|.join(', ', @ids).qq|)|
|
|
654 |
);
|
|
661 |
| |
|
662 |
. ($form->{id}
|
|
663 |
? qq|WHERE o.id = $form->{id}|
|
|
664 |
: qq|WHERE o.id IN (| . join(', ', @ids) . qq|)|);
|
|
655 | 665 |
|
656 |
#$main::lxdebug->message(0, $query); |
|
666 |
#$main::lxdebug->message(0, $query);
|
|
657 | 667 |
|
658 | 668 |
$sth = $dbh->prepare($query); |
659 | 669 |
$sth->execute || $form->dberror($query); |
... | ... | |
667 | 677 |
} |
668 | 678 |
|
669 | 679 |
# if not given, fill transdate with current_date |
670 |
$form->{transdate} = $form->current_date($myconfig) unless $form->{transdate}; |
|
680 |
$form->{transdate} = $form->current_date($myconfig) |
|
681 |
unless $form->{transdate}; |
|
671 | 682 |
|
672 | 683 |
$sth->finish; |
673 | 684 |
|
674 |
# shipto and pinted/mailed/queued status makes only sense for single id retrieve
|
|
685 |
# shipto and pinted/mailed/queued status makes only sense for single id retrieve |
|
675 | 686 |
if (!@ids) { |
676 | 687 |
$query = qq|SELECT s.* FROM shipto s |
677 | 688 |
WHERE s.trans_id = $form->{id}|; |
... | ... | |
692 | 703 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
693 | 704 |
$form->{printed} .= "$ref->{formname} " if $ref->{printed}; |
694 | 705 |
$form->{emailed} .= "$ref->{formname} " if $ref->{emailed}; |
695 |
$form->{queued} .= "$ref->{formname} $ref->{spoolfile} " if $ref->{spoolfile}; |
|
706 |
$form->{queued} .= "$ref->{formname} $ref->{spoolfile} " |
|
707 |
if $ref->{spoolfile}; |
|
696 | 708 |
} |
697 | 709 |
$sth->finish; |
698 | 710 |
map { $form->{$_} =~ s/ +$//g } qw(printed emailed queued); |
699 |
} # if !@ids |
|
711 |
} # if !@ids
|
|
700 | 712 |
|
701 | 713 |
my %oid = ('Pg' => 'oid', |
702 | 714 |
'Oracle' => 'rowid'); |
... | ... | |
723 | 735 |
LEFT JOIN chart c3 ON (p.expense_accno_id = c3.id) |
724 | 736 |
LEFT JOIN project pr ON (o.project_id = pr.id) |
725 | 737 |
LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) |
726 |
|. ($form->{id} |
|
727 |
? qq|WHERE o.trans_id = $form->{id}| |
|
728 |
: qq|WHERE o.trans_id IN (|.join(", ", @ids).qq|)| |
|
729 |
).qq| |
|
738 |
| |
|
739 |
. ($form->{id} |
|
740 |
? qq|WHERE o.trans_id = $form->{id}| |
|
741 |
: qq|WHERE o.trans_id IN (| . join(", ", @ids) . qq|)|) |
|
742 |
. qq| |
|
730 | 743 |
ORDER BY o.$oid{$myconfig->{dbdriver}}|; |
731 |
|
|
744 |
|
|
732 | 745 |
$sth = $dbh->prepare($query); |
733 | 746 |
$sth->execute || $form->dberror($query); |
734 | 747 |
|
735 | 748 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
736 |
|
|
749 |
|
|
737 | 750 |
# in collective order, copy global ordnumber, transdate, cusordnumber into item scope |
738 |
# unless already present there
|
|
751 |
# unless already present there |
|
739 | 752 |
# remove _oe entries afterwards |
740 | 753 |
map { $ref->{$_} = $ref->{"${_}_oe"} if ($ref->{$_} eq '') } |
741 |
qw|ordnumber transdate cusordnumber| if (@ids);
|
|
742 |
map{ delete $ref->{$_} }
|
|
743 |
qw|ordnumber_oe transdate_oe cusordnumber_oe|;
|
|
754 |
qw|ordnumber transdate cusordnumber| |
|
755 |
if (@ids);
|
|
756 |
map { delete $ref->{$_} } qw|ordnumber_oe transdate_oe cusordnumber_oe|;
|
|
744 | 757 |
|
745 | 758 |
#set expense_accno=inventory_accno if they are different => bilanz |
746 | 759 |
$vendor_accno = |
... | ... | |
891 | 904 |
$dec = length $dec; |
892 | 905 |
my $decimalplaces = ($dec > 2) ? $dec : 2; |
893 | 906 |
|
894 |
my $i_discount = $form->round_amount($sellprice * |
|
895 |
$form->parse_amount($myconfig, $form->{"discount_$i"}) / 100, $decimalplaces); |
|
907 |
my $i_discount = |
|
908 |
$form->round_amount( |
|
909 |
$sellprice * $form->parse_amount($myconfig, |
|
910 |
$form->{"discount_$i"}) / 100, |
|
911 |
$decimalplaces); |
|
896 | 912 |
|
897 |
my $discount = $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); |
|
913 |
my $discount = |
|
914 |
$form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); |
|
898 | 915 |
|
899 | 916 |
# keep a netprice as well, (sellprice - discount) |
900 | 917 |
#$form->{"netprice_$i"} = $sellprice - $discount; |
... | ... | |
917 | 934 |
: " "; |
918 | 935 |
$linetotal = ($linetotal != 0) ? $linetotal : " "; |
919 | 936 |
|
920 |
push(@{ $form->{discount} }, $discount); |
|
937 |
push(@{ $form->{discount} }, $discount);
|
|
921 | 938 |
push(@{ $form->{p_discount} }, $form->{"discount_$i"}); |
922 | 939 |
|
923 | 940 |
$form->{ordtotal} += $linetotal; |
... | ... | |
949 | 966 |
} |
950 | 967 |
} |
951 | 968 |
|
952 |
$tax_rate = $taxrate*100;
|
|
969 |
$tax_rate = $taxrate * 100;
|
|
953 | 970 |
push(@{ $form->{tax_rate} }, qq|$tax_rate|); |
954 | 971 |
|
955 | 972 |
if ($form->{"assembly_$i"}) { |
SL/RP.pm | ||
---|---|---|
34 | 34 |
|
35 | 35 |
package RP; |
36 | 36 |
|
37 |
|
|
38 | 37 |
sub balance_sheet { |
39 | 38 |
$main::lxdebug->enter_sub(); |
40 | 39 |
|
... | ... | |
1134 | 1133 |
my @accno; |
1135 | 1134 |
my $accno; |
1136 | 1135 |
my $ref; |
1136 |
|
|
1137 | 1137 |
#print $query; |
1138 | 1138 |
my $sth = $dbh->prepare($query); |
1139 | 1139 |
$sth->execute || $form->dberror($query); |
... | ... | |
2045 | 2045 |
|
2046 | 2046 |
my $sortorder = join ', ', |
2047 | 2047 |
$form->sort_columns(qw(name invnumber ordnumber transdate source)); |
2048 |
$sortorder = $form->{sort} if $form->{sort};
|
|
2049 |
|
|
2048 |
$sortorder = $form->{sort} if $form->{sort}; |
|
2049 |
|
|
2050 | 2050 |
# cycle through each id |
2051 | 2051 |
foreach my $accno (split(/ /, $form->{paymentaccounts})) { |
2052 | 2052 |
|
... | ... | |
2143 | 2143 |
$form->{ "$key" . "gesamtleistung" } = 0; |
2144 | 2144 |
$form->{ "$key" . "gesamtkosten" } = 0; |
2145 | 2145 |
|
2146 |
|
|
2147 | 2146 |
foreach $category (@categories) { |
2148 | 2147 |
|
2149 | 2148 |
if (defined($form->{$category}{$key})) { |
2150 | 2149 |
$form->{"$key$category"} = |
2151 | 2150 |
$form->format_amount($myconfig, |
2152 | 2151 |
$form->round_amount($form->{$category}{$key}, 2 |
2153 |
), $form->{decimalplaces}, '0'); |
|
2152 |
), |
|
2153 |
$form->{decimalplaces}, |
|
2154 |
'0'); |
|
2154 | 2155 |
} |
2155 | 2156 |
} |
2156 | 2157 |
foreach $item (@gesamtleistung) { |
... | ... | |
2173 | 2174 |
$form->{ "$key" . "ergebnisvorsteuern" } = |
2174 | 2175 |
$form->{ "$key" . "betriebsergebnis" } - |
2175 | 2176 |
$form->{ "$key" . "neutraleraufwand" } + |
2176 |
$form->{ "$key" . "neutralertrag" };
|
|
2177 |
$form->{ "$key" . "neutralertrag" }; |
|
2177 | 2178 |
$form->{ "$key" . "ergebnis" } = |
2178 | 2179 |
$form->{ "$key" . "ergebnisvorsteuern" } + $form->{35}{$key}; |
2179 | 2180 |
|
... | ... | |
2188 | 2189 |
$form->{ "$key" . "gesamtleistung" } * 100 |
2189 | 2190 |
), |
2190 | 2191 |
$form->{decimalplaces} |
2191 |
), $form->{decimalplaces}, '0'); |
|
2192 |
), |
|
2193 |
$form->{decimalplaces}, |
|
2194 |
'0'); |
|
2192 | 2195 |
} |
2193 | 2196 |
} |
2194 | 2197 |
foreach $item (@ergebnisse) { |
... | ... | |
2199 | 2202 |
$form->{ "$key" . "gesamtleistung" } * 100 |
2200 | 2203 |
), |
2201 | 2204 |
$form->{decimalplaces} |
2202 |
), $form->{decimalplaces}, '0'); |
|
2205 |
), |
|
2206 |
$form->{decimalplaces}, |
|
2207 |
'0'); |
|
2203 | 2208 |
} |
2204 | 2209 |
} |
2205 | 2210 |
|
... | ... | |
2213 | 2218 |
$form->{ "$key" . "gesamtkosten" } * 100 |
2214 | 2219 |
), |
2215 | 2220 |
$form->{decimalplaces} |
2216 |
), $form->{decimalplaces}, '0'); |
|
2221 |
), |
|
2222 |
$form->{decimalplaces}, |
|
2223 |
'0'); |
|
2217 | 2224 |
} |
2218 | 2225 |
} |
2219 | 2226 |
foreach $item (@ergebnisse) { |
... | ... | |
2224 | 2231 |
$form->{ "$key" . "gesamtkosten" } * 100 |
2225 | 2232 |
), |
2226 | 2233 |
$form->{decimalplaces} |
2227 |
), $form->{decimalplaces}, '0'); |
|
2234 |
), |
|
2235 |
$form->{decimalplaces}, |
|
2236 |
'0'); |
|
2228 | 2237 |
} |
2229 | 2238 |
} |
2230 | 2239 |
|
... | ... | |
2233 | 2242 |
if (defined($form->{$category}{$key})) { |
2234 | 2243 |
$form->{ "$key" . "pk" . "$category" } = |
2235 | 2244 |
$form->format_amount( |
2236 |
$myconfig, |
|
2237 |
$form->round_amount( |
|
2238 |
($form->{$category}{$key} / $form->{10}{$key} * 100), |
|
2239 |
$form->{decimalplaces} |
|
2240 |
), $form->{decimalplaces}, '0'); |
|
2245 |
$myconfig, |
|
2246 |
$form->round_amount( |
|
2247 |
($form->{$category}{$key} / $form->{10}{$key} * 100), |
|
2248 |
$form->{decimalplaces} |
|
2249 |
), |
|
2250 |
$form->{decimalplaces}, |
|
2251 |
'0'); |
|
2241 | 2252 |
} |
2242 | 2253 |
} |
2243 | 2254 |
foreach $item (@ergebnisse) { |
... | ... | |
2248 | 2259 |
$form->{10}{$key} * 100 |
2249 | 2260 |
), |
2250 | 2261 |
$form->{decimalplaces} |
2251 |
), $form->{decimalplaces}, '0'); |
|
2262 |
), |
|
2263 |
$form->{decimalplaces}, |
|
2264 |
'0'); |
|
2252 | 2265 |
} |
2253 | 2266 |
} |
2254 | 2267 |
|
... | ... | |
2257 | 2270 |
if (defined($form->{$category}{$key})) { |
2258 | 2271 |
$form->{ "$key" . "auf" . "$category" } = |
2259 | 2272 |
$form->format_amount( |
2260 |
$myconfig, |
|
2261 |
$form->round_amount( |
|
2262 |
($form->{$category}{$key} / $form->{4}{$key} * 100), |
|
2263 |
$form->{decimalplaces} |
|
2264 |
), $form->{decimalplaces}, '0'); |
|
2273 |
$myconfig, |
|
2274 |
$form->round_amount( |
|
2275 |
($form->{$category}{$key} / $form->{4}{$key} * 100), |
|
2276 |
$form->{decimalplaces} |
|
2277 |
), |
|
2278 |
$form->{decimalplaces}, |
|
2279 |
'0'); |
|
2265 | 2280 |
} |
2266 | 2281 |
} |
2267 | 2282 |
foreach $item (@ergebnisse) { |
... | ... | |
2272 | 2287 |
$form->{4}{$key} * 100 |
2273 | 2288 |
), |
2274 | 2289 |
$form->{decimalplaces} |
2275 |
), $form->{decimalplaces}, '0'); |
|
2290 |
), |
|
2291 |
$form->{decimalplaces}, |
|
2292 |
'0'); |
|
2276 | 2293 |
} |
2277 | 2294 |
} |
2278 | 2295 |
|
2279 | 2296 |
foreach $item (@ergebnisse) { |
2280 | 2297 |
$form->{ "$key" . "$item" } = |
2281 | 2298 |
$form->format_amount($myconfig, |
2282 |
$form->round_amount($form->{ "$key" . "$item" }, |
|
2283 |
$form->{decimalplaces} |
|
2284 |
), $form->{decimalplaces}, '0'); |
|
2299 |
$form->round_amount($form->{ "$key" . "$item" }, |
|
2300 |
$form->{decimalplaces} |
|
2301 |
), |
|
2302 |
$form->{decimalplaces}, |
|
2303 |
'0'); |
|
2285 | 2304 |
} |
2286 | 2305 |
|
2287 | 2306 |
} |
... | ... | |
2301 | 2320 |
my $last_period = 0; |
2302 | 2321 |
my $category = "pos_ustva"; |
2303 | 2322 |
my @categories_cent = qw(51r 511 86r 861 97r 971 93r 931 |
2304 |
96 66 43 45 53 62 65 67);
|
|
2323 |
96 66 43 45 53 62 65 67); |
|
2305 | 2324 |
my @categories_euro = qw(48 51 86 91 97 93 94); |
2306 | 2325 |
$form->{decimalplaces} *= 1; |
2307 | 2326 |
|
... | ... | |
2339 | 2358 |
# } |
2340 | 2359 |
# |
2341 | 2360 |
# } |
2342 |
|
|
2361 |
|
|
2343 | 2362 |
# |
2344 | 2363 |
# Berechnung der USTVA Formularfelder |
2345 | 2364 |
# |
... | ... | |
2347 | 2366 |
$form->{"86r"} = $form->{"861"}; |
2348 | 2367 |
$form->{"97r"} = $form->{"971"}; |
2349 | 2368 |
$form->{"93r"} = $form->{"931"}; |
2369 |
|
|
2350 | 2370 |
#$form->{"96"} = $form->{"94"} * 0.16; |
2351 |
$form->{"43"} =
|
|
2371 |
$form->{"43"} = |
|
2352 | 2372 |
$form->{"51r"} + $form->{"86r"} + $form->{"97r"} + $form->{"93r"} + |
2353 | 2373 |
$form->{"96"}; |
2354 | 2374 |
$form->{"45"} = $form->{"43"}; |
... | ... | |
2359 | 2379 |
|
2360 | 2380 |
foreach $item (@categories_cent) { |
2361 | 2381 |
$form->{$item} = |
2362 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), 2, '0'); |
|
2382 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), |
|
2383 |
2, '0'); |
|
2363 | 2384 |
} |
2364 | 2385 |
|
2365 | 2386 |
foreach $item (@categories_euro) { |
2366 | 2387 |
$form->{$item} = |
2367 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), 0, '0'); |
|
2388 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), |
|
2389 |
0, '0'); |
|
2368 | 2390 |
} |
2369 | 2391 |
|
2370 | 2392 |
$dbh->disconnect; |
SL/USTVA.pm | ||
---|---|---|
215 | 215 |
$elster_land_fa{$FFFF} = $elster_init->{$elster_land}->{$FFFF}->[0]; |
216 | 216 |
} |
217 | 217 |
foreach $ffff (sort { $elster_land_fa{$a} cmp $elster_land_fa{$b} } |
218 |
keys(%elster_land_fa)) { |
|
218 |
keys(%elster_land_fa) |
|
219 |
) { |
|
219 | 220 |
print qq| |
220 | 221 |
elsterFAAuswahl.options[$j] = new Option("$elster_land_fa{$ffff} ($ffff)","$ffff");|; |
221 | 222 |
$j++; |
... | ... | |
268 | 269 |
print qq|<option value="Auswahl" $checked>hier ausw?hlen...</option>|; |
269 | 270 |
} else { |
270 | 271 |
foreach $ffff (sort { $elster_land_fa{$a} cmp $elster_land_fa{$b} } |
271 |
keys(%elster_land_fa)) { |
|
272 |
keys(%elster_land_fa) |
|
273 |
) { |
|
272 | 274 |
|
273 | 275 |
print qq| |
274 | 276 |
<option value="$ffff"|; |
... | ... | |
556 | 558 |
$main::lxdebug->leave_sub(); |
557 | 559 |
} |
558 | 560 |
|
559 |
|
|
560 | 561 |
sub ustva { |
561 | 562 |
$main::lxdebug->enter_sub(); |
562 | 563 |
|
... | ... | |
567 | 568 |
|
568 | 569 |
my $last_period = 0; |
569 | 570 |
my $category = "pos_ustva"; |
570 |
my @categories_cent = qw(511 861 36 80 971 931 98 96 53 74
|
|
571 |
85 65 66 61 62 67 63 64 59 69 39 83
|
|
572 |
Z43 Z45 Z53 Z62 Z65 Z67);
|
|
573 |
|
|
574 |
my @categories_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
|
|
575 |
95 94 42 60 45 52 73 84);
|
|
571 |
my @categories_cent = qw(511 861 36 80 971 931 98 96 53 74 |
|
572 |
85 65 66 61 62 67 63 64 59 69 39 83
|
|
573 |
Z43 Z45 Z53 Z62 Z65 Z67); |
|
574 |
|
|
575 |
my @categories_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93 |
|
576 |
95 94 42 60 45 52 73 84); |
|
576 | 577 |
|
577 | 578 |
$form->{decimalplaces} *= 1; |
578 | 579 |
|
... | ... | |
583 | 584 |
$form->{"$item"} = 0; |
584 | 585 |
} |
585 | 586 |
|
586 |
|
|
587 | 587 |
&get_accounts_ustva($dbh, $last_period, $form->{fromdate}, $form->{todate}, |
588 |
$form, $category); |
|
589 |
|
|
588 |
$form, $category); |
|
590 | 589 |
|
591 | 590 |
# |
592 | 591 |
# Berechnung der USTVA Formularfelder |
... | ... | |
595 | 594 |
$form->{"86r"} = $form->{"861"}; |
596 | 595 |
$form->{"97r"} = $form->{"971"}; |
597 | 596 |
$form->{"93r"} = $form->{"931"}; |
598 |
$form->{"Z43"} = $form->{"511"}+ $form->{"861"} + |
|
599 |
$form->{"36"} + $form->{"80"} + |
|
600 |
$form->{"971"}+ $form->{"931"} + |
|
601 |
$form->{"96"} + $form->{"98"}; |
|
597 |
$form->{"Z43"} = |
|
598 |
$form->{"511"} + $form->{"861"} + $form->{"36"} + $form->{"80"} + |
|
599 |
$form->{"971"} + $form->{"931"} + $form->{"96"} + $form->{"98"}; |
|
602 | 600 |
$form->{"Z45"} = $form->{"Z43"}; |
603 | 601 |
$form->{"Z53"} = $form->{"Z43"}; |
604 |
$form->{"Z62"} = $form->{"Z43"}- $form->{"66"} - |
|
605 |
$form->{"61"} - $form->{"62"} - |
|
606 |
$form->{"63"} - $form->{"64"} - |
|
607 |
$form->{"59"}; |
|
608 |
$form->{"Z65"} = $form->{"Z62"}- $form->{"69"}; |
|
609 |
$form->{"83"} = $form->{"Z65"}- $form->{"39"}; |
|
610 |
|
|
602 |
$form->{"Z62"} = |
|
603 |
$form->{"Z43"} - $form->{"66"} - $form->{"61"} - $form->{"62"} - |
|
604 |
$form->{"63"} - $form->{"64"} - $form->{"59"}; |
|
605 |
$form->{"Z65"} = $form->{"Z62"} - $form->{"69"}; |
|
606 |
$form->{"83"} = $form->{"Z65"} - $form->{"39"}; |
|
607 |
|
|
611 | 608 |
foreach $item (@categories_cent) { |
612 | 609 |
$form->{$item} = |
613 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), 2, '0'); |
|
610 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), |
|
611 |
2, '0'); |
|
614 | 612 |
} |
615 | 613 |
|
616 | 614 |
foreach $item (@categories_euro) { |
617 | 615 |
$form->{$item} = |
618 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), 0, '0'); |
|
616 |
$form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), |
|
617 |
0, '0'); |
|
619 | 618 |
} |
620 | 619 |
|
621 | 620 |
$dbh->disconnect; |
... | ... | |
637 | 636 |
my $where = "1 = 1"; |
638 | 637 |
my $glwhere = ""; |
639 | 638 |
my $subwhere = ""; |
640 |
my $ARwhere = ""; |
|
641 |
my $arwhere = ""; |
|
639 |
my $ARwhere = "";
|
|
640 |
my $arwhere = "";
|
|
642 | 641 |
my $item; |
643 | 642 |
|
644 | 643 |
if ($fromdate) { |
Auch abrufbar als: Unified diff
Kosmetik: Perltidy-Lauf nach den Einstellungen in doc/programmierrichtlinien.txt ueber alle .pl und .pm.