X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=sql-ledger%2Fold%2Fsql-ledger%2Fbin%2Fmozilla%2Fca.pl;fp=sql-ledger%2Fold%2Fsql-ledger%2Fbin%2Fmozilla%2Fca.pl;h=0000000000000000000000000000000000000000;hp=ed3100573117bb26e12f76dada5c3db1918fd90a;hb=0554f5dec1d99c9be70b2a0b841b5327db917dbe;hpb=ac9a5336dd181bc617710a09effc3efa1a0d5932 diff --git a/sql-ledger/old/sql-ledger/bin/mozilla/ca.pl b/sql-ledger/old/sql-ledger/bin/mozilla/ca.pl deleted file mode 100644 index ed3100573..000000000 --- a/sql-ledger/old/sql-ledger/bin/mozilla/ca.pl +++ /dev/null @@ -1,413 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 2001 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# -# 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 SL::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||.$locale->text('Account').qq|\n|; - $column_header{gifi_accno} = qq||.$locale->text('GIFI').qq|\n|; - $column_header{description} = qq||.$locale->text('Description').qq|\n|; - $column_header{debit} = qq||.$locale->text('Debit').qq|\n|; - $column_header{credit} = qq||.$locale->text('Credit').qq|\n|; - - - $form->{title} = $locale->text('Chart of Accounts'); - - $colspan = $#column_index + 1; - - $form->header; - - print qq| - - - - - - |; - - map { print $column_header{$_} } @column_index; - - print qq| - -|; - - - 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}&password=$form->{password}&description=$description&gifi_accno=$ca->{gifi_accno}&gifi_description=$gifi_description|; - - if ($ca->{charttype} eq "H") { - print qq||; - map { $column_data{$_} = ""; } qw(accno description); - $column_data{gifi_accno} = ""; - } else { - $i++; $i %= 2; - print qq||; - $column_data{accno} = ""; - $column_data{gifi_accno} = ""; - $column_data{description} = ""; - } - - $column_data{debit} = "\n"; - $column_data{credit} = "\n"; - - $totaldebit += $ca->{debit}; - $totalcredit += $ca->{credit}; - - map { print $column_data{$_} } @column_index; - - print qq| - -|; - } - - map { $column_data{$_} = ""; } qw(accno gifi_accno description); - - $column_data{debit} = ""; - $column_data{credit} = ""; - - print ""; - - map { print $column_data{$_} } @column_index; - - print qq| - - - - -
$form->{title}
$ca->{$_}$ca->{gifi_accno} 
$ca->{accno}$ca->{gifi_accno} $ca->{description}".$form->format_amount(\%myconfig, $ca->{debit}, 2, " ")."".$form->format_amount(\%myconfig, $ca->{credit}, 2, " ")."
 ".$form->format_amount(\%myconfig, $totaldebit, 2, 0)."".$form->format_amount(\%myconfig, $totalcredit, 2, 0)."

