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

SF.net SVN: ledger-smb:[6254] addons/1.3/wxPOS



Revision: 6254
          http://sourceforge.net/p/ledger-smb/code/6254
Author:   einhverfr
Date:     2013-11-08 05:10:36 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
Customer/pricelist system now works

Modified Paths:
--------------
    addons/1.3/wxPOS/scripts/AR.pm
    addons/1.3/wxPOS/scripts/WXPOS/Part.pm
    addons/1.3/wxPOS/setup/functions.sql

Modified: addons/1.3/wxPOS/scripts/AR.pm
===================================================================
--- addons/1.3/wxPOS/scripts/AR.pm	2013-11-08 04:14:08 UTC (rev 6253)
+++ addons/1.3/wxPOS/scripts/AR.pm	2013-11-08 05:10:36 UTC (rev 6254)
@@ -5,9 +5,9 @@
 use Wx qw(wxDefaultPosition wxDefaultSize wxLI_HORIZONTAL wxCB_READONLY wxICON_ERROR wxOK wxCENTRE wxLC_REPORT wxLIST_NEXT_ALL wxLIST_STATE_SELECTED wxLIST_STATE_DONTCARE wxLIST_NEXT_BELOW wxLC_VIRTUAL);
 use Wx::Grid;
 use WXPOS::Part;
+use WXPOS::Counterparty;
 
 # TODO:
-# customer box addresses entity.id when is should address entity_credit_account.id
 # Need payment/posting screen
 # No hardware support/printing support yet.
 # Dropping warehouse search restrictions currently.
@@ -120,9 +120,9 @@
  my $customer = $self->{custom}->GetValue();
  my $list;
  my $i = 0;
- foreach (@{$self->{sesion}->{ldb}->getEntityList(2, undef, $customer)}) {
-  push (@{$list}, "$_->[1]");
-  $self->{customer_search}->{$_->[1]} = $_->[0];
+ foreach (WXPOS::Counterparty->search($customer, 2)) {
+  push (@{$list}, $_->name);
+  $self->{customer_search}->{$_->name} = $_->id;
   $i++;
  }
  if ($list) {

Modified: addons/1.3/wxPOS/scripts/WXPOS/Part.pm
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/Part.pm	2013-11-08 04:14:08 UTC (rev 6253)
+++ addons/1.3/wxPOS/scripts/WXPOS/Part.pm	2013-11-08 05:10:36 UTC (rev 6254)
@@ -74,6 +74,7 @@
 sub get_by_partnumber {
     my ($self, $partnumber, $contact_id, $entity_class) = @_;
     my ($ref) = __PACKAGE__->call_procedure(funcname => 'get',
+                                          funcprefix => _get_prefix(),
                                                 args => [$partnumber, 
                                                          $contact_id, 
                                                          $entity_class]
@@ -92,6 +93,7 @@
 sub search {
     my ($self, $string, $contact_id, $entity_class) = @_;
     my @results = __PACKAGE__->call_procedure(funcname => 'search',
+                                            funcprefix => _get_prefix(),
                                                   args => [$string,
                                                          $contact_id, 
                                                          $entity_class]

Modified: addons/1.3/wxPOS/setup/functions.sql
===================================================================
--- addons/1.3/wxPOS/setup/functions.sql	2013-11-08 04:14:08 UTC (rev 6253)
+++ addons/1.3/wxPOS/setup/functions.sql	2013-11-08 05:10:36 UTC (rev 6254)
@@ -122,4 +122,30 @@
 END;
 $$;
 
+DROP TYPE IF EXISTS wxpos_counterparty CASCADE;
+CREATE TYPE wxpos_counterparty AS (
+    id int,
+    "name" text,
+    pay_to text
+);
+
+CREATE OR REPLACE FUNCTION wxpos_counterparty__get(in_id int, in_class int)
+RETURNS wxpos_counterparty LANGUAGE SQL AS
+$$
+SELECT eca.id, e.name, eca.pay_to_name
+  FROM entity_credit_account eca
+  JOIN entity e ON eca.entity_id = e.id
+ WHERE eca.id = $1 AND eca.entity_class = $2;
+$$;
+
+CREATE OR REPLACE FUNCTION wxpos_counterparty__search(in_name text, in_class int)
+RETURNS SETOF wxpos_counterparty LANGUAGE SQL AS
+$$
+SELECT eca.id, e.name, eca.pay_to_name
+  FROM entity_credit_account eca
+  JOIN entity e ON eca.entity_id = e.id
+ WHERE eca.entity_class = $2 AND
+       (e.name @@ plainto_tsquery($1) OR eca.pay_to_name @@plainto_tsquery($1));
+$$;
+
 COMMIT;

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


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits