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

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



Revision: 3249
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3249&view=rev
Author:   einhverfr
Date:     2011-06-15 02:43:17 +0000 (Wed, 15 Jun 2011)

Log Message:
-----------
History filter screen complete.  Now working on history report itself

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Company.pm
    trunk/LedgerSMB/ScriptLib/Company.pm
    trunk/UI/Contact/history_filter.html
    trunk/dists/source/build.sh
    trunk/sql/modules/Company.sql

Modified: trunk/LedgerSMB/DBObject/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Company.pm	2011-06-14 19:39:31 UTC (rev 3248)
+++ trunk/LedgerSMB/DBObject/Company.pm	2011-06-15 02:43:17 UTC (rev 3249)
@@ -72,6 +72,57 @@
 
 Retrieves customer/vendor purchase.
 
+Search Criteria
+name:  search string for company name
+contact_info:  Search string for contact info, can match phone, fax, or email.
+salesperson:  Search string for employee name in the salesperson field
+notes: Notes search.  Not currently implemented
+meta_number:  Exact match for customer/vendor number
+address_line:  Search string for first or second line of address.
+city:  Search string for city name
+state:  Case insensitive, otherwise exact match for state or province
+zip:  leading match for zip/mail code
+country_id:  integer for country id.  Exact match
+tartdate_from:  Earliest date for startdate of entity credit account
+startdate_to:  Lates date for entity credit accounts' start date
+type:  either 'i' for invoice, 'o' for orders, 'q' for quotations
+from_date:  Earliest date for the invoice/order
+to_date:  Latest date for the invoice/order
+
+Unless otherwise noted, partial matches are sufficient.
+
+Control variables:
+inc_open:  Include open invoices/orders.  If not true, no open invoices are
+           displayed
+inc_closed: Include closed invoices/orders.  If not true, no closed invoices are
+            displayed
+report_type:  Either summary or detail
+
+returns a list of rows of the summary report and sets these to 
..hidden..>{history_rows}}
+
+=back
+
+=cut
+
+
+
+sub get_history {
+    my ($self) = @_;
+    my @results;
+    if ($self->{report_type} eq 'summary') {
+        @results = $self->exec_method(funcname => 'eca_history_summary');
+    } elsif ($self->{report_type} eq 'detail'){
+        @results = $self->exec_method(funcname => 'eca_history');
+    } else {
+        $self->error('Invalid report type in history report');
+    }
+    $self->{history_rows} = ..hidden..;
+    return @results;
+}
+
+=pod
+
 =over
 
 =item save_credit 

Modified: trunk/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Company.pm	2011-06-14 19:39:31 UTC (rev 3248)
+++ trunk/LedgerSMB/ScriptLib/Company.pm	2011-06-15 02:43:17 UTC (rev 3249)
@@ -404,6 +404,8 @@
 sub history {
     my ($request) = @_;
     set_entity_class($request);
+    my $company = LedgerSMB::DBObject::Company->new(base => $request);
+    $company->get_metadata;
     my $template = LedgerSMB::Template->new( 
 	user => $request->{_user}, 
     	template => 'history_filter', 
@@ -411,7 +413,7 @@
 	path => 'UI/Contact',
         format => 'HTML'
     );
-    $template->render($request);
+    $template->render($company);
 
 } 
 

Modified: trunk/UI/Contact/history_filter.html
===================================================================
--- trunk/UI/Contact/history_filter.html	2011-06-14 19:39:31 UTC (rev 3248)
+++ trunk/UI/Contact/history_filter.html	2011-06-15 02:43:17 UTC (rev 3249)
@@ -109,16 +109,16 @@
 	      </tr> 
 	      <tr> 
 		<th align=right nowrap><?lsmb text('Country') ?></th> 
-		<td><?lsmb countries.push({});
+		<td><?lsmb country_list.unshift({});
                      INCLUDE select element_data = {
                          name = "country_id",
                          text_attr = 'name',
                          value_attr = 'id',
-                         option = countries,
+                         options = country_list,
                     } ?></td>
 	      </tr> 
 	      <tr> 
-		<th align=right nowrap>i<?lsmb text('Startdate') ?></th> 
+		<th align=right nowrap><?lsmb text('Startdate') ?></th> 
 		<td><?lsmb INCLUDE input element_data = {
                          name = "startdate_from",
                          size = "11",

Modified: trunk/dists/source/build.sh
===================================================================
--- trunk/dists/source/build.sh	2011-06-14 19:39:31 UTC (rev 3248)
+++ trunk/dists/source/build.sh	2011-06-15 02:43:17 UTC (rev 3249)
@@ -2,13 +2,13 @@
 
 # Simple script to prepare for release
 
-version="1.3.0_beta_3";
+version="1.3.0_snapshot20110614";
 build_d="../release";
 
 if test -d $build_d/ledgersmb; then
   rm -rf $build_d/ledgersmb
 fi
-
+rm -rf $build_d/ledgersmb
 svn export . $build_d/ledgersmb
 
 cd $build_d

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2011-06-14 19:39:31 UTC (rev 3248)
+++ trunk/sql/modules/Company.sql	2011-06-15 02:43:17 UTC (rev 3249)
@@ -35,7 +35,6 @@
    salesperson_name text
 );
 
-
 CREATE OR REPLACE FUNCTION eca_history
 (in_name text, in_meta_number text, in_contact_info text, in_address_line text,
  in_city text, in_state text, in_zip text, in_salesperson text, in_notes text, 
@@ -48,7 +47,7 @@
             a.id as invoice_id, a.invnumber, a.curr::text, 
             p.id AS parts_id, p.partnumber, 
             i.description, i.qty, i.unit::text, i.sellprice, i.discount, 
-            i.deliverydate, pr.id as projectnumber, pr.projectnumber,
+            i.deliverydate, pr.id as project_id, pr.projectnumber,
             i.serialnumber, 
             case when $16 = 1 then xr.buy else xr.sell end as exchange_rate,
             ee.id as salesperson_id, 
@@ -129,10 +128,29 @@
           and (a.transdate >= $11 or $11 is null)
           and (a.transdate <= $12 or $12 is null)
           and (eca.startdate >= $14 or $14 is null)
-          and (eca.startdate <= $15 or $15 is null);
+          and (eca.startdate <= $15 or $15 is null)
+ ORDER BY eca.meta_number;
 $$ LANGUAGE SQL;
 
 
+CREATE OR REPLACE FUNCTION eca_history_summary
+(in_name text, in_meta_number text, in_contact_info text, in_address_line text,
+ in_city text, in_state text, in_zip text, in_salesperson text, in_notes text, 
+ in_country_id int, in_from_date date, in_to_date date, in_type char(1), 
+ in_start_from date, in_start_to date, in_account_class int, 
+ inc_open bool, inc_closed bool)
+RETURNS SETOF  eca_history_result AS
+$$
+SELECT id, name, meta_number, null::int, null::text, curr, parts_id, partnumber,
+       description, sum(qty), unit, null::numeric, null::numeric, null::date, 
+       null::int, null::text, null::text, null::numeric,
+       null::int, null::text
+  FROM eca_history($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14,
+                   $15, $16, $17, $18)
+ group by id, name, meta_number, curr, parts_id, partnumber, description, unit
+ order by meta_number;
+$$ LANGUAGE SQL;
+
 CREATE OR REPLACE FUNCTION company__search
 (in_account_class int, in_contact text, in_contact_info text[], 
 	in_meta_number text, in_address text, in_city text, in_state text, 


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