[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3876] addons/1.3/budgetting/trunk
- Subject: SF.net SVN: ledger-smb:[3876] addons/1.3/budgetting/trunk
- From: ..hidden..
- Date: Mon, 17 Oct 2011 10:35:29 +0000
Revision: 3876
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3876&view=rev
Author: einhverfr
Date: 2011-10-17 10:35:29 +0000 (Mon, 17 Oct 2011)
Log Message:
-----------
Budget module ready for beta testing and user feedback
Modified Paths:
--------------
addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm
addons/1.3/budgetting/trunk/scripts/budgets.pl
Modified: addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm
===================================================================
--- addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm 2011-10-17 09:39:20 UTC (rev 3875)
+++ addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm 2011-10-17 10:35:29 UTC (rev 3876)
@@ -127,36 +127,16 @@
=cut
sub run_report {
- my ($self, $id) = @_;
+ my ($self) = @_;
my ($info) = $self->call_procedure(
- {procname => 'budget__get_info', args => [$id]}
+ procname => 'budget__get_info', args => [$self->{id}]
);
$self->merge($info);
@{$self->{lines}} = $self->exec_method(
{funcname => 'budget__variance_report'}
);
-}
-=item list_projects
-Lists all projects available for the start date of the budget.
-
-=cut
-
-sub list_projects {
- my ($self) = @_;
- my $effective_date = $self->{start_date} || 'today';
- return $self->call_procedure(procname => 'project_list_open',
- args =>[$effective_date]);
-}
-
-=item list_departments
-Lists all departments
-
-=cut
-
-sub list_departments {
- my ($self) = @_;
- return $self->call_procedure(procname => 'department_list');
+ return @{$self->{lines}};
}
1;
Modified: addons/1.3/budgetting/trunk/scripts/budgets.pl
===================================================================
--- addons/1.3/budgetting/trunk/scripts/budgets.pl 2011-10-17 09:39:20 UTC (rev 3875)
+++ addons/1.3/budgetting/trunk/scripts/budgets.pl 2011-10-17 10:35:29 UTC (rev 3876)
@@ -32,6 +32,43 @@
sub variance_report {
my ($request) = @_;
+ my $report = LedgerSMB::DBObject::Budget_Report->new({base => $request});
+ my @rows = $report->run_report();
+ my @cols = qw(accno account_label budget_description budget_amount
+ used_amount variance);
+ my $heading = {
+ budget_description => $request->{_locale}->text('Description'),
+ accno => $request->{_locale}->text('Account Number'),
+ account_label => $request->{_locale}->text('Account Label'),
+ budget_amount => $request->{_locale}->text('Amount Budgetted'),
+ used_amount => $request->{_locale}->text('- Used'),
+ variance => $request->{_locale}->text('= Variance'),
+ };
+ for my $row(@rows){
+ $row->{budget_amount} = $report->format_amount(
+ {amount => $row->{budget_amount}, money => 1}
+ );
+ $row->{used_amount} = $report->format_amount(
+ {amount => $row->{used_amount}, money => 1}
+ );
+ $row->{variance} = $report->format_amount(
+ {amount => $row->{variance}, money => 1}
+ );
+ }
+ my $template = LedgerSMB::Template->new(
+ user => $request->{_user},
+ locale => $request->{_locale},
+ path => 'UI',
+ template => 'form-dynatable',
+ format => ($report->{format}) ? $report->{format} : 'HTML',
+ );
+ $template->render({
+ form => $report,
+ columns => ..hidden..,
+ rows => ..hidden..,
+ heading => $heading,
+ });
+
}
=item new_budget
@@ -351,6 +388,15 @@
. '&id=' . $row->{id},
text => $row->{reference},
};
+ $row->{start_date} = { href => $base_url
+ . '?action=variance_report'
+ . '&id=' . $row->{id},
+ text => $row->{start_date},
+ };
+ $row->{end_date} = { href => $row->{start_date}->{href},
+ text => $row->{end_date}
+ };
+
}
my $template = LedgerSMB::Template->new(
user => $request->{_user},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.