[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3829] addons/1.3/budgetting/trunk



Revision: 3829
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3829&view=rev
Author:   einhverfr
Date:     2011-10-09 22:15:57 +0000 (Sun, 09 Oct 2011)
Log Message:
-----------
Budgetting perl modules now largely complete

Modified Paths:
--------------
    addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm
    addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm
    addons/1.3/budgetting/trunk/sql/modules/Budgetting.sql

Modified: addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm
===================================================================
--- addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm	2011-10-09 21:36:40 UTC (rev 3828)
+++ addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm	2011-10-09 22:15:57 UTC (rev 3829)
@@ -109,8 +109,26 @@
 
 =back
 
+=item @notes
+Where each note is a hashref containing
+
+=over
+=item $subject string
+   Subject of note
+
+=item $note string
+   The body of the note.
+
+=item $created timestamp
+   This is when the note was created
+
+=item $created_by string
+   Username of the individual who created the note at the time of its creation.
+
 =back
 
+=back
+
 =head1 METHODS
 
 =over
@@ -200,6 +218,8 @@
           {procname => 'budget__get_info', args => [$id]}
    );
    $self->merge($info);
+   @{$self->{lines}} = $self->exec_method({funcname => 'budget__get_details'});
+   @{$self->{notes}} = $self->exec_method({funcname => 'budget__get_notes'});
 }
 
 =item approve
@@ -209,7 +229,7 @@
 
 sub approve {
    my ($self) = @_;
-   $self->call_procedure({procname => 'budget__approve'});
+   $self->exec_method({funcname => 'budget__approve'});
    $self->{dbh}->commit;
 }
 
@@ -220,7 +240,7 @@
 
 sub reject {
    my ($self) = @_;
-   $self->call_procedure({procname => 'budget__reject'});
+   $self->exec_method({funcname => 'budget__reject'});
    $self->{dbh}->commit;
 }
 
@@ -231,12 +251,23 @@
 
 sub obsolete {
    my ($self) = @_;
-   $self->call_procedure({procname => 'budget__obsolete'});
+   $self->exec_method({funcname => 'budget__obsolete'});
    $self->{dbh}->commit;
 }
 
-#TODO:  Add notes to interface
+=item save_note(subject string, note string)
+Attaches a note with this subject and content to the budget.
 
+=cut
+
+sub save_note {
+   my ($self, $subject, $note) = @_;
+   my ($info) = $self->call_procedure(
+          {procname => 'budget__save_note', 
+           args => [$self->{id}, $subject, $note]}
+   );
+}
+
 1;
 
 =back

Modified: addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm
===================================================================
--- addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm	2011-10-09 21:36:40 UTC (rev 3828)
+++ addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm	2011-10-09 22:15:57 UTC (rev 3829)
@@ -31,33 +31,84 @@
 
 =over
 =item id
+The id of the budget
+
 =item start_date
+The start date of the budget, inclusive
+
 =item end_date
+The end date of the budget, inclusive
+
 =item reference
+The reference or control code of the budget
+
 =item description
+Description of the budget
+
 =item entered_by
+entity id of the one who entered the budget
+
 =item approved_by
+entity id of the one who approved the budget
+
 =item obsolete_by
+entity id of the one who marked the budget obsolete
+
 =item entered_at
+Timestamp when the budget was saved
+
 =item approved_at
+Timestamp when the budget was approved
+
 =item obsolete_at
+Timestamp when the budget was marked obsolete
+
 =item entered_by_name
+Name of the entity who entered the budget
+
 =item approved_by_name
+Name of the entity who approved the budget
+
 =item obsolete_by_name
+Name of the entity who marked the budget obsolete
+
 =item department_id
+The ID of the department for which this budget was written
+
 =item department_name
+Name of the department for which this budget was written
+
 =item project_id
+ID of project for which this budget was written
+
 =item projectnumber
+Project number for which this budget was written
+
 =item lines
+Lines of the report.  Each line is a hashref containing:
 
 =over
-=item accno text,
-=item account_label text,
-=item account_id int,
-=item budget_description text,
-=item budget_amount numeric,
-=item used_amount numeric,
-=item variance numeric
+=item accno
+Account number for the account in question
+
+=item account_label
+Description for the account in question
+
+=item account_id
+ID for the account in question
+
+=item budget_description
+Description for the line item of the budget
+
+=item budget_amount
+The amount budgetted
+
+=item used_amount
+The amount actually used
+
+=item variance
+budgetted - used
+
 =back
 
 =back
@@ -66,12 +117,27 @@
 
 =over
 =item run_report($id);
-=back
 
+Takes a blank (base) object and populates with the variance report data provided
+by the id argument.
+
 =cut
 
+sub run_report {
+    my ($self, $id) =  @_;
+   my ($info) = $self->call_procedure(
+          {procname => 'budget__get_info', args => [$id]}
+   );
+   $self->merge($info);
+   @{$self->{lines}} = $self->exec_method(
+          {funcname => 'budget__variance_report'}
+   );
+}
+
 1;
 
+=back
+
 =head1 COPYRIGHT AND LICENSE
 
 Copyright (C) 2011 LedgerSMB Core Team.  This file is licensed under the GNU 

Modified: addons/1.3/budgetting/trunk/sql/modules/Budgetting.sql
===================================================================
--- addons/1.3/budgetting/trunk/sql/modules/Budgetting.sql	2011-10-09 21:36:40 UTC (rev 3828)
+++ addons/1.3/budgetting/trunk/sql/modules/Budgetting.sql	2011-10-09 22:15:57 UTC (rev 3829)
@@ -200,6 +200,15 @@
 COMMENT ON FUNCTION budget__get_details(in_id int) IS
 $$ This retrieves the budget lines associated with a budget.$$;
 
+CREATE OR REPLACE FUNCTION budget__get_notes(in_id int) 
+RETURNS SETOF budget_note AS
+$$ 
+   SELECT * FROM budget_note WHERE ref_key = $1; 
+$$ LANGUAGE SQL;
+
+COMMENT ON FUNCTION budget__get_notes(in_id int) IS
+$$ Retrieves the notes associated with the budget.$$;
+
 CREATE OR REPLACE FUNCTION budget__save_note(in_id, in_subject, in_note)
 RETURNS budget_note AS
 $$

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.