- - - -|; - -} - - -sub list { - - $form->{title} = $locale->text('List Transactions'); - if ($form->{accounttype} eq 'gifi') { - $form->{title} .= " - ".$locale->text('GIFI')." $form->{gifi_accno}"; - } else { - $form->{title} .= " - ".$locale->text('Account')." $form->{accno}"; - } - - $form->header; - - map { $form->{$_} =~ s/"/"/g; } qw(description gifi_description); - - print qq| - - -
{script}> - -{accno}> - - - -{accounttype}> -{gifi_accno}> - - - - - - - - -
$form->{title}
- - - - - - - - - - - -
|.$locale->text('From').qq||.$locale->text('to').qq|
|.$locale->text('Include in Report').qq| -  |.$locale->text('Subtotal').qq|
-

- -{login}> -{path}> -{password}> - -
-
- - - -|; - -} - - -sub list_transactions { - - CA->all_transactions(\%myconfig, \%$form); - - $description = $form->escape($form->{description}); - $gifi_description = $form->escape($form->{gifi_description}); - - # construct href - $href = "$form->{script}?path=$form->{path}&action=list_transactions&accno=$form->{accno}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&description=$description&accounttype=$form->{accounttype}&gifi_accno=$form->{gifi_accno}&gifi_description=$gifi_description&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}"; - - # construct callback - $callback = "rp.pl?path=$form->{path}&action=generate_trial_balance&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&accounttype=$form->{accounttype}"; - - # figure out which column comes first - $column_header{transdate} = qq||.$locale->text('Date').qq||; - $column_header{reference} = qq||.$locale->text('Reference').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - $column_header{debit} = qq||.$locale->text('Debit').qq||; - $column_header{credit} = qq||.$locale->text('Credit').qq||; - $column_header{balance} = qq||.$locale->text('Balance').qq||; - - @column_index = $form->sort_columns(qw(transdate reference description debit credit)); - - if ($form->{accounttype} eq 'gifi') { - map { $form->{$_} = $form->{"gifi_$_"} } qw(accno description); - } - 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->{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->header; - - print qq| - - - - - - - - - - - - - - - - -
$form->{title}
$form->{period}
- - -|; - -map { print "$column_header{$_}\n" } @column_index; - -print qq| - -|; - - # add sort to callback - $callback = $form->escape($callback . "&sort=$form->{sort}"); - - if (@{ $form->{CA} }) { - $sameitem = $form->{CA}->[0]->{$form->{sort}}; - } - - $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1; - if ($form->{accno} && $form->{balance}) { - - map { $column_data{$_} = "" } @column_index; - - $column_data{balance} = ""; - - $i++; $i %= 2; - print qq| - -|; - map { print $column_data{$_} } @column_index; - print qq| - -|; - } - - foreach $ca (@{ $form->{CA} }) { - - if ($form->{l_subtotal} eq 'Y') { - if ($sameitem ne $ca->{$form->{sort}}) { - &ca_subtotal; - } - } - - # construct link to source - $href = "{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{reference}"; - - - $column_data{debit} = ""; - $column_data{credit} = ""; - - $form->{balance} += $ca->{amount}; - $column_data{balance} = ""; - - $subtotaldebit += $ca->{debit}; - $subtotalcredit += $ca->{credit}; - - $totaldebit += $ca->{debit}; - $totalcredit += $ca->{credit}; - - $column_data{transdate} = qq||; - $column_data{reference} = qq||; - $column_data{description} = qq||; - - $i++; $i %= 2; - print qq| - -|; - - map { print $column_data{$_} } @column_index; - - print qq| - -|; - - } - - - if ($form->{l_subtotal} eq 'Y') { - &ca_subtotal; - } - - - map { $column_data{$_} = "" } @column_index; - - $column_data{debit} = ""; - $column_data{credit} = ""; - $column_data{balance} = ""; - - print qq| - -|; - - map { print $column_data{$_} } @column_index; - - print qq| - -
 ".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."
".$form->format_amount(\%myconfig, $ca->{debit}, 2, " ")."".$form->format_amount(\%myconfig, $ca->{credit}, 2, " ")."".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."$ca->{transdate}$href$ca->{description}
 ".$form->format_amount(\%myconfig, $totaldebit, 2, " ")."".$form->format_amount(\%myconfig, $totalcredit, 2, " ")."".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."
-

- - - -|; - -} - - -sub ca_subtotal { - - map { $column_data{$_} = " " } @column_index; - - $column_data{debit} = "".$form->format_amount(\%myconfig, $subtotaldebit, 2, " ") . ""; - $column_data{credit} = "".$form->format_amount(\%myconfig, $subtotalcredit, 2, " ") . ""; - - $subtotaldebit = 0; - $subtotalcredit = 0; - - $sameitem = $ca->{$form->{sort}}; - - print qq| - -|; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - -} -