X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=sql-ledger%2Fold%2Fsql-ledger%2Fbin%2Fmozilla%2Fct.pl;fp=sql-ledger%2Fold%2Fsql-ledger%2Fbin%2Fmozilla%2Fct.pl;h=0000000000000000000000000000000000000000;hp=3dbb5656a9c55002f6068c2da976616f9618bab2;hb=0554f5dec1d99c9be70b2a0b841b5327db917dbe;hpb=ac9a5336dd181bc617710a09effc3efa1a0d5932 diff --git a/sql-ledger/old/sql-ledger/bin/mozilla/ct.pl b/sql-ledger/old/sql-ledger/bin/mozilla/ct.pl deleted file mode 100644 index 3dbb5656a..000000000 --- a/sql-ledger/old/sql-ledger/bin/mozilla/ct.pl +++ /dev/null @@ -1,631 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (c) 1998-2002 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# Contributors: Reed White -# -# 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 -# -#====================================================================== - -# $locale->text('Customers') -# $locale->text('Vendors') - -use SL::CT; - -1; -# end of main - - - -sub add { - - $form->{title} = "Add"; - - $form->{callback} = "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; - - CT->taxaccounts(\%myconfig, \%$form); - - &form_header; - &form_footer; - -} - - -sub search { - - $label = ucfirst $form->{db}; - $form->{title} = $locale->text($label."s"); - - $form->header; - - print qq| - - -
{script}> - -{db}> - - - - - - - - - - - - -
$form->{title}
- - - - - - - - - - - - - - - - - - - - - - - - - -
|.$locale->text('Number').qq|{db}number size=35>
|.$locale->text('Name').qq|
|.$locale->text('Contact').qq|
|.$locale->text('E-mail').qq|
 |.$locale->text('All').qq| -  |.$locale->text('Orphaned').qq|
|.$locale->text('Include in Report').qq| -  |.$locale->text('Number').qq| -  |.$locale->text('Name').qq| -  |.$locale->text('Address').qq|
-  |.$locale->text('Contact').qq| -  |.$locale->text('Phone').qq| -  |.$locale->text('Fax').qq| -  |.$locale->text('E-mail').qq| -  |.$locale->text('Cc').qq| -
-

- - - -{path}> -{login}> -{password}> - -
- -
- - - -|; -} - - -sub list_names { - - CT->search(\%myconfig, \%$form); - - $callback = "$form->{script}?action=list_names&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}"; - $href = $callback; - - @columns = $form->sort_columns(name, "$form->{db}number", address, contact, phone, fax, email, cc); - - 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->{status} eq 'all') { - $option = $locale->text('All'); - } - if ($form->{status} eq 'orphaned') { - $option .= $locale->text('Orphaned'); - } - if ($form->{name}) { - $callback .= "&name=$form->{name}"; - $href .= "&name=".$form->escape($form->{name}); - $option .= "\n
".$locale->text('Name')." : $form->{name}"; - } - if ($form->{contact}) { - $callback .= "&contact=$form->{contact}"; - $href .= "&contact=".$form->escape($form->{contact}); - $option .= "\n
".$locale->text('Contact')." : $form->{contact}"; - } - if ($form->{"$form->{db}number"}) { - $callback .= qq|&$form->{db}number=$form->{"$form->{db}number"}|; - $href .= "&$form->{db}number=".$form->escape($form->{"$form->{db}number"}); - $option .= "\n
".$locale->text('Number').qq| : $form->{"$form->{db}number"}|; - } - if ($form->{email}) { - $callback .= "&email=$form->{email}"; - $href .= "&email=".$form->escape($form->{email}); - $option .= "\n
".$locale->text('E-mail')." : $form->{email}"; - } - - $form->{callback} = "$callback&sort=$form->{sort}"; - $callback = $form->escape($form->{callback}); - - $column_header{"$form->{db}number"} = qq|{db}number>|.$locale->text('Number').qq||; - $column_header{name} = qq||.$locale->text('Name').qq||; - $column_header{address} = qq||.$locale->text('Address').qq||; - $column_header{contact} = qq||.$locale->text('Contact').qq||; - $column_header{phone} = qq||.$locale->text('Phone').qq||; - $column_header{fax} = qq||.$locale->text('Fax').qq||; - $column_header{email} = qq||.$locale->text('E-mail').qq||; - $column_header{cc} = qq||.$locale->text('Cc').qq||; - - $label = ucfirst $form->{db}."s"; - $form->{title} = $locale->text($label); - - $form->header; - - print qq| - - - - - - - - - - - - - - - - -
$form->{title}
$option
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{CT} }) { - - map { $column_data{$_} = "" } ("$form->{db}number", address, contact, phone, fax); - - $column_data{name} = ""; - - $column_data{email} = ($ref->{email}) ? qq|| : ""; - $column_data{cc} = ($ref->{cc}) ? qq|| : ""; - - $i++; $i %= 2; - print " - -"; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - - } - - print qq| -
$ref->{$_} {script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}&callback=$callback>$ref->{name} $ref->{email} $ref->{cc} 
-

