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

SF.net SVN: ledger-smb: [1736] trunk



Revision: 1736
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1736&view=rev
Author:   einhverfr
Date:     2007-10-10 10:46:32 -0700 (Wed, 10 Oct 2007)

Log Message:
-----------
Adding David Mora's workflow script.  It still needs POD.

Added Paths:
-----------
    trunk/payment.pl
    trunk/scripts/payment.pl
    trunk/vouchers.pl

Copied: trunk/payment.pl (from rev 1728, trunk/menu.pl)
===================================================================
--- trunk/payment.pl	                        (rev 0)
+++ trunk/payment.pl	2007-10-10 17:46:32 UTC (rev 1736)
@@ -0,0 +1,3 @@
+#!/usr/bin/perl
+
+require "lsmb-request.pl";

Added: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	                        (rev 0)
+++ trunk/scripts/payment.pl	2007-10-10 17:46:32 UTC (rev 1736)
@@ -0,0 +1,152 @@
+
+#=====================================================================
+# PLAXIS
+# Copyright (c) 2007
+#
+#  Author: David Mora R
+# 	   Christian Ceballos B	   
+#
+#
+#
+#  
+#
+# 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.
+#======================================================================
+#
+# NEW PAYMENTS AND CHECK MODULE
+# 
+#
+#======================================================================
+
+
+package LedgerSMB::Scripts::payment;
+use LedgerSMB::Template;
+use LedgerSMB::DBObject::Payment;
+use LedgerSMB::DBObject::Date;
+use strict; 
+=pod
+
+=item payment
+
+This method is used to set the filter screen and prints it, using the 
+TT2 system. (hopefully it will... )
+
+=back
+
+=cut
+
+sub payment {
+ my ($request)    = @_;  
+ my $locale       = $request->{_locale};
+ my $templateData;
+ my  $dbPayment = LedgerSMB::DBObject::Payment->new({'base' => $request});
+# Lets get the project data... 
+ my  @projectOptions; 
+ my  @arrayOptions  = $dbPayment->list_open_projects();
+ push @projectOptions, {}; #A blank field on the select box 
+ for my $ref (0 .. $#arrayOptions) {
+       push @projectOptions, { value => $arrayOptions[$ref]->{id},
+                                text => $arrayOptions[$ref]->{projectnumber}."--".$arrayOptions[$ref]->{description}};
+ }
+# Lets get the departments data...
+  my @departmentOptions;
+  my $role =  $request->{type} eq 'receipt' ? 'P' : 'C';
+  @arrayOptions = $dbPayment->list_departments($role);
+  push @departmentOptions, {}; # A blank field on the select box
+  for my $ref (0 .. $#arrayOptions) {
+      push @departmentOptions, { value => $arrayOptions[$ref]->{id},
+                                  text => $arrayOptions[$ref]->{description}};
+  }
+# Lets get the customer or vendor :)
+ my @vcOptions;
+ $dbPayment->{account_class} = $request->{type} eq 'receipt' ? 2 : 1;
+ @arrayOptions = $dbPayment->get_open_accounts();
+ for my $ref (0 .. $#arrayOptions) {
+    push @vcOptions, { value => $arrayOptions[$ref]->{id},
+                       text => $arrayOptions[$ref]->{description}};
+ }
+# Lets get the open currencies (this uses the $dbPayment->{account_class} property)
+ my @currOptions;
+ @arrayOptions = $dbPayment->get_open_currencies(); 
+ for my $ref (0 .. $#arrayOptions) {
+     push @arrayOptions, { value => $arrayOptions[$ref]->{id},
+                           text => $arrayOptions[$ref]->{description}};
+ }
+# Lets build filter by period
+my $date = LedgerSMB::DBObject::Date->new({base => $request});
+   $date->build_filter_by_period($locale);
+# Lets set the data in a hash for the template system. :)    
+my $select = {
+  stylesheet => $request->{_user}->{stylesheet},
+  projects => {
+    name => 'projects',
+    options => ..hidden..
+  },
+  department => {
+    name => 'department',
+    options => ..hidden..
+  },
+  customer => {
+    name => 'customer',
+    options => ..hidden..
+  },
+  curr => {
+    name => 'curr',
+    options => ..hidden..
+  },
+  month => {
+    name => 'month',
+    options => $date->{monthsOptions}
+  },
+  year => {
+    name => 'year',
+    options => $date->{yearsOptions}
+  },
+  interval_radios => $date->{radioOptions},	
+  amountfrom => {
+	type => 'text',
+	name => 'amountfrom',
+	size => '10',
+	maxlength => '10'
+  },
+  amountto => {
+	type => 'text',
+	name => 'amountto',
+	size => '10',
+	maxlength => '10'
+  },
+  sort => {
+    type => 'hidden',
+    value => 'sort_value'	
+  },
+  action => {
+    name => 'action',
+    value => 'continue', 
+    text => $locale->text("Continue"),
+  },
+
+};
+# Lets call upon the template system
+my $template;
+
+  $template = LedgerSMB::Template->new(
+  user     => $request->{_user},
+  locale   => $request->{_locale},
+  path     => 'UI',
+  template => 'payment1',
+  format => 'HTML', );
+$template->render($select);# And finally, Lets print the screen :)
+}
+
+1;

Added: trunk/vouchers.pl
===================================================================
--- trunk/vouchers.pl	                        (rev 0)
+++ trunk/vouchers.pl	2007-10-10 17:46:32 UTC (rev 1736)
@@ -0,0 +1,3 @@
+#!/usr/bin/perl
+
+require 'lsmb-request.pl';


Property changes on: trunk/vouchers.pl
___________________________________________________________________
Name: svn:executable
   + *


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