summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-10-20 01:16:29 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-10-20 01:16:29 +0000
commitc440a20c234d4fa586ae30edd77377d08238eb6d (patch)
tree17cf782c268b6e1bd92826c63683291c05ea8e18 /bin
parent70c29cebc700cf9cd2f63b0a333b61aca85ac30d (diff)
Removing ca.pl's list_transactions and CA.pm's all_transactions
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2375 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/ca.pl238
1 files changed, 0 insertions, 238 deletions
diff --git a/bin/ca.pl b/bin/ca.pl
index 7b85c73f..fba81cab 100644
--- a/bin/ca.pl
+++ b/bin/ca.pl
@@ -260,244 +260,6 @@ sub list {
});
}
-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} = {
- text => $locale->text('Date'),
- href => "$href&sort=transdate"};
- $column_header{reference} = {
- text => $locale->text('Reference'),
- href => "$href&sort=reference"};
- $column_header{description} = {
- text => $locale->text('Description'),
- href => "$href&sort=description"};
- $column_header{cleared} = $locale->text('R');
- $column_header{source} = $locale->text('Source');
- $column_header{debit} = $locale->text('Debit');
- $column_header{credit} = $locale->text('Credit');
- $column_header{balance} = $locale->text('Balance');
- $column_header{accno} = $locale->text('AR/AP');
-
- @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}";
-
- my @options;
- if ( $form->{department} ) {
- ($department) = split /--/, $form->{department};
- push @options, $locale->text('Department') . " : $department";
- }
- if ( $form->{projectnumber} ) {
- ($projectnumber) = split /--/, $form->{projectnumber};
- push @options, $locale->text('Project Number') . " : $projectnumber";
- }
-
- 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 );
- }
-
- if ($form->{prevreport}) {
- push @options, {text => $form->{period}, href=> $form->{prevreport}};
- $form->{period} = "<a href=$form->{prevreport}>$form->{period}</a>";
- }
-
-
- # 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->{$_}";
- }
-
- # add sort to callback
- $form->{callback} =
- $form->escape( $form->{callback} . "&sort=$form->{sort}" );
-
- my @rows;
- 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} ) {
- my %column_data;
-
- for (@column_index) { $column_data{$_} = " " }
-
- $column_data{balance} =
- $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 );
-
- $i++;
- $i %= 2;
-
- $column_data{i} = $i;
- push @rows, \%column_data;
-
- }
-
- foreach my $ca ( @{ $form->{CA} } ) {
- my %column_data;
-
- if ( $form->{l_subtotal} eq 'Y' ) {
- if ( $sameitem ne $ca->{ $form->{sort} } ) {
- push @rows, &ca_subtotal;
- }
- }
-
- $column_data{debit} =
- $form->format_amount( \%myconfig, $ca->{debit}, 2, " " );
- $column_data{credit} =
- $form->format_amount( \%myconfig, $ca->{credit}, 2, " " );
-
- $form->{balance} += $ca->{amount};
- $column_data{balance} =
- $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 );
-
- $subtotaldebit += $ca->{debit};
- $subtotalcredit += $ca->{credit};
-
- $totaldebit += $ca->{debit};
- $totalcredit += $ca->{credit};
-
- $column_data{transdate} = $ca->{transdate};
- $column_data{reference} = {
- text => $ca->{reference},
- href => "$ca->{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$form->{callback}"};
-
- $column_data{description} = $ca->{description};
-
- $column_data{cleared} =
- ( $ca->{cleared} ) ? "*" : " ";
- $column_data{source} = $ca->{source};
-
- $column_data{accno} = [];
- for ( @{ $ca->{accno} } ) {
- push @{$column_data{accno}}, {text => $_, href=> "$drilldown&accno=$_>"};
- }
-
- if ( $ca->{id} != $sameid ) {
- $i++;
- $i %= 2;
- }
- $sameid = $ca->{id};
-
- $column_data{i} = $i;
- push @rows, \%column_data;
-
- }
-
- if ( $form->{l_subtotal} eq 'Y' ) {
- push @rows, &ca_subtotal;
- }
-
- for (@column_index) { $column_data{$_} = " " }
-
- $column_data{debit} =
- $form->format_amount( \%myconfig, $totaldebit, 2, " " );
- $column_data{credit} =
- $form->format_amount( \%myconfig, $totalcredit, 2, " " );
- $column_data{balance} =
- $form->format_amount( \%myconfig, $form->{balance} * $ml, 2, 0 );
-
- my @buttons;
- push @buttons, {
- name => 'action',
- value => 'csv_list_transactions',
- text => $locale->text('CSV Report'),
- type => 'submit',
- class => 'submit',
- };
-
- $form->{callback} = $form->unescape($form->{callback});
- my $template = LedgerSMB::Template->new(
- user => \%myconfig,
- locale => $locale,
- path => 'UI',
- template => 'ca-list-transactions',
- format => ($form->{action} =~ /^csv/)? 'CSV': 'HTML');
- $template->render({
- form => \%$form,
- options => \@options,
- buttons => \@buttons,
- columns => \@column_index,
- heading => \%column_header,
- totals => \%column_data,
- rows => \@rows,
- });
-}
-
-sub csv_list_transactions { &list_transactions }
-
sub ca_subtotal {
my %column_data;