[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [59] trunk/bin



Revision: 59
          http://svn.sourceforge.net/ledger-smb/?rev=59&view=rev
Author:   einhverfr
Date:     2006-09-10 13:04:26 -0700 (Sun, 10 Sep 2006)

Log Message:
-----------
Updated copyright notices on remaining bin/mozilla files.  
Centralized Lynx support to merely include most of the files in the bin/mozilla directory

Modified Paths:
--------------
    trunk/bin/lynx/ca.pl
    trunk/bin/lynx/cp.pl
    trunk/bin/lynx/ct.pl
    trunk/bin/lynx/gl.pl
    trunk/bin/lynx/hr.pl
    trunk/bin/lynx/ic.pl
    trunk/bin/lynx/io.pl
    trunk/bin/lynx/ir.pl
    trunk/bin/lynx/is.pl
    trunk/bin/lynx/jc.pl
    trunk/bin/lynx/login.pl
    trunk/bin/lynx/menu.pl
    trunk/bin/lynx/oe.pl
    trunk/bin/lynx/pos.pl
    trunk/bin/lynx/ps.pl
    trunk/bin/lynx/pw.pl
    trunk/bin/lynx/rc.pl
    trunk/bin/lynx/rp.pl
    trunk/bin/mozilla/ca.pl
    trunk/bin/mozilla/cp.pl
    trunk/bin/mozilla/ct.pl
    trunk/bin/mozilla/gl.pl
    trunk/bin/mozilla/hr.pl
    trunk/bin/mozilla/ic.pl
    trunk/bin/mozilla/io.pl
    trunk/bin/mozilla/ir.pl
    trunk/bin/mozilla/is.pl
    trunk/bin/mozilla/jc.pl
    trunk/bin/mozilla/login.pl
    trunk/bin/mozilla/oe.pl
    trunk/bin/mozilla/pos.pl
    trunk/bin/mozilla/ps.pl
    trunk/bin/mozilla/pw.pl
    trunk/bin/mozilla/rc.pl
    trunk/bin/mozilla/rp.pl

Modified: trunk/bin/lynx/ca.pl
===================================================================
--- trunk/bin/lynx/ca.pl	2006-09-10 18:35:50 UTC (rev 58)
+++ trunk/bin/lynx/ca.pl	2006-09-10 20:04:26 UTC (rev 59)
@@ -1,532 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
+#!/usr/bin/perl
 
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed 
-# under the GNU General Public License version 2 or, at your option, any later 
-# version.  For a full list including contact information of contributors, 
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (C) 2001
-#
-#  Author: DWS Systems Inc.
-#     Web: http://www.sql-ledger.org
-#
-#  Contributors:
-#
-#
-#  Author: DWS Systems Inc.
-#     Web: http://sourceforge.net/projects/ledger-smb/
-#
-#  Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# module for Chart of Accounts, Income Statement and Balance Sheet
-# search and edit transactions posted by the GL, AR and AP
-# 
-#======================================================================
-
-use LedgerSMB::CA;
-
-1;
-# end of main
-
-# this is for our long dates
-# $locale->text('January')
-# $locale->text('February')
-# $locale->text('March')
-# $locale->text('April')
-# $locale->text('May ')
-# $locale->text('June')
-# $locale->text('July')
-# $locale->text('August')
-# $locale->text('September')
-# $locale->text('October')
-# $locale->text('November')
-# $locale->text('December')
-
-# this is for our short month
-# $locale->text('Jan')
-# $locale->text('Feb')
-# $locale->text('Mar')
-# $locale->text('Apr')
-# $locale->text('May')
-# $locale->text('Jun')
-# $locale->text('Jul')
-# $locale->text('Aug')
-# $locale->text('Sep')
-# $locale->text('Oct')
-# $locale->text('Nov')
-# $locale->text('Dec')
-
-
-sub chart_of_accounts {
-
-  CA->all_accounts(\%myconfig, \%$form);
-
-  @column_index = qw(accno gifi_accno description debit credit);
-
-  $column_header{accno} = qq|<th class=listtop>|.$locale->text('Account').qq|</th>\n|;
-  $column_header{gifi_accno} = qq|<th class=listtop>|.$locale->text('GIFI').qq|</th>\n|;
-  $column_header{description} = qq|<th class=listtop>|.$locale->text('Description').qq|</th>\n|;
-  $column_header{debit} = qq|<th class=listtop>|.$locale->text('Debit').qq|</th>\n|;
-  $column_header{credit} = qq|<th class=listtop>|.$locale->text('Credit').qq|</th>\n|;
-  
-
-  $form->{title} = $locale->text('Chart of Accounts');
-
-  $colspan = $#column_index + 1;
-  
-  $form->header;
-
-  print qq|
-<body>
-  
-<table border=0 width=100%>
-  <tr><th class=listtop colspan=$colspan>$form->{title}</th></tr>
-  <tr height="5"></tr>
-  <tr class=listheading>|;
-
-  for (@column_index) { print $column_header{$_} }
-
-  print qq|
-  </tr>
-|;
-
-  
-  foreach $ca (@{ $form->{CA} }) {
-
-    $description = $form->escape($ca->{description});
-    $gifi_description = $form->escape($ca->{gifi_description});
-    
-    $href = qq|$form->{script}?path=$form->{path}&action=list&accno=$ca->{accno}&login=$form->{login}&sessionid=$form->{sessionid}&description=$description&gifi_accno=$ca->{gifi_accno}&gifi_description=$gifi_description|;
-    
-    if ($ca->{charttype} eq "H") {
-      print qq|<tr class=listheading>|;
-      for (qw(accno description)) { $column_data{$_} = "<th class=listheading>$ca->{$_}</th>" }
-      $column_data{gifi_accno} = "<th class=listheading>$ca->{gifi_accno}&nbsp;</th>";
-    } else {
-      $i++; $i %= 2;
-      print qq|<tr class=listrow$i>|;
-      $column_data{accno} = "<td><a href=$href>$ca->{accno}</a></td>";
-      $column_data{gifi_accno} = "<td><a href=$href&accounttype=gifi>$ca->{gifi_accno}</a>&nbsp;</td>";
-      $column_data{description} = "<td>$ca->{description}</td>";
-    }
-      
-    $column_data{debit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{debit}, 2, "&nbsp;")."</td>\n";
-    $column_data{credit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{credit}, 2, "&nbsp;")."</td>\n";
-    
-    $totaldebit += $ca->{debit};
-    $totalcredit += $ca->{credit};
-
-    for (@column_index) { print "$column_data{$_}\n" }
-
-    print qq|
-</tr>
-|;
-  }
-
-  for (qw(accno gifi_accno description)) { $column_data{$_} = "<td>&nbsp;</td>" }
-
-  $column_data{debit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totaldebit, 2, 0)."</th>";
-  $column_data{credit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totalcredit, 2, 0)."</th>";
-  
-  print "<tr class=listtotal>";
-
-  for (@column_index) { print "$column_data{$_}\n" }
-
-  print qq|
-</tr>
-<tr>
-  <td colspan=$colspan><hr size=3 noshade></td>
-</tr>
-</table>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub list {
-
-  $form->{title} = $locale->text('List Transactions');
-  if ($form->{accounttype} eq 'gifi') {
-    $form->{title} .= " - ".$locale->text('GIFI')." $form->{gifi_accno} - $form->{gifi_description}";
-  } else {
-    $form->{title} .= " - ".$locale->text('Account')." $form->{accno} - $form->{description}";
-  }
-
-  # get departments
-  $form->all_departments(\%myconfig);
-  if (@{ $form->{all_department} }) {
-    $form->{selectdepartment} = "<option>\n";
-
-    for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
-  }
-
-  $department = qq|
-        <tr>
-	  <th align=right nowrap>|.$locale->text('Department').qq|</th>
-	  <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
-	</tr>
-| if $form->{selectdepartment};
-
-  if (@{ $form->{all_years} }) {
-    # accounting years
-    $form->{selectaccountingyear} = "<option>\n";
-    for (@{ $form->{all_years} }) { $form->{selectaccountingyear} .= qq|<option>$_\n| }
-    $form->{selectaccountingmonth} = "<option>\n";
-    for (sort keys %{ $form->{all_month} }) { $form->{selectaccountingmonth} .= qq|<option value=$_>|.$locale->text($form->{all_month}{$_}).qq|\n| }
-
-    $selectfrom = qq|
-        <tr>
-	<th align=right>|.$locale->text('Period').qq|</th>
-	<td colspan=3>
-	<select name=month>$form->{selectaccountingmonth}</select>
-	<select name=year>$form->{selectaccountingyear}</select>
-	<input name=interval class=radio type=radio value=0 checked>&nbsp;|.$locale->text('Current').qq|
-	<input name=interval class=radio type=radio value=1>&nbsp;|.$locale->text('Month').qq|
-	<input name=interval class=radio type=radio value=3>&nbsp;|.$locale->text('Quarter').qq|
-	<input name=interval class=radio type=radio value=12>&nbsp;|.$locale->text('Year').qq|
-	</td>
-      </tr>
-|;
-  }
-
-
-  $form->header;
-  
-  print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=accno value=$form->{accno}>
-<input type=hidden name=description value="$form->{description}">
-
-<input type=hidden name=sort value=transdate>
-<input type=hidden name=oldsort value=transdate>
-
-<input type=hidden name=accounttype value=$form->{accounttype}>
-<input type=hidden name=gifi_accno value=$form->{gifi_accno}>
-<input type=hidden name=gifi_description value="$form->{gifi_description}">
-
-<table border=0 width=100%>
-  <tr><th class=listtop>$form->{title}</th></tr>
-  <tr height="5"></tr
-  <tr valign=top>
-    <td>
-      <table>
-        $department
-	<tr>
-	  <th align=right>|.$locale->text('From').qq|</th>
-	  <td><input name=fromdate size=11 title="$myconfig{dateformat}"></td>
-	  <th align=right>|.$locale->text('To').qq|</th>
-	  <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
-	</tr>
-	$selectfrom
-	<tr>
-	  <th align=right>|.$locale->text('Include in Report').qq|</th>
-	  <td colspan=3>
-	  <input name=l_accno class=checkbox type=checkbox value=Y>&nbsp;|.$locale->text('AR/AP').qq|
-	  <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|.$locale->text('Subtotal').qq|
-	  </td>
-	</tr>
-      </table>
-    </td>
-  </tr>
-  <tr><td><hr size=3 noshade></td></tr>
-</table>
-
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<br><input class=submit type=submit name=action value="|.$locale->text('List Transactions').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub list_transactions {
-
-  CA->all_transactions(\%myconfig, \%$form);
-  
-  $department = $form->escape($form->{department});
-  $projectnumber = $form->escape($form->{projectnumber});
-  $title = $form->escape($form->{title});
-
-  # construct href
-  $href = "$form->{script}?action=list_transactions&department=$department&projectnumber=$projectnumber&title=$title";
-  for (qw(path oldsort accno login sessionid fromdate todate accounttype gifi_accno l_heading l_subtotal l_accno)) { $href .= "&$_=$form->{$_}" }
-
-  $drilldown = $href;
-  $drilldown .= "&sort=$form->{sort}";
-
-  $href .= "&direction=$form->{direction}";
-  
-  $form->sort_order();
-
-  $drilldown .= "&direction=$form->{direction}";
-
-  $form->{prevreport} = $href unless $form->{prevreport};
-  $href .= "&prevreport=".$form->escape($form->{prevreport});
-  $drilldown .= "&prevreport=".$form->escape($form->{prevreport});
- 
-  # figure out which column comes first
-  $column_header{transdate} = qq|<th><a class=listheading href=$href&sort=transdate>|.$locale->text('Date').qq|</a></th>|;
-  $column_header{reference} = qq|<th><a class=listheading href=$href&sort=reference>|.$locale->text('Reference').qq|</a></th>|;
-  $column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
-  $column_header{cleared} = qq|<th class=listheading>|.$locale->text('R').qq|</th>|;
-  $column_header{source} = qq|<th class=listheading>|.$locale->text('Source').qq|</th>|;
-  $column_header{debit} = qq|<th class=listheading>|.$locale->text('Debit').qq|</th>|;
-  $column_header{credit} = qq|<th class=listheading>|.$locale->text('Credit').qq|</th>|;
-  $column_header{balance} = qq|<th class=listheading>|.$locale->text('Balance').qq|</th>|;
-  $column_header{accno} = qq|<th class=listheading>|.$locale->text('AR/AP').qq|</th>|;
-
-  @columns = qw(transdate reference description debit credit);
-  if ($form->{link} =~ /_paid/) {
-    @columns = qw(transdate reference description source cleared debit credit);
-  }
-  push @columns, "accno" if $form->{l_accno};
-  @column_index = $form->sort_columns(@columns);
-
- 
-  if ($form->{accounttype} eq 'gifi') {
-    for (qw(accno description)) { $form->{$_} = $form->{"gifi_$_"} }
-  }
-  if ($form->{accno}) {
-    push @column_index, "balance";
-  }
-    
-  $form->{title} = ($form->{accounttype} eq 'gifi') ? $locale->text('GIFI') : $locale->text('Account');
-  
-  $form->{title} .= " $form->{accno} - $form->{description}";
-
-  if ($form->{department}) {
-    ($department) = split /--/, $form->{department};
-    $options = $locale->text('Department')." : $department<br>";
-  }
-  if ($form->{projectnumber}) {
-    ($projectnumber) = split /--/, $form->{projectnumber};
-    $options .= $locale->text('Project Number')." : $projectnumber<br>";
-  }
-
-
-  if ($form->{fromdate} || $form->{todate}) {
-
-    if ($form->{fromdate}) {
-      $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
-    }
-    if ($form->{todate}) {
-      $todate = $locale->date(\%myconfig, $form->{todate}, 1);
-    }
-    
-    $form->{period} = "$fromdate - $todate";
-  } else {
-    $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
-  }
-
-  $form->{period} = "<a href=$form->{prevreport}>$form->{period}</a>" if $form->{prevreport};
-  
-  $options .= $form->{period};
-
-
-  # construct callback
-  $department = $form->escape($form->{department},1);
-  $projectnumber = $form->escape($form->{projectnumber},1);
-  $title = $form->escape($form->{title},1);
-  $form->{prevreport} = $form->escape($form->{prevreport},1);
- 
-  $form->{callback} = "$form->{script}?action=list_transactions&department=$department&projectnumber=$projectnumber&title=$title";
-  for (qw(path direction oldsort accno login sessionid fromdate todate accounttype gifi_accno l_heading l_subtotal l_accno prevreport)) { $form->{callback} .= "&$_=$form->{$_}" }
- 
-  
-  $form->header;
-
-  print qq|
-<body>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>$options</td>
-  </tr>
-  <tr>
-    <td>
-      <table width=100%>
-       <tr class=listheading>
-|;
-
-  for (@column_index) { print "$column_header{$_}\n" }
-
-  print qq|
-       </tr>
-|;
-
-  # add sort to callback
-  $form->{callback} = $form->escape($form->{callback} . "&sort=$form->{sort}");
-
-  if (@{ $form->{CA} }) {
-    $sameitem = $form->{CA}->[0]->{$form->{sort}};
-  }
-
-  $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
-  $ml *= -1 if $form->{contra};
-
-  if ($form->{accno} && $form->{balance}) {
-    
-    for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
-    $column_data{balance} = "<td align=right>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</td>";
-
-    $i++; $i %= 2;
-    
-    print qq|
-        <tr class=listrow$i>
-|;
-    for (@column_index) { print "$column_data{$_}\n" }
-    print qq|
-       </tr>
-|;
-
-  }
-    
-  foreach $ca (@{ $form->{CA} }) {
-
-    if ($form->{l_subtotal} eq 'Y') {
-      if ($sameitem ne $ca->{$form->{sort}}) {
-	&ca_subtotal;
-      }
-    }
-    
-    # construct link to source
-    $href = "<a href=$ca->{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$form->{callback}>$ca->{reference}</a>";
-
-    
-    $column_data{debit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{debit}, 2, "&nbsp;")."</td>";
-    $column_data{credit} = "<td align=right>".$form->format_amount(\%myconfig, $ca->{credit}, 2, "&nbsp;")."</td>";
-    
-    $form->{balance} += $ca->{amount};
-    $column_data{balance} = "<td align=right>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</td>";
-
-    $subtotaldebit += $ca->{debit};
-    $subtotalcredit += $ca->{credit};
-    
-    $totaldebit += $ca->{debit};
-    $totalcredit += $ca->{credit};
-    
-    $column_data{transdate} = qq|<td>$ca->{transdate}</td>|;
-    $column_data{reference} = qq|<td>$href</td>|;
-    $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
-    
-    $column_data{cleared} = ($ca->{cleared}) ? qq|<td>*</td>| : qq|<td>&nbsp;</td>|;
-    $column_data{source} = qq|<td>$ca->{source}&nbsp;</td>|;
-    
-    $column_data{accno} = qq|<td>|;
-    for (@{ $ca->{accno} }) { $column_data{accno} .= "<a href=$drilldown&accno=$_>$_</a> " }
-    $column_data{accno} .= qq|&nbsp;</td>|;
-  
-    if ($ca->{id} != $sameid) {
-      $i++; $i %= 2;
-    }
-    $sameid = $ca->{id};
-
-    print qq|
-        <tr class=listrow$i>
-|;
-
-    for (@column_index) { print "$column_data{$_}\n" }
-
-    print qq|
-        </tr>
-|;
-
-  }
- 
-
-  if ($form->{l_subtotal} eq 'Y') {
-    &ca_subtotal;
-  }
- 
-
-  for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-  
-  $column_data{debit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totaldebit, 2, "&nbsp;")."</th>";
-  $column_data{credit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totalcredit, 2, "&nbsp;")."</th>";
-  $column_data{balance} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</th>";
-
-  print qq|
-	<tr class=listtotal>
-|;
-
-  for (@column_index) { print "$column_data{$_}\n" }
-  
-  print qq|
-	</tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-</body>
-</html>
-|;
-  
-}
-
-
-sub ca_subtotal {
-
-  for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-  
-  $column_data{debit} = "<th align=right class=listsubtotal>".$form->format_amount(\%myconfig, $subtotaldebit, 2, "&nbsp;") . "</th>";
-  $column_data{credit} = "<th align=right class=listsubtotal>".$form->format_amount(\%myconfig, $subtotalcredit, 2, "&nbsp;") . "</th>";
-       
-  $subtotaldebit = 0;
-  $subtotalcredit = 0;
-
-  $sameitem = $ca->{$form->{sort}};
-
-  print qq|
-      <tr class=listsubtotal>
-|;
-
-  for (@column_index) { print "$column_data{$_}\n" }
-
-  print qq|
-      </tr>
-|;
-
-}
-
+require "bin/mozilla/ca.pl";

Modified: trunk/bin/lynx/cp.pl
===================================================================
--- trunk/bin/lynx/cp.pl	2006-09-10 18:35:50 UTC (rev 58)
+++ trunk/bin/lynx/cp.pl	2006-09-10 20:04:26 UTC (rev 59)
@@ -1,1410 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
+#!/usr/bin/perl
 
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed 
-# under the GNU General Public License version 2 or, at your option, any later 
-# version.  For a full list including contact information of contributors, 
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2002
-#
-#  Author: DWS Systems Inc.
-#     Web: http://www.sql-ledger.org
-#
-# Contributors:
-#
-#
-#  Author: DWS Systems Inc.
-#     Web: http://sourceforge.net/projects/ledger-smb/
-#
-# Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# Payment module
-#
-#======================================================================
-
-
-use SL::CP;
-use SL::OP;
-use SL::IS;
-use SL::IR;
-
-require "$form->{path}/arap.pl";
-
-1;
-# end of main
-
-
-sub payment {
-
-  if ($form->{type} eq 'receipt') {
-    $form->{ARAP} = "AR";
-    $form->{arap} = "ar";
-    $form->{vc} = "customer";
-    $form->{formname} = "receipt";
-  }
-  if ($form->{type} eq 'check') {
-    $form->{ARAP} = "AP";
-    $form->{arap} = "ap";
-    $form->{vc} = "vendor";
-    $form->{formname} = "check";
-  }
-
-  $form->{payment} = "payment";
-  
-  $form->{callback} = "$form->{script}?action=payment&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&all_vc=$form->{all_vc}&type=$form->{type}";
-  
-  # setup customer/vendor selection for open invoices
-  if ($form->{all_vc}) {
-    $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP}, undef, $form->{datepaid});
-  } else {
-    CP->get_openvc(\%myconfig, \%$form);
-    if ($myconfig{vclimit} > 0) {
-      $form->{"all_$form->{vc}"} = $form->{name_list};
-    }
-  }
-
-  $form->{"select$form->{vc}"} = "";
-  if (@{ $form->{"all_$form->{vc}"} }) {
-    $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
-    for (@{ $form->{"all_$form->{vc}"} }) { $form->{"select$form->{vc}"} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
-  }
-
-  # departments
-  if (@{ $form->{all_department} }) { 
-    $form->{selectdepartment} = "<option>\n";
-    $form->{department} = "$form->{department}--$form->{department_id}" if $form->{department};
-
-    for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
-  }
-
-  if (@{ $form->{all_language} }) {
-    $form->{selectlanguage} = "<option>\n";
-    for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|<option value="$_->{code}">$_->{description}\n| }
-  }
-
-  CP->paymentaccounts(\%myconfig, \%$form);
-
-  $form->{selectaccount} = "";
-  $form->{"select$form->{ARAP}"} = "";
-
-  for (@{ $form->{PR}{"$form->{ARAP}_paid"} }) { $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n" }
-  for (@{ $form->{PR}{$form->{ARAP}} }) { $form->{"select$form->{ARAP}"} .= "<option>$_->{accno}--$_->{description}\n" }
-
-  # currencies
-  @curr = split /:/, $form->{currencies};
-  $form->{defaultcurrency} = $curr[0];
-  chomp $form->{defaultcurrency};
-
-  $form->{selectcurrency} = "";
-  for (@curr) { $form->{selectcurrency} .= "<option>$_\n" }
-
-  $form->{currency} = $form->{defaultcurrency};
-  $form->{oldcurrency} = $form->{currency};
-
-  if ($form->{currency} ne $form->{defaultcurrency}) {
-    $form->{forex} = $form->{exchangerate} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{datepaid}, ($form->{vc} eq 'customer') ? "buy" : "sell");
-  }
-
-  $form->{olddatepaid} = $form->{datepaid};
-
-  $form->{media} = $myconfig{printer};
-  $form->{format} = "pdf" unless $myconfig{printer};
-
-  &payment_header;
-  &payment_footer;
-  
-}
-
-
-sub payments {
-  
-  if ($form->{type} eq 'receipt') {
-    $form->{ARAP} = "AR";
-    $form->{arap} = "ar";
-    $form->{vc} = "customer";
-    $form->{formname} = "receipt";
-  }
-  if ($form->{type} eq 'check') {
-    $form->{ARAP} = "AP";
-    $form->{arap} = "ap";
-    $form->{vc} = "vendor";
-    $form->{formname} = "check";
-  }
-  
-  $form->{payment} = "payments";
-
-  $form->{callback} = "$form->{script}?action=$form->{action}";
-  for (qw(path login sessionid type)) { $form->{callback} .= "&$_=$form->{$_}" }
-
-  CP->paymentaccounts(\%myconfig, \%$form);
-  
-  if (@{ $form->{all_language} }) {
-    $form->{selectlanguage} = "<option>\n";
-    for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|<option value="$_->{code}">$_->{description}\n| }
-  }
-  
-  # departments
-  if (@{ $form->{all_department} }) { 
-    $form->{selectdepartment} = "<option>\n";
-    $form->{department} = "$form->{department}--$form->{department_id}" if $form->{department};
-
-    for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
-  }
-
-  $form->{selectaccount} = "";
-  $form->{"select$form->{ARAP}"} = "";
-
-  for (@{ $form->{PR}{"$form->{ARAP}_paid"} }) { $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n" }
-  for (@{ $form->{PR}{$form->{ARAP}} }) { $form->{"select$form->{ARAP}"} .= "<option>$_->{accno}--$_->{description}\n" }
-
-  # currencies
-  @curr = split /:/, $form->{currencies};
-  $form->{defaultcurrency} = $curr[0];
-  chomp $form->{defaultcurrency};
-
-  $form->{selectcurrency} = "";
-  for (@curr) { $form->{selectcurrency} .= "<option>$_\n" }
-
-  $form->{oldcurrency} = $form->{currency} = $form->{defaultcurrency};
-  $form->{oldduedateto} = $form->{datepaid};
-
-  $form->{media} = $myconfig{printer};
-  $form->{format} = "pdf" unless $myconfig{printer};
-
-  &payments_header;
-  &invoices_due;
-  &payments_footer;
-
-}
-
-
-sub payments_header {
-
-  if ($form->{type} eq 'receipt') {
-    $form->{title} = $locale->text('Receipts');
-  }
-  if ($form->{type} eq 'check') {
-    $form->{title} = $locale->text('Payments');
-  }
-
- 
-  for ("department") {
-    $form->{"select$_"} = $form->unescape($form->{"select$_"});
-    $form->{"select$_"} =~ s/ selected//;
-    $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
-  }
- 
-  for ("account", "currency", "$form->{ARAP}") {
-    $form->{"select$_"} =~ s/ selected//;
-    $form->{"select$_"} =~ s/option>\Q$form->{$_}\E/option selected>$form->{$_}/;
-  }
-
-  if ($form->{defaultcurrency}) {
-     $exchangerate = qq|
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Currency').qq|</th>
-		<td><select name=currency>$form->{selectcurrency}</select></td>
-		<input type=hidden name=selectcurrency value="$form->{selectcurrency}">
-		<input type=hidden name=oldcurrency value=$form->{oldcurrency}>
-	      </tr>
-|;
-  }
- 
-  if ($form->{currency} ne $form->{defaultcurrency}) {
-    $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
-
-    if ($form->{forex}) {
-      $exchangerate .= qq|
- 	      <tr>
-		<th align=right nowrap>|.$locale->text('Exchange Rate').qq|</th>
-		<td colspan=3><input type=hidden name=exchangerate size=10 value=$form->{exchangerate}>$form->{exchangerate}</td>
-	      </tr>
-|;
-    } else {
-      $exchangerate .= qq|
- 	      <tr>
-		<th align=right nowrap>|.$locale->text('Exchange Rate').qq|</th>
-		<td colspan=3><input name=exchangerate size=10 value=$form->{exchangerate}></td>
-	      </tr>
-|;
-    }
-  }
- 
-  $department = qq|
-              <tr>
-	        <th align="right" nowrap>|.$locale->text('Department').qq|</th>
-		<td><select name=department>$form->{selectdepartment}</select>
-		<input type=hidden name=selectdepartment value="|.$form->escape($form->{selectdepartment},1).qq|">
-	      </td>
-	    </tr>
-| if $form->{selectdepartment};
-
-
-  $form->header;
-
-  print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
-  $form->hide_form(qw(defaultcurrency closedto vc type formname arap ARAP title oldduedatefrom oldduedateto payment olddepartment));
-
-  print qq|
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr valign=top>
-	  <td>
-	    <table>
-	      <tr>
-	        <th align=right>|.$locale->text('Due Date').qq|&nbsp;|.$locale->text('From').qq|</th>
-		<td><input name=duedatefrom value="$form->{duedatefrom}" title="$myconfig{dateformat}" size=11></td>
-	        <th align=right>|.$locale->text('To').qq|</th>
-		<td><input name=duedateto value="$form->{duedateto}" title="$myconfig{dateformat}" size=11></td>
-	      </tr>
-	    </table>
-	  </td>
-	  </td>
-	  <td align=right>
-	    <table>
-	      $department
-	      <tr>
-	        <th align=right nowrap>|.$locale->text($form->{ARAP}).qq|</th>
-		<td colspan=3><select name=$form->{ARAP}>$form->{"select$form->{ARAP}"}</select>
-		</td>
-		<input type=hidden name="select$form->{ARAP}" value="$form->{"select$form->{ARAP}"}">
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Account').qq|</th>
-		<td colspan=3><select name=account>$form->{selectaccount}</select>
-		<input type=hidden name=selectaccount value="$form->{selectaccount}">
-		</td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Date').qq|</th>
-		<td><input name=datepaid value="$form->{datepaid}" title="$myconfig{dateformat}" size=11></td>
-	      </tr>
-	      $exchangerate
-	    </table>
-	  </td>
-	</tr>
-      </table>
-    </td>
-  </tr>
-|;
-
-}
-
-
-sub invoices_due {
-
-  @column_index = qw(name invnumber transdate amount due checked paid memo source);
-  push @column_index, "language" if $form->{selectlanguage};
-  
-  $colspan = $#column_index + 1;
-
-  $invoice = $locale->text('Invoices');
-  $vclabel = ucfirst $form->{vc};
-  $vclabel = $locale->text($vclabel);
-  
-  print qq|
-  <input type=hidden name=column_index value="id @column_index">
-  <tr>
-    <td>
-      <table width=100%>
-	<tr>
-	  <th class=listheading colspan=$colspan>$invoice</th>
-	</tr>
-|;
-
-  $column_data{name} = qq|<th nowrap>$vclabel</th>|;
-  $column_data{invnumber} = qq|<th nowrap>|.$locale->text('Invoice')."</th>";
-  $column_data{transdate} = qq|<th nowrap>|.$locale->text('Date')."</th>";
-  $column_data{amount} = qq|<th nowrap>|.$locale->text('Amount')."</th>";
-  $column_data{due} = qq|<th nowrap>|.$locale->text('Amount Due')."</th>";
-  $column_data{paid} = qq|<th nowrap>|.$locale->text('Amount')."</th>";
-  $column_data{checked} = qq|<th nowrap>|.$locale->text('Select')."</th>";
-  $column_data{memo} = qq|<th nowrap>|.$locale->text('Memo')."</th>";
-  $column_data{source} = qq|<th nowrap>|.$locale->text('Source')."</th>";
-  $column_data{language} = qq|<th nowrap>|.$locale->text('Language')."</th>";
-  
-  print qq|
-        <tr>
-|;
-  for (@column_index) { print "$column_data{$_}\n" }
-  print qq|
-        </tr>
-|;
-
-  $form->{selectlanguage} = $form->unescape($form->{selectlanguage});
-
-  for $i (1 .. $form->{rowcount}) {
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
-    
-    $totalamount += $form->{"amount_$i"};
-    $totaldue += $form->{"due_$i"};
-    $totalpaid += $form->{"paid_$i"};
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) }
-
-    $column_data{invnumber} = qq|<td>$form->{"invnumber_$i"}</td>
-      <input type=hidden name="invnumber_$i" value="$form->{"invnumber_$i"}">
-      <input type=hidden name="id_$i" value=$form->{"id_$i"}>|;
-    $column_data{transdate} = qq|<td>$form->{"transdate_$i"}</td>
-      <input type=hidden name="transdate_$i" value=$form->{"transdate_$i"}>|;
-    $column_data{amount} = qq|<td align=right>$form->{"amount_$i"}</td>
-      <input type=hidden name="amount_$i" value=$form->{"amount_$i"}>|;
-    $column_data{due} = qq|<td align=right>$form->{"due_$i"}</td>
-      <input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
-
-    $column_data{paid} = qq|<td align=right><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
-
-    if ($same_id eq $form->{"$form->{vc}_id_$i"}) {
-      for (qw(name memo source language)) { $column_data{$_} = qq|<td>&nbsp;</td>| }
-    } else {
-      $column_data{name} = qq|<td>$form->{"name_$i"}</td>|;
-      $column_data{memo} = qq|<td align=right><input name="memo_$i" size=10 value="$form->{"memo_$i"}"></td>|;
-      $column_data{source} = qq|<td align=right><input name="source_$i" size=10 value="$form->{"source_$i"}"></td>|;
-
-      if ($form->{selectlanguage}) {
-	$selectlanguage = $form->{selectlanguage};
-	$selectlanguage =~ s/(<option value="\Q$form->{"language_code_$i"}\E")/$1 selected/;
-	$column_data{language} = qq|<td><select name="language_code_$i">$selectlanguage</select></td>|;
-      }
-
-    }
-    
-    $column_data{name} .= qq|
-      <input type=hidden name="name_$i" value="$form->{"name_$i"}">
-      <input type=hidden name="$form->{vc}_id_$i" value="$form->{"$form->{vc}_id_$i"}">|;
-
-    $form->{"checked_$i"} = ($form->{"checked_$i"}) ? "checked" : "";
-    $column_data{checked} = qq|<td align=center><input name="checked_$i" type=checkbox class=checkbox $form->{"checked_$i"}></td>|;
-
-    $j++; $j %= 2;
-    print qq|
-	<tr class=listrow$j>
-|;
-    for (@column_index) { print "$column_data{$_}\n" }
-    print qq|
-        </tr>
-|;
-
-    $same_id = $form->{"$form->{vc}_id_$i"};
-    
-  }
-
-  for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
-  $column_data{amount} = qq|<th class=listtotal align=right>|.$form->format_amount(\%myconfig, $totalamount, 2, "&nbsp;").qq|</th>|;
-  $column_data{due} = qq|<th class=listtotal align=right>|.$form->format_amount(\%myconfig, $totaldue, 2, "&nbsp;").qq|</th>|;
-  $column_data{paid} = qq|<th class=listtotal align=right>|.$form->format_amount(\%myconfig, $totalpaid, 2, "&nbsp;").qq|</th>|;
-
-  print qq|
-        <tr class=listtotal>
-|;
-  for (@column_index) { print "$column_data{$_}\n" }
-  print qq|
-        </tr>
-      </table>
-    </td>
-  </tr>
-<input type=hidden name=selectlanguage value="|.$form->escape($form->{selectlanguage},1).qq|">
-|;
-
-}
-
-
-sub payments_footer {
-  
-  $form->{DF}{$form->{format}} = "selected";
-
-  $transdate = $form->datetonum(\%myconfig, $form->{datepaid});
-  $closedto = $form->datetonum(\%myconfig, $form->{closedto});
-  
-  if ($latex) {
-   
-    $media = qq|<select name=media>
-          <option value=screen>|.$locale->text('Screen');
-
-    if (%printer) {
-      for (sort keys %printer) { $media .= qq| 
-          <option value="$_">$_| }
-    }
-  
-    $media .= qq|</select>|;
-    $format = qq|<select name=format>
-            <option value=postscript $form->{DF}{postscript}>|.$locale->text('Postscript').qq|
-	    <option value=pdf $form->{DF}{pdf}>|.$locale->text('PDF').qq|</select>|;
-  }
-
-  print qq|
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-|;
-
-# type=submit $locale->text('Update')
-# type=submit $locale->text('Post')
-# type=submit $locale->text('Print') 
-# type=submit $locale->text('Select all') 
-
-  %button = ('Update' => { ndx => 1, key => 'U', value => $locale->text('Update') },
-	     'Select all' => { ndx => 2, key => 'A', value => $locale->text('Select all') },
-             'Print' => { ndx => 3, key => 'P', value => $locale->text('Print') },
-	     'Post' => { ndx => 4, key => 'O', value => $locale->text('Post') },
-	    ); 
-
-  if (! $latex) {
-    delete $button{'Print'};
-  }
-
-  if ($transdate <= $closedto) {
-    for ('Post', 'Print') { delete $button{$_} }
-    $media = $format = "";
-  }
-  
-  for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
-
-  $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
-
-  print qq|
-  $format
-  $media
-|;
-
-  $form->hide_form(qw(callback rowcount path login sessionid));
- 
-  if ($form->{menubar}) {
-    require "$form->{path}/menu.pl";
-    &menubar;
-  }
-
-  print qq|
-  </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub select_all {
-
-  for (1 .. $form->{rowcount}) { $form->{"checked_$_"} = 1 }
-  &{"update_$form->{payment}"}
-  
-}
-
-
-sub update {
-  my ($new_name_selected) = @_;
-
-  &{"update_$form->{payment}"};
-  
-}
-
-
-sub update_payments {
-
-  if ($form->{ARAP} eq 'AR') {
-    $buysell = "buy";
-  } else {
-    $buysell = "sell";
-  }
-
-  if (($form->{oldduedatefrom} ne $form->{duedatefrom}) || ($form->{oldduedateto} ne $form->{duedateto}) || ($form->{department} ne $form->{olddepartment})) {
-    CP->get_openinvoices(\%myconfig, \%$form);
-    $form->{redo} = 1;
-  }
-
-  if ($form->{currency} ne $form->{oldcurrency}) {
-    $form->{oldcurrency} = $form->{currency};
-    if (!$form->{redo}) {
-      CP->get_openinvoices(\%myconfig, \%$form);
-      $form->{redo} = 1;
-    }
-  }
-
-  for (qw(duedatefrom duedateto department)) { $form->{"old$_"} = $form->{$_} }
-  
-  $form->{exchangerate} = $exchangerate if ($form->{forex} = ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{datepaid}, $buysell)));
-
-  if ($form->{redo}) {
-    $form->{rowcount} = 0;
-
-    $i = 0;
-    foreach $ref (@{ $form->{PR} }) {
-      $i++;
-      for (qw(id name invnumber transdate)) { $form->{"${_}_$i"} = $ref->{$_} }
-      $form->{"$form->{vc}_id_$i"} = $ref->{"$form->{vc}_id"};
-      $ref->{exchangerate} = 1 unless $ref->{exchangerate};
-      $form->{"amount_$i"} = $ref->{amount} / $ref->{exchangerate};
-      $form->{"due_$i"} = ($ref->{amount} - $ref->{paid}) / $ref->{exchangerate};
-      $form->{"checked_$i"} = "";
-      $form->{"paid_$i"} = "";
-
-      # need to format
-      for (qw(amount due)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) }
-    }
-    
-    $form->{rowcount} = $i;
-  }
-
-  $form->{amount} = $form->parse_amount(\%myconfig, $form->{amount});
-
-  # recalculate
-  $amount = 0;
-  for $i (1 .. $form->{rowcount}) {
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
-
-    if ($form->{"checked_$i"}) {
-      # calculate paid_$i
-      if (!$form->{"paid_$i"}) {
-	$form->{"paid_$i"} = $form->{"due_$i"};
-      }
-      
-      $amount += $form->{"paid_$i"};
-      $form->{redo} = 1;
-    } else {
-      $form->{"paid_$i"} = "";
-    }
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) }
-  }
-
-  $form->{amount} += ($amount - $form->{oldamount}) if $form->{redo};
-
-  &payments_header;
-  &invoices_due;
-  &payments_footer;
-  
-}
-
-
-sub update_payment {
-
-  if ($form->{vc} eq 'customer') {
-    $buysell = "buy";
-  } else {
-    $buysell = "sell";
-  }
-
-  $department = $form->{department};
-
-  # get customer/vendor
-  &check_openvc;
-  $form->{department} = $department;
-
-  if ($form->{datepaid} ne $form->{olddatepaid}) {
-    $form->{olddatepaid} = $form->{datepaid};
-    $form->{oldall_vc} = !$form->{oldall_vc} if $form->{all_vc};
-  }
-
-  if ($form->{department} ne $form->{olddepartment}) {
-    $form->{olddepartment} = $form->{department};
-    $form->{redo} = 1;
-  }
-  
-  # if we switched to all_vc
-  if ($form->{all_vc} ne $form->{oldall_vc}) {
-
-    if ($form->{"select$form->{vc}"}) {
-      $form->{redo} = ($form->{"old$name"} ne $form->{$name});
-    } else {
-      $form->{redo} = ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|);
-    }
-
-    $form->{"select$form->{vc}"} = "";
-
-    if ($form->{all_vc}) {
-      $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP}, undef, $form->{datepaid});
-      
-      if (@{ $form->{"all_$form->{vc}"} }) {
-	for (@{ $form->{"all_$form->{vc}"} }) { $form->{"select$form->{vc}"} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
-      }
-      
-    } else {
-      if (($myconfig{vclimit} * 1) > 0) {
-	$form->{$form->{vc}} = "";
-      }
-      
-      CP->get_openvc(\%myconfig, \%$form);
-
-      if (($myconfig{vclimit} * 1) > 0) {
-	$form->{"all_$form->{vc}"} = $form->{name_list};
-      }
-
-      if (@{ $form->{"all_$form->{vc}"} }) {
-	$newvc = qq|$form->{"all_$form->{vc}"}[0]->{name}--$form->{"all_$form->{vc}"}[0]->{id}|;
-	for (@{ $form->{"all_$form->{vc}"} }) { $form->{"select$form->{vc}"} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
-
-
-	# if the name is not the same
-	if ($form->{"select$form->{vc}"} !~ /$form->{$form->{vc}}/) {
-	  $form->{$form->{vc}} = $newvc;
-	  &check_openvc;
-	}
-      }
-    }
-
-    if (@{ $form->{all_language} }) {
-      $form->{selectlanguage} = "<option>\n";
-      for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|<option value="$_->{code}">$_->{description}\n| }
-    }
-
-  }
-
-  if ($new_name_selected || $form->{redo}) {
-    CP->get_openinvoices(\%myconfig, \%$form);
-    ($newvc) = split /--/, $form->{$form->{vc}};
-    $form->{"old$form->{vc}"} = qq|$newvc--$form->{"$form->{vc}_id"}|;;
-    $form->{redo} = 1;
-  }
-
-  if ($form->{currency} ne $form->{oldcurrency}) {
-    $form->{oldcurrency} = $form->{currency};
-    if (!$form->{redo}) {
-      CP->get_openinvoices(\%myconfig, \%$form);
-      $form->{redo} = 1;
-    }
-  }
-  
-  
-  $form->{exchangerate} = $exchangerate if ($form->{forex} = ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{datepaid}, $buysell)));
-
-  if ($form->{redo}) {
-    $form->{rowcount} = 0;
-
-    $i = 0;
-    foreach $ref (@{ $form->{PR} }) {
-      $i++;
-      $form->{"id_$i"} = $ref->{id};
-      $form->{"invnumber_$i"} = $ref->{invnumber};
-      $form->{"transdate_$i"} = $ref->{transdate};
-      $ref->{exchangerate} = 1 unless $ref->{exchangerate};
-      $form->{"amount_$i"} = $ref->{amount} / $ref->{exchangerate};
-      $form->{"due_$i"} = ($ref->{amount} - $ref->{paid}) / $ref->{exchangerate};
-      $form->{"checked_$i"} = "";
-      $form->{"paid_$i"} = "";
-
-      # need to format
-      for (qw(amount due)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) }
-    }
-    $form->{rowcount} = $i;
-  }
-
-  $form->{amount} = $form->parse_amount(\%myconfig, $form->{amount});
-
-  # recalculate
-  $amount = 0;
-  for $i (1 .. $form->{rowcount}) {
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
-
-    if ($form->{"checked_$i"}) {
-      # calculate paid_$i
-      if (!$form->{"paid_$i"}) {
-	$form->{"paid_$i"} = $form->{"due_$i"};
-      }
-      
-      $amount += $form->{"paid_$i"};
-      $form->{redo} = 1;
-    } else {
-      $form->{"paid_$i"} = "";
-    }
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) }
-  }
-
-  $form->{amount} += ($amount - $form->{oldamount}) if $form->{redo};
-
-  &payment_header;
-  &list_invoices;
-  &payment_footer;
-  
-}
-
-
-
-
-sub payment_header {
-
-  $vclabel = ucfirst $form->{vc};
-  $vclabel = $locale->text($vclabel);
-  
-  if ($form->{type} eq 'receipt') {
-    $form->{title} = $locale->text('Receipt');
-  }
-  if ($form->{type} eq 'check') {
-    $form->{title} = $locale->text('Payment');
-  }
-
-
-# $locale->text('Customer')
-# $locale->text('Vendor')
-
-  if ($form->{$form->{vc}} eq "") {
-    for (qw(address1 address2 city zipcode state country)) { $form->{$_} = "" }
-  }
-  
-  for ("$form->{vc}", "department") {
-    $form->{"select$_"} = $form->unescape($form->{"select$_"});
-    $form->{"select$_"} =~ s/ selected//;
-    $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
-  }
-  
-  for ("account", "currency", "$form->{ARAP}") {
-    $form->{"select$_"} =~ s/ selected//;
-    $form->{"select$_"} =~ s/option>\Q$form->{$_}\E/option selected>$form->{$_}/;
-  }
-
-  if ($form->{defaultcurrency}) {
-    $exchangerate = qq|
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Currency').qq|</th>
-		<td><select name=currency>$form->{selectcurrency}</select></td>
-		<input type=hidden name=selectcurrency value="$form->{selectcurrency}">
-		<input type=hidden name=oldcurrency value=$form->{oldcurrency}>
-	      </tr>
-|;
-  }
-
-  if ($form->{currency} ne $form->{defaultcurrency}) {
-    $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
-
-    if ($form->{forex}) {
-      $exchangerate .= qq|
- 	      <tr>
-		<th align=right nowrap>|.$locale->text('Exchange Rate').qq|</th>
-		<td colspan=3><input type=hidden name=exchangerate size=10 value=$form->{exchangerate}>$form->{exchangerate}</td>
-	      </tr>
-|;
-    } else {
-      $exchangerate .= qq|
- 	      <tr>
-		<th align=right nowrap>|.$locale->text('Exchange Rate').qq|</th>
-		<td colspan=3><input name=exchangerate size=10 value=$form->{exchangerate}></td>
-	      </tr>
-|;
-    }
-  }
-
-  $vc = ($form->{"select$form->{vc}"}) ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}\n</select>| : qq|<input name=$form->{vc} size=35 value="$form->{$form->{vc}}">|;
-
-  if ($form->{all_vc}) {
-    $allvc = "checked";
-  } else {
-    $allvc = "";
-  }
-  
-# $locale->text('AR')
-# $locale->text('AP')
-
-  $department = qq|
-              <tr>
-	        <th align="right" nowrap>|.$locale->text('Department').qq|</th>
-		<td><select name=department>$form->{selectdepartment}</select>
-		<input type=hidden name=selectdepartment value="|.$form->escape($form->{selectdepartment},1).qq|">
-	      </td>
-	    </tr>
-| if $form->{selectdepartment};
-
-  $form->header;
-
-  print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
-  $form->hide_form(qw(defaultcurrency closedto vc type ARAP arap title formname payment olddepartment));
-
-  print qq|
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr valign=top>
-	  <td>
-	    <table>
-	      <tr>
-	        <td align=right>
-		<input name=all_vc type=checkbox class=checkbox value=Y $allvc>
-		<input type=hidden name="oldall_vc" value="$form->{all_vc}"></td>
-		<th align=left>|.$locale->text('All').qq|</th>
-	      </tr>
-	      <tr>
-		<th align=right>$vclabel</th>
-		<td>$vc</td>
-                <input type=hidden name="select$form->{vc}" value="|.$form->escape($form->{"select$form->{vc}"},1).qq|">
-                <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
-		<input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
-	      </tr>
-	      <tr valign=top>
-		<th align=right nowrap>|.$locale->text('Address').qq|</th>
-		<td colspan=2>
-		  <table>
-		    <tr>
-		      <td>$form->{address1}</td>
-		    </tr>
-		    <tr>
-		      <td>$form->{address2}</td>
-		    </tr>
-		      <td>$form->{city}</td>
-		    </tr>
-		    </tr>
-		      <td>$form->{state}</td>
-		    </tr>
-		    </tr>
-		      <td>$form->{zipcode}</td>
-		    </tr>
-		    <tr>
-		      <td>$form->{country}</td>
-		    </tr>
-		  </table>
-		</td>
-		<input type=hidden name=address1 value="$form->{address1}">
-		<input type=hidden name=address2 value="$form->{address2}">
-		<input type=hidden name=city value="$form->{city}">
-		<input type=hidden name=state value="$form->{state}">
-		<input type=hidden name=zipcode value="$form->{zipcode}">
-		<input type=hidden name=country value="$form->{country}">
-	      </tr>
-	      <tr>
-		<th align=right>|.$locale->text('Memo').qq|</th>
-		<td colspan=2><input name="memo" size=30 value="$form->{memo}"></td>
-	      </tr>
-	    </table>
-	  </td>
-	  <td align=right>
-	    <table>
-	      $department
-	      <tr>
-	        <th align=right nowrap>|.$locale->text($form->{ARAP}).qq|</th>
-		<td colspan=3><select name=$form->{ARAP}>$form->{"select$form->{ARAP}"}</select>
-		</td>
-		<input type=hidden name="select$form->{ARAP}" value="$form->{"select$form->{ARAP}"}">
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Account').qq|</th>
-		<td colspan=3><select name=account>$form->{selectaccount}</select>
-		<input type=hidden name=selectaccount value="$form->{selectaccount}">
-		</td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Date').qq|</th>
-		<td><input name=datepaid value="$form->{datepaid}" title="$myconfig{dateformat}" size=11></td>
-		<input type=hidden name=olddatepaid value=$form->{olddatepaid}>
-	      </tr>
-	      $exchangerate
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Source').qq|</th>
-		<td colspan=3><input name=source value="$form->{source}" size=10></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Amount').qq|</th>
-		<td colspan=3><input name=amount size=10 value=|.$form->format_amount(\%myconfig, $form->{amount}, 2).qq|></td>
-		<input type=hidden name=oldamount value=$form->{amount}>
-	      </tr>
-	    </table>
-	  </td>
-	</tr>
-      </table>
-    </td>
-  </tr>
-|;
-
-}
-
-
-sub list_invoices {
-
-  @column_index = qw(invnumber transdate amount due checked paid);
-  
-  $colspan = $#column_index + 1;
-
-  $invoice = $locale->text('Invoices');
-  
-  print qq|
-  <input type=hidden name=column_index value="id @column_index">
-  <tr>
-    <td>
-      <table width=100%>
-	<tr>
-	  <th class=listheading colspan=$colspan>$invoice</th>
-	</tr>
-|;
-
-  $column_data{invnumber} = qq|<th nowrap>|.$locale->text('Invoice')."</th>";
-  $column_data{transdate} = qq|<th nowrap>|.$locale->text('Date')."</th>";
-  $column_data{amount} = qq|<th nowrap>|.$locale->text('Amount')."</th>";
-  $column_data{due} = qq|<th nowrap>|.$locale->text('Amount Due')."</th>";
-  $column_data{paid} = qq|<th nowrap>|.$locale->text('Amount')."</th>";
-  $column_data{checked} = qq|<th nowrap>|.$locale->text('Select')."</th>";
-  
-  print qq|
-        <tr>
-|;
-  for (@column_index) { print "$column_data{$_}\n" }
-  print qq|
-        </tr>
-|;
-
-  for $i (1 .. $form->{rowcount}) {
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
-    
-    $totalamount += $form->{"amount_$i"};
-    $totaldue += $form->{"due_$i"};
-    $totalpaid += $form->{"paid_$i"};
-
-    for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) }
-
-    $column_data{invnumber} = qq|<td>$form->{"invnumber_$i"}</td>
-      <input type=hidden name="invnumber_$i" value="$form->{"invnumber_$i"}">
-      <input type=hidden name="id_$i" value=$form->{"id_$i"}>|;
-    $column_data{transdate} = qq|<td width=15%>$form->{"transdate_$i"}</td>
-      <input type=hidden name="transdate_$i" value=$form->{"transdate_$i"}>|;
-    $column_data{amount} = qq|<td align=right width=15%>$form->{"amount_$i"}</td>
-      <input type=hidden name="amount_$i" value=$form->{"amount_$i"}>|;
-    $column_data{due} = qq|<td align=right width=15%>$form->{"due_$i"}</td>
-      <input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
-
-    $column_data{paid} = qq|<td align=right width=15%><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
-
-    $form->{"checked_$i"} = ($form->{"checked_$i"}) ? "checked" : "";
-    $column_data{checked} = qq|<td align=center width=10%><input name="checked_$i" type=checkbox class=checkbox $form->{"checked_$i"}></td>|;
-
-    $j++; $j %= 2;
-    print qq|
-	<tr class=listrow$j>
-|;
-    for (@column_index) { print "$column_data{$_}\n" }
-    print qq|
-        </tr>
-|;
-  }
-
-  for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
-  $column_data{amount} = qq|<th class=listtotal align=right>|.$form->format_amount(\%myconfig, $totalamount, 2, "&nbsp;").qq|</th>|;
-  $column_data{due} = qq|<th class=listtotal align=right>|.$form->format_amount(\%myconfig, $totaldue, 2, "&nbsp;").qq|</th>|;
-  $column_data{paid} = qq|<th class=listtotal align=right>|.$form->format_amount(\%myconfig, $totalpaid, 2, "&nbsp;").qq|</th>|;
-
-  print qq|
-        <tr class=listtotal>
-|;
-  for (@column_index) { print "$column_data{$_}\n" }
-  print qq|
-        </tr>
-      </table>
-    </td>
-  </tr>
-|;
-
-}
-
-
-sub payment_footer {
-
-  $form->{DF}{$form->{format}} = "selected";
-
-  $transdate = $form->datetonum(\%myconfig, $form->{datepaid});
-  $closedto = $form->datetonum(\%myconfig, $form->{closedto});
-
-  if ($latex) {
-    if ($form->{selectlanguage}) {
-      $form->{"selectlanguage"} = $form->unescape($form->{"selectlanguage"});
-      $form->{"selectlanguage"} =~ s/ selected//;
-      $form->{"selectlanguage"} =~ s/(<option value="\Q$form->{language_code}\E")/$1 selected/;
-      $lang = qq|<select name=language_code>$form->{selectlanguage}</select>
-      <input type=hidden name=selectlanguage value="|.
-      $form->escape($form->{selectlanguage},1).qq|">|;
-    }
-    
-    $media = qq|<select name=media>
-          <option value=screen>|.$locale->text('Screen');
-
-    if (%printer) {
-      for (sort keys %printer) { $media .= qq| 
-          <option value="$_">$_| }
-    }
-  
-    $media .= qq|</select>|;
-    $format = qq|<select name=format>
-            <option value=postscript $form->{DF}{postscript}>|.$locale->text('Postscript').qq|
-	    <option value=pdf $form->{DF}{pdf}>|.$locale->text('PDF').qq|</select>|;
-  }
-
-  print qq|
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-|;
-
-  %button = ('Update' => { ndx => 1, key => 'U', value => $locale->text('Update') },
-	     'Select all' => { ndx => 2, key => 'A', value => $locale->text('Select all') },
-             'Print' => { ndx => 3, key => 'P', value => $locale->text('Print') },
-	     'Post' => { ndx => 4, key => 'O', value => $locale->text('Post') },
-	    ); 
-
-  if (! $latex) {
-    delete $button{'Print'};
-  }
-
-  if ($transdate <= $closedto) {
-    for ('Post', 'Print') { delete $button{$_} }
-    $media = $format = "";
-  }
-
-  for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
-  
-  $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
-
-  print qq|
-  $lang
-  $format
-  $media
-|;
-
-  $form->hide_form(qw(callback rowcount path login sessionid));
- 
-  if ($form->{menubar}) {
-    require "$form->{path}/menu.pl";
-    &menubar;
-  }
-
-  print qq|
-  </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub post { &{"post_$form->{payment}"} }
-
-
-sub post_payments {
-  
-  if ($form->{currency} ne $form->{defaultcurrency}) {
-    $form->error($locale->text('Exchange rate missing!')) unless $form->{exchangerate};
-  }
-
-  if (CP->post_payments(\%myconfig, \%$form)) {
-    $form->redirect($locale->text('Payments posted!'));
-  } else {
-    $form->error($locale->text('Posting failed!'));
-  }
-
-}
-
-
-sub post_payment {
-  
-  &check_form;
-  
-  if ($form->{currency} ne $form->{defaultcurrency}) {
-    $form->error($locale->text('Exchange rate missing!')) unless $form->{exchangerate};
-  }
-
-  $msg1 = "$form->{title} posted!";
-  $msg2 = "Cannot post $form->{title}!";
-
-# $locale->text('Payment posted!')
-# $locale->text('Receipt posted!')
-# $locale->text('Cannot post Payment!')
-# $locale->text('Cannot post Receipt!')
-
-
-  $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
-
-  $source = $form->{source};
-  $source =~ s/(\d+)/$1 + 1/e;
-  
-  if ($form->{callback}) {
-    $form->{callback} .= "&source=$source";
-  }
-  
-  if (CP->post_payment(\%myconfig, \%$form)) {
-    $form->redirect($locale->text($msg1));
-  } else {
-    $form->error($locale->text($msg2));
-  }
-
-}
-
-
-sub print {
-  
-  &{ "print_$form->{payment}" };
-  &update if $form->{media} ne 'screen';
-  
-}
-
-
-sub print_payments {
-
-  $form->error($locale->text('Select postscript or PDF!')) if ($form->{format} !~ /(postscript|pdf)/);
-  
-  $SIG{INT} = 'IGNORE';
-
-  for (qw(company address)) { $form->{$_} = $myconfig{$_} }
-  $form->{address} =~ s/\\n/\n/g;
-
-  %oldform = ();
-  for (keys %$form) { $oldform{$_} = $form->{$_} };
-  
-  @a = qw(name company address text_amount text_decimal address1 address2 city state zipcode country memo);
-  for (@a) { $temp{$_} = $form->{$_} }
-
-  $form->format_string(@a);
-
-  $ok = 0;
-  $j = 0;
-  $temp{rowcount} = $form->{rowcount};
-  
-  for $i (1 .. $temp{rowcount}) {
-
-    if ($form->{"$form->{vc}_id_$i"} ne $form->{"$form->{vc}_id"}) {
-
-      $form->{rowcount} = $j;
-      for (1 .. $j) { $form->{"id_$_"} = $temp{"id_$_"} }
-      &print_form if $ok;
-
-      $ok = 0;
-      $j = 0;
-      $form->{amount} = 0;
-      for (qw(invnumber invdate due paid)) { @{ $form->{$_} } = () }
-      for (qw(language_code source memo)) { $form->{$_} = $form->{"${_}_$i"} }
-
-    }
-
-    if ($form->{"checked_$i"}) {
-      $j++;
-      $ok = 1;
-      $temp{"id_$j"} = $form->{"id_$i"};
-      $form->{"invdate_$i"} = $form->{"transdate_$i"};
-      for (qw(invnumber invdate due paid)) { push @{ $form->{$_} }, $form->{"${_}_$i"} }
-      $form->{amount} += $form->parse_amount(\%myconfig, $form->{"paid_$i"});
-      $form->{"$form->{vc}_id"} = $form->{"$form->{vc}_id_$i"};
-    }
-    
-  }
-
-  $form->{rowcount} = $j;
-  for (1 .. $j) { $form->{"id_$_"} = $temp{"id_$_"} }
-
-  &print_form if $ok;
-
-  for (keys %oldform) { $form->{$_} = $oldform{$_} }
-
-}
-
-
-sub print_form {
-       
-  $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
-  $c->init;
-
-  ($whole, $form->{decimal}) = split /\./, $form->{amount};
-  $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
-  $form->{decimal} .= "00";
-  $form->{decimal} = substr($form->{decimal}, 0, 2);
-  $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
-  $form->{text_amount} = $c->num2text($whole);
-  $form->{integer_amount} = $form->format_amount($myconfig, $whole);
-
-  $datepaid = $form->datetonum(\%myconfig, $form->{datepaid});
-  ($form->{yyyy}, $form->{mm}, $form->{dd}) = $datepaid =~ /(....)(..)(..)/;
-  
-  &{ "$form->{vc}_details" };
-
-  $form->{templates} = "$myconfig{templates}";
-  $form->{IN} = "$form->{formname}.tex";
-
-  if ($form->{media} ne 'screen') {
-    $form->{OUT} = "| $printer{$form->{media}}";
-  }
-
-  $form->parse_template(\%myconfig, $userspath);
-
-}
-
-
-sub print_payment {
- 
-  &check_form;
-  
-  for (qw(company address)) { $form->{$_} = $myconfig{$_} }
-  $form->{address} =~ s/\\n/\n/g;
-
-  @a = qw(name company address text_amount text_decimal address1 address2 city state zipcode country memo);
-
-  %temp = ();
-  for (@a) { $temp{$_} = $form->{$_} }
-
-  $form->format_string(@a);
-
-  &print_form;
-  
-  for (keys %temp) { $form->{$_} = $temp{$_} }
-
-}
-
-
-sub customer_details { IS->customer_details(\%myconfig, \%$form) };
-sub vendor_details { IR->vendor_details(\%myconfig, \%$form) };
-  
-
-sub check_form {
-  
-  &check_openvc;
-
-  if ($form->{currency} ne $form->{oldcurrency}) {
-    &update;
-    exit;
-  }
-  
-  $form->error($locale->text('Date missing!')) unless $form->{datepaid};
-
-  $closedto = $form->datetonum(\%myconfig, $form->{closedto});
-  $datepaid = $form->datetonum(\%myconfig, $form->{datepaid});
-  
-  $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto);
-
-  # this is just to format the year
-  $form->{datepaid} = $locale->date(\%myconfig, $form->{datepaid});
-  
-  $amount = $form->parse_amount(\%myconfig, $form->{amount});
-  $form->{amount} = $amount;
-  
-  for $i (1 .. $form->{rowcount}) {
-    if ($form->{"paid_$i"}) {
-      $amount -= $form->parse_amount(\%myconfig, $form->{"paid_$i"});
-      
-      push(@{ $form->{paid} }, $form->{"paid_$i"});
-      push(@{ $form->{due} }, $form->{"due_$i"});
-      push(@{ $form->{invnumber} }, $form->{"invnumber_$i"});
-      push(@{ $form->{invdate} }, $form->{"transdate_$i"});
-    }
-  }
-
-  if ($form->round_amount($amount, 2) != 0) {
-    push(@{ $form->{paid} }, $form->format_amount(\%myconfig, $amount, 2));
-    push(@{ $form->{due} }, $form->format_amount(\%myconfig, 0, "0"));
-    push(@{ $form->{invnumber} }, ($form->{ARAP} eq 'AR') ? $locale->text('Deposit') : $locale->text('Prepayment'));
-    push(@{ $form->{invdate} }, $form->{datepaid});
-  }
-   
-}
-
-
-sub check_openvc {
-
-  $name = $form->{vc};
-  ($new_name, $new_id) = split /--/, $form->{$name};
-  
-  if ($form->{all_vc}) {
-    if ($form->{"select$name"}) {
-      $ok = ($form->{"old$name"} ne $form->{$name});
-    } else {
-      $ok = ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|);
-    }
-
-    if ($ok) {
-      $form->{redo} = 1;
-      if ($form->{"select$name"}) {
-	$form->{"${name}_id"} = $new_id;
-	AA->get_name(\%myconfig, \%$form);
-	$form->{$name} = $form->{"old$name"} = "$new_name--$new_id";
-      } else {
-	&check_name($form->{vc});
-      }
-    }
-    
-  } else {
-    
-    # if we use a selection
-    if ($form->{"select$name"}) {
-      if ($form->{"old$name"} ne $form->{$name}) {
-
-	$form->{"${name}_id"} = $new_id;
-	AA->get_name(\%myconfig, \%$form);
-
-	$form->{$name} = $form->{"old$name"} = "$new_name--$new_id";
-        $form->{redo} = 1;
-      }
-    } else {
-
-      # check name, combine name and id
-      if ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|) {
-
-	# return one name or a list of names in $form->{name_list}
-	if (($rv = CP->get_openvc(\%myconfig, \%$form)) > 1) {
-	  $form->{redo} = 1;
-	  &select_name($name);
-	  exit;
-	}
-
-	if ($rv == 1) {
-	  # we got one name
-	  $form->{"${name}_id"} = $form->{name_list}[0]->{id};
-	  $form->{$name} = $form->{name_list}[0]->{name};
-	  $form->{"old$name"} = qq|$form->{$name}--$form->{"${name}_id"}|;
-
-	  AA->get_name(\%myconfig, \%$form);
-
-	} else {
-	  # nothing open
-	  $form->error($locale->text('Nothing open!'));
-	}
-	
-	$form->{redo} = 1;
-      }
-    }
-  }
-
-}
-
-
+require "bin/mozilla/cp.pl";

