From 081a4f9736f3bc345872be8f61632cbed4a8d9b3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 3 Feb 2006 14:46:22 +0000 Subject: [PATCH] Kosmetik: Perltidy-Lauf nach den Einstellungen in doc/programmierrichtlinien.txt ueber alle .pl und .pm. --- SL/AP.pm | 2 +- SL/AR.pm | 6 +- SL/CA.pm | 18 ++-- SL/CT.pm | 5 +- SL/DATEV.pm | 11 +-- SL/Form.pm | 209 ++++++++++++++++++++++------------------ SL/GL.pm | 138 +++++++++++++------------- SL/IC.pm | 29 +++--- SL/IS.pm | 23 +++-- SL/LXDebug.pm | 4 +- SL/OE.pm | 89 ++++++++++------- SL/RP.pm | 82 ++++++++++------ SL/USTVA.pm | 57 ++++++----- bin/mozilla/am.pl | 20 ++-- bin/mozilla/ar.pl | 2 +- bin/mozilla/bp.pl | 9 +- bin/mozilla/ca.pl | 3 +- bin/mozilla/cp.pl | 12 +-- bin/mozilla/ct.pl | 49 +++++----- bin/mozilla/datev.pl | 57 ++++------- bin/mozilla/gl.pl | 72 +++++++------- bin/mozilla/ic.pl | 25 +++-- bin/mozilla/io.pl | 95 +++++++++--------- bin/mozilla/is.pl | 20 ++-- bin/mozilla/kopf.pl | 4 +- bin/mozilla/licenses.pl | 54 ++++------- bin/mozilla/menunew.pl | 4 +- bin/mozilla/oe.pl | 122 +++++++++++++---------- bin/mozilla/rc.pl | 5 +- bin/mozilla/rp.pl | 202 +++++++++++++------------------------- bin/mozilla/ustva.pl | 181 ++++++++++++++++++---------------- 31 files changed, 817 insertions(+), 792 deletions(-) diff --git a/SL/AP.pm b/SL/AP.pm index 2a486c882..e909890f8 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -442,7 +442,7 @@ sub ap_transactions { push @a, "employee" if $self->{l_employee}; my $sortorder = join ', ', $form->sort_columns(@a); $sortorder = $form->{sort} if $form->{sort}; - + $query .= "WHERE $where ORDER by $sortorder"; diff --git a/SL/AR.pm b/SL/AR.pm index 76cea5579..42f8c1cc7 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -83,9 +83,10 @@ sub post_transaction { $form->{amount} = $form->{netamount}; - $form->{tax} = 0; + $form->{tax} = 0; $form->{netamount} = 0; $form->{total_tax} = 0; + # taxincluded doesn't make sense if there is no amount $form->{taxincluded} = 0 if ($form->{amount} == 0); @@ -114,7 +115,8 @@ sub post_transaction { $form->{netamount} += $form->{"amount_$i"}; } else { $form->{"tax_$i"} = $form->{"amount_$i"} * $form->{"taxrate_$i"}; - $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2); + $form->{"tax_$i"} = + $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2); $form->{netamount} += $form->{"amount_$i"}; } } diff --git a/SL/CA.pm b/SL/CA.pm index 3517a3488..4453a9fd6 100644 --- a/SL/CA.pm +++ b/SL/CA.pm @@ -164,7 +164,7 @@ sub all_transactions { $where .= $fromto; $AR_PAID = ""; $AP_PAID = ""; - $glwhere = ""; # note! gl will be aliased as "a" later... + $glwhere = ""; # note! gl will be aliased as "a" later... } my $sortorder = join ', ', $form->sort_columns(qw(transdate reference description)); @@ -323,14 +323,14 @@ sub all_transactions { foreach my $id (@id) { - # NOTE: - # Postgres is really picky about the order of implicit CROSS JOINs with ',' - # if you alias the tables and want to use the alias later in another JOIN. - # the alias you want to use has to be the most recent in the list, otherwise - # Postgres will overwrite the alias internally and complain. - # For this reason, in the next 3 SELECTs, the 'a' alias is last in the list. - # Don't change this, and if you do, substitute the ',' with CROSS JOIN - # ... that also works. + # NOTE: + # Postgres is really picky about the order of implicit CROSS JOINs with ',' + # if you alias the tables and want to use the alias later in another JOIN. + # the alias you want to use has to be the most recent in the list, otherwise + # Postgres will overwrite the alias internally and complain. + # For this reason, in the next 3 SELECTs, the 'a' alias is last in the list. + # Don't change this, and if you do, substitute the ',' with CROSS JOIN + # ... that also works. # get all transactions $query .= qq|$union diff --git a/SL/CT.pm b/SL/CT.pm index 308a36e46..ab5d70ef4 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -232,7 +232,8 @@ sub save_customer { $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} if ($form->{"selected_cp_${_}"}); } qw(title greeting)); -# + + # # escape ' map { $form->{$_} =~ s/\'/\'\'/g } qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language pricegroup); @@ -318,7 +319,7 @@ sub save_customer { ustid = '$form->{ustid}', username = '$form->{username}', salesman_id = '$form->{salesman_id}', - user_password = | . $dbh->quote($form->{user_password}) .qq|, + user_password = | . $dbh->quote($form->{user_password}) . qq|, c_vendor_id = '$form->{c_vendor_id}', klass = '$form->{klass}' WHERE id = $form->{id}|; diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 36fe80dba..9c617dbb8 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -588,7 +588,7 @@ sub kne_buchungsexport { my $evfile = "EV01"; my @ed_versionsets; my $fileno = 0; - + $form->header; print qq| @@ -616,8 +616,8 @@ sub kne_buchungsexport { $remaining_bytes -= length($header); while (scalar(@{ $form->{DATEV} }) > 0) { - $transaction = shift @{ $form->{DATEV} }; - $trans_lines = scalar(@{$transaction}); + $transaction = shift @{ $form->{DATEV} }; + $trans_lines = scalar(@{$transaction}); $counter++; if (($counter % 500) == 0) { print("$counter "); @@ -829,7 +829,7 @@ sub kne_buchungsexport { print(EV $ed_versionset[$file]); } close(EV); -print qq|
Done.
+ print qq|
Done.
|; ### @@ -865,8 +865,7 @@ sub kne_stammdatenexport { qq|SELECT c.accno, c.description FROM chart c WHERE c.accno >=| . $dbh->quote($form->{accnofrom}) . qq| AND c.accno <= | - . $dbh->quote($form->{accnoto}) - . qq| ORDER BY c.accno|; + . $dbh->quote($form->{accnoto}) . qq| ORDER BY c.accno|; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); diff --git a/SL/Form.pm b/SL/Form.pm index 68e66836e..8670d604c 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -195,7 +195,7 @@ sub unescape { sub quote { my ($self, $str) = @_; - if ($str && ! ref($str)) { + if ($str && !ref($str)) { $str =~ s/"/"/g; } @@ -203,11 +203,10 @@ sub quote { } - sub unquote { my ($self, $str) = @_; - if ($str && ! ref($str)) { + if ($str && !ref($str)) { $str =~ s/"/"/g; } @@ -215,17 +214,24 @@ sub unquote { } - sub hide_form { my $self = shift; if (@_) { - for (@_) { print qq|\n| } + for (@_) { + print qq|\n|; + } } else { delete $self->{header}; - for (sort keys %$self) { print qq|\n| } + for (sort keys %$self) { + print qq|\n|; + } } - + } sub error { @@ -452,17 +458,17 @@ sub write_trigger { push @triggers, qq| Calendar.setup( { - inputField : "|.(shift).qq|", + inputField : "| . (shift) . qq|", ifFormat :"$ifFormat", - align : "|.(shift).qq|", - button : "|.(shift).qq|" + align : "| . (shift) . qq|", + button : "| . (shift) . qq|" } ); |; } $jsscript = qq| |; @@ -505,12 +511,12 @@ sub format_amount { $main::lxdebug->enter_sub(); my ($self, $myconfig, $amount, $places, $dash) = @_; - + #Workaround for $format_amount calls without $places - if (!defined $places){ - (my $dec) = ($amount =~ /\.(\d+)/); - $places = length $dec; - } + if (!defined $places) { + (my $dec) = ($amount =~ /\.(\d+)/); + $places = length $dec; + } if ($places =~ /\d/) { $amount = $self->round_amount($amount, $places); @@ -518,7 +524,7 @@ sub format_amount { # is the amount negative my $negative = ($amount < 0); - my $fillup = ""; + my $fillup = ""; if ($amount != 0) { if ($myconfig->{numberformat} && ($myconfig->{numberformat} ne '1000.00')) @@ -532,19 +538,19 @@ sub format_amount { $amount =~ s/\d{3,}?/$&,/g; $amount =~ s/,$//; $amount = join '', reverse split //, $amount; - $amount .= "\.$dec".$fillup if ($places ne '' && $places*1 != 0); + $amount .= "\.$dec" . $fillup if ($places ne '' && $places * 1 != 0); } if ($myconfig->{numberformat} eq '1.000,00') { $amount =~ s/\d{3,}?/$&./g; $amount =~ s/\.$//; $amount = join '', reverse split //, $amount; - $amount .= ",$dec".$fillup if ($places ne '' && $places*1 != 0); + $amount .= ",$dec" . $fillup if ($places ne '' && $places * 1 != 0); } if ($myconfig->{numberformat} eq '1000,00') { $amount = "$whole"; - $amount .= ",$dec" .$fillup if ($places ne '' && $places*1 != 0); + $amount .= ",$dec" . $fillup if ($places ne '' && $places * 1 != 0); } if ($dash =~ /-/) { @@ -576,29 +582,39 @@ sub parse_amount { $main::lxdebug->enter_sub(); my ($self, $myconfig, $amount) = @_; - $main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount"); - - if ($myconfig->{in_numberformat} == 1){ + $main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount"); + + if ($myconfig->{in_numberformat} == 1) { + # Extra input number format 1000.00 or 1000,00 - $main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('1000,00 or 1000.00')); + $main::lxdebug->message(LXDebug::DEBUG2, + "in_numberformat: " . $main::locale->text('1000,00 or 1000.00')); $amount =~ s/,/\./g; + #$main::lxdebug->message(LXDebug::DEBUG2, "1.Parsed Number: $amount") if ($amount); $amount = scalar reverse $amount; + #$main::lxdebug->message(LXDebug::DEBUG2, "2.Parsed Number: $amount") if ($amount); $amount =~ s/\./DOT/; + #$main::lxdebug->message(LXDebug::DEBUG2, "3.Parsed Number: $amount") if ($amount); $amount =~ s/\.//g; + #$main::lxdebug->message(LXDebug::DEBUG2, "4.Parsed Number: $amount") if ($amount); $amount =~ s/DOT/\./; + #$main::lxdebug->message(LXDebug::DEBUG2, "5.Parsed Number:" . $amount) if ($amount); - $amount = scalar reverse $amount ; - $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n"); + $amount = scalar reverse $amount; + $main::lxdebug->message(LXDebug::DEBUG2, + "Parsed amount:" . $amount . "\n"); return ($amount * 1); } - $main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('equal Outputformat')); - $main::lxdebug->message(LXDebug::DEBUG2, " = numberformat: $myconfig->{numberformat}"); + $main::lxdebug->message(LXDebug::DEBUG2, + "in_numberformat: " . $main::locale->text('equal Outputformat')); + $main::lxdebug->message(LXDebug::DEBUG2, + " = numberformat: $myconfig->{numberformat}"); if ( ($myconfig->{numberformat} eq '1.000,00') || ($myconfig->{numberformat} eq '1000,00')) { $amount =~ s/\.//g; @@ -606,14 +622,15 @@ sub parse_amount { } if ($myconfig->{numberformat} eq "1'000.00") { - $amount =~ s/'//g; + $amount =~ s/'//g; } $amount =~ s/,//g; - - $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount. "\n") if ($amount); + + $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n") + if ($amount); $main::lxdebug->leave_sub(); - + return ($amount * 1); } @@ -625,20 +642,18 @@ sub round_amount { # Rounding like "Kaufmannsrunden" # Descr. http://de.wikipedia.org/wiki/Rundung - # Inspired by + # Inspired by # http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q4.13.html # Solves Bug: 189 # Udo Spallek - $amount = $amount * (10 ** ($places)); - $round_amount = int($amount + .5 * ($amount <=> 0))/(10**($places)); + $amount = $amount * (10**($places)); + $round_amount = int($amount + .5 * ($amount <=> 0)) / (10**($places)); $main::lxdebug->leave_sub(); return $round_amount; - -} - +} sub parse_template { $main::lxdebug->enter_sub(); @@ -754,8 +769,11 @@ sub parse_template { } # Yes we need a manual page break -- or the user has forced one - if ((($current_line + $lines) > $lpp) || - ($self->{"_forced_pagebreaks"} && grep(/^${current_row}$/, @{$self->{"_forced_pagebreaks"}}))) { + if ( + (($current_line + $lines) > $lpp) + || ($self->{"_forced_pagebreaks"} + && grep(/^${current_row}$/, @{ $self->{"_forced_pagebreaks"} })) + ) { my $pb = $pagebreak; # replace the special variables <%sumcarriedforward%> @@ -1042,7 +1060,7 @@ sub format_string { my %unique_fields; %unique_fields = map({ $_ => 1 } @fields); - @fields = keys(%unique_fields); + @fields = keys(%unique_fields); foreach my $field (@fields) { next unless ($self->{$field} =~ /\/); @@ -1295,7 +1313,7 @@ sub get_exchangerate { $main::lxdebug->enter_sub(); my ($self, $dbh, $curr, $transdate, $fld) = @_; - + unless ($transdate) { $main::lxdebug->leave_sub(); return ""; @@ -1348,8 +1366,9 @@ sub add_shipto { my ($self, $dbh, $id) = @_; ##LINET my $shipto; - foreach - my $item (qw(name department_1 department_2 street zipcode city country contact phone fax email)) { + foreach my $item ( + qw(name department_1 department_2 street zipcode city country contact phone fax email) + ) { if ($self->{"shipto$item"}) { $shipto = 1 if ($self->{$item} ne $self->{"shipto$item"}); } @@ -1357,7 +1376,8 @@ sub add_shipto { } if ($shipto) { - my $query = qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2, shiptostreet, + my $query = + qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2, shiptostreet, shiptozipcode, shiptocity, shiptocountry, shiptocontact, shiptophone, shiptofax, shiptoemail) VALUES ($id, '$self->{shiptoname}', '$self->{shiptodepartment_1}', '$self->{shiptodepartment_2}', '$self->{shiptostreet}', @@ -1616,8 +1636,7 @@ sub create_links { my %xkeyref = (); # now get the account numbers - $query = - qq|SELECT c.accno, c.description, c.link, c.taxkey_id + $query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id FROM chart c WHERE c.link LIKE '%$module%' ORDER BY c.accno|; @@ -1700,14 +1719,14 @@ sub create_links { $self->{exchangerate} = $self->get_exchangerate($dbh, $self->{currency}, $self->{transdate}, $fld); - my $index=0; + my $index = 0; # store amounts in {acc_trans}{$key} for multiple accounts while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { $ref->{exchangerate} = $self->get_exchangerate($dbh, $self->{currency}, $ref->{transdate}, $fld); - if ( !($xkeyref{ $ref->{accno} } =~ /tax/)) { + if (!($xkeyref{ $ref->{accno} } =~ /tax/)) { $index++; } $ref->{index} = $index; @@ -2143,7 +2162,6 @@ sub get_partsgroup { $main::lxdebug->leave_sub(); } - sub get_pricegroup { $main::lxdebug->enter_sub(); @@ -2175,92 +2193,95 @@ sub get_pricegroup { $main::lxdebug->leave_sub(); } - sub audittrail { my ($self, $dbh, $myconfig, $audittrail) = @_; - -# table, $reference, $formname, $action, $id, $transdate) = @_; + + # table, $reference, $formname, $action, $id, $transdate) = @_; my $query; my $rv; my $disconnect; - if (! $dbh) { - $dbh = $self->dbconnect($myconfig); + if (!$dbh) { + $dbh = $self->dbconnect($myconfig); $disconnect = 1; } - + # if we have an id add audittrail, otherwise get a new timestamp - + if ($audittrail->{id}) { - + $query = qq|SELECT audittrail FROM defaults|; - + if ($dbh->selectrow_array($query)) { my ($null, $employee_id) = $self->get_employee($dbh); if ($self->{audittrail} && !$myconfig) { - chop $self->{audittrail}; - - my @a = split /\|/, $self->{audittrail}; - my %newtrail = (); - my $key; - my $i; - my @flds = qw(tablename reference formname action transdate); - - # put into hash and remove dups - while (@a) { - $key = "$a[2]$a[3]"; - $i = 0; - $newtrail{$key} = { map { $_ => $a[$i++] } @flds }; - splice @a, 0, 5; - } - - $query = qq|INSERT INTO audittrail (trans_id, tablename, reference, + chop $self->{audittrail}; + + my @a = split /\|/, $self->{audittrail}; + my %newtrail = (); + my $key; + my $i; + my @flds = qw(tablename reference formname action transdate); + + # put into hash and remove dups + while (@a) { + $key = "$a[2]$a[3]"; + $i = 0; + $newtrail{$key} = { map { $_ => $a[$i++] } @flds }; + splice @a, 0, 5; + } + + $query = qq|INSERT INTO audittrail (trans_id, tablename, reference, formname, action, employee_id, transdate) VALUES ($audittrail->{id}, ?, ?, ?, ?, $employee_id, ?)|; - my $sth = $dbh->prepare($query) || $self->dberror($query); - - foreach $key (sort { $newtrail{$a}{transdate} cmp $newtrail{$b}{transdate} } keys %newtrail) { - $i = 1; - for (@flds) { $sth->bind_param($i++, $newtrail{$key}{$_}) } - - $sth->execute || $self->dberror; - $sth->finish; - } + my $sth = $dbh->prepare($query) || $self->dberror($query); + + foreach $key ( + sort { + $newtrail{$a}{transdate} cmp $newtrail{$b}{transdate} + } keys %newtrail + ) { + $i = 1; + for (@flds) { $sth->bind_param($i++, $newtrail{$key}{$_}) } + + $sth->execute || $self->dberror; + $sth->finish; + } } - if ($audittrail->{transdate}) { - $query = qq|INSERT INTO audittrail (trans_id, tablename, reference, + $query = qq|INSERT INTO audittrail (trans_id, tablename, reference, formname, action, employee_id, transdate) VALUES ( $audittrail->{id}, '$audittrail->{tablename}', | - .$dbh->quote($audittrail->{reference}).qq|, + . $dbh->quote($audittrail->{reference}) . qq|, '$audittrail->{formname}', '$audittrail->{action}', $employee_id, '$audittrail->{transdate}')|; } else { - $query = qq|INSERT INTO audittrail (trans_id, tablename, reference, + $query = qq|INSERT INTO audittrail (trans_id, tablename, reference, formname, action, employee_id) VALUES ($audittrail->{id}, '$audittrail->{tablename}', | - .$dbh->quote($audittrail->{reference}).qq|, + . $dbh->quote($audittrail->{reference}) . qq|, '$audittrail->{formname}', '$audittrail->{action}', $employee_id)|; } $dbh->do($query); } } else { - + $query = qq|SELECT current_timestamp FROM defaults|; my ($timestamp) = $dbh->selectrow_array($query); - $rv = "$audittrail->{tablename}|$audittrail->{reference}|$audittrail->{formname}|$audittrail->{action}|$timestamp|"; + $rv = + "$audittrail->{tablename}|$audittrail->{reference}|$audittrail->{formname}|$audittrail->{action}|$timestamp|"; } $dbh->disconnect if $disconnect; - + $rv; - + } package Locale; diff --git a/SL/GL.pm b/SL/GL.pm index 1cc3d3447..d6723d3c5 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -283,9 +283,12 @@ sub all_transactions { $apwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'"; } if ($form->{category} ne 'X') { - $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}'))"; - $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}'))"; - $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}'))"; + $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}'))"; + $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}'))"; + $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}'))"; } if ($form->{accno}) { @@ -344,19 +347,20 @@ sub all_transactions { my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|; - my $sortorder = join ', ', $form->sort_columns(qw(transdate reference source description accno)); - my %ordinal = ( transdate => 6, - reference => 4, - source => 7, - description => 5 ); - map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal; - - if ($form->{sort}) { - $sortorder = $form->{sort} . ","; - } else { - $sortorder = ""; - } - + my $sortorder = join ', ', + $form->sort_columns(qw(transdate reference source description accno)); + my %ordinal = (transdate => 6, + reference => 4, + source => 7, + description => 5); + map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal; + + if ($form->{sort}) { + $sortorder = $form->{sort} . ","; + } else { + $sortorder = ""; + } + my $query = qq|SELECT g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, t.taxkey AS sorttax, g.description, ac.transdate, ac.source, ac.trans_id, @@ -389,7 +393,7 @@ sub all_transactions { ORDER BY $sortorder transdate, trans_id, taxkey DESC, sorttax DESC,oid|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - my $trans_id = ""; + my $trans_id = ""; my $trans_id2 = ""; while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) { $trans_id = $ref0->{id}; @@ -398,13 +402,14 @@ sub all_transactions { push @{ $form->{GL} }, $ref; $balance = 0; } - $ref = $ref0; + $ref = $ref0; $trans_id2 = $ref->{id}; - + # gl if ($ref->{type} eq "gl") { $ref->{module} = "gl"; } + # ap if ($ref->{type} eq "ap") { if ($ref->{invoice}) { @@ -413,7 +418,7 @@ sub all_transactions { $ref->{module} = "ap"; } } - + # ar if ($ref->{type} eq "ar") { if ($ref->{invoice}) { @@ -447,55 +452,56 @@ sub all_transactions { } } } else { - $ref2 = $ref0; + $ref2 = $ref0; $trans_id2 = $ref2->{id}; -# if ($form->{accno} eq ''){ # flo & udo: if general report, - # then check balance -# while (abs($balance) >= 0.015) { -# my $ref2 = $sth->fetchrow_hashref(NAME_lc) -# || $form->error("Unbalanced ledger!"); -# - $balance = - (int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000; - if ($ref2->{amount} < 0) { - if ($ref2->{chart_id} > 0) { - if ($ref->{debit_tax_accno}{$i} ne "") { - $i++; - } - $ref->{debit_tax}{$i} = $ref2->{amount} * -1; - $ref->{debit_tax_accno}{$i} = $ref2->{accno}; - } else { - if ($ref->{debit_accno}{$k} ne "") { - $k++; - } - $ref->{debit}{$k} = $ref2->{amount} * -1; - $ref->{debit_accno}{$k} = $ref2->{accno}; - $ref->{debit_taxkey}{$k} = $ref2->{taxkey}; - } - } else { - if ($ref2->{chart_id} > 0) { - if ($ref->{credit_tax_accno}{$j} ne "") { - $j++; - } - $ref->{credit_tax}{$j} = $ref2->{amount}; - $ref->{credit_tax_accno}{$j} = $ref2->{accno}; - } else { - if ($ref->{credit_accno}{$l} ne "") { - $l++; - } - $ref->{credit}{$l} = $ref2->{amount}; - $ref->{credit_accno}{$l} = $ref2->{accno}; - $ref->{credit_taxkey}{$l} = $ref2->{taxkey}; - } + + # if ($form->{accno} eq ''){ # flo & udo: if general report, + # then check balance + # while (abs($balance) >= 0.015) { + # my $ref2 = $sth->fetchrow_hashref(NAME_lc) + # || $form->error("Unbalanced ledger!"); + # + $balance = + (int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000; + if ($ref2->{amount} < 0) { + if ($ref2->{chart_id} > 0) { + if ($ref->{debit_tax_accno}{$i} ne "") { + $i++; } -# } -# } else { -# # if account-report, then calculate the Balance?! -# # ToDo: Calculate the Balance -# 1; -# } + $ref->{debit_tax}{$i} = $ref2->{amount} * -1; + $ref->{debit_tax_accno}{$i} = $ref2->{accno}; + } else { + if ($ref->{debit_accno}{$k} ne "") { + $k++; + } + $ref->{debit}{$k} = $ref2->{amount} * -1; + $ref->{debit_accno}{$k} = $ref2->{accno}; + $ref->{debit_taxkey}{$k} = $ref2->{taxkey}; + } + } else { + if ($ref2->{chart_id} > 0) { + if ($ref->{credit_tax_accno}{$j} ne "") { + $j++; + } + $ref->{credit_tax}{$j} = $ref2->{amount}; + $ref->{credit_tax_accno}{$j} = $ref2->{accno}; + } else { + if ($ref->{credit_accno}{$l} ne "") { + $l++; + } + $ref->{credit}{$l} = $ref2->{amount}; + $ref->{credit_accno}{$l} = $ref2->{accno}; + $ref->{credit_taxkey}{$l} = $ref2->{taxkey}; + } + } + + # } + # } else { + # # if account-report, then calculate the Balance?! + # # ToDo: Calculate the Balance + # 1; + # } } - } push @{ $form->{GL} }, $ref; diff --git a/SL/IC.pm b/SL/IC.pm index fd8a23061..eaa5e880b 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -34,6 +34,7 @@ package IC; use Data::Dumper; + sub get_part { $main::lxdebug->enter_sub(); @@ -235,8 +236,8 @@ sub get_pricegroups { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; - my $dbh = $form->dbconnect($myconfig); - my $i = 1; + my $dbh = $form->dbconnect($myconfig); + my $i = 1; my @pricegroups_not_used = (); # get pricegroups @@ -276,7 +277,6 @@ sub get_pricegroups { $main::lxdebug->leave_sub(); } - sub save { $main::lxdebug->enter_sub(); @@ -456,11 +456,14 @@ sub save { # insert price records only if different to sellprice for my $i (1 .. $form->{price_rows}) { if ($form->{"price_$i"} eq "0") { - $form->{"price_$i"} = $form->{sellprice}; + $form->{"price_$i"} = $form->{sellprice}; } - if (( $form->{"price_$i"} - || $form->{"klass_$i"} - || $form->{"pricegroup_id_$i"}) and $form->{"price_$i"} != $form->{sellprice}) { + if ( + ( $form->{"price_$i"} + || $form->{"klass_$i"} + || $form->{"pricegroup_id_$i"}) + and $form->{"price_$i"} != $form->{sellprice} + ) { $klass = $form->parse_amount($myconfig, $form->{"klass_$i"}); $price = $form->parse_amount($myconfig, $form->{"price_$i"}); $pricegroup_id = @@ -1041,7 +1044,8 @@ sub all_parts { $ordwhere .= " AND lower(oi.description) LIKE '$var'"; } - $flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, + $flds = + qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, oi.qty AS onhand, oi.unit, p.bin, oi.sellprice, p.listprice, p.lastcost, p.rop, p.weight, p.priceupdate, p.image, p.drawing, p.microfiche, @@ -1067,7 +1071,8 @@ sub all_parts { } if ($form->{onorder}) { - $flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, + $flds = + qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice, p.listprice, p.lastcost, p.rop, p.weight, p.priceupdate, p.image, p.drawing, p.microfiche, @@ -1104,7 +1109,8 @@ sub all_parts { $quowhere .= " AND lower(oi.description) LIKE '$var'"; } - $flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, + $flds = + qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, oi.qty AS onhand, oi.unit, p.bin, oi.sellprice, p.listprice, p.lastcost, p.rop, p.weight, p.priceupdate, p.image, p.drawing, p.microfiche, @@ -1130,7 +1136,8 @@ sub all_parts { } if ($form->{rfq}) { - $flds = qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, + $flds = + qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber, oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice, p.listprice, p.lastcost, p.rop, p.weight, p.priceupdate, p.image, p.drawing, p.microfiche, diff --git a/SL/IS.pm b/SL/IS.pm index 04144ff70..d4d8c6f1d 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -106,10 +106,10 @@ sub invoice_details { push(@{ $form->{description} }, qq|$form->{"description_$i"}|); push(@{ $form->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"})); - push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|); + push(@{ $form->{unit} }, qq|$form->{"unit_$i"}|); push(@{ $form->{deliverydate_oe} }, qq|$form->{"deliverydate_$i"}|); - push(@{ $form->{sellprice} }, $form->{"sellprice_$i"}); + push(@{ $form->{sellprice} }, $form->{"sellprice_$i"}); push(@{ $form->{ordnumber_oe} }, qq|$form->{"ordnumber_$i"}|); push(@{ $form->{transdate_oe} }, qq|$form->{"transdate_$i"}|); @@ -139,10 +139,14 @@ sub invoice_details { $dec = length $dec; my $decimalplaces = ($dec > 2) ? $dec : 2; - my $i_discount = $form->round_amount($sellprice * - $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100, $decimalplaces); + my $i_discount = + $form->round_amount( + $sellprice * $form->parse_amount($myconfig, + $form->{"discount_$i"}) / 100, + $decimalplaces); - my $discount = $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); + my $discount = + $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); # keep a netprice as well, (sellprice - discount) $form->{"netprice_$i"} = $sellprice - $i_discount; @@ -164,7 +168,7 @@ sub invoice_details { : " "; $linetotal = ($linetotal != 0) ? $linetotal : " "; - push(@{ $form->{discount} }, $discount); + push(@{ $form->{discount} }, $discount); push(@{ $form->{p_discount} }, $form->{"discount_$i"}); $form->{total} += $linetotal; @@ -803,9 +807,10 @@ sub post_invoice { # set values which could be empty to 0 $form->{terms} *= 1; $form->{taxincluded} *= 1; - my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL"; - my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL"; - my $deliverydate = ($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL"; + my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL"; + my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL"; + my $deliverydate = + ($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL"; # fill in subject if there is none $form->{subject} = qq|$form->{label} $form->{invnumber}| diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index c3a5a6485..8a9619ca4 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -1,7 +1,7 @@ package LXDebug; -use constant NONE => 0; -use constant INFO => 1; +use constant NONE => 0; +use constant INFO => 1; use constant DEBUG1 => 2; use constant DEBUG2 => 3; diff --git a/SL/OE.pm b/SL/OE.pm index 4662f5046..fb7153c4f 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -223,7 +223,8 @@ sub save { for my $i (1 .. $form->{rowcount}) { map { - $form->{"${_}_$i"} = $form->parse_amount($myconfig, $form->{"${_}_$i"}) + $form->{"${_}_$i"} = + $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship); if ($form->{"qty_$i"}) { @@ -460,18 +461,19 @@ Message: $form->{message}\r| if $form->{message}; return $rc; } -# this function closes multiple orders given in $form->{ordnumber_#}. +# this function closes multiple orders given in $form->{ordnumber_#}. # use this for multiple orders that don't have to be saved back # single orders should use OE::save instead. sub close_orders { $main::lxdebug->enter_sub(); - my ($self, $myconfig ,$form) = @_; + my ($self, $myconfig, $form) = @_; for my $i (1 .. $form->{rowcount}) { map { - $form->{"${_}_$i"} = $form->parse_amount($myconfig, $form->{"${_}_$i"}) + $form->{"${_}_$i"} = + $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship); if ($delete_oe_id) { $form->{"orderitems_id_$i"} = ""; @@ -487,13 +489,16 @@ sub close_orders { $form->parse_amount($myconfig, $form->{"sellprice_$i"}); } } + # get ids from $form - map { push @ids, $form->{"ordnumber_$_"} if $form->{"ordnumber_$_"} } (1 .. $form->{rowcount}); - + map { push @ids, $form->{"ordnumber_$_"} if $form->{"ordnumber_$_"} } + (1 .. $form->{rowcount}); + my $dbh = $form->dbconnect($myconfig); $query = qq|UPDATE oe SET closed = TRUE - WHERE ordnumber IN (|.join(', ', map{ $dbh->quote($_) }@ids).qq|)|; + WHERE ordnumber IN (| + . join(', ', map { $dbh->quote($_) } @ids) . qq|)|; $dbh->do($query) || $form->dberror($query); $dbh->disconnect; @@ -581,9 +586,12 @@ sub retrieve { my $query, @ids; # translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later - map { push @ids, $form->{"trans_id_$_"} if ($form->{"id_$_"} and $form->{"trans_id_$_"}) } (1 .. $form->{"rowcount"}); + map { + push @ids, $form->{"trans_id_$_"} + if ($form->{"id_$_"} and $form->{"trans_id_$_"}) + } (1 .. $form->{"rowcount"}); - # if called in multi id mode, and still only got one id, switch back to single id + # if called in multi id mode, and still only got one id, switch back to single id if ($form->{"rowcount"} and $#ids == 0) { $form->{"id"} = $ids[0]; undef @ids; @@ -628,15 +636,17 @@ sub retrieve { ($form->{currency}) = split /:/, $form->{currencies}; - # set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure + # set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure # we come from invoices, feel free. - $form->{reqdate} = $form->{deliverydate} if ($form->{deliverydate} and $form->{callback} =~ /action=ar_transactions/); + $form->{reqdate} = $form->{deliverydate} + if ( $form->{deliverydate} + and $form->{callback} =~ /action=ar_transactions/); if ($form->{id} or @ids) { # retrieve order for single id # NOTE: this query is intended to fetch all information only ONCE. - # so if any of these infos is important (or even different) for any item, + # so if any of these infos is important (or even different) for any item, # it will be killed out and then has to be fetched from the item scope query further down $query = qq|SELECT o.cp_id, o.ordnumber, o.transdate, o.reqdate, o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes, @@ -648,12 +658,12 @@ sub retrieve { JOIN $form->{vc} cv ON (o.$form->{vc}_id = cv.id) LEFT JOIN employee e ON (o.employee_id = e.id) LEFT JOIN department d ON (o.department_id = d.id) - |. ($form->{id} - ? qq|WHERE o.id = $form->{id}| - : qq|WHERE o.id IN (|.join(', ', @ids).qq|)| - ); + | + . ($form->{id} + ? qq|WHERE o.id = $form->{id}| + : qq|WHERE o.id IN (| . join(', ', @ids) . qq|)|); -#$main::lxdebug->message(0, $query); + #$main::lxdebug->message(0, $query); $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -667,11 +677,12 @@ sub retrieve { } # if not given, fill transdate with current_date - $form->{transdate} = $form->current_date($myconfig) unless $form->{transdate}; + $form->{transdate} = $form->current_date($myconfig) + unless $form->{transdate}; $sth->finish; - # shipto and pinted/mailed/queued status makes only sense for single id retrieve + # shipto and pinted/mailed/queued status makes only sense for single id retrieve if (!@ids) { $query = qq|SELECT s.* FROM shipto s WHERE s.trans_id = $form->{id}|; @@ -692,11 +703,12 @@ sub retrieve { while ($ref = $sth->fetchrow_hashref(NAME_lc)) { $form->{printed} .= "$ref->{formname} " if $ref->{printed}; $form->{emailed} .= "$ref->{formname} " if $ref->{emailed}; - $form->{queued} .= "$ref->{formname} $ref->{spoolfile} " if $ref->{spoolfile}; + $form->{queued} .= "$ref->{formname} $ref->{spoolfile} " + if $ref->{spoolfile}; } $sth->finish; map { $form->{$_} =~ s/ +$//g } qw(printed emailed queued); - } # if !@ids + } # if !@ids my %oid = ('Pg' => 'oid', 'Oracle' => 'rowid'); @@ -723,24 +735,25 @@ sub retrieve { LEFT JOIN chart c3 ON (p.expense_accno_id = c3.id) LEFT JOIN project pr ON (o.project_id = pr.id) LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) - |. ($form->{id} - ? qq|WHERE o.trans_id = $form->{id}| - : qq|WHERE o.trans_id IN (|.join(", ", @ids).qq|)| - ).qq| + | + . ($form->{id} + ? qq|WHERE o.trans_id = $form->{id}| + : qq|WHERE o.trans_id IN (| . join(", ", @ids) . qq|)|) + . qq| ORDER BY o.$oid{$myconfig->{dbdriver}}|; - + $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); while ($ref = $sth->fetchrow_hashref(NAME_lc)) { - + # in collective order, copy global ordnumber, transdate, cusordnumber into item scope - # unless already present there + # unless already present there # remove _oe entries afterwards map { $ref->{$_} = $ref->{"${_}_oe"} if ($ref->{$_} eq '') } - qw|ordnumber transdate cusordnumber| if (@ids); - map{ delete $ref->{$_} } - qw|ordnumber_oe transdate_oe cusordnumber_oe|; + qw|ordnumber transdate cusordnumber| + if (@ids); + map { delete $ref->{$_} } qw|ordnumber_oe transdate_oe cusordnumber_oe|; #set expense_accno=inventory_accno if they are different => bilanz $vendor_accno = @@ -891,10 +904,14 @@ sub order_details { $dec = length $dec; my $decimalplaces = ($dec > 2) ? $dec : 2; - my $i_discount = $form->round_amount($sellprice * - $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100, $decimalplaces); + my $i_discount = + $form->round_amount( + $sellprice * $form->parse_amount($myconfig, + $form->{"discount_$i"}) / 100, + $decimalplaces); - my $discount = $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); + my $discount = + $form->round_amount($form->{"qty_$i"} * $i_discount, $decimalplaces); # keep a netprice as well, (sellprice - discount) #$form->{"netprice_$i"} = $sellprice - $discount; @@ -917,7 +934,7 @@ sub order_details { : " "; $linetotal = ($linetotal != 0) ? $linetotal : " "; - push(@{ $form->{discount} }, $discount); + push(@{ $form->{discount} }, $discount); push(@{ $form->{p_discount} }, $form->{"discount_$i"}); $form->{ordtotal} += $linetotal; @@ -949,7 +966,7 @@ sub order_details { } } - $tax_rate = $taxrate*100; + $tax_rate = $taxrate * 100; push(@{ $form->{tax_rate} }, qq|$tax_rate|); if ($form->{"assembly_$i"}) { diff --git a/SL/RP.pm b/SL/RP.pm index 4ccabce4e..89e81359c 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -34,7 +34,6 @@ package RP; - sub balance_sheet { $main::lxdebug->enter_sub(); @@ -1134,6 +1133,7 @@ sub get_accounts_g { my @accno; my $accno; my $ref; + #print $query; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -2045,8 +2045,8 @@ sub payments { my $sortorder = join ', ', $form->sort_columns(qw(name invnumber ordnumber transdate source)); - $sortorder = $form->{sort} if $form->{sort}; - + $sortorder = $form->{sort} if $form->{sort}; + # cycle through each id foreach my $accno (split(/ /, $form->{paymentaccounts})) { @@ -2143,14 +2143,15 @@ sub bwa { $form->{ "$key" . "gesamtleistung" } = 0; $form->{ "$key" . "gesamtkosten" } = 0; - foreach $category (@categories) { if (defined($form->{$category}{$key})) { $form->{"$key$category"} = $form->format_amount($myconfig, $form->round_amount($form->{$category}{$key}, 2 - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } foreach $item (@gesamtleistung) { @@ -2173,7 +2174,7 @@ sub bwa { $form->{ "$key" . "ergebnisvorsteuern" } = $form->{ "$key" . "betriebsergebnis" } - $form->{ "$key" . "neutraleraufwand" } + - $form->{ "$key" . "neutralertrag" }; + $form->{ "$key" . "neutralertrag" }; $form->{ "$key" . "ergebnis" } = $form->{ "$key" . "ergebnisvorsteuern" } + $form->{35}{$key}; @@ -2188,7 +2189,9 @@ sub bwa { $form->{ "$key" . "gesamtleistung" } * 100 ), $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } foreach $item (@ergebnisse) { @@ -2199,7 +2202,9 @@ sub bwa { $form->{ "$key" . "gesamtleistung" } * 100 ), $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } @@ -2213,7 +2218,9 @@ sub bwa { $form->{ "$key" . "gesamtkosten" } * 100 ), $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } foreach $item (@ergebnisse) { @@ -2224,7 +2231,9 @@ sub bwa { $form->{ "$key" . "gesamtkosten" } * 100 ), $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } @@ -2233,11 +2242,13 @@ sub bwa { if (defined($form->{$category}{$key})) { $form->{ "$key" . "pk" . "$category" } = $form->format_amount( - $myconfig, - $form->round_amount( - ($form->{$category}{$key} / $form->{10}{$key} * 100), - $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + $myconfig, + $form->round_amount( + ($form->{$category}{$key} / $form->{10}{$key} * 100), + $form->{decimalplaces} + ), + $form->{decimalplaces}, + '0'); } } foreach $item (@ergebnisse) { @@ -2248,7 +2259,9 @@ sub bwa { $form->{10}{$key} * 100 ), $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } @@ -2257,11 +2270,13 @@ sub bwa { if (defined($form->{$category}{$key})) { $form->{ "$key" . "auf" . "$category" } = $form->format_amount( - $myconfig, - $form->round_amount( - ($form->{$category}{$key} / $form->{4}{$key} * 100), - $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + $myconfig, + $form->round_amount( + ($form->{$category}{$key} / $form->{4}{$key} * 100), + $form->{decimalplaces} + ), + $form->{decimalplaces}, + '0'); } } foreach $item (@ergebnisse) { @@ -2272,16 +2287,20 @@ sub bwa { $form->{4}{$key} * 100 ), $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + ), + $form->{decimalplaces}, + '0'); } } foreach $item (@ergebnisse) { $form->{ "$key" . "$item" } = $form->format_amount($myconfig, - $form->round_amount($form->{ "$key" . "$item" }, - $form->{decimalplaces} - ), $form->{decimalplaces}, '0'); + $form->round_amount($form->{ "$key" . "$item" }, + $form->{decimalplaces} + ), + $form->{decimalplaces}, + '0'); } } @@ -2301,7 +2320,7 @@ sub ustva { my $last_period = 0; my $category = "pos_ustva"; my @categories_cent = qw(51r 511 86r 861 97r 971 93r 931 - 96 66 43 45 53 62 65 67); + 96 66 43 45 53 62 65 67); my @categories_euro = qw(48 51 86 91 97 93 94); $form->{decimalplaces} *= 1; @@ -2339,7 +2358,7 @@ sub ustva { # } # # } - + # # Berechnung der USTVA Formularfelder # @@ -2347,8 +2366,9 @@ sub ustva { $form->{"86r"} = $form->{"861"}; $form->{"97r"} = $form->{"971"}; $form->{"93r"} = $form->{"931"}; + #$form->{"96"} = $form->{"94"} * 0.16; - $form->{"43"} = + $form->{"43"} = $form->{"51r"} + $form->{"86r"} + $form->{"97r"} + $form->{"93r"} + $form->{"96"}; $form->{"45"} = $form->{"43"}; @@ -2359,12 +2379,14 @@ sub ustva { foreach $item (@categories_cent) { $form->{$item} = - $form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), 2, '0'); + $form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), + 2, '0'); } foreach $item (@categories_euro) { $form->{$item} = - $form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), 0, '0'); + $form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), + 0, '0'); } $dbh->disconnect; diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 28fc5718e..84dc4f312 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -215,7 +215,8 @@ sub fa_auswahl { $elster_land_fa{$FFFF} = $elster_init->{$elster_land}->{$FFFF}->[0]; } foreach $ffff (sort { $elster_land_fa{$a} cmp $elster_land_fa{$b} } - keys(%elster_land_fa)) { + keys(%elster_land_fa) + ) { print qq| elsterFAAuswahl.options[$j] = new Option("$elster_land_fa{$ffff} ($ffff)","$ffff");|; $j++; @@ -268,7 +269,8 @@ sub fa_auswahl { print qq||; } else { foreach $ffff (sort { $elster_land_fa{$a} cmp $elster_land_fa{$b} } - keys(%elster_land_fa)) { + keys(%elster_land_fa) + ) { print qq| + . $locale->text('February') . qq| + . $locale->text('March') . qq| + . $locale->text('April') . qq| + . $locale->text('May') . qq| + . $locale->text('June') . qq| + . $locale->text('July') . qq| + . $locale->text('August') . qq| + . $locale->text('September') . qq| + . $locale->text('October') . qq| + . $locale->text('November') . qq| |; + . $locale->text('December') . qq||; $form->{allequartale} = qq| + . $locale->text('III') . qq| |; + . $locale->text('IV') . qq||; $form->header; print qq| @@ -210,24 +194,21 @@ sub export_bewegungsdaten { + . $locale->text('Monat') . qq| + . $locale->text('Quartal') . qq| + . $locale->text('Datum von') . qq| diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 9e8402973..b2b7885bf 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -620,15 +620,17 @@ sub generate_report { |; } - $form->{balance} *= $ml; + $form->{balance} *= $ml; foreach $ref (@{ $form->{GL} }) { $form->{balance} *= $ml; + # if item ne sort print subtotal if ($form->{l_subtotal} eq 'Y') { if ($sameitem ne $ref->{ $form->{sort} }) { &gl_subtotal; } } + #foreach $key (sort keys(%{ $ref->{amount} })) { # $form->{balance} += $ref->{amount}{$key}; #} @@ -656,7 +658,7 @@ sub generate_report { $credit .= "
" . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0); } - $form->{balance} = abs($form->{balance}) - abs( $ref->{credit}{$key}); + $form->{balance} = abs($form->{balance}) - abs($ref->{credit}{$key}); } $debittax = ""; @@ -698,9 +700,10 @@ sub generate_report { $debitaccno .= "
{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}"; } -# if ($ref->{debit_taxkey}{$key} eq $debittaxkey) { -# $ref->{debit_tax_accno}{$key} = $taxaccno; -# } + + # if ($ref->{debit_taxkey}{$key} eq $debittaxkey) { + # $ref->{debit_tax_accno}{$key} = $taxaccno; + # } $taxaccno = $ref->{debit_tax_accno}{$key}; $debittaxkey = $ref->{debit_taxkey}{$key}; } @@ -716,9 +719,10 @@ sub generate_report { $creditaccno .= "
{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}"; } -# if ($ref->{credit_taxkey}{$key} eq $credittaxkey) { -# $ref->{credit_tax_accno}{$key} = $taxaccno; -# } + + # if ($ref->{credit_taxkey}{$key} eq $credittaxkey) { + # $ref->{credit_tax_accno}{$key} = $taxaccno; + # } $taxaccno = $ref->{credit_tax_accno}{$key}; $credittaxkey = $ref->{credit_taxkey}{$key}; } @@ -776,9 +780,8 @@ sub generate_report { $column_data{gifi_accno} = ""; $column_data{balance} = - ""; + ""; $i++; $i %= 2; @@ -1052,13 +1055,14 @@ sub display_rows { |; $tax = - qq||; -# if ($form->{selectprojectnumber}) { -# $project = qq| -# |; -# } + + # if ($form->{selectprojectnumber}) { + # $project = qq| + # |; + # } $korrektur = qq||; -# if ($form->{selectprojectnumber}) { -# $form->{"projectnumber_$i"} = "" -# if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/; -# -# $project = $form->{"projectnumber_$i"}; -# $project =~ s/--.*//; -# $project = qq||; -# } + # if ($form->{selectprojectnumber}) { + # $form->{"projectnumber_$i"} = "" + # if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/; + # + # $project = $form->{"projectnumber_$i"}; + # $project =~ s/--.*//; + # $project = qq||; + # } if ($form->{transfer}) { $checked = ($form->{"fx_transaction_$i"}) ? "1" : ""; @@ -1138,10 +1142,11 @@ sub display_rows { $tax = qq| |; -# if ($form->{selectprojectnumber}) { -# $project = qq| -# |; -# } + + # if ($form->{selectprojectnumber}) { + # $project = qq| + # |; + # } $korrektur = qq||; } if ($form->{resubmit} && ($form->{format} eq "html")) { - $onload = qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|; - } elsif($form->{resubmit}) { + $onload = + qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|; + } elsif ($form->{resubmit}) { $onload = qq|document.invoice.submit()|; } else { $onload = "fokus()"; @@ -1083,7 +1087,7 @@ sub post { # get new invnumber in sequence if no invnumber is given or if posasnew was requested if (!$form->{invnumber} || $form->{postasnew}) { - $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber") + $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber"); } if ($print_post) { if (!(IS->post_invoice(\%myconfig, \%$form))) { diff --git a/bin/mozilla/kopf.pl b/bin/mozilla/kopf.pl index fab414cd6..23dfa2a9d 100644 --- a/bin/mozilla/kopf.pl +++ b/bin/mozilla/kopf.pl @@ -107,9 +107,7 @@ print qq|
 | - . $locale->text('Monat') - . qq|
 | - . $locale->text('Quartal') - . qq|
 | - . $locale->text('Datum von') - . qq| | . $locale->text('bis') . qq|
{gifi_accno}&callback=$callback>$ref->{gifi_accno} " - . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) - . "" + . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . "$form->{taxchart}$tax$project$projecthide_form(qw(rowcount selectaccno)); -# print qq| -# |; + + # print qq| + # |; $lxdebug->leave_sub(); } @@ -1546,9 +1552,9 @@ sub post { unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) { if ($form->{"debit_$i"} ne "") { $form->{"credit_$i"} = $form->{"debit_$i"}; - $form->{"debit_$i"} = ""; + $form->{"debit_$i"} = ""; } elsif ($form->{"credit_$i"} ne "") { - $form->{"debit_$i"} = $form->{"credit_$i"}; + $form->{"debit_$i"} = $form->{"credit_$i"}; $form->{"credit_$i"} = ""; } } diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index f6134db52..bcd1405c5 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -33,6 +33,7 @@ #$locale->text('ea'); use SL::IC; + #use SL::PE; require "$form->{path}/io.pl"; @@ -1934,7 +1935,7 @@ sub form_header { $lxdebug->enter_sub(); my $dec = ''; - + #decimalplaces for listprice ($dec) = ($form->{listprice} =~ /\.(\d+)/); $dec = length $dec; @@ -2718,7 +2719,8 @@ sub save { # $locale->text('Assembly Number missing!') # save part - $lxdebug->message(LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n"); + $lxdebug->message(LXDebug::DEBUG1, + "ic.pl: sellprice in save = $form->{sellprice}\n"); $rc = IC->save(\%myconfig, \%$form); if ($rc == 3) { $form->error($locale->text('Partnumber not unique!')); @@ -2776,7 +2778,9 @@ sub save { if ($form->{exchangerate} != 0) { $form->{"sellprice_$i"} /= $form->{exchangerate}; } - $lxdebug->message(LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = |.$form->{"sellprice_$i"}.qq|\n|); + $lxdebug->message(LXDebug::DEBUG1, + qq|sellprice_$i in previousform 2 = | + . $form->{"sellprice_$i"} . qq|\n|); map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount}; chop $form->{"taxaccounts_$i"}; @@ -2797,10 +2801,12 @@ sub save { $form->{creditremaining} -= $amount; - # redo number formatting, because invoice parse them! - $i = $form->{rowcount}; - map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } - qw(weight listprice sellprice rop); + # redo number formatting, because invoice parse them! + $i = $form->{rowcount}; + map { + $form->{"${_}_$i"} = + $form->format_amount(\%myconfig, $form->{"${_}_$i"}) + } qw(weight listprice sellprice rop); } $form->{"id_$i"} = $parts_id; @@ -2822,7 +2828,10 @@ sub save { } $form->{callback} = $callback; } - $lxdebug->message(LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = |.$form->{"sellprice_$i"}.qq|\n|); + $lxdebug->message(LXDebug::DEBUG1, + qq|ic.pl: sellprice_$i nach sub save = | + . $form->{"sellprice_$i"} . qq|\n|); + # redirect $form->redirect; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 03fd32ace..4291cf55d 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -399,7 +399,10 @@ sub display_row { |; if ($form->{type} eq 'invoice' or $form->{type} =~ /order/) { - my $reqdate_term = ($form->{type} eq 'invoice')?'deliverydate':'reqdate'; # invoice uses a different term for the same thing. + my $reqdate_term = + ($form->{type} eq 'invoice') + ? 'deliverydate' + : 'reqdate'; # invoice uses a different term for the same thing. print qq| ${$reqdate_term}  |; @@ -441,9 +444,10 @@ sub set_pricegroup { $prices = ''; $price = 0; foreach $item (@{ $form->{PRICES}{$j} }) { + #$price = $form->round_amount($myconfig, $item->{price}, 5); #$price = $form->format_amount($myconfig, $item->{price}, 2); - $price = $item->{price}; + $price = $item->{price}; $pricegroup_id = $item->{pricegroup_id}; $pricegroup = $item->{pricegroup}; @@ -452,10 +456,11 @@ sub set_pricegroup { qq|\n|; $len += 1; -# map { -# $form->{"${_}_$j"} = -# $form->format_amount(\%myconfig, $form->{"${_}_$j"}) -# } qw(sellprice price_new price_old); + + # map { + # $form->{"${_}_$j"} = + # $form->format_amount(\%myconfig, $form->{"${_}_$j"}) + # } qw(sellprice price_new price_old); # set new selectedpricegroup_id and prices for "Preis" if ($item->{selected} && ($pricegroup_id != 0)) { @@ -771,39 +776,40 @@ sub display_form { &{"$form->{display_form}"}; exit; } -# if ( $form->{print_and_post} -# && $form->{second_run} -# && ($form->{action} eq "display_form")) { -# for (keys %$form) { $old_form->{$_} = $form->{$_} } -# $old_form->{rowcount}++; -# -# #$form->{rowcount}--; -# #$form->{rowcount}--; -# -# $form->{print_and_post} = 0; -# -# &print_form($old_form); -# exit; -# } -# -# $form->{action} = ""; -# $form->{resubmit} = 0; -# -# if ($form->{print_and_post} && !$form->{second_run}) { -# $form->{second_run} = 1; -# $form->{action} = "display_form"; -# $form->{rowcount}--; -# my $rowcount = $form->{rowcount}; -# -# # get pricegroups for parts -# IS->get_pricegroups_for_parts(\%myconfig, \%$form); -# -# # build up html code for prices_$i -# set_pricegroup($rowcount); -# -# $form->{resubmit} = 1; -# -# } + + # if ( $form->{print_and_post} + # && $form->{second_run} + # && ($form->{action} eq "display_form")) { + # for (keys %$form) { $old_form->{$_} = $form->{$_} } + # $old_form->{rowcount}++; + # + # #$form->{rowcount}--; + # #$form->{rowcount}--; + # + # $form->{print_and_post} = 0; + # + # &print_form($old_form); + # exit; + # } + # + # $form->{action} = ""; + # $form->{resubmit} = 0; + # + # if ($form->{print_and_post} && !$form->{second_run}) { + # $form->{second_run} = 1; + # $form->{action} = "display_form"; + # $form->{rowcount}--; + # my $rowcount = $form->{rowcount}; + # + # # get pricegroups for parts + # IS->get_pricegroups_for_parts(\%myconfig, \%$form); + # + # # build up html code for prices_$i + # set_pricegroup($rowcount); + # + # $form->{resubmit} = 1; + # + # } &form_header; $numrows = ++$form->{rowcount}; @@ -1264,7 +1270,7 @@ sub print_options { $form->{DF}{ $form->{format} } = "selected"; $form->{OP}{ $form->{media} } = "selected"; $form->{SM}{ $form->{sendmode} } = "selected"; - + if ($form->{type} eq 'purchase_order') { $type = qq|{duedate}>
| - . $login - . $datum - . qq|   + . $login . $datum . qq|  
diff --git a/bin/mozilla/licenses.pl b/bin/mozilla/licenses.pl index 300673a96..52e5e4f86 100644 --- a/bin/mozilla/licenses.pl +++ b/bin/mozilla/licenses.pl @@ -87,8 +87,7 @@ sub print_part_selection { + . $locale->text('Select from one of the items below') . qq| @@ -111,13 +110,9 @@ sub print_part_selection { qq| + . $p{"partnumber"} . qq|\">| . $p{"partnumber"} . qq| + . $p{"description"} . qq|\">| . $p{"description"} . qq||); @@ -145,8 +140,7 @@ sub print_customer_selection {
| - . $locale->text('Select from one of the items below') - . qq|
| - . $p{"partnumber"} - . qq| | - . $p{"description"} - . qq|
+ . $locale->text('Select from one of the names below') . qq| @@ -174,11 +168,9 @@ sub print_customer_selection { qq| + . $c{"id"} . qq|\">$c{"customernumber"} + . $c{"name"} . qq|\">$c{"name"} @@ -211,14 +203,12 @@ sub print_license_form { + . quot($form->{"partnumber"}) . qq|\"> + . quot($form->{"description"}) . qq|\">|); @@ -242,26 +232,22 @@ sub print_license_form { + . quot($form->{"comment"}) . qq|\"> + . quot($form->{"validuntil"}) . qq|\"> + . quot($form->{"quantity"}) . qq|\"> + . quot($form->{"licensenumber"}) . qq|\"> @@ -276,8 +262,7 @@ sub print_license_form { print( qq|  text('Save') - . qq|\">\n|); + . $locale->text('Save') . qq|\">\n|); } print( qq| @@ -291,7 +276,8 @@ sub add { $lxdebug->enter_sub(); if (!$lizenzen) { $form->error( - $locale->text('The licensing module has been deactivated in lx-erp.conf.') + $locale->text( + 'The licensing module has been deactivated in lx-erp.conf.') ); } @@ -487,8 +473,7 @@ sub search { . $locale->text('Expiring in x month(s)') . qq| 
| - . $locale->text('Expired licenses') - . qq| + . $locale->text('Expired licenses') . qq|
| - . $locale->text('Select from one of the names below') - . qq|
$c{"customernumber"} $c{"name"} $c{"street"} $c{"zipcode"} $c{"city"}
| . $locale->text('Part Number') . qq| {"partnumber"}) - . qq|\">
| . $locale->text('Description') . qq| {"description"}) - . qq|\">
| . $locale->text('Company Name') . qq|
| . $locale->text('Comment') . qq| {"comment"}) - . qq|\">
| . $locale->text('Valid until') . qq| {"validuntil"}) - . qq|\">
| . $locale->text('Quantity') . qq| {"quantity"}) - . qq|\">
| . $locale->text('License key') . qq| {"licensenumber"}) - . qq|\">
| . $locale->text('Own Product') . qq|
@@ -542,7 +527,8 @@ sub do_search { |); if (scalar(@{ $form->{"licenses"} }) == 0) { print(qq|| - . $locale->text("No licenses were found that match the search criteria.") + . $locale->text( + "No licenses were found that match the search criteria.") . qq||); exit(0); } @@ -561,9 +547,7 @@ sub do_search { . $locale->text('Description') . qq| " - . $locale->text('Company Name') - . qq| + . $columns{"name"} . "\">" . $locale->text('Company Name') . qq| " . $locale->text('Valid until') diff --git a/bin/mozilla/menunew.pl b/bin/mozilla/menunew.pl index 64a1f5833..57b2e028d 100644 --- a/bin/mozilla/menunew.pl +++ b/bin/mozilla/menunew.pl @@ -152,9 +152,7 @@ function clockon() {
| - . $login - . $datum - . qq|   + . $login . $datum . qq|  
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index d05745b8e..baa041f36 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -79,8 +79,9 @@ sub edit { # editing without stuff to edit? try adding it first if ($form->{rowcount}) { - map {$id++ if $form->{"id_$_"}} (1 .. $form->{rowcount}); + map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount}); if (!$id) { + # reset rowcount undef $form->{rowcount}; &add; @@ -131,18 +132,24 @@ sub order_links { # retrieve order/quotation $form->{webdav} = $webdav; - # set jscalendar $form->{jscalendar} = $jscalendar; OE->retrieve(\%myconfig, \%$form); # if multiple rowcounts (== collective order) then check if the - # there were more than one customer (in that case OE::retrieve removes + # there were more than one customer (in that case OE::retrieve removes # the content from the field) - if ($form->{rowcount} && $form->{type} eq 'sales_order' && defined $form->{customer} && $form->{customer} eq '') { -# $main::lxdebug->message(0, "Detected Edit order with concurrent customers"); - $form->error($locale->text('Collective Orders only work for orders from one customer!')); + if ( $form->{rowcount} + && $form->{type} eq 'sales_order' + && defined $form->{customer} + && $form->{customer} eq '') { + + # $main::lxdebug->message(0, "Detected Edit order with concurrent customers"); + $form->error( + $locale->text( + 'Collective Orders only work for orders from one customer!') + ); } $taxincluded = $form->{taxincluded}; @@ -221,40 +228,42 @@ sub prepare_order { $form->{media} = "screen"; $form->{formname} = $form->{type}; - map { $form->{$_} =~ s/\"/"/g } - qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact); + map { $form->{$_} =~ s/\"/"/g } + qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact); - foreach $ref (@{ $form->{form_details} }) { - $form->{rowcount} = ++$i; + foreach $ref (@{ $form->{form_details} }) { + $form->{rowcount} = ++$i; - map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; - } - for my $i (1 .. $form->{rowcount}) { - if ($form->{id}) { - $form->{"discount_$i"} = - $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); - } else { - $form->{"discount_$i"} = - $form->format_amount(\%myconfig, $form->{"discount_$i"}); - } - ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); - $dec = length $dec; - $decimalplaces = ($dec > 2) ? $dec : 2; - - # copy reqdate from deliverydate for invoice -> order conversion - $form->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"}; - - $form->{"sellprice_$i"} = - $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, - $decimalplaces); - - (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); - $dec_qty = length $dec_qty; - $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); - - map { $form->{"${_}_$i"} =~ s/\"/"/g } - qw(partnumber description unit); + map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; + } + for my $i (1 .. $form->{rowcount}) { + if ($form->{id}) { + $form->{"discount_$i"} = + $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); + } else { + $form->{"discount_$i"} = + $form->format_amount(\%myconfig, $form->{"discount_$i"}); } + ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); + $dec = length $dec; + $decimalplaces = ($dec > 2) ? $dec : 2; + + # copy reqdate from deliverydate for invoice -> order conversion + $form->{"reqdate_$i"} = $form->{"deliverydate_$i"} + unless $form->{"reqdate_$i"}; + + $form->{"sellprice_$i"} = + $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, + $decimalplaces); + + (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); + $dec_qty = length $dec_qty; + $form->{"qty_$i"} = + $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); + + map { $form->{"${_}_$i"} =~ s/\"/"/g } + qw(partnumber description unit); + } $lxdebug->leave_sub(); } @@ -883,7 +892,6 @@ Bearbeiten des $form->{heading}
. $locale->text('Invoice') . qq|"> |; } - if ($form->{menubar}) { require "$form->{path}/menu.pl"; @@ -983,6 +991,7 @@ sub update { } else { $form->{"sellprice_$i"} *= (1 - $form->{tradediscount}); + # if there is an exchange rate adjust sellprice $form->{"sellprice_$i"} /= $exchangerate; } @@ -1036,7 +1045,6 @@ sub update { } } - $lxdebug->leave_sub(); } @@ -1515,7 +1523,8 @@ sub orders { $subtotalnetamount += $oe->{netamount}; $subtotalamount += $oe->{amount}; - $column_data{ids} = qq||; + $column_data{ids} = + qq||; $column_data{id} = "$oe->{id}"; $column_data{transdate} = "$oe->{transdate} "; $column_data{reqdate} = "$oe->{reqdate} "; @@ -1581,13 +1590,13 @@ sub orders { |; -# multiple invoice edit button only if gotten there via sales_order form. + # multiple invoice edit button only if gotten there via sales_order form. -if ($form->{type} =~ /sales_order/) { -print qq| + if ($form->{type} =~ /sales_order/) { + print qq| + . $locale->text('Continue') . qq|"> @@ -1596,9 +1605,9 @@ print qq| |; -} + } -print qq| + print qq|
@@ -1804,10 +1813,15 @@ sub invoice { $lxdebug->enter_sub(); if ($form->{type} =~ /_order$/) { + # these checks only apply if the items don't bring their own ordnumbers/transdates. # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields. - $form->isblank("ordnumber", $locale->text('Order Number missing!')) if ( +{ map { $form->{"ordnumber_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} ); - $form->isblank("transdate", $locale->text('Order Date missing!')) if ( +{ map { $form->{"transdate_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} ); + $form->isblank("ordnumber", $locale->text('Order Number missing!')) + if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) } + ->{''}); + $form->isblank("transdate", $locale->text('Order Date missing!')) + if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) } + ->{''}); # also copy deliverydate from the order $form->{deliverydate} = $form->{reqdate} if $form->{reqdate}; @@ -1846,7 +1860,7 @@ sub invoice { # close orders/quotations $form->{closed} = 1; - # save order if one ordnumber has been given + # save order if one ordnumber has been given # if not it's most likely a collective order, which can't be saved back # so they just have to be closed if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) { @@ -1927,15 +1941,17 @@ sub invoice { $decimalplaces = ($dec > 2) ? $dec : 2; # copy delivery date from reqdate for order -> invoice conversion - $form->{"deliverydate_$i"} = $form->{"reqdate_$i"} unless $form->{"deliverydate_$i"}; + $form->{"deliverydate_$i"} = $form->{"reqdate_$i"} + unless $form->{"deliverydate_$i"}; $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); - + (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); - $dec_qty = length $dec_qty; - $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); + $dec_qty = length $dec_qty; + $form->{"qty_$i"} = + $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit); diff --git a/bin/mozilla/rc.pl b/bin/mozilla/rc.pl index 9dfb1e1c5..2a1742974 100644 --- a/bin/mozilla/rc.pl +++ b/bin/mozilla/rc.pl @@ -298,11 +298,10 @@ sub display_form { $clearedbalance = $form->format_amount(\%myconfig, $clearedbalance, 2, 0); if ($fx) { - $fx = $form->format_amount(\%myconfig, $fx, 2, 0); + $fx = $form->format_amount(\%myconfig, $fx, 2, 0); $exchdiff = qq| | - . $locale->text('Exchangerate Difference') - . qq| + . $locale->text('Exchangerate Difference') . qq| $fx |; diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 32ec6efb0..34b12848f 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -269,8 +269,7 @@ sub report {  | . $locale->text('Heading') . qq|  | - . $locale->text('Subtotal') - . qq| + . $locale->text('Subtotal') . qq| $jsscript @@ -288,14 +287,12 @@ $jsscript + . $locale->text('Customized Report') . qq| + . $locale->text('YYYY') . qq|" value="$year"> |; @@ -310,70 +307,54 @@ $jsscript + . $locale->text('Quarter') . qq| |; $checked = ""; print qq| + . $locale->text('January') . qq| |; $checked = ""; print qq| + . $locale->text('May') . qq| + . $locale->text('September') . qq| + . $locale->text('Quarter') . qq| + . $locale->text('February') . qq| + . $locale->text('June') . qq| + . $locale->text('October') . qq| + . $locale->text('Quarter') . qq| + . $locale->text('March') . qq| + . $locale->text('July') . qq| + . $locale->text('November') . qq| + . $locale->text('Quarter') . qq|  + . $locale->text('April') . qq| + . $locale->text('August') . qq| + . $locale->text('December') . qq| @@ -381,8 +362,7 @@ $jsscript + . $locale->text('Free report period') . qq| + . $locale->text('EUR') . qq| $jsscript @@ -418,14 +397,12 @@ $jsscript
| - . $locale->text('Customized Report') - . qq|
| . $locale->text('Year') . qq|
   1. | - . $locale->text('Quarter') - . qq| | - . $locale->text('January') - . qq| | - . $locale->text('May') - . qq|  | - . $locale->text('September') - . qq|
   2. | - . $locale->text('Quarter') - . qq|  | - . $locale->text('February') - . qq|  | - . $locale->text('June') - . qq|  | - . $locale->text('October') - . qq|
   3. | - . $locale->text('Quarter') - . qq|  | - . $locale->text('March') - . qq|  | - . $locale->text('July') - . qq|  | - . $locale->text('November') - . qq|
   4. | - . $locale->text('Quarter') - . qq|   | - . $locale->text('April') - . qq|  | - . $locale->text('August') - . qq|  | - . $locale->text('December') - . qq|
| - . $locale->text('Free report period') - . qq| | . $locale->text('From') . qq|  $button1 $button1_2  @@ -399,8 +379,7 @@ $jsscript | . $locale->text('Accrual') . qq|  | - . $locale->text('EUR') - . qq|
+ . $locale->text('Customized Report') . qq| + . $locale->text('YYYY') . qq|" value="$year"> |; @@ -440,70 +417,54 @@ $jsscript + . $locale->text('Quarter') . qq| |; $checked = "checked"; print qq| + . $locale->text('January') . qq| |; $checked = ""; print qq| + . $locale->text('May') . qq| + . $locale->text('September') . qq| + . $locale->text('Quarter') . qq| + . $locale->text('February') . qq| + . $locale->text('June') . qq| + . $locale->text('October') . qq| + . $locale->text('Quarter') . qq| + . $locale->text('March') . qq| + . $locale->text('July') . qq| + . $locale->text('November') . qq| + . $locale->text('Quarter') . qq|  + . $locale->text('April') . qq| + . $locale->text('August') . qq| + . $locale->text('December') . qq| @@ -511,8 +472,7 @@ $checked> + . $locale->text('Free report period') . qq| + . $locale->text('EUR') . qq| - + @@ -551,14 +512,12 @@ $jsscript
| - . $locale->text('Customized Report') - . qq|
| . $locale->text('Year') . qq|
   1. | - . $locale->text('Quarter') - . qq| | - . $locale->text('January') - . qq| | - . $locale->text('May') - . qq|  | - . $locale->text('September') - . qq|
   2. | - . $locale->text('Quarter') - . qq|  | - . $locale->text('February') - . qq|  | - . $locale->text('June') - . qq|  | - . $locale->text('October') - . qq|
   3. | - . $locale->text('Quarter') - . qq|  | - . $locale->text('March') - . qq|  | - . $locale->text('July') - . qq|  | - . $locale->text('November') - . qq|
   4. | - . $locale->text('Quarter') - . qq|   | - . $locale->text('April') - . qq|  | - . $locale->text('August') - . qq|  | - . $locale->text('December') - . qq|
| - . $locale->text('Free report period') - . qq| | . $locale->text('From') . qq|  $button1 $button1_2  @@ -529,11 +489,12 @@ $checked> | . $locale->text('Accrual') . qq|  | - . $locale->text('EUR') - . qq|
| . $locale->text('Decimalplaces') . qq|| + . $locale->text('Decimalplaces') + . qq|
+ . $locale->text('Zeitraum') . qq| + . $locale->text('YYYY') . qq|" value="$year"> |; @@ -573,70 +532,54 @@ $jsscript + . $locale->text('Quarter') . qq| |; $checked = "checked"; print qq| + . $locale->text('January') . qq| |; $checked = ""; print qq| + . $locale->text('May') . qq| + . $locale->text('September') . qq| + . $locale->text('Quarter') . qq| + . $locale->text('February') . qq| + . $locale->text('June') . qq| + . $locale->text('October') . qq| + . $locale->text('Quarter') . qq| + . $locale->text('March') . qq| + . $locale->text('July') . qq| + . $locale->text('November') . qq| + . $locale->text('Quarter') . qq|  + . $locale->text('April') . qq| + . $locale->text('August') . qq| + . $locale->text('December') . qq| @@ -647,8 +590,7 @@ $checked> + . $locale->text('EUR') . qq| + . $locale->text('EUR') . qq| @@ -702,8 +643,7 @@ $checked> | . $locale->text('Subtotal') . qq|  | - . $locale->text('Account Number') - . qq| + . $locale->text('Account Number') . qq| $jsscript @@ -739,8 +679,7 @@ $jsscript  | . $locale->text('Subtotal') . qq|  | - . $locale->text('All Accounts') - . qq| + . $locale->text('All Accounts') . qq| $jsscript @@ -817,8 +756,7 @@ $jsscript + . $locale->text('EUR') . qq|
| - . $locale->text('Zeitraum') - . qq|
| . $locale->text('Year') . qq|
   1. | - . $locale->text('Quarter') - . qq| | - . $locale->text('January') - . qq| | - . $locale->text('May') - . qq|  | - . $locale->text('September') - . qq|
   2. | - . $locale->text('Quarter') - . qq|  | - . $locale->text('February') - . qq|  | - . $locale->text('June') - . qq|  | - . $locale->text('October') - . qq|
   3. | - . $locale->text('Quarter') - . qq|  | - . $locale->text('March') - . qq|  | - . $locale->text('July') - . qq|  | - . $locale->text('November') - . qq|
   4. | - . $locale->text('Quarter') - . qq|   | - . $locale->text('April') - . qq|  | - . $locale->text('August') - . qq|  | - . $locale->text('December') - . qq|
| . $locale->text('Accrual') . qq|  | - . $locale->text('EUR') - . qq|
|; @@ -691,8 +633,7 @@ $checked> | . $locale->text('Accrual') . qq|  | - . $locale->text('EUR') - . qq|
| . $locale->text('Accrual') . qq|  | - . $locale->text('EUR') - . qq|
@@ -891,8 +829,7 @@ $jsscript | . $locale->text('Accrual') . qq|  | - . $locale->text('EUR') - . qq| + . $locale->text('EUR') . qq| | . $locale->text('Include in Report') . qq| @@ -1034,8 +971,7 @@ $jsscript | - . $locale->text('Include Exchangerate Difference') - . qq| + . $locale->text('Include Exchangerate Difference') . qq| $jsscript diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 2e42f186f..4ee763881 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -76,7 +76,11 @@ sub report { $form->{title} = $locale->text('UStVA'); $form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 - my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig),0,4); + my $year = substr( + $form->datetonum($form->current_date(\%myconfig), + \%myconfig + ), + 0, 4); my $department = ''; local $hide = ''; @@ -103,7 +107,7 @@ sub report { # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum # Einlesen der Finanzamtdaten &get_config($userspath, 'finanzamt.ini'); - + # Hier Einlesen der user-config # steuernummer entfernt für prerelease my @a = qw(signature name company address businessnumber tel fax email @@ -134,7 +138,7 @@ sub report { | . $locale->text('Kein Firmenname hinterlegt!') . qq|

|; } - + # Anpassungen der Variablennamen auf pre 2.1.1 Namen # klären, ob $form->{company_street|_address} gesetzt sind # @@ -145,24 +149,24 @@ sub report { ($form->{co_street}, $form->{co_city}) = split("
", $temp); } - if ( $form->{co_street} ne '' - and ($form->{co_zip} ne '' - or $form->{co_city} ne '') ) { + if ($form->{co_street} ne '' + and ( $form->{co_zip} ne '' + or $form->{co_city} ne '') + ) { print qq| $form->{co_street}
$form->{co_street1}
$form->{co_zip} $form->{co_city}|; - } else { + } else { print qq| {path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}> | . $locale->text('Keine Firmenadresse hinterlegt!') . qq|\n|; } - $form->{co_email}=$form->{email} unless $form->{co_email}; - $form->{co_tel}=$form->{tel} unless $form->{co_tel}; - $form->{co_fax}=$form->{fax} unless $form->{co_fax}; - $form->{co_url}=$form->{urlx} unless $form->{co_url}; - - + $form->{co_email} = $form->{email} unless $form->{co_email}; + $form->{co_tel} = $form->{tel} unless $form->{co_tel}; + $form->{co_fax} = $form->{fax} unless $form->{co_fax}; + $form->{co_url} = $form->{urlx} unless $form->{co_url}; + print qq|

@@ -227,7 +231,7 @@ sub report { # accounting years if SQL-Ledger Version < 2.4.1 # $year = $form->{year} * 1; - @years = sort { $b <=> $a } (2003 .. ($year+1)); + @years = sort { $b <=> $a } (2003 .. ($year + 1)); $form->{all_years} = \@years; } map { $form->{selectaccountingyear} .= qq|