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

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



Revision: 6258
          http://sourceforge.net/p/ledger-smb/code/6258
Author:   einhverfr
Date:     2013-11-08 05:49:22 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
Moved the UI modules into a namespace abstraction.  This will be helpful when it comes time to add i18n support.

Modified Paths:
--------------
    addons/1.3/wxPOS/scripts/WXPOS/UI.pm

Added Paths:
-----------
    addons/1.3/wxPOS/scripts/WXPOS/UI/AR.pm
    addons/1.3/wxPOS/scripts/WXPOS/UI/IC.pm

Removed Paths:
-------------
    addons/1.3/wxPOS/scripts/AR.pm
    addons/1.3/wxPOS/scripts/IC.pm

Deleted: addons/1.3/wxPOS/scripts/AR.pm
===================================================================
--- addons/1.3/wxPOS/scripts/AR.pm	2013-11-08 05:37:37 UTC (rev 6257)
+++ addons/1.3/wxPOS/scripts/AR.pm	2013-11-08 05:49:22 UTC (rev 6258)
@@ -1,274 +0,0 @@
-package AR;
-
-use base qw(Wx::Frame);
-use Wx::Event qw(EVT_BUTTON EVT_LISTBOX_DCLICK EVT_COMBOBOX EVT_LIST_ITEM_RIGHT_CLICK EVT_LIST_ITEM_SELECTED EVT_LIST_ITEM_DESELECTED);
-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:
-# Need payment/posting screen
-# No hardware support/printing support yet.
-# Dropping warehouse search restrictions currently.
-
-sub new {
- my ($class, $sesion, $action) = @_;
- my $self = {};
- $self->{sesion} = $sesion;
- bless $self, $class;
- return $self->$action();
-}
-
-####### Invoice Screen
-sub Invoice {
- my ($self) = @_;
- $self->{sesion}->{tk} = undef;
- $self->{sesion}->{tk}->{items} = 0;
- $self->{tab} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize);
-
-### Close Window Button
- my $close_btn = Wx::Button->new($self->{tab}, -1, '[X]', [750, 3], [30, 24]);
- EVT_BUTTON($self->{tab}, $close_btn, sub{$self->_close_pane});
-
-### Customer
- my $dft_custom = $self->{sesion}->{defaults}->{custom} || '';
- $dft_custom ||= $WXPOS::Sysconfig::default_customer;
- Wx::StaticLine->new($self->{tab}, -1, [0, 0], [800, 2], wxLI_HORIZONTAL);
- Wx::StaticText->new($self->{tab}, -1, 'Customer', [10, 10], [90, 24]);
- $self->{custom} = Wx::TextCtrl->new($self->{tab}, -1, $dft_custom, [110, 10], [90, 24]);
- my $cust_but = Wx::Button->new($self->{tab}, -1, 'Search', [210, 10], [90, 24]);
- EVT_BUTTON($self->{tab}, $cust_but, sub{$self->_listCustomByName});
- $self->{customer_list} = Wx::ComboBox->new($self->{tab}, -1, '', [10, 40], [290, 24], [''], wxCB_READONLY);
- Wx::StaticLine->new($self->{tab}, -1, [0, 70], [800, 2], wxLI_HORIZONTAL);
-### Parts Search
-
- my $warehouse = $self->{sesion}->{defaults}->{wh} || '';
- Wx::StaticText->new($self->{tab}, -1, 'Warehouse: '.$warehouse, [10,120], [120, 24]);
- Wx::StaticText->new($self->{tab}, -1, 'Description', [140, 120], [90, 24]);
- $self->{desc} = Wx::TextCtrl->new($self->{tab}, -1, '', [240, 120], [180, 24]);
- my $parts_but = Wx::Button->new($self->{tab}, -1, 'Search', [440, 120], [60, 24]);
- EVT_BUTTON($self->{tab}, $parts_but, sub{$self->_listPartsByName});
- Wx::StaticLine->new($self->{tab}, -1, [0, 150], [800, 2], wxLI_HORIZONTAL);
-
-### Line Entry
- Wx::StaticText->new($self->{tab}, -1, 'Qty: ', [10, 160], [30, 24]);
- $self->{part_qty} = Wx::TextCtrl->new($self->{tab}, -1, '1', [50, 160], [30, 24]);
- Wx::StaticText->new($self->{tab}, -1, 'Number: ', [90, 160], [60, 24]);
- $self->{part_numb} = Wx::TextCtrl->new($self->{tab}, -1, '', [160, 160], [90, 24]);
- Wx::StaticText->new($self->{tab}, -1, 'Price: ', [260, 160], [60, 24]);
- $self->{part_sellprice} 
-     = Wx::TextCtrl->new($self->{tab}, -1, '', [300, 160], [90, 24]);
- Wx::StaticText->new($self->{tab}, -1, 'Disc: ', [400, 160], [60, 24]);
- $self->{part_discount} 
-     = Wx::TextCtrl->new($self->{tab}, -1, '', [440, 160], [40, 24]);
- my $parts_add = Wx::Button->new($self->{tab}, -1, 'Add', [500, 160], [60, 24]);
- EVT_BUTTON($self->{tab}, $parts_add, sub{$self->_addParts});
- Wx::StaticText->new($self->{tab}, -1, 'Selected: ', [600, 160], [90, 24]);
- $self->{sel_del} = Wx::StaticText->new($self->{tab}, -1, '', [690, 160], [30, 24]);
- my $parts_del = Wx::Button->new($self->{tab}, -1, 'Del', [730, 160], [60, 24]);
- EVT_BUTTON($self->{tab}, $parts_del, sub{$self->_delParts});
-
-### Ticket
- $self->{list} = Wx::ListCtrl->new($self->{tab}, -1, [10, 200], [780, 280], wxLC_REPORT);
- $self->{list}->InsertColumn(1, 'Number');
- $self->{list}->InsertColumn(2, 'Description');
- $self->{list}->InsertColumn(3, 'Price');
- $self->{list}->InsertColumn(4, 'Tax');
- $self->{list}->InsertColumn(5, 'Ratio');
- $self->{list}->InsertColumn(6, 'SubTotal');
- $self->{list}->InsertColumn(7, 'Qty');
- $self->{list}->InsertColumn(8, 'Total');
- EVT_LIST_ITEM_SELECTED($self->{tab}, $self->{list}, sub{$self->_selParts});
- EVT_LIST_ITEM_DESELECTED($self->{tab}, $self->{list}, sub{$self->_selParts});
-
-### Pay
- Wx::StaticLine->new($self->{tab}, -1, [0, 490], [800, 2], wxLI_HORIZONTAL);
- Wx::StaticText->new($self->{tab}, -1, 'Net: ', [100, 500], [90, 24]);
- $self->{net_total} = Wx::StaticText->new($self->{tab}, -1, '', [200, 500], [90, 24]);
- Wx::StaticText->new($self->{tab}, -1, 'Tax: ', [300, 500], [90, 24]);
- $self->{tax_total} = Wx::StaticText->new($self->{tab}, -1, '', [400, 500], [90, 24]);
- Wx::StaticText->new($self->{tab}, -1, 'Total: ', [500, 500], [90, 24]);
- $self->{total} = Wx::StaticText->new($self->{tab}, -1, '', [600, 500], [90, 24]);
- my $invoice_post = Wx::Button->new($self->{tab}, -1, 'Pay', [700, 500], [90, 24]);
- EVT_BUTTON($self->{tab}, $invoice_post, sub{$self->_InvoicePay});
-
-## Finishing
- if ($dft_custom){
-    $self->_listCustomByName;
- }
- return $self->{tab};
-}
-#######
-
-sub Transaction {
- my ($self) = @_;
- $self->{tab} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize);
- Wx::StaticText->new($self->{tab}, -1, 'WIP', [400, 300], [100, 24]);
- return $self->{tab};
-}
-
-sub Customer {
- my ($self) = @_;
- $self->{tab} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize);
- Wx::StaticText->new($self->{tab}, -1, 'WIP', [400, 300], [100, 24]);
- return $self->{tab};
-}
-
-sub _listCustomByName {
- my($self, $event) = @_;
- my $customer = $self->{custom}->GetValue();
- my $list;
- my $i = 0;
- foreach (WXPOS::Counterparty->search($customer, 2)) {
-  push (@{$list}, $_->name);
-  $self->{customer_search}->{$_->name} = $_->id;
-  $i++;
- }
- if ($list) {
-  $self->{customer_list} = undef;
-  $self->{customer_list} = Wx::ComboBox->new($self->{tab}, -1, $list->[0], [10, 40], [290, 24], $list);
- }
- else {
-  $self->{customer_list} = undef;
-  $self->{customer_list} = Wx::ComboBox->new($self->{tab}, -1, '', [10, 40], [290, 24], ['']);
- }
- return $self->{customer_list};
-}
-
-sub _listPartsByName {
- my($self, $event) = @_;
- my $desc = $self->{desc}->GetValue();
- my $wh = $self->{sesion}->{defaults}->{wh};
- my $list;
- my $cust = $self->{customer_search}->{$self->{customer_list}->GetValue()};
- foreach (WXPOS::Part->search($desc, $cust, 2)) {
-  push (@{$list}, $_->description);
-  $self->{parts_search}->{$_->description} = $_->partnumber;
- }
- if ($list) {
-  $self->{parts_list} = undef;
-  $self->{parts_list} = Wx::ComboBox->new($self->{tab}, -1, $list->[0], [510, 120], [280, 24], $list, wxCB_READONLY);
-  EVT_COMBOBOX($self->{tab}, $self->{parts_list}, sub{$self->_getPartsNumber});
- }
- else {
-  $self->{parts_list} = undef;
-  $self->{parts_list} = Wx::ComboBox->new($self->{tab}, -1, '', [510, 120], [280, 24], [''], wxCB_READONLY);
- }
- return $self->{parts_list};
-}
-
-sub _getPartsNumber {
- my($self, $event) = @_;
- my $numb = $self->{parts_search}->{$self->{parts_list}->GetValue()};
- $self->{part_numb}->SetValue($numb);
- return $self->{part_numb};
-}
-
-
-sub _addParts {
- my($self, $event) = @_;
- my $part = $self->{part_numb}->GetValue();
- my $cust = $self->{customer_search}->{$self->{customer_list}->GetValue()};
-### Check for customer
- if (!$cust) {
-  Wx::MessageBox("Please, try again selecting a customer.", "Customer not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
-  return 0;
- }
-### Check for part
- if (!$part) {
-  Wx::MessageBox("Please, try again selecting a part.", "Part not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
-  return 0;
- }
- $part = WXPOS::Part->get_by_partnumber($part, $cust, 2);
- my $numb = $part->partnumber;
- my $desc = $part->description;
- my $sell = $part->sellprice;
- if (!$numb) {
-  Wx::MessageBox("Please, try again.", "Part not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
-  return 0;
- }
-## Price/discount overrides
- if ($self->{part_sellprice}->GetValue()){
-    $sell = $self->{part_sellprice}->GetValue();
- }
- my $disc = $self->{part_discount}->GetValue();
- my $format;
- if ($disc){
-    $sell = $sell * (100 - $disc)/100;
-    $format = "%." .$WXPOS::Sysconfig::money_places . "f";
-    
-    $sell = sprintf($format, $sell);
- }
- my $qty = $self->{part_qty}->GetValue();
- my $total_tax = 0;
- my $total_tax_ratio = 0;
-### Calculates total ratio and total tax ammount
- foreach my $tax (@{$self->{sesion}->{ldb}->getTaxByPair($cust, $part)}) {
-  $total_tax_ratio += $tax->[1];
-  $total_tax += $tax->[1] * $sell;
- }
- my $st = $total_tax + $sell;
- my $total = $st * $qty;
- my $pp = $self->{list}->InsertStringItem($self->{sesion}->{tk}->{items}, $numb);
- $self->{list}->SetItem($pp, 1, $desc, -1);
- $self->{list}->SetItem($pp, 2, $sell, -1);
- $self->{list}->SetItem($pp, 3, $total_tax, -1);
- $self->{list}->SetItem($pp, 4, $total_tax_ratio, -1);
- $self->{list}->SetItem($pp, 5, $st, -1);
- $self->{list}->SetItem($pp, 6, $qty, -1);
- $self->{list}->SetItem($pp, 7, $total, -1);
-
- $self->{sesion}->{tk}->{tnet} += $sell;
- $self->{sesion}->{tk}->{ttax} += $total_tax;
- $self->{sesion}->{tk}->{total} += $total;
- $self->{net_total}->SetLabel($self->{sesion}->{tk}->{tnet});
- $self->{tax_total}->SetLabel($self->{sesion}->{tk}->{ttax});
- $self->{total}->SetLabel($self->{sesion}->{tk}->{total});
- $self->{sesion}->{tk}->{items}++;
- return $part;
-}
-
-sub _selParts {
- my($self) = @_;
- $self->{sel_del}->SetLabel($self->{list}->GetSelectedItemCount);
- return 1;
-}
-
-sub _delParts {
- my($self) = @_;
- if ($self->{list}->GetSelectedItemCount < 1) {
-  Wx::MessageBox("Please, try again selecting an item.", "Item not deleted!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
-  return 0;
- }
- my $item = $self->{list}->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- my $sell = $self->{list}->GetItem($item, 2)->GetText();
- my $total_tax = $self->{list}->GetItem($item, 3)->GetText();
- my $total = $self->{list}->GetItem($item, 7)->GetText();
- $self->{sesion}->{tk}->{tnet} -= $sell;
- $self->{sesion}->{tk}->{ttax} -= $total_tax;
- $self->{sesion}->{tk}->{total} -= $total;
- $self->{net_total}->SetLabel($self->{sesion}->{tk}->{tnet});
- $self->{tax_total}->SetLabel($self->{sesion}->{tk}->{ttax});
- $self->{total}->SetLabel($self->{sesion}->{tk}->{total});
- $self->{list}->DeleteItem($item);
- $self->{sesion}->{tk}->{items}--;
- $self->{sel_del}->SetLabel($self->{list}->GetSelectedItemCount);
-#use Data::Dumper;
-#print Dumper($item_col);
- return 1;
-}
-
-sub _close_pane {
- my ($self) = $_;
- my $selection = $WXPOS::State::Notebook->GetSelection;
- $WXPOS::State::Notebook->DeletePage($selection);
- return 1;
-}
-
-sub _InvoicePay {
- my($self) = @_;
- Wx::MessageBox("At this point we should be able to track each account and the account to set.", "DEBUG", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
- return 1;
-}
-1;

Deleted: addons/1.3/wxPOS/scripts/IC.pm
===================================================================
--- addons/1.3/wxPOS/scripts/IC.pm	2013-11-08 05:37:37 UTC (rev 6257)
+++ addons/1.3/wxPOS/scripts/IC.pm	2013-11-08 05:49:22 UTC (rev 6258)
@@ -1,116 +0,0 @@
-=head1 NAME
-
-LedgerSMB - Wx Inventory Control
-
-=head1 SYNOPSIS
-
-This module is on charge of inventory operations.
-
-=head1 METHODS
-
-=over
-
-=item new ($sesion, $action)
-
-This will get, set and go an action from the menu that is a method of this class. It will
-work as a kind of handler and will return a reference to that action.
-$sesion = It is a hash with all objects and variables needed.
-$action = Method name to invoque as String
-
-=item Parts ()
-
-This is an action that will show a panel asiking for number or description.
-
-=item _listPartsByName ()
-
-A private function used by the Search action that invoques lsmbdb interface to get parts list from the db.
-
-=back
-
-=head1 AUTHOR
-
-Andres Basile (..hidden..)
-
-=cut
-
-package IC;
-
-use base qw(Wx::Frame);
-use Wx::Event qw(EVT_BUTTON);
-use Wx qw(wxDefaultPosition wxDefaultSize wxMAXIMIZE wxCB_READONLY);
-use Wx::Grid;
-
-sub new {
- my ($class, $sesion, $action) = @_;
- my $self = {};
- $self->{sesion} = $sesion;
- $self->{wh_dft_id} = $self->{sesion}->{defaults}->{wh};
- bless $self, $class;
- $self->_getWarehouses();
- return $self->$action();
-}
-
-sub _close_pane {
- my ($self) = $_;
- my $selection = $WXPOS::State::Notebook->GetSelection;
- $WXPOS::State::Notebook->DeletePage($selection);
- return 1;
-}
-
-sub _getWarehouses {
- my ($self) = @_;
- $self->{wh_des}->{''} = '';
- foreach (@{$self->{sesion}->{ldb}->getWarehouseList()}) {
-  $self->{wh_des}->{$_->[1]} = $_->[0];
-  if ($_->[0] == $self->{wh_dft_id}) {
-   $self->{wh_dft_des} = $_->[1];
-  }
- }
- return $self;
-}
-
-sub Parts {
- my ($self) = @_;
-### Close Window
- $self->{WxPanel} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize, wxMAXIMIZE);
- my $close_btn = Wx::Button->new($self->{WxPanel}, -1, '[X]', [750, 3], [30, 24]);
- EVT_BUTTON($self->{WxPanel}, $close_btn, sub{$self->_close_pane});
- Wx::StaticText->new($self->{WxPanel}, -1, 'Number', [10, 20], [90, 24]);
- $self->{numb} = Wx::TextCtrl->new($self->{WxPanel}, -1, '', [110, 20], [90, 24]);
- Wx::StaticText->new($self->{WxPanel}, -1, 'Description', [10, 60], [90, 24]);
- $self->{desc} = Wx::TextCtrl->new($self->{WxPanel}, -1, '', [110, 60], [180, 24]);
- Wx::StaticText->new($self->{WxPanel}, -1, 'Warehouse', [310, 40], [90, 24]);
- $self->{wh} = Wx::ComboBox->new($self->{WxPanel}, -1, $self->{wh_dft_des}, [400, 40], [180, 24], [keys(%{$self->{wh_des}})]);
- my $button = Wx::Button->new($self->{WxPanel}, -1, 'Search', [110, 100], [60, 24]);
- EVT_BUTTON($self->{WxPanel}, $button, sub{$self->_listPartsByName});
- return $self->{WxPanel};
-}
-
-sub _listPartsByName {
- my($self, $event) = @_;
- my $numb = $self->{numb}->GetValue();
- my $desc = $self->{desc}->GetValue();
- my $wh = $self->{wh_des}->{$self->{wh}->GetValue()};wxCB_READONLY
- $self->{list} = Wx::Grid->new($self->{WxPanel}, -1, [10, 160], [790, 480], wxCB_READONLY);
- $self->{list}->CreateGrid(0, 4);
- $self->{list}->SetColLabelValue(0, 'Number');
- $self->{list}->SetColSize(0, 100);
- $self->{list}->SetColLabelValue(1, 'Description');
- $self->{list}->SetColSize(1, 440);
- $self->{list}->SetColLabelValue(2, 'Warehouse');
- $self->{list}->SetColSize(2, 100);
- $self->{list}->SetColLabelValue(3, 'Qty');
- $self->{list}->SetColSize(3, 60);
- my $list = $self->{sesion}->{ldb}->getPartsList($numb, $desc, $wh);
- my $i = 0;
- foreach (@{$list}) {
-  $self->{list}->AppendRows();
-  $self->{list}->SetCellValue($i, 0, $_->[0]);
-  $self->{list}->SetCellValue($i, 1, $_->[1]);
-  $self->{list}->SetCellValue($i, 2, $_->[2]);
-  $self->{list}->SetCellValue($i, 3, $_->[3]);
-  $i++;
- }
- return $self->{list};
-}
-1;

Copied: addons/1.3/wxPOS/scripts/WXPOS/UI/AR.pm (from rev 6256, addons/1.3/wxPOS/scripts/AR.pm)
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/UI/AR.pm	                        (rev 0)
+++ addons/1.3/wxPOS/scripts/WXPOS/UI/AR.pm	2013-11-08 05:49:22 UTC (rev 6258)
@@ -0,0 +1,274 @@
+package WXPOS::UI::AR;
+
+use base qw(Wx::Frame);
+use Wx::Event qw(EVT_BUTTON EVT_LISTBOX_DCLICK EVT_COMBOBOX EVT_LIST_ITEM_RIGHT_CLICK EVT_LIST_ITEM_SELECTED EVT_LIST_ITEM_DESELECTED);
+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:
+# Need payment/posting screen
+# No hardware support/printing support yet.
+# Dropping warehouse search restrictions currently.
+
+sub new {
+ my ($class, $sesion, $action) = @_;
+ my $self = {};
+ $self->{sesion} = $sesion;
+ bless $self, $class;
+ return $self->$action();
+}
+
+####### Invoice Screen
+sub Invoice {
+ my ($self) = @_;
+ $self->{sesion}->{tk} = undef;
+ $self->{sesion}->{tk}->{items} = 0;
+ $self->{tab} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize);
+
+### Close Window Button
+ my $close_btn = Wx::Button->new($self->{tab}, -1, '[X]', [750, 3], [30, 24]);
+ EVT_BUTTON($self->{tab}, $close_btn, sub{$self->_close_pane});
+
+### Customer
+ my $dft_custom = $self->{sesion}->{defaults}->{custom} || '';
+ $dft_custom ||= $WXPOS::Sysconfig::default_customer;
+ Wx::StaticLine->new($self->{tab}, -1, [0, 0], [800, 2], wxLI_HORIZONTAL);
+ Wx::StaticText->new($self->{tab}, -1, 'Customer', [10, 10], [90, 24]);
+ $self->{custom} = Wx::TextCtrl->new($self->{tab}, -1, $dft_custom, [110, 10], [90, 24]);
+ my $cust_but = Wx::Button->new($self->{tab}, -1, 'Search', [210, 10], [90, 24]);
+ EVT_BUTTON($self->{tab}, $cust_but, sub{$self->_listCustomByName});
+ $self->{customer_list} = Wx::ComboBox->new($self->{tab}, -1, '', [10, 40], [290, 24], [''], wxCB_READONLY);
+ Wx::StaticLine->new($self->{tab}, -1, [0, 70], [800, 2], wxLI_HORIZONTAL);
+### Parts Search
+
+ my $warehouse = $self->{sesion}->{defaults}->{wh} || '';
+ Wx::StaticText->new($self->{tab}, -1, 'Warehouse: '.$warehouse, [10,120], [120, 24]);
+ Wx::StaticText->new($self->{tab}, -1, 'Description', [140, 120], [90, 24]);
+ $self->{desc} = Wx::TextCtrl->new($self->{tab}, -1, '', [240, 120], [180, 24]);
+ my $parts_but = Wx::Button->new($self->{tab}, -1, 'Search', [440, 120], [60, 24]);
+ EVT_BUTTON($self->{tab}, $parts_but, sub{$self->_listPartsByName});
+ Wx::StaticLine->new($self->{tab}, -1, [0, 150], [800, 2], wxLI_HORIZONTAL);
+
+### Line Entry
+ Wx::StaticText->new($self->{tab}, -1, 'Qty: ', [10, 160], [30, 24]);
+ $self->{part_qty} = Wx::TextCtrl->new($self->{tab}, -1, '1', [50, 160], [30, 24]);
+ Wx::StaticText->new($self->{tab}, -1, 'Number: ', [90, 160], [60, 24]);
+ $self->{part_numb} = Wx::TextCtrl->new($self->{tab}, -1, '', [160, 160], [90, 24]);
+ Wx::StaticText->new($self->{tab}, -1, 'Price: ', [260, 160], [60, 24]);
+ $self->{part_sellprice} 
+     = Wx::TextCtrl->new($self->{tab}, -1, '', [300, 160], [90, 24]);
+ Wx::StaticText->new($self->{tab}, -1, 'Disc: ', [400, 160], [60, 24]);
+ $self->{part_discount} 
+     = Wx::TextCtrl->new($self->{tab}, -1, '', [440, 160], [40, 24]);
+ my $parts_add = Wx::Button->new($self->{tab}, -1, 'Add', [500, 160], [60, 24]);
+ EVT_BUTTON($self->{tab}, $parts_add, sub{$self->_addParts});
+ Wx::StaticText->new($self->{tab}, -1, 'Selected: ', [600, 160], [90, 24]);
+ $self->{sel_del} = Wx::StaticText->new($self->{tab}, -1, '', [690, 160], [30, 24]);
+ my $parts_del = Wx::Button->new($self->{tab}, -1, 'Del', [730, 160], [60, 24]);
+ EVT_BUTTON($self->{tab}, $parts_del, sub{$self->_delParts});
+
+### Ticket
+ $self->{list} = Wx::ListCtrl->new($self->{tab}, -1, [10, 200], [780, 280], wxLC_REPORT);
+ $self->{list}->InsertColumn(1, 'Number');
+ $self->{list}->InsertColumn(2, 'Description');
+ $self->{list}->InsertColumn(3, 'Price');
+ $self->{list}->InsertColumn(4, 'Tax');
+ $self->{list}->InsertColumn(5, 'Ratio');
+ $self->{list}->InsertColumn(6, 'SubTotal');
+ $self->{list}->InsertColumn(7, 'Qty');
+ $self->{list}->InsertColumn(8, 'Total');
+ EVT_LIST_ITEM_SELECTED($self->{tab}, $self->{list}, sub{$self->_selParts});
+ EVT_LIST_ITEM_DESELECTED($self->{tab}, $self->{list}, sub{$self->_selParts});
+
+### Pay
+ Wx::StaticLine->new($self->{tab}, -1, [0, 490], [800, 2], wxLI_HORIZONTAL);
+ Wx::StaticText->new($self->{tab}, -1, 'Net: ', [100, 500], [90, 24]);
+ $self->{net_total} = Wx::StaticText->new($self->{tab}, -1, '', [200, 500], [90, 24]);
+ Wx::StaticText->new($self->{tab}, -1, 'Tax: ', [300, 500], [90, 24]);
+ $self->{tax_total} = Wx::StaticText->new($self->{tab}, -1, '', [400, 500], [90, 24]);
+ Wx::StaticText->new($self->{tab}, -1, 'Total: ', [500, 500], [90, 24]);
+ $self->{total} = Wx::StaticText->new($self->{tab}, -1, '', [600, 500], [90, 24]);
+ my $invoice_post = Wx::Button->new($self->{tab}, -1, 'Pay', [700, 500], [90, 24]);
+ EVT_BUTTON($self->{tab}, $invoice_post, sub{$self->_InvoicePay});
+
+## Finishing
+ if ($dft_custom){
+    $self->_listCustomByName;
+ }
+ return $self->{tab};
+}
+#######
+
+sub Transaction {
+ my ($self) = @_;
+ $self->{tab} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize);
+ Wx::StaticText->new($self->{tab}, -1, 'WIP', [400, 300], [100, 24]);
+ return $self->{tab};
+}
+
+sub Customer {
+ my ($self) = @_;
+ $self->{tab} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize);
+ Wx::StaticText->new($self->{tab}, -1, 'WIP', [400, 300], [100, 24]);
+ return $self->{tab};
+}
+
+sub _listCustomByName {
+ my($self, $event) = @_;
+ my $customer = $self->{custom}->GetValue();
+ my $list;
+ my $i = 0;
+ foreach (WXPOS::Counterparty->search($customer, 2)) {
+  push (@{$list}, $_->name);
+  $self->{customer_search}->{$_->name} = $_->id;
+  $i++;
+ }
+ if ($list) {
+  $self->{customer_list} = undef;
+  $self->{customer_list} = Wx::ComboBox->new($self->{tab}, -1, $list->[0], [10, 40], [290, 24], $list);
+ }
+ else {
+  $self->{customer_list} = undef;
+  $self->{customer_list} = Wx::ComboBox->new($self->{tab}, -1, '', [10, 40], [290, 24], ['']);
+ }
+ return $self->{customer_list};
+}
+
+sub _listPartsByName {
+ my($self, $event) = @_;
+ my $desc = $self->{desc}->GetValue();
+ my $wh = $self->{sesion}->{defaults}->{wh};
+ my $list;
+ my $cust = $self->{customer_search}->{$self->{customer_list}->GetValue()};
+ foreach (WXPOS::Part->search($desc, $cust, 2)) {
+  push (@{$list}, $_->description);
+  $self->{parts_search}->{$_->description} = $_->partnumber;
+ }
+ if ($list) {
+  $self->{parts_list} = undef;
+  $self->{parts_list} = Wx::ComboBox->new($self->{tab}, -1, $list->[0], [510, 120], [280, 24], $list, wxCB_READONLY);
+  EVT_COMBOBOX($self->{tab}, $self->{parts_list}, sub{$self->_getPartsNumber});
+ }
+ else {
+  $self->{parts_list} = undef;
+  $self->{parts_list} = Wx::ComboBox->new($self->{tab}, -1, '', [510, 120], [280, 24], [''], wxCB_READONLY);
+ }
+ return $self->{parts_list};
+}
+
+sub _getPartsNumber {
+ my($self, $event) = @_;
+ my $numb = $self->{parts_search}->{$self->{parts_list}->GetValue()};
+ $self->{part_numb}->SetValue($numb);
+ return $self->{part_numb};
+}
+
+
+sub _addParts {
+ my($self, $event) = @_;
+ my $part = $self->{part_numb}->GetValue();
+ my $cust = $self->{customer_search}->{$self->{customer_list}->GetValue()};
+### Check for customer
+ if (!$cust) {
+  Wx::MessageBox("Please, try again selecting a customer.", "Customer not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
+  return 0;
+ }
+### Check for part
+ if (!$part) {
+  Wx::MessageBox("Please, try again selecting a part.", "Part not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
+  return 0;
+ }
+ $part = WXPOS::Part->get_by_partnumber($part, $cust, 2);
+ my $numb = $part->partnumber;
+ my $desc = $part->description;
+ my $sell = $part->sellprice;
+ if (!$numb) {
+  Wx::MessageBox("Please, try again.", "Part not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
+  return 0;
+ }
+## Price/discount overrides
+ if ($self->{part_sellprice}->GetValue()){
+    $sell = $self->{part_sellprice}->GetValue();
+ }
+ my $disc = $self->{part_discount}->GetValue();
+ my $format;
+ if ($disc){
+    $sell = $sell * (100 - $disc)/100;
+    $format = "%." .$WXPOS::Sysconfig::money_places . "f";
+    
+    $sell = sprintf($format, $sell);
+ }
+ my $qty = $self->{part_qty}->GetValue();
+ my $total_tax = 0;
+ my $total_tax_ratio = 0;
+### Calculates total ratio and total tax ammount
+ foreach my $tax (@{$self->{sesion}->{ldb}->getTaxByPair($cust, $part)}) {
+  $total_tax_ratio += $tax->[1];
+  $total_tax += $tax->[1] * $sell;
+ }
+ my $st = $total_tax + $sell;
+ my $total = $st * $qty;
+ my $pp = $self->{list}->InsertStringItem($self->{sesion}->{tk}->{items}, $numb);
+ $self->{list}->SetItem($pp, 1, $desc, -1);
+ $self->{list}->SetItem($pp, 2, $sell, -1);
+ $self->{list}->SetItem($pp, 3, $total_tax, -1);
+ $self->{list}->SetItem($pp, 4, $total_tax_ratio, -1);
+ $self->{list}->SetItem($pp, 5, $st, -1);
+ $self->{list}->SetItem($pp, 6, $qty, -1);
+ $self->{list}->SetItem($pp, 7, $total, -1);
+
+ $self->{sesion}->{tk}->{tnet} += $sell;
+ $self->{sesion}->{tk}->{ttax} += $total_tax;
+ $self->{sesion}->{tk}->{total} += $total;
+ $self->{net_total}->SetLabel($self->{sesion}->{tk}->{tnet});
+ $self->{tax_total}->SetLabel($self->{sesion}->{tk}->{ttax});
+ $self->{total}->SetLabel($self->{sesion}->{tk}->{total});
+ $self->{sesion}->{tk}->{items}++;
+ return $part;
+}
+
+sub _selParts {
+ my($self) = @_;
+ $self->{sel_del}->SetLabel($self->{list}->GetSelectedItemCount);
+ return 1;
+}
+
+sub _delParts {
+ my($self) = @_;
+ if ($self->{list}->GetSelectedItemCount < 1) {
+  Wx::MessageBox("Please, try again selecting an item.", "Item not deleted!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
+  return 0;
+ }
+ my $item = $self->{list}->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ my $sell = $self->{list}->GetItem($item, 2)->GetText();
+ my $total_tax = $self->{list}->GetItem($item, 3)->GetText();
+ my $total = $self->{list}->GetItem($item, 7)->GetText();
+ $self->{sesion}->{tk}->{tnet} -= $sell;
+ $self->{sesion}->{tk}->{ttax} -= $total_tax;
+ $self->{sesion}->{tk}->{total} -= $total;
+ $self->{net_total}->SetLabel($self->{sesion}->{tk}->{tnet});
+ $self->{tax_total}->SetLabel($self->{sesion}->{tk}->{ttax});
+ $self->{total}->SetLabel($self->{sesion}->{tk}->{total});
+ $self->{list}->DeleteItem($item);
+ $self->{sesion}->{tk}->{items}--;
+ $self->{sel_del}->SetLabel($self->{list}->GetSelectedItemCount);
+#use Data::Dumper;
+#print Dumper($item_col);
+ return 1;
+}
+
+sub _close_pane {
+ my ($self) = $_;
+ my $selection = $WXPOS::State::Notebook->GetSelection;
+ $WXPOS::State::Notebook->DeletePage($selection);
+ return 1;
+}
+
+sub _InvoicePay {
+ my($self) = @_;
+ Wx::MessageBox("At this point we should be able to track each account and the account to set.", "DEBUG", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
+ return 1;
+}
+1;

Copied: addons/1.3/wxPOS/scripts/WXPOS/UI/IC.pm (from rev 6255, addons/1.3/wxPOS/scripts/IC.pm)
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/UI/IC.pm	                        (rev 0)
+++ addons/1.3/wxPOS/scripts/WXPOS/UI/IC.pm	2013-11-08 05:49:22 UTC (rev 6258)
@@ -0,0 +1,116 @@
+=head1 NAME
+
+LedgerSMB - Wx Inventory Control
+
+=head1 SYNOPSIS
+
+This module is on charge of inventory operations.
+
+=head1 METHODS
+
+=over
+
+=item new ($sesion, $action)
+
+This will get, set and go an action from the menu that is a method of this class. It will
+work as a kind of handler and will return a reference to that action.
+$sesion = It is a hash with all objects and variables needed.
+$action = Method name to invoque as String
+
+=item Parts ()
+
+This is an action that will show a panel asiking for number or description.
+
+=item _listPartsByName ()
+
+A private function used by the Search action that invoques lsmbdb interface to get parts list from the db.
+
+=back
+
+=head1 AUTHOR
+
+Andres Basile (..hidden..)
+
+=cut
+
+package WXPOS::UI::IC;
+
+use base qw(Wx::Frame);
+use Wx::Event qw(EVT_BUTTON);
+use Wx qw(wxDefaultPosition wxDefaultSize wxMAXIMIZE wxCB_READONLY);
+use Wx::Grid;
+
+sub new {
+ my ($class, $sesion, $action) = @_;
+ my $self = {};
+ $self->{sesion} = $sesion;
+ $self->{wh_dft_id} = $self->{sesion}->{defaults}->{wh};
+ bless $self, $class;
+ $self->_getWarehouses();
+ return $self->$action();
+}
+
+sub _close_pane {
+ my ($self) = $_;
+ my $selection = $WXPOS::State::Notebook->GetSelection;
+ $WXPOS::State::Notebook->DeletePage($selection);
+ return 1;
+}
+
+sub _getWarehouses {
+ my ($self) = @_;
+ $self->{wh_des}->{''} = '';
+ foreach (@{$self->{sesion}->{ldb}->getWarehouseList()}) {
+  $self->{wh_des}->{$_->[1]} = $_->[0];
+  if ($_->[0] == $self->{wh_dft_id}) {
+   $self->{wh_dft_des} = $_->[1];
+  }
+ }
+ return $self;
+}
+
+sub Parts {
+ my ($self) = @_;
+### Close Window
+ $self->{WxPanel} = Wx::Panel->new($self->{sesion}->{nb}, -1, wxDefaultPosition, wxDefaultSize, wxMAXIMIZE);
+ my $close_btn = Wx::Button->new($self->{WxPanel}, -1, '[X]', [750, 3], [30, 24]);
+ EVT_BUTTON($self->{WxPanel}, $close_btn, sub{$self->_close_pane});
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Number', [10, 20], [90, 24]);
+ $self->{numb} = Wx::TextCtrl->new($self->{WxPanel}, -1, '', [110, 20], [90, 24]);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Description', [10, 60], [90, 24]);
+ $self->{desc} = Wx::TextCtrl->new($self->{WxPanel}, -1, '', [110, 60], [180, 24]);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Warehouse', [310, 40], [90, 24]);
+ $self->{wh} = Wx::ComboBox->new($self->{WxPanel}, -1, $self->{wh_dft_des}, [400, 40], [180, 24], [keys(%{$self->{wh_des}})]);
+ my $button = Wx::Button->new($self->{WxPanel}, -1, 'Search', [110, 100], [60, 24]);
+ EVT_BUTTON($self->{WxPanel}, $button, sub{$self->_listPartsByName});
+ return $self->{WxPanel};
+}
+
+sub _listPartsByName {
+ my($self, $event) = @_;
+ my $numb = $self->{numb}->GetValue();
+ my $desc = $self->{desc}->GetValue();
+ my $wh = $self->{wh_des}->{$self->{wh}->GetValue()};wxCB_READONLY
+ $self->{list} = Wx::Grid->new($self->{WxPanel}, -1, [10, 160], [790, 480], wxCB_READONLY);
+ $self->{list}->CreateGrid(0, 4);
+ $self->{list}->SetColLabelValue(0, 'Number');
+ $self->{list}->SetColSize(0, 100);
+ $self->{list}->SetColLabelValue(1, 'Description');
+ $self->{list}->SetColSize(1, 440);
+ $self->{list}->SetColLabelValue(2, 'Warehouse');
+ $self->{list}->SetColSize(2, 100);
+ $self->{list}->SetColLabelValue(3, 'Qty');
+ $self->{list}->SetColSize(3, 60);
+ my $list = $self->{sesion}->{ldb}->getPartsList($numb, $desc, $wh);
+ my $i = 0;
+ foreach (@{$list}) {
+  $self->{list}->AppendRows();
+  $self->{list}->SetCellValue($i, 0, $_->[0]);
+  $self->{list}->SetCellValue($i, 1, $_->[1]);
+  $self->{list}->SetCellValue($i, 2, $_->[2]);
+  $self->{list}->SetCellValue($i, 3, $_->[3]);
+  $i++;
+ }
+ return $self->{list};
+}
+1;

Modified: addons/1.3/wxPOS/scripts/WXPOS/UI.pm
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/UI.pm	2013-11-08 05:37:37 UTC (rev 6257)
+++ addons/1.3/wxPOS/scripts/WXPOS/UI.pm	2013-11-08 05:49:22 UTC (rev 6258)
@@ -130,9 +130,12 @@
 sub _load_module {
  my ($self, $module, $action) = @_;
  #$self->{sesion}->{nb}->DeleteAllPages();
+ my $mname = "WXPOS::UI::$module"; 
  use lib "scripts";
- require $module.".pm";
- my $tab = $module->new($self->{sesion}, $action);
+ my $mfile = "$mname.pm";
+ $mfile =~ s|::|/|g;
+ require $mfile;
+ my $tab = $mname->new($self->{sesion}, $action);
  $self->{sesion}->{nb}->AddPage($tab, $action, 1);
  $tab->Show();
  EVT_KEY_DOWN($tab, sub {$self->_process_char});

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