- -
-
{script}> - - -{db}> - -{path}> -{login}> -{password}> - - - -
- - - -|; - -} - - -sub edit { - -# $locale->text('Edit Customer') -# $locale->text('Edit Vendor') - - CT->get_tuple(\%myconfig, \%$form); - - # format " into " - map { $form->{$_} =~ s/"/"/g } keys %$form; - - $form->{title} = "Edit"; - - # format discount - $form->{discount} *= 100; - - &form_header; - &form_footer; - -} - - -sub form_header { - - foreach $item (split / /, $form->{taxaccounts}) { - if (($form->{tax}{$item}{taxable}) || !($form->{id})) { - $taxable .= qq|  $form->{tax}{$item}{description}|; - } else { - $taxable .= qq|  $form->{tax}{$item}{description}|; - } - } - - $tax = qq| - - - - - - - -
|.$locale->text('Taxable').qq|$taxable
- - -|; - - $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; - $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0); - - if ($myconfig{admin}) { - $bcc = qq| - - |.$locale->text('Bcc').qq| - - -|; - } - - - $label = ucfirst $form->{db}; - $form->{title} = $locale->text("$form->{title} $label"); - - if ($form->{db} eq 'customer') { - $creditlimit = qq| - |.$locale->text('Credit Limit').qq| - - |.$locale->text('Discount').qq| - - % -|; - } - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - $tax - - - - - - - - - -
$form->{title}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $bcc -
 |.$locale->text('Ship to').qq|
|.$locale->text('Number').qq|{db}number"}">
|.$locale->text('Name').qq|
|.$locale->text('Address').qq|
|.$locale->text('Contact').qq|
|.$locale->text('Phone').qq|
|.$locale->text('Fax').qq|
|.$locale->text('E-mail').qq|
|.$locale->text('Cc').qq|
-
- - - - - - $creditlimit - - - -
|.$locale->text('Terms: Net').qq||.$locale->text('days').qq|{taxincluded}>|.$locale->text('Tax Included').qq|
-
|.$locale->text('Notes').qq|

-|; - -} - - - -sub form_footer { - - $label = ucfirst $form->{db}; - - print qq| -{id}> - - -{path}> -{login}> -{password}> - - -{db}> - -
- - - - -|; - - if ($form->{id} && $form->{status} eq 'orphaned') { - print qq|\n|; - } - - print qq| - -
- - - -|; - -} - - -sub invoice { &{ "$form->{db}_invoice" } }; - -sub customer_invoice { - - $form->isblank("name", $locale->text("Name missing!")); - CT->save_customer(\%myconfig, \%$form); - - delete $form->{script}; - - $form->{action} = "add"; - $form->{callback} = $form->escape($form->{callback},1); - - $form->{customer} = $form->{name}; - $form->{customer_id} = $form->{id}; - $form->{vc} = 'customer'; - - delete $form->{id}; - - map { $argv .= "$_=$form->{$_}&" } keys %$form; - - exec ("perl", "is.pl", $argv); - -} - - -sub vendor_invoice { - - $form->isblank("name", $locale->text("Name missing!")); - CT->save_vendor(\%myconfig, \%$form); - - delete $form->{script}; - - $form->{action} = "add"; - $form->{callback} = $form->escape($form->{callback},1); - - $form->{vendor} = $form->{name}; - $form->{vendor_id} = $form->{id}; - $form->{vc} = 'vendor'; - - delete $form->{id}; - - map { $argv .= "$_=$form->{$_}&" } keys %$form; - - exec ("perl", "ir.pl", $argv); - -} - - -sub order { &{ "$form->{db}_order" } }; - -sub customer_order { - - $form->isblank("name", $locale->text("Name missing!")); - CT->save_customer(\%myconfig, \%$form); - - delete $form->{script}; - - $form->{action} = "add"; - $form->{callback} = $form->escape($form->{callback},1); - - $form->{customer} = $form->{name}; - $form->{customer_id} = $form->{id}; - $form->{vc} = 'customer'; - - $form->{type} = 'sales_order'; - - delete $form->{id}; - - map { $argv .= "$_=$form->{$_}&" } keys %$form; - - exec ("perl", "oe.pl", $argv); - -} - - -sub vendor_order { - - $form->isblank("name", $locale->text("Name missing!")); - CT->save_vendor(\%myconfig, \%$form); - - delete $form->{script}; - - $form->{action} = "add"; - $form->{callback} = $form->escape($form->{callback},1); - - $form->{vendor} = $form->{name}; - $form->{vendor_id} = $form->{id}; - $form->{vc} = 'vendor'; - - $form->{type} = 'purchase_order'; - - delete $form->{id}; - - map { $argv .= "$_=$form->{$_}&" } keys %$form; - - exec ("perl", "oe.pl", $argv); - -} - - -sub save { &{ "save_$form->{db}" } }; - -sub save_customer { - - $form->isblank("name", $locale->text("Name missing!")); - CT->save_customer(\%myconfig, \%$form); - $form->redirect($locale->text('Customer saved!')); - -} - - -sub save_vendor { - - $form->isblank("name", $locale->text("Name missing!")); - CT->save_vendor(\%myconfig, \%$form); - $form->redirect($locale->text('Vendor saved!')); - -} - - -sub delete { &{ "delete_$form->{db}" } }; - -sub delete_customer { - - $rc = CT->delete_customer(\%myconfig, \%$form); - - $form->error($locale->text('Transactions exist, cannot delete customer!')) if ($rc == -1); - $form->redirect($locale->text('Customer deleted!')) if $rc; - $form->error($locale->text('Cannot delete customer!')); - -} - - -sub delete_vendor { - - $rc = CT->delete_vendor(\%myconfig, \%$form); - - $form->error($locale->text('Transactions exist, cannot delete vendor!')) if ($rc == -1); - $form->redirect($locale->text('Vendor deleted!')) if $rc; - $form->error($locale->text('Cannot delete vendor!')); - -} - - -sub continue { &{ $form->{nextsub} } }; - -