Modified: trunk/bin/lynx/ct.pl
===================================================================
--- trunk/bin/lynx/ct.pl	2006-09-10 18:35:50 UTC (rev 58)
+++ trunk/bin/lynx/ct.pl	2006-09-10 20:04:26 UTC (rev 59)
@@ -1,2496 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
+#!/usr/bin/perl
 
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed 
-# under the GNU General Public License version 2 or, at your option, any later 
-# version.  For a full list including contact information of contributors, 
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2001
-#
-#  Author: DWS Systems Inc.
-#     Web: http://www.sql-ledger.org
-#
-#  Contributors: Reed White <..hidden..>
-#
-#
-#  Author: DWS Systems Inc.
-#     Web: http://sourceforge.net/projects/ledger-smb/
-#
-#  Contributors: Reed White <..hidden..>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# customer/vendor module
-#
-#======================================================================
-
-use SL::CT;
-
-1;
-# end of main
-
-
-
-sub add {
-
-  $form->{title} = "Add";
-# $locale->text('Add Customer')
-# $locale->text('Add Vendor')
-
-  $form->{callback} = "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
-  CT->create_links(\%myconfig, \%$form);
-  
-  &form_header;
-  &form_footer;
-  
-}
-
-
-sub history {
-
-# $locale->text('Customer History')
-# $locale->text('Vendor History')
-
-  $history = 1;
-  $label = ucfirst $form->{db};
-  $label .= " History";
-
-  if ($form->{db} eq 'customer') {
-    $invlabel = $locale->text('Sales Invoices');
-    $ordlabel = $locale->text('Sales Orders');
-    $quolabel = $locale->text('Quotations');
-  } else {
-    $invlabel = $locale->text('Vendor Invoices');
-    $ordlabel = $locale->text('Purchase Orders');
-    $quolabel = $locale->text('Request for Quotations');
-  }
-  
-  $form->{title} = $locale->text($label);
-  
-  $form->{nextsub} = "list_history";
-
-  $transactions = qq|
- 	<tr>
-	  <td></td>
-	  <td>
-	    <table>
-	      <tr>
-	        <td>
-		  <table>
-		    <tr>
-		      <td><input name=type type=radio class=radio value=invoice checked> $invlabel</td>
-		    </tr>
-		    <tr>
-		      <td><input name=type type=radio class=radio value=order> $ordlabel</td>
-		    </tr>
-		    <tr>
-		      <td><input name="type" type=radio class=radio value=quotation> $quolabel</td>
-		    </tr>
-		  </table>
-		</td>
-		<td>
-		  <table>
-		    <tr>
-		      <th>|.$locale->text('From').qq|</th>
-		      <td><input name=transdatefrom size=11 title="$myconfig{dateformat}"></td>
-		      <th>|.$locale->text('To').qq|</th>
-		      <td><input name=transdateto size=11 title="$myconfig{dateformat}"></td>
-		    </tr>
-		    <tr>
-		      <td></td>
-		      <td colspan=3>
-	              <input name="open" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Open').qq|
-	              <input name="closed" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Closed').qq|
-		      </td>
-		    </tr>
-		  </table>
-		</td>
-	      </tr>
- 	    </table>
-	  </td>
-	</tr>
-|;
-
-  $include = qq|
-	<tr>
-	  <th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
-	  <td>
-	    <table>
-	      <tr>
-		<td><input name=history type=radio class=radio value=summary checked> |.$locale->text('Summary').qq|</td>
-		<td><input name=history type=radio class=radio value=detail> |.$locale->text('Detail').qq|
-		</td>
-	      </tr>
-	      <tr>
-		<td>
-		<input name="l_partnumber" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Part Number').qq|
-		</td>
-		<td>
-		<input name="l_description" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Description').qq|
-		</td>
-		<td>
-		<input name="l_sellprice" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Sell Price').qq|
-		</td>
-		<td>
-		<input name="l_curr" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Currency').qq|
-		</td>
-	      </tr>
-	      <tr>
-		<td>
-		<input name="l_qty" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Qty').qq|
-		</td>
-		<td>
-		<input name="l_unit" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Unit').qq|
-		</td>
-		<td>
-		<input name="l_discount" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Discount').qq|
-		</td>
-	      <tr>
-	      </tr>
-		<td>
-		<input name="l_deliverydate" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Delivery Date').qq|
-		</td>
-		<td>
-		<input name="l_projectnumber" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Project Number').qq|
-		</td>
-		<td>
-		<input name="l_serialnumber" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Serial Number').qq|
-		</td>
-	      </tr>
-	    </table>
-	  </td>
-	</tr>
-|;
-
-  &search_name;
-  
-  if ($form->{menubar}) {
-    require "$form->{path}/menu.pl";
-    &menubar;
-  }
-
-  print qq|
-</body>
-</html>
-|;
-
-}
-
-
-sub transactions {
-
-  if ($form->{db} eq 'customer') {
-    $translabel = $locale->text('AR Transactions');
-    $invlabel = $locale->text('Sales Invoices');
-    $ordlabel = $locale->text('Sales Orders');
-    $quolabel = $locale->text('Quotations');
-  } else {
-    $translabel = $locale->text('AP Transactions');
-    $invlabel = $locale->text('Vendor Invoices');
-    $ordlabel = $locale->text('Purchase Orders');
-    $quolabel = $locale->text('Request for Quotations');
-  }
-
- 
-  $transactions = qq|
- 	<tr>
-	  <td></td>
-	  <td>
-	    <table>
-	      <tr>
-	        <td>
-		  <table>
-		    <tr>
-		      <td><input name="l_transnumber" type=checkbox class=checkbox value=Y> $translabel</td>
-		    </tr>
-		    <tr>
-		      <td><input name="l_invnumber" type=checkbox class=checkbox value=Y> $invlabel</td>
-		    </tr>
-		    <tr>
-		      <td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> $ordlabel</td>
-		    </tr>
-		    <tr>
-		      <td><input name="l_quonumber" type=checkbox class=checkbox value=Y> $quolabel</td>
-		    </tr>
-		  </table>
-		</td>
-		<td>
-		  <table>
-		    <tr>
-		      <th>|.$locale->text('From').qq|</th>
-		      <td><input name=transdatefrom size=11 title="$myconfig{dateformat}"></td>
-		      <th>|.$locale->text('To').qq|</th>
-		      <td><input name=transdateto size=11 title="$myconfig{dateformat}"></td>
-		    </tr>
-		    <tr>
-		      <td></td>
-		      <td colspan=3>
-	              <input name="open" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Open').qq|
-	              <input name="closed" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Closed').qq|
-		      </td>
-		    </tr>
-		    <tr>
-		      <td></td>
-		      <td colspan=3>
-	              <input name="l_amount" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Amount').qq|
-	              <input name="l_tax" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Tax').qq|
-	              <input name="l_total" type=checkbox class=checkbox value=Y checked>&nbsp;|.$locale->text('Total').qq|
-	              <input name="l_subtotal" type=checkbox class=checkbox value=Y>&nbsp;|.$locale->text('Subtotal').qq|
-		      </td>
-		    </tr>
-		  </table>
-		</td>
-	      </tr>
- 	    </table>
-	  </td>
-	</tr>
-|;
-
-}
-
-
-sub include_in_report {
-  
-  $label = ucfirst $form->{db};
-
-  @a = ();
-  
-  push @a, qq|<input name="l_ndx" type=checkbox class=checkbox value=Y> |.$locale->text('No.');
-  push @a, qq|<input name="l_id" type=checkbox class=checkbox value=Y> |.$locale->text('ID');
-  push @a, qq|<input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |.$locale->text($label . ' Number');
-  push @a, qq|<input name="l_name" type=checkbox class=checkbox value=Y $form->{l_name}> |.$locale->text('Company Name');
-  push @a, qq|<input name="l_contact" type=checkbox class=checkbox value=Y $form->{l_contact}> |.$locale->text('Contact');
-  push @a, qq|<input name="l_email" type=checkbox class=checkbox value=Y $form->{l_email}> |.$locale->text('E-mail');
-  push @a, qq|<input name="l_address" type=checkbox class=checkbox value=Y> |.$locale->text('Address');
-  push @a, qq|<input name="l_city" type=checkbox class=checkbox value=Y> |.$locale->text('City');
-  push @a, qq|<input name="l_state" type=checkbox class=checkbox value=Y> |.$locale->text('State/Province');
-  push @a, qq|<input name="l_zipcode" type=checkbox class=checkbox value=Y> |.$locale->text('Zip/Postal Code');
-  push @a, qq|<input name="l_country" type=checkbox class=checkbox value=Y> |.$locale->text('Country');
-  push @a, qq|<input name="l_phone" type=checkbox class=checkbox value=Y $form->{l_phone}> |.$locale->text('Phone');
-  push @a, qq|<input name="l_fax" type=checkbox class=checkbox value=Y> |.$locale->text('Fax');
-  push @a, qq|<input name="l_cc" type=checkbox class=checkbox value=Y> |.$locale->text('Cc');
-  
-  if ($myconfig{role} =~ /(admin|manager)/) {
-    push @a, qq|<input name="l_bcc" type=checkbox class=checkbox value=Y> |.$locale->text('Bcc');
-  }
-
-  push @a, qq|<input name="l_notes" type=checkbox class=checkbox value=Y> |.$locale->text('Notes');
-  push @a, qq|<input name="l_discount" type=checkbox class=checkbox value=Y> |.$locale->text('Discount');
-  push @a, qq|<input name="l_taxaccount" type=checkbox class=checkbox value=Y> |.$locale->text('Tax Account');
-  push @a, qq|<input name="l_taxnumber" type=checkbox class=checkbox value=Y> |.$locale->text('Tax Number');
-  
-  if ($form->{db} eq 'customer') {
-    push @a, qq|<input name="l_employee" type=checkbox class=checkbox value=Y> |.$locale->text('Salesperson');
-    push @a, qq|<input name="l_manager" type=checkbox class=checkbox value=Y> |.$locale->text('Manager');
-    push @a, qq|<input name="l_pricegroup" type=checkbox class=checkbox value=Y> |.$locale->text('Pricegroup');
-
-  } else {
-    push @a, qq|<input name="l_employee" type=checkbox class=checkbox value=Y> |.$locale->text('Employee');
-    push @a, qq|<input name="l_manager" type=checkbox class=checkbox value=Y> |.$locale->text('Manager');
-    push @a, qq|<input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |.$locale->text('GIFI');
-
-  }
-
-  push @a, qq|<input name="l_sic_code" type=checkbox class=checkbox value=Y> |.$locale->text('SIC');
-  push @a, qq|<input name="l_iban" type=checkbox class=checkbox value=Y> |.$locale->text('IBAN');
-  push @a, qq|<input name="l_bic" type=checkbox class=checkbox value=Y> |.$locale->text('BIC');
-  push @a, qq|<input name="l_business" type=checkbox class=checkbox value=Y> |.$locale->text('Type of Business');
-  push @a, qq|<input name="l_terms" type=checkbox class=checkbox value=Y> |.$locale->text('Terms');
-  push @a, qq|<input name="l_language" type=checkbox class=checkbox value=Y> |.$locale->text('Language');
-  push @a, qq|<input name="l_startdate" type=checkbox class=checkbox value=Y> |.$locale->text('Startdate');
-  push @a, qq|<input name="l_enddate" type=checkbox class=checkbox value=Y> |.$locale->text('Enddate');
-
-   
-  $include = qq|
-	<tr>
-	  <th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
-	  <td>
-	    <table>
-|;
-
-  while (@a) {
-    $include .= qq|<tr>\n|;
-    for (1 .. 5) {
-      $include .= qq|<td nowrap>|. shift @a;
-      $include .= qq|</td>\n|;
-    }
-    $include .= qq|</tr>\n|;
-  }
-
-  $include .= qq|
-	    </table>
-	  </td>
-	</tr>
-|;
-
-}
-
-
-sub search {
-
-# $locale->text('Customers')
-# $locale->text('Vendors')
-
-  $form->{title} = $locale->text('Search') unless $form->{title};
-  
-  for (qw(name contact phone email)) { $form->{"l_$_"} = 'checked' }
-
-  $form->{nextsub} = "list_names";
-
-  $orphan = qq|
-	<tr>
-	  <td></td>
-	  <td><input name=status class=radio type=radio value=all checked>&nbsp;|.$locale->text('All').qq|
-	  <input name=status class=radio type=radio value=active>&nbsp;|.$locale->text('Active').qq|
-	  <input name=status class=radio type=radio value=inactive>&nbsp;|.$locale->text('Inactive').qq|
-	  <input name=status class=radio type=radio value=orphaned>&nbsp;|.$locale->text('Orphaned').qq|</td>
-	</tr>
-|;
-
-
-  &transactions;
-  &include_in_report;
-  &search_name;
-
-  if ($form->{menubar}) {
-    require "$form->{path}/menu.pl";
-    &menubar;
-  }
-
-  print qq|
-	      
-</body>
-</html>
-|;
-
-}
-
-
-sub search_name {
-
-  $label = ucfirst $form->{db};
-
-  if ($form->{db} eq 'customer') {
-    $employee = qq|
- 	  <th align=right nowrap>|.$locale->text('Salesperson').qq|</th>
-	  <td><input name=employee size=32></td>
-|;
-  }
-  if ($form->{db} eq 'vendor') {
-    $employee = qq|
- 	  <th align=right nowrap>|.$locale->text('Employee').qq|</th>
-	  <td><input name=employee size=32></td>
-|;
-  }
- 
- 
-  $form->header;
-  
-  print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=db value=$form->{db}>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr valign=top>
-    <td>
-      <table>
-	<tr valign=top>
-	  <td>
-	    <table>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Company Name').qq|</th>
-		<td><input name=name size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Contact').qq|</th>
-		<td><input name=contact size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('E-mail').qq|</th>
-		<td><input name=email size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Phone').qq|</th>
-		<td><input name=phone size=20></td>
-	      </tr>
-	      <tr>
-		$employee
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Notes').qq|</th>
-		<td colspan=3><textarea name=notes rows=3 cols=32></textarea></td>
-	      </tr>
-	    </table>
-	  </td>
-
-	  <td>
-	    <table>
-	      <tr>
-		<th align=right nowrap>|.$locale->text($label . ' Number').qq|</th>
-		<td><input name=$form->{db}number size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Address').qq|</th>
-		<td><input name=address size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('City').qq|</th>
-		<td><input name=city size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('State/Province').qq|</th>
-		<td><input name=state size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Zip/Postal Code').qq|</th>
-		<td><input name=zipcode size=10></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Country').qq|</th>
-		<td><input name=country size=32></td>
-	      </tr>
-	      <tr>
-		<th align=right nowrap>|.$locale->text('Startdate').qq|</th>
-		<td>|.$locale->text('From').qq| <input name=startdatefrom size=11 title="$myconfig{dateformat}"> |.$locale->text('To').qq| <input name=startdateto size=11 title="$myconfig{dateformat}"></td>
-	      </tr>
-	    </table>
-	  </td>
-	</tr>
-      </table>
-    </td>
-  </tr>
-
-  <tr>
-    <td>
-      <table>
-
-	$orphan
-	$transactions
-	$include
-
-      </table>
-    </td>
-  </tr>
-
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<input type=hidden name=nextsub value=$form->{nextsub}>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-</form>
-|;
-
-}
-
-
-sub list_names {
-
-  CT->search(\%myconfig, \%$form);
-  
-  $href = "$form->{script}?action=list_names&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&l_subtotal=$form->{l_subtotal}";
-  
-  $form->sort_order();
-  
-  $callback = "$form->{script}?action=list_names&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&l_subtotal=$form->{l_subtotal}";
-  
-  @columns = $form->sort_columns(id, name, "$form->{db}number", address,
-                                 city, state, zipcode, country, contact,
-				 phone, fax, email, cc, bcc, employee,
-				 manager, notes, discount, terms,
-				 taxaccount, taxnumber, gifi_accno, sic_code, business,
-				 pricegroup, language, iban, bic,
-				 startdate, enddate,
-				 invnumber, invamount, invtax, invtotal,
-				 ordnumber, ordamount, ordtax, ordtotal,
-				 quonumber, quoamount, quotax, quototal);
-  unshift @columns, "ndx";
-  
-  $form->{l_invnumber} = "Y" if $form->{l_transnumber};
-  foreach $item (qw(inv ord quo)) {
-    if ($form->{"l_${item}number"}) {
-      for (qw(amount tax total)) { $form->{"l_$item$_"} = $form->{"l_$_"} }
-      $removeemployee = 1;
-      $openclosed = 1;
-    }
-  }
-  $form->{open} = $form->{closed} = "" if !$openclosed;
-
-
-  foreach $item (@columns) {
-    if ($form->{"l_$item"} eq "Y") {
-      push @column_index, $item;
-
-      # add column to href and callback
-      $callback .= "&l_$item=Y";
-      $href .= "&l_$item=Y";
-    }
-  }
-  
-  foreach $item (qw(amount tax total transnumber)) {
-    if ($form->{"l_$item"} eq "Y") { 
-      $callback .= "&l_$item=Y"; 
-      $href .= "&l_$item=Y"; 
-    }
-  }
-
-
-  if ($form->{status} eq 'all') {
-    $option = $locale->text('All');
-  }
-  if ($form->{status} eq 'orphaned') {
-    $option = $locale->text('Orphaned');
-  }
-  if ($form->{status} eq 'active') {
-    $option = $locale->text('Active');
-  }
-  if ($form->{status} eq 'inactive') {
-    $option = $locale->text('Inactive');
-  }
-
-  if ($form->{name}) {
-    $callback .= "&name=".$form->escape($form->{name},1);
-    $href .= "&name=".$form->escape($form->{name});
-    $option .= "\n<br>".$locale->text('Name')." : $form->{name}";
-  }
-  if ($form->{address}) {
-    $callback .= "&address=".$form->escape($form->{address},1);
-    $href .= "&address=".$form->escape($form->{address});
-    $option .= "\n<br>".$locale->text('Address')." : $form->{address}";
-  }
-  if ($form->{city}) {
-    $callback .= "&city=".$form->escape($form->{city},1);
-    $href .= "&city=".$form->escape($form->{city});
-    $option .= "\n<br>".$locale->text('City')." : $form->{city}";
-  }
-  if ($form->{state}) {
-    $callback .= "&state=".$form->escape($form->{state},1);
-    $href .= "&state=".$form->escape($form->{state});
-    $option .= "\n<br>".$locale->text('State')." : $form->{state}";
-  }
-  if ($form->{zipcode}) {
-    $callback .= "&zipcode=".$form->escape($form->{zipcode},1);
-    $href .= "&zipcode=".$form->escape($form->{zipcode});
-    $option .= "\n<br>".$locale->text('Zip/Postal Code')." : $form->{zipcode}";
-  }
-  if ($form->{country}) {
-    $callback .= "&country=".$form->escape($form->{country},1);
-    $href .= "&country=".$form->escape($form->{country});
-    $option .= "\n<br>".$locale->text('Country')." : $form->{country}";
-  }
-  if ($form->{contact}) {
-    $callback .= "&contact=".$form->escape($form->{contact},1);
-    $href .= "&contact=".$form->escape($form->{contact});
-    $option .= "\n<br>".$locale->text('Contact')." : $form->{contact}";
-  }
-  if ($form->{employee}) {
-    $callback .= "&employee=".$form->escape($form->{employee},1);
-    $href .= "&employee=".$form->escape($form->{employee});
-    $option .= "\n<br>";
-    if ($form->{db} eq 'customer') {
-      $option .= $locale->text('Salesperson');
-    }
-    if ($form->{db} eq 'vendor') {
-      $option .= $locale->text('Employee');
-    }
-    $option .= " : $form->{employee}";
-  }
-
-  $fromdate = "";
-  $todate = "";
-  if ($form->{startdatefrom}) {
-    $callback .= "&startdatefrom=$form->{startdatefrom}";
-    $href .= "&startdatefrom=$form->{startdatefrom}";
-    $fromdate = $locale->date(\%myconfig, $form->{startdatefrom}, 1);
-  }
-  if ($form->{startdateto}) {
-    $callback .= "&startdateto=$form->{startdateto}";
-    $href .= "&startdateto=$form->{startdateto}";
-    $todate = $locale->date(\%myconfig, $form->{startdateto}, 1);
-  }
-  if ($fromdate || $todate) {
-    $option .= "\n<br>".$locale->text('Startdate')." $fromdate - $todate";
-  }
-  
-  if ($form->{notes}) {
-    $callback .= "&notes=".$form->escape($form->{notes},1);
-    $href .= "&notes=".$form->escape($form->{notes});
-    $option .= "\n<br>".$locale->text('Notes')." : $form->{notes}";
-  }
-  if ($form->{"$form->{db}number"}) {
-    $callback .= qq|&$form->{db}number=|.$form->escape($form->{"$form->{db}number"},1);
-    $href .= "&$form->{db}number=".$form->escape($form->{"$form->{db}number"});
-    $option .= "\n<br>".$locale->text('Number').qq| : $form->{"$form->{db}number"}|;
-  }
-  if ($form->{phone}) {
-    $callback .= "&phone=".$form->escape($form->{phone},1);
-    $href .= "&phone=".$form->escape($form->{phone});
-    $option .= "\n<br>".$locale->text('Phone')." : $form->{phone}";
-  }
-  if ($form->{email}) {
-    $callback .= "&email=".$form->escape($form->{email},1);
-    $href .= "&email=".$form->escape($form->{email});
-    $option .= "\n<br>".$locale->text('E-mail')." : $form->{email}";
-  }
-  if ($form->{transdatefrom}) {
-    $callback .= "&transdatefrom=$form->{transdatefrom}";
-    $href .= "&transdatefrom=$form->{transdatefrom}";
-    $option .= "\n<br>" if ($option);
-    $option .= $locale->text('From')."&nbsp;".$locale->date(\%myconfig, $form->{transdatefrom}, 1);
-  }
-  if ($form->{transdateto}) {
-    $callback .= "&transdateto=$form->{transdateto}";
-    $href .= "&transdateto=$form->{transdateto}";
-    if ($form->{transdatefrom}) {
-      $option .= " ";
-    } else {
-      $option .= "\n<br>" if ($option);
-    }
-    $option .= $locale->text('To')."&nbsp;".$locale->date(\%myconfig, $form->{transdateto}, 1);
-  }
-  if ($form->{open}) {
-    $callback .= "&open=$form->{open}";
-    $href .= "&open=$form->{open}";
-    $option .= "\n<br>" if ($option);
-    $option .= $locale->text('Open');
-  }
-  if ($form->{closed}) {
-    $callback .= "&closed=$form->{closed}";
-    $href .= "&closed=$form->{closed}";
-    $option .= "\n<br>" if ($option);
-    $option .= $locale->text('Closed');
-  }
-  
-
-  $form->{callback} = "$callback&sort=$form->{sort}";
-  $callback = $form->escape($form->{callback});
-  
-  $column_header{ndx} = qq|<th class=listheading>&nbsp;</th>|;
-  $column_header{id} = qq|<th class=listheading>|.$locale->text('ID').qq|</th>|;
-  $column_header{"$form->{db}number"} = qq|<th><a class=listheading href=$href&sort=$form->{db}number>|.$locale->text('Number').qq|</a></th>|;
-  $column_header{name} = qq|<th><a class=listheading href=$href&sort=name>|.$locale->text('Name').qq|</a></th>|;
-  $column_header{address} = qq|<th class=listheading>|.$locale->text('Address').qq|</th>|;
-  $column_header{city} = qq|<th><a class=listheading href=$href&sort=city>|.$locale->text('City').qq|</a></th>|;
-  $column_header{state} = qq|<th><a class=listheading href=$href&sort=state>|.$locale->text('State/Province').qq|</a></th>|;
-  $column_header{zipcode} = qq|<th><a class=listheading href=$href&sort=zipcode>|.$locale->text('Zip/Postal Code').qq|</a></th>|;
-  $column_header{country} = qq|<th><a class=listheading href=$href&sort=country>|.$locale->text('Country').qq|</a></th>|;
-  $column_header{contact} = qq|<th><a class=listheading href=$href&sort=contact>|.$locale->text('Contact').qq|</a></th>|;
-  $column_header{phone} = qq|<th><a class=listheading href=$href&sort=phone>|.$locale->text('Phone').qq|</a></th>|;
-  $column_header{fax} = qq|<th><a class=listheading href=$href&sort=fax>|.$locale->text('Fax').qq|</a></th>|;
-  $column_header{email} = qq|<th><a class=listheading href=$href&sort=email>|.$locale->text('E-mail').qq|</a></th>|;
-  $column_header{cc} = qq|<th><a class=listheading href=$href&sort=cc>|.$locale->text('Cc').qq|</a></th>|;
-  $column_header{bcc} = qq|<th><a class=listheading href=$href&sort=cc>|.$locale->text('Bcc').qq|</a></th>|;
-  $column_header{notes} = qq|<th><a class=listheading href=$href&sort=notes>|.$locale->text('Notes').qq|</a></th>|;
-  $column_header{discount} = qq|<th class=listheading>%</th>|;
-  $column_header{terms} = qq|<th class=listheading>|.$locale->text('Terms').qq|</th>|;
-  
-  $column_header{taxnumber} = qq|<th><a class=listheading href=$href&sort=taxnumber>|.$locale->text('Tax Number').qq|</a></th>|;
-  $column_header{taxaccount} = qq|<th class=listheading>|.$locale->text('Tax Account').qq|</th>|;
-  $column_header{gifi_accno} = qq|<th><a class=listheading href=$href&sort=gifi_accno>|.$locale->text('GIFI').qq|</a></th>|;
-  $column_header{sic_code} = qq|<th><a class=listheading href=$href&sort=sic_code>|.$locale->text('SIC').qq|</a></th>|;
-  $column_header{business} = qq|<th><a class=listheading href=$href&sort=business>|.$locale->text('Type of Business').qq|</a></th>|;
-  $column_header{iban} = qq|<th class=listheading>|.$locale->text('IBAN').qq|</th>|;
-  $column_header{bic} = qq|<th class=listheading>|.$locale->text('BIC').qq|</th>|;
-  $column_header{startdate} = qq|<th><a class=listheading href=$href&sort=startdate>|.$locale->text('Startdate').qq|</a></th>|;
-  $column_header{enddate} = qq|<th><a class=listheading href=$href&sort=enddate>|.$locale->text('Enddate').qq|</a></th>|;
-  
-  $column_header{invnumber} = qq|<th><a class=listheading href=$href&sort=invnumber>|.$locale->text('Invoice').qq|</a></th>|;
-  $column_header{ordnumber} = qq|<th><a class=listheading href=$href&sort=ordnumber>|.$locale->text('Order').qq|</a></th>|;
-  $column_header{quonumber} = qq|<th><a class=listheading href=$href&sort=quonumber>|.$locale->text('Quotation').qq|</a></th>|;
-
-  if ($form->{db} eq 'customer') {
-    $column_header{employee} = qq|<th><a class=listheading href=$href&sort=employee>|.$locale->text('Salesperson').qq|</a></th>|;
-  } else {
-    $column_header{employee} = qq|<th><a class=listheading href=$href&sort=employee>|.$locale->text('Employee').qq|</a></th>|;
-  }
-  $column_header{manager} = qq|<th><a class=listheading href=$href&sort=manager>|.$locale->text('Manager').qq|</a></th>|;
-
-  $column_header{pricegroup} = qq|<th><a class=listheading href=$href&sort=pricegroup>|.$locale->text('Pricegroup').qq|</a></th>|;
-  $column_header{language} = qq|<th><a class=listheading href=$href&sort=language>|.$locale->text('Language').qq|</a></th>|;
-  
-
-  $amount = $locale->text('Amount');
-  $tax = $locale->text('Tax');
-  $total = $locale->text('Total');
-  
-  $column_header{invamount} = qq|<th class=listheading>$amount</th>|;
-  $column_header{ordamount} = qq|<th class=listheading>$amount</th>|;
-  $column_header{quoamount} = qq|<th class=listheading>$amount</th>|;
-  
-  $column_header{invtax} = qq|<th class=listheading>$tax</th>|;
-  $column_header{ordtax} = qq|<th class=listheading>$tax</th>|;
-  $column_header{quotax} = qq|<th class=listheading>$tax</th>|;
-  
-  $column_header{invtotal} = qq|<th class=listheading>$total</th>|;
-  $column_header{ordtotal} = qq|<th class=listheading>$total</th>|;
-  $column_header{quototal} = qq|<th class=listheading>$total</th>|;
- 
-
-  if ($form->{status}) {
-    $label = ucfirst $form->{db}."s";
-    $form->{title} = $locale->text($label);
-  } else {
-    $label = ucfirst $form->{db};
-    $form->{title} = $locale->text($label ." Transactions");
-  }
-
-  $form->header;
-
-  print qq|
-<body>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>$option</td>
-  </tr>
-  <tr>
-    <td>
-      <table width=100%>
-	<tr class=listheading>
-|;
-
-  for (@column_index) { print "$column_header{$_}\n" }
-
-  print qq|
-        </tr>
-|;
-
-  $ordertype = ($form->{db} eq 'customer') ? 'sales_order' : 'purchase_order';
-  $quotationtype = ($form->{db} eq 'customer') ? 'sales_quotation' : 'request_quotation';
-  $subtotal = 0;
-
-  $i = 0;
-  foreach $ref (@{ $form->{CT} }) {
-
-    if ($ref->{$form->{sort}} ne $sameitem && $form->{l_subtotal}) {
-      # print subtotal
-      if ($subtotal) {
-	for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-	&list_subtotal;
-      }
-    }
-
-    if ($ref->{id} eq $sameid) {
-      for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-    } else {
-    
-      $i++;
-      
-      $ref->{notes} =~ s/\r?\n/<br>/g;
-      for (@column_index) { $column_data{$_} = "<td>$ref->{$_}&nbsp;</td>" }
-
-      $column_data{ndx} = "<td align=right>$i</td>";
-      
-      if ($ref->{$form->{sort}} eq $sameitem) {
-	$column_data{$form->{sort}} = "<td>&nbsp;</td>";
-      }
-	
-      $column_data{address} = "<td>$ref->{address1} $ref->{address2}&nbsp;</td>";
-      $column_data{name} = "<td><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&callback=$callback>$ref->{name}&nbsp;</td>";
-
-      $email = "";
-      if ($form->{sort} =~ /(email|cc)/) {
-	if ($ref->{$form->{sort}} ne $sameitem) {
-	  $email = 1;
-	}
-      } else {
-	$email = 1;
-      }
-      
-      if ($email) {
-	foreach $item (qw(email cc bcc)) {
-	  if ($ref->{$item}) {
-	    $email = $ref->{$item};
-	    $email =~ s/</\&lt;/;
-	    $email =~ s/>/\&gt;/;
-	    
-	    $column_data{$item} = qq|<td><a href="mailto:$ref->{$item}">$email</a></td>|;
-	  }
-	}
-      }
-    }
-    
-    if ($ref->{formtype} eq 'invoice') {
-      $column_data{invnumber} = "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{invnumber}&nbsp;</td>";
-      
-      $column_data{invamount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{netamount}, 2, "&nbsp;")."</td>";
-      $column_data{invtax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, "&nbsp;")."</td>";
-      $column_data{invtotal} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount}, 2, "&nbsp;")."</td>";
-
-      $invamountsubtotal += $ref->{netamount};
-      $invtaxsubtotal += ($ref->{amount} - $ref->{netamount});
-      $invtotalsubtotal += $ref->{amount};
-      $subtotal = 1;
-    }
-     
-    if ($ref->{formtype} eq 'order') {
-      $column_data{ordnumber} = "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$ordertype&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{ordnumber}&nbsp;</td>";
-      
-      $column_data{ordamount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{netamount}, 2, "&nbsp;")."</td>";
-      $column_data{ordtax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, "&nbsp;")."</td>";
-      $column_data{ordtotal} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount}, 2, "&nbsp;")."</td>";
-
-      $ordamountsubtotal += $ref->{netamount};
-      $ordtaxsubtotal += ($ref->{amount} - $ref->{netamount});
-      $ordtotalsubtotal += $ref->{amount};
-      $subtotal = 1;
-    }
-
-    if ($ref->{formtype} eq 'quotation') {
-      $column_data{quonumber} = "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$quotationtype&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{quonumber}&nbsp;</td>";
-      
-      $column_data{quoamount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{netamount}, 2, "&nbsp;")."</td>";
-      $column_data{quotax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, "&nbsp;")."</td>";
-      $column_data{quototal} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount}, 2, "&nbsp;")."</td>";
-
-      $quoamountsubtotal += $ref->{netamount};
-      $quotaxsubtotal += ($ref->{amount} - $ref->{netamount});
-      $quototalsubtotal += $ref->{amount};
-      $subtotal = 1;
-    }
-    
-    if ($sameid ne "$ref->{id}") {
-      if ($form->{l_discount}) {
-	$column_data{discount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{discount} * 100, "", "&nbsp;")."</td>";
-      }
-      if ($form->{l_terms}) {
-	$column_data{terms} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{terms}, "", "&nbsp;")."</td>";
-      }
-    }
-   
-    $j++; $j %= 2;
-    print "
-        <tr class=listrow$j>
-";
-
-    for (@column_index) { print "$column_data{$_}\n" }
-
-    print qq|
-        </tr>
-|;
-    
-    $sameitem = "$ref->{$form->{sort}}";
-    $sameid = $ref->{id};
-
-  }
-
-  if ($form->{l_subtotal} && $subtotal) {
-    for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-    &list_subtotal;
-  }
-  
-  $i = 1;
-  if ($myconfig{acs} !~ /AR--AR/) {
-    if ($form->{db} eq 'customer') {
-      $button{'AR--Customers--Add Customer'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Add Customer').qq|"> |;
-      $button{'AR--Customers--Add Customer'}{order} = $i++;
-    }
-  }
-  if ($myconfig{acs} !~ /AP--AP/) {
-    if ($form->{db} eq 'vendor') {
-      $button{'AP--Vendors--Add Vendor'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Add Vendor').qq|"> |;
-      $button{'AP--Vendors--Add Vendor'}{order} = $i++;
-    }
-  }
-  
-  foreach $item (split /;/, $myconfig{acs}) {
-    delete $button{$item};
-  }
-  
-  print qq|
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
-  $form->hide_form(qw(callback db path login sessionid));
-  
-  if ($form->{status}) {
-    foreach $item (sort { $a->{order} <=> $b->{order} } %button) {
-      print $item->{code};
-    }
-  }
-
-  if ($form->{menubar}) {
-    require "$form->{path}/menu.pl";
-    &menubar;
-  }
-
-  print qq|
-  </form>
-
-</body>
-</html>
-|;
- 
-}
-
-
-sub list_subtotal {
-
-	$column_data{invamount} = "<td align=right>".$form->format_amount(\%myconfig, $invamountsubtotal, 2, "&nbsp;")."</td>";
-	$column_data{invtax} = "<td align=right>".$form->format_amount(\%myconfig, $invtaxsubtotal, 2, "&nbsp;")."</td>";
-	$column_data{invtotal} = "<td align=right>".$form->format_amount(\%myconfig, $invtotalsubtotal, 2, "&nbsp;")."</td>";
-
-	$invamountsubtotal = 0;
-	$invtaxsubtotal = 0;
-	$invtotalsubtotal = 0;
-
-	$column_data{ordamount} = "<td align=right>".$form->format_amount(\%myconfig, $ordamountsubtotal, 2, "&nbsp;")."</td>";
-	$column_data{ordtax} = "<td align=right>".$form->format_amount(\%myconfig, $ordtaxsubtotal, 2, "&nbsp;")."</td>";
-	$column_data{ordtotal} = "<td align=right>".$form->format_amount(\%myconfig, $ordtotalsubtotal, 2, "&nbsp;")."</td>";
-
-	$ordamountsubtotal = 0;
-	$ordtaxsubtotal = 0;
-	$ordtotalsubtotal = 0;
-
-	$column_data{quoamount} = "<td align=right>".$form->format_amount(\%myconfig, $quoamountsubtotal, 2, "&nbsp;")."</td>";
-	$column_data{quotax} = "<td align=right>".$form->format_amount(\%myconfig, $quotaxsubtotal, 2, "&nbsp;")."</td>";
-	$column_data{quototal} = "<td align=right>".$form->format_amount(\%myconfig, $quototalsubtotal, 2, "&nbsp;")."</td>";
-
-	$quoamountsubtotal = 0;
-	$quotaxsubtotal = 0;
-	$quototalsubtotal = 0;
-	
-	print "
-        <tr class=listsubtotal>
-";
-	for (@column_index) { print "$column_data{$_}\n" }
-
-	print qq|
-        </tr>
-|;
- 
-
-}
-
-
-sub list_history {
-  
-  CT->get_history(\%myconfig, \%$form);
-  
-  $href = "$form->{script}?action=list_history&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&history=$form->{history}";
-
-  $form->sort_order();
-  
-  $callback = "$form->{script}?action=list_history&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&history=$form->{history}";
-  
-  $form->{l_fxsellprice} = $form->{l_curr};
-  @columns = $form->sort_columns(partnumber, description, qty, unit, sellprice, fxsellprice, curr, discount, deliverydate, projectnumber, serialnumber);
-
-  if ($form->{history} eq 'summary') {
-    @columns = $form->sort_columns(partnumber, description, qty, unit, sellprice, curr);
-  }
-
-  foreach $item (@columns) {
-    if ($form->{"l_$item"} eq "Y") {
-      push @column_index, $item;
-
-      # add column to href and callback
-      $callback .= "&l_$item=Y";
-      $href .= "&l_$item=Y";
-    }
-  }
-  
-  if ($form->{history} eq 'detail') {
-    $option = $locale->text('Detail');
-  }
-  if ($form->{history} eq 'summary') {
-    $option .= $locale->text('Summary');
-  }
-  if ($form->{name}) {
-    $callback .= "&name=".$form->escape($form->{name},1);
-    $href .= "&name=".$form->escape($form->{name});
-    $option .= "\n<br>".$locale->text('Name')." : $form->{name}";
-  }
-  if ($form->{contact}) {
-    $callback .= "&contact=".$form->escape($form->{contact},1);
-    $href .= "&contact=".$form->escape($form->{contact});
-    $option .= "\n<br>".$locale->text('Contact')." : $form->{contact}";
-  }
-  if ($form->{"$form->{db}number"}) {
-    $callback .= qq|&$form->{db}number=|.$form->escape($form->{"$form->{db}number"},1);
-    $href .= "&$form->{db}number=".$form->escape($form->{"$form->{db}number"});
-    $option .= "\n<br>".$locale->text('Number').qq| : $form->{"$form->{db}number"}|;
-  }
-  if ($form->{email}) {
-    $callback .= "&email=".$form->escape($form->{email},1);
-    $href .= "&email=".$form->escape($form->{email});
-    $option .= "\n<br>".$locale->text('E-mail')." : $form->{email}";
-  }
-  if ($form->{transdatefrom}) {
-    $callback .= "&transdatefrom=$form->{transdatefrom}";
-    $href .= "&transdatefrom=$form->{transdatefrom}";
-    $option .= "\n<br>" if ($option);
-    $option .= $locale->text('From')."&nbsp;".$locale->date(\%myconfig, $form->{transdatefrom}, 1);
-  }
-  if ($form->{transdateto}) {
-    $callback .= "&transdateto=$form->{transdateto}";
-    $href .= "&transdateto=$form->{transdateto}";
-    if ($form->{transdatefrom}) {
-      $option .= " ";
-    } else {
-      $option .= "\n<br>" if ($option);
-    }
-    $option .= $locale->text('To')."&nbsp;".$locale->date(\%myconfig, $form->{transdateto}, 1);
-  }
-  if ($form->{open}) {
-    $callback .= "&open=$form->{open}";
-    $href .= "&open=$form->{open}";
-    $option .= "\n<br>" if ($option);
-    $option .= $locale->text('Open');
-  }
-  if ($form->{closed}) {
-    $callback .= "&closed=$form->{closed}";
-    $href .= "&closed=$form->{closed}";
-    $option .= "\n<br>" if ($option);
-    $option .= $locale->text('Closed');
-  }
-
-
-  $form->{callback} = "$callback&sort=$form->{sort}";
-  $callback = $form->escape($form->{callback});
-
-  $column_header{partnumber} = qq|<th><a class=listheading href=$href&sort=partnumber>|.$locale->text('Part Number').qq|</a></th>|;
-  $column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
-
-  if ($form->{history} eq 'summary') {
-    $column_header{sellprice} = qq|<th class=listheading>|.$locale->text('Total').qq|</th>|;
-  } else {
-    $column_header{sellprice} = qq|<th class=listheading>|.$locale->text('Sell Price').qq|</th>|;
-  }
-  $column_header{fxsellprice} = qq|<th>&nbsp;</th>|;
-  
-  $column_header{curr} = qq|<th class=listheading>|.$locale->text('Curr').qq|</th>|;
-  $column_header{discount} = qq|<th class=listheading>|.$locale->text('Discount').qq|</th>|;
-  $column_header{qty} = qq|<th class=listheading>|.$locale->text('Qty').qq|</th>|;
-  $column_header{unit} = qq|<th class=listheading>|.$locale->text('Unit').qq|</th>|;
-  $column_header{deliverydate} = qq|<th><a class=listheading href=$href&sort=deliverydate>|.$locale->text('Delivery Date').qq|</a></th>|;
-  $column_header{projectnumber} = qq|<th><a class=listheading href=$href&sort=projectnumber>|.$locale->text('Project Number').qq|</a></th>|;
-  $column_header{serialnumber} = qq|<th><a class=listheading href=$href&sort=serialnumber>|.$locale->text('Serial Number').qq|</a></th>|;
-  
-
-# $locale->text('Customer History')
-# $locale->text('Vendor History')
-
-  $label = ucfirst $form->{db};
-  $form->{title} = $locale->text($label." History");
-
-  $colspan = $#column_index + 1;
-
-  $form->header;
-
-  print qq|
-<body>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>$option</td>
-  </tr>
-  <tr>
-    <td>
-      <table width=100%>
-	<tr class=listheading>
-|;
-
-  for (@column_index) { print "$column_header{$_}\n" }
-
-  print qq|
-        </tr>
-|;
-
-
-  $module = 'oe';
-  if ($form->{db} eq 'customer') {
-    $invlabel = $locale->text('Sales Invoice');
-    $ordlabel = $locale->text('Sales Order');
-    $quolabel = $locale->text('Quotation');
-    
-    $ordertype = 'sales_order';
-    $quotationtype = 'sales_quotation';
-    if ($form->{type} eq 'invoice') {
-      $module = 'is';
-    }
-  } else {
-    $invlabel = $locale->text('Vendor Invoice');
-    $ordlabel = $locale->text('Purchase Order');
-    $quolabel = $locale->text('RFQ');
-    
-    $ordertype = 'purchase_order';
-    $quotationtype = 'request_quotation';

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.