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

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



Revision: 5349
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5349&view=rev
Author:   einhverfr
Date:     2012-12-15 06:13:37 +0000 (Sat, 15 Dec 2012)
Log Message:
-----------
salesperson dropdown fixes

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/invoice.pm
    trunk/LedgerSMB/Scripts/reports.pm
    trunk/UI/lib/report_base.html
    trunk/sql/modules/Employee.sql

Modified: trunk/LedgerSMB/Scripts/invoice.pm
===================================================================
--- trunk/LedgerSMB/Scripts/invoice.pm	2012-12-15 04:01:12 UTC (rev 5348)
+++ trunk/LedgerSMB/Scripts/invoice.pm	2012-12-15 06:13:37 UTC (rev 5349)
@@ -48,6 +48,9 @@
         procname => 'account__get_by_link_desc', args => [$link]);
     @{$request->{tax_accounts}} = $request->call_procedure(
         procname => 'account__get_by_link_desc', args => ["${link}_tax"]);
+    @{$request->{employees}} =  $request->call_procedure(
+        procname => 'employee__all_salespeople'
+    );
     LedgerSMB::Scripts::reports::begin_report($request);
 }
 

Modified: trunk/LedgerSMB/Scripts/reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/reports.pm	2012-12-15 04:01:12 UTC (rev 5348)
+++ trunk/LedgerSMB/Scripts/reports.pm	2012-12-15 06:13:37 UTC (rev 5349)
@@ -82,6 +82,9 @@
     @{$request->{country_list}} = $request->call_procedure( 
                    procname => 'location_list_country'
     );
+    @{$request->{employees}} =  $request->call_procedure(
+        procname => 'employee__all_salespeople'
+    );
     my $template = LedgerSMB::Template->new(
         user => $request->{_user},
         locale => $request->{_locale},

Modified: trunk/UI/lib/report_base.html
===================================================================
--- trunk/UI/lib/report_base.html	2012-12-15 04:01:12 UTC (rev 5348)
+++ trunk/UI/lib/report_base.html	2012-12-15 06:13:37 UTC (rev 5349)
@@ -188,3 +188,26 @@
 	</div>
       </div>
 <?lsmb END #BLOCK ?>
+
+<?lsmb 
+
+  BLOCK employees;
+  # DEFAULTS
+  IF ! SELECTNAME.defined;
+     SELECTNAME = 'employee_id';
+  END;
+  FOREACH e IN employees;
+     e.text = e.first_name _ ' ' _ e.last_name;
+  END ?>
+<tr>
+  <th><?lsmb text('Employees') ?></th>
+  <td><?lsmb PROCESS select element_data = {
+                 name = SELECTNAME
+       default_values = [$SELECTNAME]
+              options = employees
+           value_attr = 'id'
+                class = 'employee'
+       } ?></td>
+</tr><?lsmb
+
+  END # BLOCK employees ?>

Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql	2012-12-15 04:01:12 UTC (rev 5348)
+++ trunk/sql/modules/Employee.sql	2012-12-15 06:13:37 UTC (rev 5349)
@@ -240,16 +240,20 @@
 END;
 $$ language plpgsql;
 
+CREATE OR REPLACE FUNCTION employee__all_salespeople()
+RETURNS setof employee_result LANGUAGE SQL AS
+$$
+   SELECT p.entity_id, e.control_code, p.id, s.salutation, s.id,
+          p.first_name, p.middle_name, p.last_name,
+          ee.startdate, ee.enddate, ee.role, ee.ssn, ee.sales, ee.manager_id,
+          mp.first_name, mp.last_name, ee.employeenumber, ee.dob, e.country_id
+     FROM person p
+     JOIN entity_employee ee on (ee.entity_id = p.entity_id)
+     JOIN entity e ON (p.entity_id = e.id)
+LEFT JOIN salutation s on (p.salutation_id = s.id)
+LEFT JOIN person mp ON ee.manager_id = p.entity_id
+    WHERE ee.sales
+ ORDER BY ee.employeenumber;
+$$;
 
--- I don't like this.  Wondering if we should unify this to another function.
--- person__location_save should be cleaner.  Not documenting yet, but not 
--- removing because user management code uses it.  --CT
-create or replace function employee_set_location 
-    (in_employee int, in_location int) 
-returns void as $$
-
-    INSERT INTO entity_to_location (entity_id,location_id) 
-    SELECT entity_id, $2
-      FROM person WHERE id = $1;
-$$ language 'sql';
 COMMIT;

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