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 #======================================================================
 
  39 use strict ("vars", "subs");
 
  42 require "bin/mozilla/arap.pl";
 
  43 require "bin/mozilla/common.pl";
 
  45 our ($form, %myconfig, $lxdebug, $locale);
 
  52   $lxdebug->enter_sub();
 
  56   $form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP";
 
  57   $form->{arap} = lc $form->{ARAP};
 
  59   # setup customer/vendor selection for open invoices
 
  60   if ($form->{all_vc}) {
 
  61     $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
 
  63     CP->get_openvc(\%myconfig, \%$form);
 
  66   $form->{"select$form->{vc}"} = "";
 
  68   if ($form->{"all_$form->{vc}"}) {
 
  69     $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
 
  70     map { $form->{"select$form->{vc}"} .= "<option>$_->{name}--$_->{id}\n" }
 
  71       @{ $form->{"all_$form->{vc}"} };
 
  75   if (@{ $form->{all_departments} }) {
 
  76     $form->{selectdepartment} = "<option>\n";
 
  77     $form->{department}       = "$form->{department}--$form->{department_id}";
 
  80       $form->{selectdepartment} .=
 
  81         "<option>$_->{description}--$_->{id}\n"
 
  82     } (@{ $form->{all_departments} });
 
  85   CP->paymentaccounts(\%myconfig, \%$form);
 
  87   $form->{selectaccount} = "";
 
  88   $form->{"select$form->{ARAP}"} = "";
 
  90   map { $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n" }
 
  91     @{ $form->{PR}{"$form->{ARAP}_paid"} };
 
  93     $form->{"select$form->{ARAP}"} .=
 
  94       "<option>$_->{accno}--$_->{description}\n"
 
  95   } @{ $form->{PR}{ $form->{ARAP} } };
 
  98   @curr = split(/:/, $form->{currencies});
 
 100   $form->{defaultcurrency} = $form->{currency} = $form->{oldcurrency} =
 
 103   $form->{selectcurrency} = "";
 
 104   map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
 
 106   $form->{media} = "screen";
 
 111   $lxdebug->leave_sub();
 
 115   $lxdebug->enter_sub();
 
 117   my ($vc, $vclabel, $allvc, $arap, $department, $exchangerate);
 
 118   my ($jsscript, $button1, $button2, $onload);
 
 120   $vclabel = ucfirst $form->{vc};
 
 121   $vclabel = $locale->text($vclabel);
 
 123   if ($form->{type} eq 'receipt') {
 
 124     $form->{title}     = $locale->text('Receipt');
 
 125     $form->{origtitle} = "Receipt";
 
 127   if ($form->{type} eq 'check') {
 
 128     $form->{title}     = $locale->text('Payment');
 
 129     $form->{origtitle} = "Payment";
 
 132   # $locale->text('Customer')
 
 133   # $locale->text('Vendor')
 
 135   if ($form->{ $form->{vc} } eq "") {
 
 136     map { $form->{"addr$_"} = "" } (1 .. 4);
 
 139   if ($form->{currency} ne $form->{defaultcurrency}) {
 
 140     $form->{exchangerate} =
 
 141       $form->format_amount(\%myconfig, $form->{exchangerate});
 
 142     if ($form->{forex}) {
 
 145                 <th align=right nowrap>| . $locale->text('Exchangerate') . qq|</th>
 
 146                 <td colspan=3><input type=hidden name=exchangerate size=10 value=$form->{exchangerate}>$form->{exchangerate}</td>
 
 152                 <th align=right nowrap>| . $locale->text('Exchangerate') . qq|</th>
 
 153                 <td colspan=3><input name=exchangerate size=10 value=$form->{exchangerate}></td>
 
 159   foreach my $item ($form->{vc}, "account", "currency", $form->{ARAP}, "department") {
 
 160     $form->{"select$item"} =~ s/ selected//;
 
 161     $form->{"select$item"} =~
 
 162       s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
 
 166     ($form->{"select$form->{vc}"})
 
 167     ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}\n</select>|
 
 168     : qq|<input name=$form->{vc} size=35 value="$form->{$form->{vc}}">|;
 
 170   if ($form->{all_vc}) {
 
 172     $form->{openinvoices} = "";
 
 175     $form->{openinvoices} = 1;
 
 178   # $locale->text('AR')
 
 179   # $locale->text('AP')
 
 183                 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
 
 184                 <td><select name=department>$form->{selectdepartment}</select>
 
 185                 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
 
 189 | if $form->{selectdepartment};
 
 191   $form->{jsscript} = 1;
 
 193   if ($form->{jsscript}) {
 
 195     # with JavaScript Calendar
 
 197        <td><input name=datepaid id=datepaid size=11 title="$myconfig{dateformat}" value="$form->{datepaid}" onBlur=\"check_right_date_format(this)\">
 
 198        <input type=button name=datepaid id="trigger1" value=|
 
 199       . $locale->text('button') . qq|></td>
 
 204       Form->write_trigger(\%myconfig, "1", "datepaid", "BL", "trigger1");
 
 207     # without JavaScript Calendar
 
 209                               <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
 
 211   $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
 
 214   $arap = lc $form->{ARAP};
 
 215   $onload = qq|focus()|;
 
 216   $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
 
 217   $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
 
 219 <body onLoad="$onload">
 
 221 <form method=post action=$form->{script}>
 
 223 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
 
 224 <input type=hidden name=closedto value=$form->{closedto}>
 
 225 <input type=hidden name=vc value=$form->{vc}>
 
 226 <input type=hidden name=type value=$form->{type}>
 
 227 <input type=hidden name=formname value=$form->{type}>
 
 228 <input type=hidden name=queued value="$form->{queued}">
 
 229 <input type=hidden name=arap value=$arap>
 
 230 <input type=hidden name=ARAP value=$form->{ARAP}>
 
 231 <input type=hidden name=openinvoices value=$form->{openinvoices}>
 
 232 <input type=hidden name=title value="$form->{title}">
 
 233 <input type=hidden name=origtitle value="$form->{origtitle}">
 
 237     <th class=listtop>$form->{title}</th>
 
 248                 <input name=all_vc type=checkbox style=checkbox value=Y $allvc>
 
 249                 <input type=hidden name="oldall_vc" value="$form->{all_vc}"></td>
 
 250                 <th align=left>| . $locale->text('All') . qq|</th>
 
 253                 <th align=right>$vclabel</th>
 
 255                 <input type=hidden name="select$form->{vc}" value="$form->{"select$form->{vc}"}">
 
 256                 <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
 
 257                 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
 
 260                 <th align=right nowrap>| . $locale->text('Address') . qq|</th>
 
 264                       <td>$form->{street}</td>
 
 267                       <td>$form->{zipcode}</td>
 
 270                       <td>$form->{city}</td>
 
 273                       <td>$form->{country}</td>
 
 277                 <input type=hidden name=street value="$form->{street}">
 
 278                 <input type=hidden name=zipcode value="$form->{zipcode}">
 
 279                 <input type=hidden name=city value="$form->{city}">
 
 280                 <input type=hidden name=country value="$form->{country}">
 
 283                 <th align=right>| . $locale->text('Memo') . qq|</th>
 
 284                 <td colspan=2><input name="memo" size=30 value="$form->{memo}"></td>
 
 292                 <th align=right nowrap>| . $locale->text('Account') . qq|</th>
 
 293                 <td colspan=3><select name=account>$form->{selectaccount}</select>
 
 294                 <input type=hidden name=selectaccount value="$form->{selectaccount}">
 
 298                 <th align=right nowrap>| . $locale->text('Date') . qq|</th>
 
 302                 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
 
 303                 <td><select name=currency>$form->{selectcurrency}</select></td>
 
 304                 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
 
 305                 <input type=hidden name=oldcurrency value=$form->{oldcurrency}>
 
 309                 <th align=right nowrap>| . $locale->text('Source') . qq|</th>
 
 310                 <td colspan=3><input name=source value="$form->{source}" size=10></td>
 
 313                 <th align="right" nowrap>| . $locale->text('Amount') . qq|</th>
 
 314                 <td colspan="3"><input name="amount" size="10" value="|
 
 315     . $form->format_amount(\%myconfig, $form->{amount}, 2) . qq|" onBlur=\"check_right_number_format(this)\"></td>
 
 327   $lxdebug->leave_sub();
 
 331   $lxdebug->enter_sub();
 
 333   my (@column_index, %column_data, $colspan, $invoice);
 
 334   my ($totalamount, $totaldue, $totalpaid);
 
 336   @column_index = qw(invnumber transdate amount due checked paid);
 
 338   $colspan = $#column_index + 1;
 
 340   $invoice = $locale->text('Invoices');
 
 343   <input type=hidden name=column_index value="id @column_index">
 
 348           <th class=listheading colspan=$colspan>$invoice</th>
 
 352   $column_data{invnumber} =
 
 353     qq|<th nowrap class=listheading>| . $locale->text('Invoice') . "</th>";
 
 354   $column_data{transdate} =
 
 355     qq|<th nowrap class=listheading>| . $locale->text('Date') . "</th>";
 
 356   $column_data{amount} =
 
 357     qq|<th nowrap class=listheading>| . $locale->text('Amount') . "</th>";
 
 359     qq|<th nowrap class=listheading>| . $locale->text('Due') . "</th>";
 
 361     qq|<th nowrap class=listheading>| . $locale->text('Amount') . "</th>";
 
 362   $column_data{checked} =
 
 363     qq|<th nowrap class=listheading>| . $locale->text('Select') . "</th>";
 
 368   map { print "$column_data{$_}\n" } @column_index;
 
 373   for my $i (1 .. $form->{rowcount}) {
 
 379         $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
 
 380     } qw(amount due paid);
 
 382     $totalamount += $form->{"amount_$i"};
 
 383     $totaldue    += $form->{"due_$i"};
 
 384     $totalpaid   += $form->{"paid_$i"};
 
 388         $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
 
 389     } qw(amount due paid);
 
 391     $column_data{invnumber} = qq|<td>$form->{"invnumber_$i"}</td>
 
 392       <input type=hidden name="invnumber_$i" value="$form->{"invnumber_$i"}">
 
 393       <input type=hidden name="id_$i" value=$form->{"id_$i"}>|;
 
 394     $column_data{transdate} = qq|<td width=15%>$form->{"transdate_$i"}</td>
 
 395       <input type=hidden name="transdate_$i" value=$form->{"transdate_$i"}>|;
 
 396     $column_data{amount} =
 
 397       qq|<td align=right width=15%>$form->{"amount_$i"}</td>
 
 398       <input type=hidden name="amount_$i" value=$form->{"amount_$i"}>|;
 
 399     $column_data{due} = qq|<td align=right width=15%>$form->{"due_$i"}</td>
 
 400       <input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
 
 403       qq|<td align=right width=15%><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
 
 405     $form->{"checked_$i"} = ($form->{"checked_$i"}) ? "checked" : "";
 
 406     $column_data{checked} =
 
 407       qq|<td align=center width=10%><input name="checked_$i" type=checkbox style=checkbox $form->{"checked_$i"}></td>|;
 
 414     map { print "$column_data{$_}\n" } @column_index;
 
 420   map { $column_data{$_} = "<td> </td>" } @column_index;
 
 422   $column_data{amount} =
 
 423       qq|<th class=listtotal align=right>|
 
 424     . $form->format_amount(\%myconfig, $totalamount, 2, " ")
 
 427       qq|<th class=listtotal align=right>|
 
 428     . $form->format_amount(\%myconfig, $totaldue, 2, " ")
 
 431       qq|<th class=listtotal align=right>|
 
 432     . $form->format_amount(\%myconfig, $totalpaid, 2, " ")
 
 438   map { print "$column_data{$_}\n" } @column_index;
 
 446   $lxdebug->leave_sub();
 
 450   $lxdebug->enter_sub();
 
 452   my ($media, $format, $latex_templates);
 
 454   $form->{DF}{ $form->{format} } = "selected";
 
 455   $form->{OP}{ $form->{media} }  = "selected";
 
 458           <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
 
 460   if ($myconfig{printer} && $latex_templates) {
 
 462           <option value=printer $form->{OP}{printer}>|
 
 463       . $locale->text('Printer');
 
 465   if ($latex_templates) {
 
 467           <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
 
 469             <option value=postscript $form->{DF}{postscript}>|
 
 470       . $locale->text('Postscript') . qq|
 
 471             <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
 
 476     <td><hr size=3 noshade></td>
 
 479 <input type=hidden name=rowcount value=$form->{rowcount}>
 
 481 <input type=hidden name=login value=$form->{login}>
 
 482 <input type=hidden name=password value=$form->{password}>
 
 485 <input class=submit type=submit name=action value="|
 
 486     . $locale->text('Update') . qq|">
 
 487 <input class=submit type=submit name=action value="|
 
 488     . $locale->text('Post') . qq|">|;
 
 490   if ($latex_templates) {
 
 492 <input class=submit type=submit name=action value="|
 
 493       . $locale->text('Print') . qq|">|;
 
 497 <select name=format>$format</select>
 
 498 <select name=media>$media</select>
 
 506   $lxdebug->leave_sub();
 
 510   $lxdebug->enter_sub();
 
 512   my ($new_name_selected) = @_;
 
 514   my ($buysell, $newvc, $updated, $exchangerate, $amount);
 
 516   if ($form->{vc} eq 'customer') {
 
 522   # if we switched to all_vc
 
 523   if ($form->{all_vc} ne $form->{oldall_vc}) {
 
 525     $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1;
 
 527     $form->{"select$form->{vc}"} = "";
 
 529     if ($form->{all_vc}) {
 
 530       $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP});
 
 532       if ($form->{"all_$form->{vc}"}) {
 
 534           $form->{"select$form->{vc}"} .=
 
 535             "<option>$_->{name}--$_->{id}\n"
 
 536         } @{ $form->{"all_$form->{vc}"} };
 
 539       CP->get_openvc(\%myconfig, \%$form);
 
 541       if ($form->{"all_$form->{vc}"}) {
 
 543           qq|$form->{"all_$form->{vc}"}[0]->{name}--$form->{"all_$form->{vc}"}[0]->{id}|;
 
 545           $form->{"select$form->{vc}"} .=
 
 546             "<option>$_->{name}--$_->{id}\n"
 
 547         } @{ $form->{"all_$form->{vc}"} };
 
 550       # if the name is not the same
 
 551       if ($form->{"select$form->{vc}"} !~ /$form->{$form->{vc}}/) {
 
 552         $form->{ $form->{vc} } = $newvc;
 
 557   # get customer and invoices
 
 558   $updated = &check_name($form->{vc});
 
 560   if ($new_name_selected || $updated) {
 
 561     CP->get_openinvoices(\%myconfig, \%$form);
 
 562     ($newvc) = split /--/, $form->{ $form->{vc} };
 
 563     $form->{"old$form->{vc}"} = qq|$newvc--$form->{"$form->{vc}_id"}|;
 
 567   if ($form->{currency} ne $form->{oldcurrency}) {
 
 568     $form->{oldcurrency} = $form->{currency};
 
 570       CP->get_openinvoices(\%myconfig, \%$form);
 
 575   $form->{exchangerate} = $exchangerate
 
 579                      $form->check_exchangerate(
 
 580                      \%myconfig, $form->{currency}, $form->{datepaid}, $buysell
 
 583   $amount = $form->{amount} = $form->parse_amount(\%myconfig, $form->{amount});
 
 586     $form->{rowcount} = 0;
 
 588     $form->{queued} = "";
 
 591     foreach my $ref (@{ $form->{PR} }) {
 
 593       $form->{"id_$i"}        = $ref->{id};
 
 594       $form->{"invnumber_$i"} = $ref->{invnumber};
 
 595       $form->{"transdate_$i"} = $ref->{transdate};
 
 596       $ref->{exchangerate} = 1 unless $ref->{exchangerate};
 
 597       $form->{"amount_$i"} = $ref->{amount} / $ref->{exchangerate};
 
 599         ($ref->{amount} - $ref->{paid}) / $ref->{exchangerate};
 
 600       $form->{"checked_$i"} = "";
 
 601       $form->{"paid_$i"}    = "";
 
 606           $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
 
 610     $form->{rowcount} = $i;
 
 615   # Modified from $amount = $form->{amount} by J.Zach to update amount to total
 
 616   # payment amount in Zahlungsausgang
 
 618   for my $i (1 .. $form->{rowcount}) {
 
 622         $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
 
 623     } qw(amount due paid);
 
 625     if ($form->{"checked_$i"}) {
 
 628       if (!$form->{"paid_$i"}) {
 
 629         $form->{"paid_$i"} = $form->{"due_$i"};
 
 632       # Modified by J.Zach, see abovev
 
 633       $amount += $form->{"paid_$i"}; 
 
 636       $form->{"paid_$i"} = "";
 
 641         $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
 
 642     } qw(amount due paid);
 
 646   # Line added by J.Zach, see above
 
 647   $form->{amount}=$amount; 
 
 653   $lxdebug->leave_sub();
 
 657   $lxdebug->enter_sub();
 
 661   if ($form->{currency} ne $form->{defaultcurrency}) {
 
 662     $form->error($locale->text('Exchangerate missing!'))
 
 663       unless $form->{exchangerate};
 
 666   my $msg1 = "$form->{origtitle} posted!";
 
 667   my $msg2 = "Cannot post $form->{origtitle}!";
 
 669   # $locale->text('Payment posted!')
 
 670   # $locale->text('Receipt posted!')
 
 671   # $locale->text('Cannot post Payment!')
 
 672   # $locale->text('Cannot post Receipt!')
 
 674   $form->redirect($locale->text($msg1))
 
 675     if (CP->process_payment(\%myconfig, \%$form));
 
 676   $form->error($locale->text($msg2));
 
 678   $lxdebug->leave_sub();
 
 682   $lxdebug->enter_sub();
 
 684   my ($whole, $check, %queued, $spool, $filename, $userspath);
 
 688   ($whole, $form->{decimal}) = split(/\./, $form->{amount});
 
 690   $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
 
 692   #$form->{decimal} .= "00";
 
 693   $form->{decimal} = substr($form->{decimal}, 0, 2);
 
 695   $check = new CP $myconfig{countrycode};
 
 697   $form->{text_amount} = $check->num2text($whole);
 
 699   call_sub("$form->{vc}_details");
 
 701   $form->{callback} = "";
 
 703   $form->{templates} = "$myconfig{templates}";
 
 704   $form->{IN}        = "$form->{formname}.tex";
 
 706   if ($form->{format} eq 'postscript') {
 
 707     $form->{postscript} = 1;
 
 709   if ($form->{format} eq 'pdf') {
 
 715   if ($form->{media} eq 'printer') {
 
 716     $form->{OUT} = "| $myconfig{printer}";
 
 718   if ($form->{media} eq 'queue') {
 
 719     %queued = map { s|.*/|| } split / /, $form->{queued};
 
 721     if ($filename = $queued{ $form->{formname} }) {
 
 722       unlink "$spool/$filename";
 
 723       $filename =~ s/\..*$//g;
 
 728     $filename .= ($form->{postscript}) ? '.ps' : '.pdf';
 
 729     $form->{queued} = "$form->{formname} $filename";
 
 730     $form->{OUT}    = ">$spool/$filename";
 
 732     $form->update_status(\%myconfig);
 
 736   $form->{company} = $myconfig{company};
 
 737   $form->{address} = $myconfig{address};
 
 739   $form->parse_template(\%myconfig, $userspath);
 
 741   if ($form->{media} ne 'screen') {
 
 743       "$form->{script}?action=payment&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&all_vc=$form->{all_vc}";
 
 745     $form->redirect if (CP->process_payment(\%myconfig, \%$form));
 
 746     $form->error($locale->text('Cannot post payment!'));
 
 749   $lxdebug->leave_sub();
 
 752 sub customer_details { IS->customer_details(\%myconfig, \%$form) }
 
 753 sub vendor_details { IR->vendor_details(\%myconfig, \%$form) }
 
 756   $lxdebug->enter_sub();
 
 758   my ($closedto, $datepaid, $amount);
 
 760   &check_name($form->{vc});
 
 762   if ($form->{currency} ne $form->{oldcurrency}) {
 
 767   $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount});
 
 768   $form->error($locale->text('Date missing!')) unless $form->{datepaid};
 
 770   $closedto = $form->datetonum($form->{closedto}, \%myconfig);
 
 771   $datepaid = $form->datetonum($form->{datepaid}, \%myconfig);
 
 773   $form->error($locale->text('Cannot process payment for a closed period!'))
 
 774     if ($datepaid <= $closedto);
 
 776   $amount = $form->parse_amount(\%myconfig, $form->{amount});
 
 777   $form->{amount} = $amount;
 
 779   for my $i (1 .. $form->{rowcount}) {
 
 780     if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
 
 781       $amount -= $form->parse_amount(\%myconfig, $form->{"paid_$i"});
 
 783       push(@{ $form->{paid} },      $form->{"paid_$i"});
 
 784       push(@{ $form->{due} },       $form->{"due_$i"});
 
 785       push(@{ $form->{invnumber} }, $form->{"invnumber_$i"});
 
 786       push(@{ $form->{invdate} },   $form->{"transdate_$i"});
 
 790   if ($form->round_amount($amount, 2) != 0) {
 
 791     push(@{ $form->{paid} }, $form->format_amount(\%myconfig, $amount, 2));
 
 792     push(@{ $form->{due} }, $form->format_amount(\%myconfig, 0, "0"));
 
 793     push(@{ $form->{invnumber} },
 
 794          ($form->{ARAP} eq 'AR')
 
 795          ? $locale->text('Deposit')
 
 796          : $locale->text('Prepayment'));
 
 797     push(@{ $form->{invdate} }, $form->{datepaid});
 
 800   $lxdebug->leave_sub();