|
From: <ka...@sp...> - 2001-10-10 06:51:49
|
Hello!
I have been working on customising SQL-ledger to work both as an accounting system and also as a school registration system. I have customised the "Customer" renamed and separated the (Sub search) in ct.pl & CT.pm to (sub s_student) & (sub_vendor) since it is used to search the customer and the vendor.
I was also advised to adjust the link from the menu.pl. However, when i try access the search page and the add page from the menu i get an "Internal server error". The error.log says it was due to a "Premature end of script". I have not managed to locate the script the server is meaning.
I have attached copies of the menu.pl, ct.pl & CT.pm so you can see the adjustments i made. Sir, i will appreciate any advise you can offer. My problem is i am not at all good at perl but i am tying to learn along the way. Otherwise i like the simple structure of SQL-ledger.
Thanks.
Kaziro E
THE MENU.PL, CT.PL & CT.PM FOLLOW BELOW::::
# MENU.PL
#######################################################################
use SL::Form;
$form = new Form;
if ($form->{action}) {
require("$userspath/$form->{login}.conf");
map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset);
$locale = new Locale $myconfig{countrycode}, "menu";
if ($form->{stylesheet}) {
$form->{stylesheet} = qq|<link rel="stylesheet" href="$form->{stylesheet}" type="text/css" title="SQL-Ledger style sheet">|;
}
if ($form->{charset}) {
$form->{charset} = qq|<meta http-equiv="charset" content="$form->{charset}">|;
}
&{ $form->{action} };
} else {
$form->error("action= not defined!");
}
# end of main
sub display {
$form->{title} = "SQL-Ledger, ".$locale->text('Version')." $version";
print qq|Content-type: text/html
<HEAD>
<TITLE>$form->{title}</TITLE>
$form->{charset}
$form->{stylesheet}
</HEAD>
<FRAMESET ROWS="*,35" BORDER="0">
<FRAMESET COLS="155,*" BORDER="0">
<FRAME NAME="acc_menu" SRC="$form->{script}?login=$form->{login}&action=acc_menu&path=$form->{path}">
<FRAME NAME="main_window" SRC="login.pl?login=$form->{login}&action=company_logo&path=$form->{path}">
</FRAMESET>
<FRAME NAME="bottom_menu" SRC="$form->{script}?login=$form->{login}&action=bottom_menu&path=$form->{path}" SCROLL="no">
</FRAMESET>
|;
}
sub acc_menu {
foreach $item (split /;/, $myconfig{acs}) {
$excl{$item} = 1;
}
@menuorder = ('AR--AR', 'AR--Add_Transaction', 'AR--Receipts', 'AR--Reports', 'AR--AR_Aging', 'AR--Add_Customer', 'AR--Search_Customer', 'AR--Customer_Invoice');
$menu{'AR--AR'} = qq|<p><b>|.$locale->text('AR').qq|</b>|;
$menu{'AR--Add_Transaction'} = qq|<li><a href=ar.pl?path=$form->{path}&action=add&login=$form->{login} target=main_window>|.$locale->text('Add Transaction').qq|</a>|;
$menu{'AR--Reports'} = qq|<li><a href=ar.pl?path=$form->{path}&action=search&nextsub=ar_transactions&login=$form->{login} target=main_window>|.$locale->text('Reports').qq|</a>|;
$menu{'AR--Add_Customer'} = qq|<li><a href=ct.pl?path=$form->{path}&action=add&db=customer&login=$form->{login} target=main_window>|.$locale->text('Add Student').qq|</a>|;
$menu{'AR--Search_Customer'} = qq|<li><a href=ct.pl?action=s_student&action=search&db=customer&login=$form->{login} target=main_window>|.$locale->text('Search Student').qq|</a>|;
$menu{'AR--Customer_Invoice'} = qq|<li><a href=is.pl?path=$form->{path}&action=add&login=$form->{login} target=main_window>|.$locale->text('Student Invoice').qq|</a>|;
$menu{'AR--Receipts'} = qq|<li><a href=ar.pl?path=$form->{path}&action=search&nextsub=receipts&login=$form->{login} target=main_window>|.$locale->text('Receipts').qq|</a>|;
$menu{'AR--AR_Aging'} = qq|<li><a href=rp.pl?path=$form->{path}&action=report&title=AR%20Aging&login=$form->{login} target=main_window>|.$locale->text('AR Aging').qq|</a>|;
push @menuorder, ('AP--AP', 'AP--Add_Transaction', 'AP--Payments', 'AP--Reports', 'AP--AP_Aging', 'AP--Add_Vendor', 'AP--Search_Vendor', 'AP--Vendor_Invoice');
$menu{'AP--AP'} = qq|<p><b>|.$locale->text('AP').qq|</b>|;
$menu{'AP--Add_Transaction'} = qq|<li><a href=ap.pl?path=$form->{path}&action=add&login=$form->{login} target=main_window>|.$locale->text('Add Transaction').qq|</a>|;
$menu{'AP--Reports'} = qq|<li><a href=ap.pl?path=$form->{path}&action=search&nextsub=ap_transactions&login=$form->{login} target=main_window>|.$locale->text('Reports').qq|</a>|;
$menu{'AP--Add_Vendor'} = qq|<li><a href=ct.pl?path=$form->{path}&action=add&db=vendor&login=$form->{login} target=main_window>|.$locale->text('Add Vendor').qq|</a>|;
$menu{'AP--Search_Vendor'} = qq|<li><a href=ct.pl?action=s_vendor&action=search&db=vendor&login=$form->{login} target=main_window>|.$locale->text('Search Vendor').qq|</a>|;
$menu{'AP--Vendor_Invoice'} = qq|<li><a href=ir.pl?path=$form->{path}&action=add&login=$form->{login} target=main_window>|.$locale->text('Vendor Invoice').qq|</a>|;
$menu{'AP--Payments'} = qq|<li><a href=ap.pl?path=$form->{path}&action=search&nextsub=payments&login=$form->{login} target=main_window>|.$locale->text('Payments').qq|</a>|;
$menu{'AP--AP_Aging'} = qq|<li><a href=rp.pl?path=$form->{path}&action=report&title=AP%20Aging&login=$form->{login} target=main_window>|.$locale->text('AP Aging').qq|</a>|;
push @menuorder, ('General_Ledger--General_Ledger', 'General_Ledger--Add_Transaction', 'General_Ledger--Reports');
$menu{'General_Ledger--General_Ledger'} = qq|<p><b>|.$locale->text('General Ledger').qq|</b>|;
$menu{'General_Ledger--Add_Transaction'} = qq|<li><a href=gl.pl?path=$form->{path}&action=add&login=$form->{login} target=main_window>|.$locale->text('Add Transaction').qq|</a>|;
$menu{'General_Ledger--Reports'} = qq|<li><a href=gl.pl?path=$form->{path}&action=search&login=$form->{login} target=main_window>|.$locale->text('Reports').qq|</a>|;
push @menuorder, ('Inventory--Inventory', 'Inventory--Add_Part', 'Inventory--Add_Service', 'Inventory--Add_Assembly', 'Inventory--Reports', 'Inventory--Merchandise_Received', 'Inventory--Stock_Assembly');
$menu{'Inventory--Inventory'} = qq|<p><b>|.$locale->text('Inventory').qq|</b>|;
$menu{'Inventory--Add_Part'} = qq|<li><a href=ic.pl?path=$form->{path}&action=add&item=part&login=$form->{login} target=main_window>|.$locale->text('Add Part').qq|</a>|;
$menu{'Inventory--Add_Service'} = qq|<li><a href=ic.pl?path=$form->{path}&action=add&item=service&login=$form->{login} target=main_window>|.$locale->text('Add Service').qq|</a>|;
$menu{'Inventory--Add_Assembly'} = qq|<li><a href=ic.pl?path=$form->{path}&action=add&item=assembly&login=$form->{login} target=main_window>|.$locale->text('Add Assembly').qq|</a>|;
$menu{'Inventory--Reports'} = qq|<li><a href=ic.pl?path=$form->{path}&action=search&login=$form->{login} target=main_window>|.$locale->text('Reports').qq|</a>|;
$menu{'Inventory--Merchandise_Received'} = qq|<li><a href=ir.pl?path=$form->{path}&action=add&login=$form->{login} target=main_window>|.$locale->text('Merchandise Received').qq|</a>|;
$menu{'Inventory--Stock_Assembly'} = qq|<li><a href=is.pl?path=$form->{path}&action=stock_assembly&login=$form->{login} target=main_window>|.$locale->text('Stock Assembly').qq|</a>|;
push @menuorder, ('Reports--Reports', 'Reports--Chart_of_Accounts', 'Reports--Trial_Balance', 'Reports--Income_Statement', 'Reports--Balance_Sheet');
$menu{'Reports--Reports'} = qq|<p><b>|.$locale->text('Reports').qq|</b>|;
$menu{'Reports--Chart_of_Accounts'} = qq|<li><a href=ca.pl?path=$form->{path}&login=$form->{login} target=main_window>|.$locale->text('Chart of Accounts').qq|</a>|;
$menu{'Reports--Trial_Balance'} = qq|<li><a href=rp.pl?path=$form->{path}&action=report&title=Trial%20Balance&login=$form->{login} target=main_window>|.$locale->text('Trial Balance').qq|</a>|;
$menu{'Reports--Income_Statement'} = qq|<li><a href=rp.pl?path=$form->{path}&action=report&title=Income%20Statement&login=$form->{login} target=main_window>|.$locale->text('Income Statement').qq|</a>|;
$menu{'Reports--Balance_Sheet'} = qq|<li><a href=rp.pl?path=$form->{path}&action=report&title=Balance%20Sheet&login=$form->{login} target=main_window>|.$locale->text('Balance Sheet').qq|</a>|;
$form->{title} = $locale->text('Accounting Menu');
print qq|Content-type: text/html
<head>
<title>$form->{title}</title>
$form->{charset}
$form->{stylesheet}
</head>
<body bgcolor="#FBFFE7">
<font size=-1>
<b>$form->{title}</b>
<p>
|;
map { print $menu{$_} unless $excl{$_} } @menuorder;
}
sub bottom_menu {
print qq'Content-type: text/html
<head>
<title>bottom_menu</title>
$form->{charset}
$form->{stylesheet}
</head>
<body bgcolor="#FBFFE7">
<table width=100% border=0>
<tr>
<td width=30%>
<b>$myconfig{name}</b>
</td>
<td width=60% align=center>|
<a href=$form->{script}?path=$form->{path}&action=acc_menu&login=$form->{login} target=acc_menu>'.$locale->text('Accounting').qq'</a> |
<a href=login.pl?path=$form->{path}&action=company_logo&login=$form->{login} target=main_window>'.$locale->text('Version').qq'</a> |
<a href=mailto:dsimader\@sql-ledger.org?subject=SQL-Ledger%20$version%20/%20Bug%20Report>'.$locale->text('Bug Report').qq'</a> |
</td>
<td width=10% align=right>';
unless ($myconfig{acs} =~ /Setup--Setup/) {
print qq'
<a href=am.pl?path=$form->{path}&action=setup_menu&login=$form->{login} target=acc_menu>'.$locale->text('Setup').qq'</a>';
}
print qq'
</td>
</tr></table>
';
}
#======================================================================
#
# customer/vendor module
#
# CHANGE LOG:
# DS. 2000-07-04 Created
#
#======================================================================
use DBI;
use SL::Form;
use SL::CT;
$form = new Form;
if ($form->{action}) {
require("$userspath/$form->{login}.conf");
$myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset);
$locale = new Locale $myconfig{countrycode}, "ct";
&{ $locale->findsub($form->{action}) };
} else {
$form->error("action= not defined!");
}
# end of main
sub add {
$form->{title} = "Add";
$form->{callback} = "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}";
CT->taxaccounts(\%myconfig, \%$form);
&{ "$form->{db}_header" };
&form_footer;
}
sub s_student {
$form->{title} = $locale->text("Search for " . ucfirst $form->{db});
# class=submit type=submit $locale->text('Search for Student')
# class=submit type=submit $locale->text('Search for Vendor')
$form->header;
print qq|
<h2>$form->{title}</h2>
<form method=post action=$form->{script}>
<input type=hidden name=db value=$form->{db}>
<table border=1>
<tr valign=top>
<td>
<table>
<tr>
<th align=right>|.$locale->text('Name').qq|</th><td><input name=name size=35></td>
<th align=right>|.$locale->text('ID number').qq|</th><td><input name=idnumber size=35></td>
<th align=right>|.$locale->text('Date of Birth').qq|</th><td><input name=dob size=35></td>
</tr>
<tr>
<th align=right>|.$locale->text('Class').qq|</th><td><input name=class size=35></td>
<th align=right>|.$locale->text('Club').qq|</th><td><input name=club size=35></td>
<th align=right>|.$locale->text('Society').qq|</th><td><input name=society size=35></td>
</tr>
<tr>
<th align=right>|.$locale->text('Father').qq|</th><td><input name=father size=35></td>
<th align=right>|.$locale->text('Mother').qq|</th><td><input name=mother size=35></td>
</tr>
<tr>
<th align=right>|.$locale->text('Include in Report').qq|</th>
<td>
<input name="l_name" class=checkbox type=checkbox value=Y checked> |.$locale->text('Name').qq|
<input name="l_idnumber" class=checkbox type=checkbox value=Y checked> |.$locale->text('ID no').qq|
<input name="l_address" class=checkbox type=checkbox value=Y> |.$locale->text('Address').qq|
<input name="l_father" class=checkbox type=checkbox value=Y checked> |.$locale->text('Father').qq|
<input name="l_mother" class=checkbox type=checkbox value=Y checked> |.$locale->text('Mother').qq|
<input name="l_phone" class=checkbox type=checkbox value=Y checked> |.$locale->text('Phone [Home]').qq|
<input name="l_cellular" class=checkbox type=checkbox value=Y checked> |.$locale->text('Phone [Cellular]').qq|
<input name="l_fax" class=checkbox type=checkbox value=Y> |.$locale->text('Fax').qq|
<input name="l_email" class=checkbox type=checkbox value=Y checked> |.$locale->text('E-mail').qq|
<input name="l_class" class=checkbox type=checkbox value=Y checked> |.$locale->text('Class').qq|
<input name="l_club" class=checkbox type=checkbox value=Y checked> |.$locale->text('Club').qq|
<input name="l_society" class=checkbox type=checkbox value=Y checked> |.$locale->text('Society').qq|
<input name="l_guardian" class=checkbox type=checkbox value=Y checked> |.$locale->text('Guardian').qq|
<input name="l_guardianphone" class=checkbox type=checkbox value=Y checked> |.$locale->text('Guardian [Tel]').qq|
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input class=submit type=submit name=action value="|.$locale->text('Search for ' . ucfirst $form->{db}).qq|">
</form>
<p>|.$locale->text("To display all $form->{db}s, leave fields blank").qq|
</body>
</html>
|;
}
# $locale->text('To display all customers, leave fields blank')
# $locale->text('To display all 0s, leave fields blank')
sub s_vendor {
$form->{title} = $locale->text("Search for " . ucfirst $form->{db});
# class=submit type=submit $locale->text('Search for Customer')
# class=submit type=submit $locale->text('Search for Vendor')
$form->header;
print qq|
<h2>$form->{title}</h2>
<form method=post action=$form->{script}>
<input type=hidden name=db value=$form->{db}>
<table border=1>
<tr valign=top>
<td>
<table>
<tr>
<th align=right>|.$locale->text('Company').qq|</th><td><input name=name size=35></td>
</tr>
<tr>
<th align=right>|.$locale->text('Contact').qq|</th><td><input name=contact size=35></td>
</tr>
<tr>
<th align=right>|.$locale->text('Include in Report').qq|</th>
<td>
<input name="l_name" class=checkbox type=checkbox value=Y checked> |.$locale->text('Name').qq|
<input name="l_address" class=checkbox type=checkbox value=Y> |.$locale->text('Address').qq|
<input name="l_contact" class=checkbox type=checkbox value=Y checked> |.$locale->text('Contact').qq|
<input name="l_phone" class=checkbox type=checkbox value=Y checked> |.$locale->text('Phone').qq|
<input name="l_fax" class=checkbox type=checkbox value=Y> |.$locale->text('Fax').qq|
<input name="l_email" class=checkbox type=checkbox value=Y checked> |.$locale->text('E-mail').qq|
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input class=submit type=submit name=action value="|.$locale->text('Search for ' . ucfirst $form->{db}).qq|">
</form>
<p>|.$locale->text("To display all $form->{db}s, leave fields blank").qq|
</body>
</html>
|;
}
# $locale->text('To display all customers, leave fields blank')
# $locale->text('To display all vendors, leave fields blank')
sub search_for_vendor {
&search_for_name;
}
sub search_for_name {
CT->search(\%myconfig, \%$form);
$callback = "$form->{script}?action=search_for_name&db=$form->{db}&path=$form->{path}&login=$form->{login}";
$href = "$form->{script}?action=search_for_name&db=$form->{db}&path=$form->{path}&login=$form->{login}&name=" . $form->escape($form->{name}) . "&contact=" . $form->escape($form->{contact});
@columns = $form->sort_columns(qw(name address contact phone fax email));
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->{name}) {
$callback .= "&name=$form->{name}";
}
if ($form->{contact}) {
$callback .= "&contact=$form->{contact}";
}
$callback = $form->escape($callback . "&sort=$form->{sort}");
$column_header{name} = qq|<th><a href=$href&sort=name><font color=ffffff>|.$locale->text('Name').qq|</a></th>|;
$column_header{address} = qq~<th><a href=$href&sort="addr1 || addr2 || addr3"><font color=ffffff>~.$locale->text('Address').qq|</a></th>|;
$column_header{contact} = qq|<th><a href=$href&sort=contact><font color=ffffff>|.$locale->text('Contact').qq|</a></th>|;
$column_header{phone} = qq|<th><a href=$href&sort=phone><font color=ffffff>|.$locale->text('Phone').qq|</a></th>|;
$column_header{fax} = qq|<th><a href=$href&sort=fax><font color=ffffff>|.$locale->text('Fax').qq|</a></th>|;
$column_header{email} = qq|<th><a href=$href&sort=email><font color=ffffff>|.$locale->text('E-mail').qq|</a></th>|;
# $locale->text('Customer List')
# $locale->text('Vendor List')
$form->{title} = $locale->text(ucfirst $form->{db} . " List");
$form->header;
print qq|
<h2>$form->{title}</h2>
<table border=1>
<tr bgcolor=336666>
|;
map { print "$column_header{$_}\n" } @column_index;
print qq|
</tr>
|;
foreach $ref (@{ $form->{CT} }) {
map { $column_data{$_} = "<td> $ref->{$_}</td>" } qw(address contact phone fax);
$column_data{name} = "<td><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&callback=$callback>$ref->{name}</td>";
$column_data{email} = ($ref->{email}) ? "<td><a href=mailto:$ref->{email}>$ref->{email}</a></td>" : "<td> </td>";
print "<tr>";
map { print "$column_data{$_}\n" } @column_index;
print qq|</tr>|;
}
print qq|
</table>
<p>|.$locale->text("Click on $form->{db} name to edit").qq|
|;
# $locale->text('Click on customer name to edit')
# $locale->text('Click on vendor name to edit')
}
sub search_ for_customer {
&search_for_student;
}
sub search_for_student {
CT->search(\%myconfig, \%$form);
$callback = "$form->{script}?action=search_for_student&db=$form->{db}&path=$form->{path}&login=$form->{login}";
$href = "$form->{script}?action=search_for_student&db=$form->{db}&path=$form->{path}&login=$form->{login}&name=" . $form->escape($form->{name}) . "&idnumber=" . $form->escape($form->{idnumber}) . "&father=" . $form->escape($form->{father}) . "&mother=" . $form->escape($form->{mother}) . "&class=" . $form->escape($form->{class}) . "&club=" . $form->escape($form->{club}) . "&society=" . $form->escape($form->{society}) . "&dob=" . $form->escape($form->{dob}) . "&addr=" . $form->escape($form->{addr}) . "&guardian=" . $form->escape($form->{guardian}) . "&guardianphone=" . $form->escape($form->{guardianphone}) . "&phone=" . $form->escape($form->{phone});
@columns = $form->sort_columns(qw(ID-no name DOB Father Mother Address Phone Class Club Society Guardian Guardian-tel));
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->{name}) {
$callback .= "&name=$form->{name}";
}
if ($form->{father}) {
$callback .= "&contact=$form->{father}";
}
if ($form->{mother}) {
$callback .= "&name=$form->{mother}";
}
if ($form->{idnumber}) {
$callback .= "&contact=$form->{idnumber}";
}
if ($form->{dob}) {
$callback .= "&name=$form->{dob}";
}
if ($form->{class}) {
$callback .= "&contact=$form->{class}";
}
if ($form->{club}) {
$callback .= "&name=$form->{club}";
}
if ($form->{society}) {
$callback .= "&contact=$form->{society}";
}
$callback = $form->escape($callback . "&sort=$form->{sort}");
$column_header{idnumber} = qq|<th><a href=$href&sort=name><font color=ffffff>|.$locale->text('ID-no.').qq|</a></th>|;
$column_header{name} = qq~<th><a href=$href&sort="addr1 || addr2 || addr3"><font color=ffffff>~.$locale->text('Name').qq|</a></th>|;
$column_header{dob} = qq|<th><a href=$href&sort=contact><font color=ffffff>|.$locale->text('DOB').qq|</a></th>|;
$column_header{father} = qq|<th><a href=$href&sort=phone><font color=ffffff>|.$locale->text('Father').qq|</a></th>|;
$column_header{mother} = qq|<th><a href=$href&sort=fax><font color=ffffff>|.$locale->text('Mother').qq|</a></th>|;
$column_header{addr} = qq|<th><a href=$href&sort=email><font color=ffffff>|.$locale->text('Address').qq|</a></th>|;
$column_header{phone} = qq|<th><a href=$href&sort=name><font color=ffffff>|.$locale->text('Phone').qq|</a></th>|;
$column_header{class} = qq~<th><a href=$href&sort="addr1 || addr2 || addr3"><font color=ffffff>~.$locale->text('Class').qq|</a></th>|;
$column_header{club} = qq|<th><a href=$href&sort=contact><font color=ffffff>|.$locale->text('Club').qq|</a></th>|;
$column_header{society} = qq|<th><a href=$href&sort=phone><font color=ffffff>|.$locale->text('Society').qq|</a></th>|;
$column_header{guardian} = qq|<th><a href=$href&sort=fax><font color=ffffff>|.$locale->text('Guardian').qq|</a></th>|;
$column_header{guardianphone} = qq|<th><a href=$href&sort=email><font color=ffffff>|.$locale->text('Guardian-Tel').qq|</a></th>|;
# $locale->text('Customer List')
# $locale->text('Vendor List')
$form->{title} = $locale->text(ucfirst $form->{db} . " List");
$form->header;
print qq|
<h2>$form->{title}</h2>
<table border=1>
<tr bgcolor=336666>
|;
map { print "$column_header{$_}\n" } @column_index;
print qq|
</tr>
|;
foreach $ref (@{ $form->{CT} }) {
map { $column_data{$_} = "<td> $ref->{$_}</td>" } qw(ID-no Name DOB Father Mother Address phone Class Club Society Guardian Guardian-Tel);
$column_data{name} = "<td><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&callback=$callback>$ref->{name}</td>";
$column_data{email} = ($ref->{email}) ? "<td><a href=mailto:$ref->{email}>$ref->{email}</a></td>" : "<td> </td>";
print "<tr>";
map { print "$column_data{$_}\n" } @column_index;
print qq|</tr>|;
}
print qq|
</table>
<p>|.$locale->text("Click on $form->{db} name to edit").qq|
|;
# $locale->text('Click on customer name to edit')
# $locale->text('Click on vendor name to edit')
}
sub edit {
CT->get_tuple(\%myconfig, \%$form);
$form->{title} = "Edit";
# format discount
$form->{discount} *= 100;
&{ "$form->{db}_header" };
&form_footer;
}
sub customer_header {
# class=submit type=submit $locale->text('Add Customer')
# class=submit type=submit $locale->text('Edit Customer')
$tax = qq|<tr><th align=right>|.$locale->text('Taxable').qq|</th><td colspan=3>\n|;
foreach $item (split / /, $form->{taxaccounts}) {
if (($form->{tax}{$item}{taxable}) || !($form->{id})) {
$tax .= qq|<input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>\n|;
} else {
$tax .= qq|<input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>\n|;
}
}
$tax .= qq|</td></tr>|;
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
$form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit});
$form->{title} = $locale->text("$form->{title} Customer");
$form->header;
print qq|
<h2>$form->{title}</h2>
<form method=post action=$form->{script}>
<table border=1>
<tr>
<td>
<table border=0>
<tr>
<th colspan=2>|.$locale->text('Student Info').qq|</th>
<th>|.$locale->text('School Info').qq|</th>
</tr>
<tr>
<th align=right>|.$locale->text('Student Name').qq|</th>
<td colspan=2><input name=name size=35 maxsize=35 value="$form->{name}"></td>
<th align=right>|.$locale->text('Class').qq|</th>
<td><input name=class size=35 maxsize=35 value="$form->{class}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('ID Number').qq|</th>
<td colspan=2><input name=idnumber size=35 maxsize=35 value="$form->{idnumber}"></td>
<th align=right>|.$locale->text('Club').qq|</th>
<td><input name=club size=35 maxsize=35 value="$form->{club}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Date of Birth').qq|</th>
<td colspan=2><input name=dob size=35 maxsize=35 value="$form->{dob}"></td>
<th align=right>|.$locale->text('Society').qq|</th>
<td><input name=society size=35 maxsize=35 value="$form->{society}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Home Address').qq|</th>
<td colspan=2><input name=addr size=35 maxsize=35 value="$form->{addr}"></td>
<th align=right>|.$locale->text('?????').qq|</th>
<td><input name=shiptoaddr3 size=35 maxsize=35 value="$form->{shiptoaddr3}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('?????').qq|</th>
<td colspan=2><input name=addr4 size=35 maxsize=35 value="$form->{addr4}"></td>
<th align=right>|.$locale->text('?????').qq|</th>
<td><input name=shiptoaddr4 size=35 maxsize=35 value="$form->{shiptoaddr4}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Parent [Father]').qq|</th>
<td><input name=father size=20 maxsize=35 value="$form->{father}"></td>
<td>
<th align=right>|.$locale->text('Parent [Mother]').qq|</th>
<input name=mother size=20 maxsize=35 value="$form->{mother}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Phone [Home]').qq|</th>
<td><input name=phone size=20 maxsize=20 value="$form->{phone}"></td>
<th align=right>|.$locale->text('Phone [Cellular]').qq|</th>
<td><input name=cellular size=20 maxsize=20 value="$form->{cellular}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Fax').qq|</th>
<td><input name=fax size=20 maxsize=20 value="$form->{fax}"></td>
<th align=right>|.$locale->text('Phone [Work]').qq|</th>
<td><input name=phonework size=20 maxsize=20 value="$form->{phonework}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('E-mail').qq|</th>
<td><input name=email size=25 value="$form->{email}"></td>
<td>
<input name=shiptoemail size=25 value="$form->{shiptoemail}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Guardian').qq|</th>
<td><input name=guardian size=25 value="$form->{guardian}"></td>
<td>
<th align=right>|.$locale->text('Guardian [Phone]').qq|</th>
<input name=guardianphone size=25 value="$form->{guardianphone}"></td>
</tr>
<tr>
<td colspan=4>
<b>|.$locale->text('Terms: Net').qq|</b> <input name=terms size=2 value="$form->{terms}">
<b>|.$locale->text('days').qq|</b> \|
<b>|.$locale->text('Credit Limit').qq|</b>
<input name=creditlimit size=9 value="$form->{creditlimit}">
<b>|.$locale->text('Discount').qq|</b>
<input name=discount size=4 value="$form->{discount}"> <b>%</b>
<b>|.$locale->text('Tax Included').qq|</b>
<input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}>
</td>
</tr>
$tax
<tr valign=top>
<th align=right>|.$locale->text('Notes').qq|</th>
<td colspan=2 rowspan=3>
<textarea name=notes rows=3 cols=60>$form->{notes}</textarea>
</td>
</tr>
</table>
</td>
</tr>
|;
}
sub vendor_header {
$form->{title} = $locale->text("$form->{title} Vendor");
$tax = qq|<tr><th align=right>|.$locale->text('Taxable').qq|</th><td colspan=2>\n|;
foreach $item (split / /, $form->{taxaccounts}) {
if (($form->{tax}{$item}{taxable}) || !($form->{id})) {
$tax .= qq|<input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>\n|;
} else {
$tax .= qq|<input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>\n|;
}
}
$tax .= qq|</td></tr>|;
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
$form->header;
# class=submit type=submit $locale->text('Add Vendor')
# class=submit type=submit $locale->text('Edit Vendor')
print qq|
<h2>$form->{title}</h2>
<form method=post action=$form->{script}>
<table border=1>
<tr>
<td>
<table border=0>
<tr>
<td colspan=2>
<input name=idnumber size=35 maxsize=35 value="$form->{idnumber}">
</td>
</tr>
<tr valign=top>
<td colspan=2>
<input name=name size=35 maxsize=35 value="$form->{name}">
</td>
</tr>
<tr>
<td colspan=2>
<input name=dob size=35 maxsize=35 value="$form->{dob}">
</td>
</tr>
<tr>
<td colspan=2>
<input name=addr size=35 maxsize=35 value="$form->{addr}">
</td>
</tr>
<tr>
<td colspan=2>
<input name=class size=35 maxsize=35 value="$form->{class}">
</td>
</tr>
<tr>
<th align=right>|.$locale->text('Father').qq|</th>
<td><input name=father size=20 maxsize=35 value="$form->{father}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Mother').qq|</th>
<td><input name=mother size=20 maxsize=35 value="$form->{mother}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Phone').qq|</th>
<td><input name=phone size=20 maxsize=20 value="$form->{phone}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('Fax').qq|</th>
<td><input name=fax size=20 maxsize=20 value="$form->{fax}"></td>
</tr>
<tr>
<th align=right>|.$locale->text('E-mail').qq|</th>
<td><input name=email size=25 value="$form->{email}"></td>
</tr>
<tr>
<td colspan=2><b>|.$locale->text('Terms: Net').qq|</b>
<input name=terms size=3 value=$form->{terms}> <b>days</b> \|
<b>|.$locale->text('Tax Included').qq|</b>
<input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}>
</td>
</tr>
$tax
<tr valign=top>
<th align=right>|.$locale->text('Notes').qq|</th>
<td colspan=2 rowspan=3>
<textarea name=notes rows=3 cols=60>$form->{notes}</textarea>
</td>
</tr>
</table>
</td>
</tr>
|;
}
sub form_footer {
print qq|
<input name=id type=hidden value=$form->{id}>
<input name=taxaccounts type=hidden value="$form->{taxaccounts}">
<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=callback value="$form->{callback}">
<input type=hidden name=db v...
[truncated message content] |