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

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



Revision: 3828
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3828&view=rev
Author:   einhverfr
Date:     2011-10-09 21:36:40 +0000 (Sun, 09 Oct 2011)
Log Message:
-----------
More budgetting stuff

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-tables.sql

Modified: addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm
===================================================================
--- addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm	2011-10-08 23:55:07 UTC (rev 3827)
+++ addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget.pm	2011-10-09 21:36:40 UTC (rev 3828)
@@ -123,47 +123,120 @@
 
 sub save {
     my ($self) = @_;
-    
+    $self->exec_method({funcname => 'budget__save_info'});
+    $self->{details} = [];
+    for my $line (@{$self->{lines}}){
+       my $l_info = [$line->{account_id}, 
+                     $line->{description}, 
+                     $line->{amount},
+       ];
+       push @{$self->{details}}, $l_info;
+    }
+    $self->exec_method({funcname => 'budget__save_details'});
+    $self->{dbh}->commit;
 }
 
 =item 
 
-=item search(....)
+=item search
+This method uses the object as the search criteria.  Nulls/undefs match all 
+values.  The properties used are:
 
+=over
+=item start_date
+Matches the start date of the budget.  Full match only.
+
+=item end_date
+Matches the end date of the budget.  Full match only
+
+=item includes_date
+This date is between start date and end date of budget, inclusive.
+
+=item reference
+Partial match on budget reference
+
+=item description
+Full text search against description
+
+=item entered_by
+Exact match of entered by.
+
+=item approved_by
+Exact match of approved by
+
+=item department_id
+Exact match of department_id
+
+=item project_id
+Exact match of project_id
+
+=item is_approved
+true lists approved budgets, false lists unapproved budgets.  null/undef lists 
+all.
+
+=item is_obsolete
+true lists obsolete budgets. False lists non-obsolete budgets.  null/undef lists
+all.
+
+=back
+
 =cut 
 
 sub search {
+    my ($self) = @_; # self is search criteria here.
+    @{$self->{search_results}}
+       = $self->exec_method({funcname => 'budget__search'});
+    return @{$self->{search_results}}; 
 }
 
 =item get(id)
+takes a new (base) object and populates with info for the budget.
 
 =cut
 
 sub get {
    my ($self, $id) = @_;
+   my ($info) = $self->call_procedure(
+          {procname => 'budget__get_info', args => [$id]}
+   );
+   $self->merge($info);
 }
 
 =item approve
+Marks the budget as approved.
 
 =cut
 
 sub approve {
+   my ($self) = @_;
+   $self->call_procedure({procname => 'budget__approve'});
+   $self->{dbh}->commit;
 }
 
 =item reject
+Reject and deletes the budget.
 
 =cut
 
 sub reject {
+   my ($self) = @_;
+   $self->call_procedure({procname => 'budget__reject'});
+   $self->{dbh}->commit;
 }
 
 =item obsolete
+Marks the budget as obsolete/superceded.
 
 =cut
 
 sub obsolete {
+   my ($self) = @_;
+   $self->call_procedure({procname => 'budget__obsolete'});
+   $self->{dbh}->commit;
 }
 
+#TODO:  Add notes to interface
+
 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-08 23:55:07 UTC (rev 3827)
+++ addons/1.3/budgetting/trunk/LedgerSMB/DBObject/Budget_Report.pm	2011-10-09 21:36:40 UTC (rev 3828)
@@ -29,8 +29,45 @@
 
 =head1 PROPERTIES
 
+=over
+=item id
+=item start_date
+=item end_date
+=item reference
+=item description
+=item entered_by
+=item approved_by
+=item obsolete_by
+=item entered_at
+=item approved_at
+=item obsolete_at
+=item entered_by_name
+=item approved_by_name
+=item obsolete_by_name
+=item department_id
+=item department_name
+=item project_id
+=item projectnumber
+=item lines
+
+=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
+=back
+
+=back
+
 =head1 METHODS
 
+=over
+=item run_report($id);
+=back
+
 =cut
 
 1;

Modified: addons/1.3/budgetting/trunk/sql/modules/budgetting-tables.sql
===================================================================
--- addons/1.3/budgetting/trunk/sql/modules/budgetting-tables.sql	2011-10-08 23:55:07 UTC (rev 3827)
+++ addons/1.3/budgetting/trunk/sql/modules/budgetting-tables.sql	2011-10-09 21:36:40 UTC (rev 3828)
@@ -35,10 +35,10 @@
     primary key (budget_id, account_id) 
 );
 
-INSERT INTO note_class (id, class) values ('5', 'Budget');
+INSERT INTO note_class (id, class) values ('6', 'Budget');
 
 CREATE OR REPLACE budget_note (
     primary key(id),
-    check (note_class = 5),
+    check (note_class = 6),
     foreign key(ref_key) references budget_info(id)
 );

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