1 #=====================================================================
 
   4 # Based on SQL-Ledger Version 2.1.9
 
   5 # Web http://www.lx-office.org
 
   7 #=====================================================================
 
   8 # SQL-Ledger Accounting
 
  11 #  Author: Dieter Simader
 
  12 #   Email: dsimader@sql-ledger.org
 
  13 #     Web: http://www.sql-ledger.org
 
  16 # This program is free software; you can redistribute it and/or modify
 
  17 # it under the terms of the GNU General Public License as published by
 
  18 # the Free Software Foundation; either version 2 of the License, or
 
  19 # (at your option) any later version.
 
  21 # This program is distributed in the hope that it will be useful,
 
  22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  24 # GNU General Public License for more details.
 
  25 # You should have received a copy of the GNU General Public License
 
  26 # along with this program; if not, write to the Free Software
 
  27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  28 #======================================================================
 
  32 #======================================================================
 
  38 use strict ("vars", "subs");
 
  41 require "bin/mozilla/arap.pl";
 
  42 require "bin/mozilla/common.pl";
 
  44 our ($form, %myconfig, $lxdebug, $locale, $auth);
 
  51   $lxdebug->enter_sub();
 
  53   $auth->assert('cash');
 
  57   $form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP";
 
  58   $form->{arap} = lc $form->{ARAP};
 
  60   # setup customer/vendor selection for open invoices
 
  61   if ($form->{all_vc}) {
 
  62     $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
 
  64     CP->get_openvc(\%myconfig, \%$form);
 
  67   $form->{"select$form->{vc}"} = "";
 
  69   if ($form->{"all_$form->{vc}"}) {
 
  70     $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
 
  71     map { $form->{"select$form->{vc}"} .= "<option>$_->{name}--$_->{id}\n" }
 
  72       @{ $form->{"all_$form->{vc}"} };
 
  76   if (@{ $form->{all_departments} || [] }) {
 
  77     $form->{selectdepartment} = "<option>\n";
 
  78     $form->{department}       = "$form->{department}--$form->{department_id}";
 
  81       $form->{selectdepartment} .=
 
  82         "<option>$_->{description}--$_->{id}\n"
 
  83     } (@{ $form->{all_departments} || [] });
 
  86   CP->paymentaccounts(\%myconfig, \%$form);
 
  88   $form->{selectaccount} = "";
 
  89   $form->{"select$form->{ARAP}"} = "";
 
  91   map { $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n" }
 
  92     @{ $form->{PR}{"$form->{ARAP}_paid"} };
 
  94     $form->{"select$form->{ARAP}"} .=
 
  95       "<option>$_->{accno}--$_->{description}\n"
 
  96   } @{ $form->{PR}{ $form->{ARAP} } };
 
  99   @curr = split(/:/, $form->{currencies});
 
 101   $form->{defaultcurrency} = $form->{currency} = $form->{oldcurrency} =
 
 104   $form->{selectcurrency} = "";
 
 105   map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
 
 107   $form->{media} = "screen";
 
 112   $lxdebug->leave_sub();
 
 116   $lxdebug->enter_sub();
 
 118   $auth->assert('cash');
 
 120   my ($vc, $vclabel, $allvc, $arap, $department, $exchangerate);
 
 121   my ($jsscript, $button1, $button2, $onload);
 
 123   $vclabel = ucfirst $form->{vc};
 
 124   $vclabel = $locale->text($vclabel);
 
 126   if ($form->{type} eq 'receipt') {
 
 127     $form->{title}     = $locale->text('Receipt');
 
 128     $form->{origtitle} = "Receipt";
 
 130   if ($form->{type} eq 'check') {
 
 131     $form->{title}     = $locale->text('Payment');
 
 132     $form->{origtitle} = "Payment";
 
 135   # $locale->text('Customer')
 
 136   # $locale->text('Vendor')
 
 138   if ($form->{ $form->{vc} } eq "") {
 
 139     map { $form->{"addr$_"} = "" } (1 .. 4);
 
 142   if ($form->{currency} ne $form->{defaultcurrency}) {
 
 143     $form->{exchangerate} =
 
 144       $form->format_amount(\%myconfig, $form->{exchangerate});
 
 145     if ($form->{forex}) {
 
 148                 <th align=right nowrap>| . $locale->text('Exchangerate') . qq|</th>
 
 149                 <td colspan=3><input type=hidden name=exchangerate size=10 value=$form->{exchangerate}>$form->{exchangerate}</td>
 
 155                 <th align=right nowrap>| . $locale->text('Exchangerate') . qq|</th>
 
 156                 <td colspan=3><input name=exchangerate size=10 value=$form->{exchangerate}></td>
 
 162   foreach my $item ($form->{vc}, "account", "currency", $form->{ARAP}, "department") {
 
 163     $form->{"select$item"} =~ s/ selected//;
 
 164     $form->{"select$item"} =~
 
 165       s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
 
 169     ($form->{"select$form->{vc}"})
 
 170     ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}\n</select>|
 
 171     : qq|<input name=$form->{vc} size=35 value="$form->{$form->{vc}}">|;
 
 173   if ($form->{all_vc}) {
 
 175     $form->{openinvoices} = "";
 
 178     $form->{openinvoices} = 1;
 
 181   # $locale->text('AR')
 
 182   # $locale->text('AP')
 
 184   $form->{jsscript} = 1;
 
 186   if ($form->{jsscript}) {
 
 188     # with JavaScript Calendar
 
 190        <td><input name=datepaid id=datepaid size=11 title="$myconfig{dateformat}" value="$form->{datepaid}" onBlur=\"check_right_date_format(this)\">
 
 191        <input type=button name=datepaid id="trigger1" value=|
 
 192       . $locale->text('button') . qq|></td>
 
 197       Form->write_trigger(\%myconfig, "1", "datepaid", "BL", "trigger1");
 
 200     # without JavaScript Calendar
 
 202                               <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
 
 204   $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
 
 207   $arap = lc $form->{ARAP};
 
 208   $onload = qq|focus()|;
 
 209   $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
 
 210   $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
 
 212 <body onLoad="$onload">
 
 214 <form method=post action=cp.pl>
 
 216 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
 
 217 <input type=hidden name=closedto value=$form->{closedto}>
 
 218 <input type=hidden name=vc value=$form->{vc}>
 
 219 <input type=hidden name=type value=$form->{type}>
 
 220 <input type=hidden name=formname value=$form->{type}>
 
 221 <input type=hidden name=queued value="$form->{queued}">
 
 222 <input type=hidden name=arap value=$arap>
 
 223 <input type=hidden name=ARAP value=$form->{ARAP}>
 
 224 <input type=hidden name=openinvoices value=$form->{openinvoices}>
 
 225 <input type=hidden name=title value="$form->{title}">
 
 226 <input type=hidden name=origtitle value="$form->{origtitle}">
 
 230     <th class=listtop>$form->{title}</th>
 
 241                 <input name=all_vc type=checkbox style=checkbox value=Y $allvc>
 
 242                 <input type=hidden name="oldall_vc" value="$form->{all_vc}"></td>
 
 243                 <th align=left>| . $locale->text('All') . qq|</th>
 
 246                 <th align=right>$vclabel</th>
 
 248                 <input type=hidden name="select$form->{vc}" value="| . H($form->{"select$form->{vc}"}) . qq|">
 
 249                 <input type=hidden name="$form->{vc}_id" value="|    . H($form->{"$form->{vc}_id"}) . qq|">
 
 250                 <input type=hidden name="old$form->{vc}" value="|    . H($form->{"old$form->{vc}"}) . qq|">
 
 253                 <th align=right nowrap>| . $locale->text('Address') . qq|</th>
 
 257                       <td>$form->{street}</td>
 
 260                       <td>$form->{zipcode}</td>
 
 263                       <td>$form->{city}</td>
 
 266                       <td>$form->{country}</td>
 
 270                 <input type=hidden name=street value="$form->{street}">
 
 271                 <input type=hidden name=zipcode value="$form->{zipcode}">
 
 272                 <input type=hidden name=city value="$form->{city}">
 
 273                 <input type=hidden name=country value="$form->{country}">
 
 276                 <th align=right>| . $locale->text('Memo') . qq|</th>
 
 277                 <td colspan=2><input name="memo" size=30 value="$form->{memo}"></td>
 
 285                 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
 
 286                 <td colspan=3><select name=account>$form->{selectaccount}</select>
 
 287                 <input type=hidden name=selectaccount value="$form->{selectaccount}">
 
 291                 <th align=right nowrap>| . $locale->text('Date') . qq|</th>
 
 295                 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
 
 296                 <td><select name=currency>$form->{selectcurrency}</select></td>
 
 297                 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
 
 298                 <input type=hidden name=oldcurrency value=$form->{oldcurrency}>
 
 302                 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
 
 303                 <td colspan=3><input name=source value="$form->{source}" size=10></td>
 
 306                 <th align="right" nowrap>| . $locale->text('Amount') . qq|</th>
 
 307                 <td colspan="3"><input name="amount" size="10" value="|
 
 308     . $form->format_amount(\%myconfig, $form->{amount}, 2) . qq|" onBlur=\"check_right_number_format(this)\"></td>
 
 320   $lxdebug->leave_sub();
 
 324   $lxdebug->enter_sub();
 
 326   $auth->assert('cash');
 
 328   my (@column_index, %column_data, $colspan, $invoice);
 
 329   my ($totalamount, $totaldue, $totalpaid);
 
 331   @column_index = qw(invnumber transdate amount due checked paid);
 
 333   $colspan = $#column_index + 1;
 
 335   $invoice = $locale->text('Invoices');
 
 338   <input type=hidden name=column_index value="id @column_index">
 
 343           <th class=listheading colspan=$colspan>$invoice</th>
 
 347   $column_data{invnumber} =
 
 348     qq|<th nowrap class=listheading>| . $locale->text('Invoice') . "</th>";
 
 349   $column_data{transdate} =
 
 350     qq|<th nowrap class=listheading>| . $locale->text('Date') . "</th>";
 
 351   $column_data{amount} =
 
 352     qq|<th nowrap class=listheading>| . $locale->text('Amount') . "</th>";
 
 354     qq|<th nowrap class=listheading>| . $locale->text('Due') . "</th>";
 
 356     qq|<th nowrap class=listheading>| . $locale->text('Amount') . "</th>";
 
 357   $column_data{checked} =
 
 358     qq|<th nowrap class=listheading>| . $locale->text('Select') . "</th>";
 
 363   map { print "$column_data{$_}\n" } @column_index;
 
 368   for my $i (1 .. $form->{rowcount}) {
 
 374         $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
 
 375     } qw(amount due paid);
 
 377     $totalamount += $form->{"amount_$i"};
 
 378     $totaldue    += $form->{"due_$i"};
 
 379     $totalpaid   += $form->{"paid_$i"};
 
 383         $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
 
 384     } qw(amount due paid);
 
 386     $column_data{invnumber} = qq|<td>$form->{"invnumber_$i"}</td>
 
 387       <input type=hidden name="invnumber_$i" value="$form->{"invnumber_$i"}">
 
 388       <input type=hidden name="id_$i" value=$form->{"id_$i"}>|;
 
 389     $column_data{transdate} = qq|<td width=15%>$form->{"transdate_$i"}</td>
 
 390       <input type=hidden name="transdate_$i" value=$form->{"transdate_$i"}>|;
 
 391     $column_data{amount} =
 
 392       qq|<td align=right width=15%>$form->{"amount_$i"}</td>
 
 393       <input type=hidden name="amount_$i" value=$form->{"amount_$i"}>|;
 
 394     $column_data{due} = qq|<td align=right width=15%>$form->{"due_$i"}</td>
 
 395       <input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
 
 398       qq|<td align=right width=15%><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
 
 400     $form->{"checked_$i"} = ($form->{"checked_$i"}) ? "checked" : "";
 
 401     $column_data{checked} =
 
 402       qq|<td align=center width=10%><input name="checked_$i" type=checkbox style=checkbox $form->{"checked_$i"}></td>|;
 
 409     map { print "$column_data{$_}\n" } @column_index;
 
 415   map { $column_data{$_} = "<td> </td>" } @column_index;
 
 417   $column_data{amount} =
 
 418       qq|<th class=listtotal align=right>|
 
 419     . $form->format_amount(\%myconfig, $totalamount, 2, " ")
 
 422       qq|<th class=listtotal align=right>|
 
 423     . $form->format_amount(\%myconfig, $totaldue, 2, " ")
 
 426       qq|<th class=listtotal align=right>|
 
 427     . $form->format_amount(\%myconfig, $totalpaid, 2, " ")
 
 433   map { print "$column_data{$_}\n" } @column_index;
 
 441   $lxdebug->leave_sub();
 
 445   $lxdebug->enter_sub();
 
 447   $auth->assert('cash');
 
 449   my ($media, $format, $latex_templates);
 
 451   $form->{DF}{ $form->{format} } = "selected";
 
 452   $form->{OP}{ $form->{media} }  = "selected";
 
 455           <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
 
 457   if ($myconfig{printer} && $latex_templates) {
 
 459           <option value=printer $form->{OP}{printer}>|
 
 460       . $locale->text('Printer');
 
 462   if ($latex_templates) {
 
 464           <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
 
 466             <option value=postscript $form->{DF}{postscript}>|
 
 467       . $locale->text('Postscript') . qq|
 
 468             <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
 
 473     <td><hr size=3 noshade></td>
 
 476 <input type=hidden name=rowcount value=$form->{rowcount}>
 
 479 <input class=submit type=submit name=action value="|
 
 480     . $locale->text('Update') . qq|">
 
 481 <input class=submit type=submit name=action value="|
 
 482     . $locale->text('Post') . qq|">|;
 
 484   if ($latex_templates) {
 
 486 <input class=submit type=submit name=action value="|
 
 487       . $locale->text('Print') . qq|">|;
 
 491 <select name=format>$format</select>
 
 492 <select name=media>$media</select>
 
 500   $lxdebug->leave_sub();
 
 504   $lxdebug->enter_sub();
 
 506   $auth->assert('cash');
 
 508   my ($new_name_selected) = @_;
 
 510   my ($buysell, $newvc, $updated, $exchangerate, $amount);
 
 512   if ($form->{vc} eq 'customer') {
 
 518   # if we switched to all_vc
 
 519   if ($form->{all_vc} ne $form->{oldall_vc}) {
 
 521     $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1;
 
 523     $form->{"select$form->{vc}"} = "";
 
 525     if ($form->{all_vc}) {
 
 526       $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
 
 528       if ($form->{"all_$form->{vc}"}) {
 
 530           $form->{"select$form->{vc}"} .=
 
 531             "<option>$_->{name}--$_->{id}\n"
 
 532         } @{ $form->{"all_$form->{vc}"} };
 
 535       CP->get_openvc(\%myconfig, \%$form);
 
 537       if ($form->{"all_$form->{vc}"}) {
 
 539           qq|$form->{"all_$form->{vc}"}[0]->{name}--$form->{"all_$form->{vc}"}[0]->{id}|;
 
 541           $form->{"select$form->{vc}"} .=
 
 542             "<option>$_->{name}--$_->{id}\n"
 
 543         } @{ $form->{"all_$form->{vc}"} };
 
 546       # if the name is not the same
 
 547       if ($form->{"select$form->{vc}"} !~ /$form->{$form->{vc}}/) {
 
 548         $form->{ $form->{vc} } = $newvc;
 
 553   # get customer and invoices
 
 554   $updated = &check_name($form->{vc});
 
 556   if ($new_name_selected || $updated) {
 
 557     CP->get_openinvoices(\%myconfig, \%$form);
 
 558     ($newvc) = split /--/, $form->{ $form->{vc} };
 
 559     $form->{"old$form->{vc}"} = qq|$newvc--$form->{"$form->{vc}_id"}|;
 
 563   if ($form->{currency} ne $form->{oldcurrency}) {
 
 564     $form->{oldcurrency} = $form->{currency};
 
 566       CP->get_openinvoices(\%myconfig, \%$form);
 
 571   $form->{forex}        = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{datepaid}, $buysell);
 
 572   $form->{exchangerate} = $form->{forex} if $form->{forex};
 
 574   $amount = $form->{amount} = $form->parse_amount(\%myconfig, $form->{amount});
 
 577     $form->{rowcount} = 0;
 
 579     $form->{queued} = "";
 
 582     foreach my $ref (@{ $form->{PR} }) {
 
 584       $form->{"id_$i"}        = $ref->{id};
 
 585       $form->{"invnumber_$i"} = $ref->{invnumber};
 
 586       $form->{"transdate_$i"} = $ref->{transdate};
 
 587       $ref->{exchangerate} = 1 unless $ref->{exchangerate};
 
 588       $form->{"amount_$i"} = $ref->{amount} / $ref->{exchangerate};
 
 590         ($ref->{amount} - $ref->{paid}) / $ref->{exchangerate};
 
 591       $form->{"checked_$i"} = "";
 
 592       $form->{"paid_$i"}    = "";
 
 597           $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
 
 601     $form->{rowcount} = $i;
 
 606   # Modified from $amount = $form->{amount} by J.Zach to update amount to total
 
 607   # payment amount in Zahlungsausgang
 
 609   for my $i (1 .. $form->{rowcount}) {
 
 613         $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
 
 614     } qw(amount due paid);
 
 616     if ($form->{"checked_$i"}) {
 
 619       if (!$form->{"paid_$i"}) {
 
 620         $form->{"paid_$i"} = $form->{"due_$i"};
 
 623       # Modified by J.Zach, see abovev
 
 624       $amount += $form->{"paid_$i"};
 
 627       $form->{"paid_$i"} = "";
 
 632         $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
 
 633     } qw(amount due paid);
 
 637   # Line added by J.Zach, see above
 
 638   $form->{amount}=$amount;
 
 644   $lxdebug->leave_sub();
 
 648   $lxdebug->enter_sub();
 
 650   $auth->assert('cash');
 
 654   if ($form->{currency} ne $form->{defaultcurrency}) {
 
 655     $form->error($locale->text('Exchangerate missing!'))
 
 656       unless $form->{exchangerate};
 
 659   my $msg1 = "$form->{origtitle} posted!";
 
 660   my $msg2 = "Cannot post $form->{origtitle}!";
 
 662   # $locale->text('Payment posted!')
 
 663   # $locale->text('Receipt posted!')
 
 664   # $locale->text('Cannot post Payment!')
 
 665   # $locale->text('Cannot post Receipt!')
 
 667   $form->redirect($locale->text($msg1))
 
 668     if (CP->process_payment(\%myconfig, \%$form));
 
 669   $form->error($locale->text($msg2));
 
 671   $lxdebug->leave_sub();
 
 675   $lxdebug->enter_sub();
 
 677   $auth->assert('cash');
 
 679   my ($whole, $check, %queued, $spool, $filename, $userspath);
 
 683   ($whole, $form->{decimal}) = split(/\./, $form->{amount});
 
 685   $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
 
 687   #$form->{decimal} .= "00";
 
 688   $form->{decimal} = substr($form->{decimal}, 0, 2);
 
 690   $check = new CP $myconfig{countrycode};
 
 692   $form->{text_amount} = $check->num2text($whole);
 
 694   if ($form->{vc} eq 'customer') {
 
 695     IS->customer_details(\%myconfig, $form);
 
 697     IR->vendor_details(\%myconfig, $form);
 
 700   $form->{callback} = "";
 
 702   $form->{templates} = "$myconfig{templates}";
 
 703   $form->{IN}        = "$form->{formname}.tex";
 
 705   if ($form->{format} eq 'postscript') {
 
 706     $form->{postscript} = 1;
 
 708   if ($form->{format} eq 'pdf') {
 
 714   if ($form->{media} eq 'printer') {
 
 715     $form->{OUT} = "| $myconfig{printer}";
 
 717   if ($form->{media} eq 'queue') {
 
 718     %queued = map { s|.*/|| } split / /, $form->{queued};
 
 720     if ($filename = $queued{ $form->{formname} }) {
 
 721       unlink "$spool/$filename";
 
 722       $filename =~ s/\..*$//g;
 
 727     $filename .= ($form->{postscript}) ? '.ps' : '.pdf';
 
 728     $form->{queued} = "$form->{formname} $filename";
 
 729     $form->{OUT}    = ">$spool/$filename";
 
 731     $form->update_status(\%myconfig);
 
 735   $form->{company} = $myconfig{company};
 
 736   $form->{address} = $myconfig{address};
 
 738   $form->parse_template(\%myconfig, $userspath);
 
 740   if ($form->{media} ne 'screen') {
 
 741     $form->{callback} = "cp.pl?action=payment&vc=$form->{vc}&all_vc=$form->{all_vc}";
 
 743     $form->redirect if (CP->process_payment(\%myconfig, \%$form));
 
 744     $form->error($locale->text('Cannot post payment!'));
 
 747   $lxdebug->leave_sub();
 
 751   $lxdebug->enter_sub();
 
 753   $auth->assert('cash');
 
 755   my ($closedto, $datepaid, $amount);
 
 757   &check_name($form->{vc});
 
 759   if ($form->{currency} ne $form->{oldcurrency}) {
 
 764   $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount});
 
 765   $form->error($locale->text('Date missing!')) unless $form->{datepaid};
 
 767   $closedto = $form->datetonum($form->{closedto}, \%myconfig);
 
 768   $datepaid = $form->datetonum($form->{datepaid}, \%myconfig);
 
 770   $form->error($locale->text('Cannot process payment for a closed period!'))
 
 771     if ($form->date_closed($form->{"datepaid"}, \%myconfig));
 
 773   $amount = $form->parse_amount(\%myconfig, $form->{amount});
 
 774   $form->{amount} = $amount;
 
 776   for my $i (1 .. $form->{rowcount}) {
 
 777     if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
 
 778       $amount -= $form->parse_amount(\%myconfig, $form->{"paid_$i"});
 
 780       push(@{ $form->{paid} },      $form->{"paid_$i"});
 
 781       push(@{ $form->{due} },       $form->{"due_$i"});
 
 782       push(@{ $form->{invnumber} }, $form->{"invnumber_$i"});
 
 783       push(@{ $form->{invdate} },   $form->{"transdate_$i"});
 
 787   if ($form->round_amount($amount, 2) != 0) {
 
 788     push(@{ $form->{paid} }, $form->format_amount(\%myconfig, $amount, 2));
 
 789     push(@{ $form->{due} }, $form->format_amount(\%myconfig, 0, "0"));
 
 790     push(@{ $form->{invnumber} },
 
 791          ($form->{ARAP} eq 'AR')
 
 792          ? $locale->text('Deposit')
 
 793          : $locale->text('Prepayment'));
 
 794     push(@{ $form->{invdate} }, $form->{datepaid});
 
 797   $lxdebug->leave_sub();