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

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



Revision: 6247
          http://sourceforge.net/p/ledger-smb/code/6247
Author:   einhverfr
Date:     2013-11-07 15:24:37 +0000 (Thu, 07 Nov 2013)
Log Message:
-----------
Adding discount and price override support.  Such should probably be made more optional

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

Modified: addons/1.3/wxPOS/scripts/AR.pm
===================================================================
--- addons/1.3/wxPOS/scripts/AR.pm	2013-11-07 15:03:14 UTC (rev 6246)
+++ addons/1.3/wxPOS/scripts/AR.pm	2013-11-07 15:24:37 UTC (rev 6247)
@@ -13,15 +13,17 @@
  return $self->$action();
 }
 
-####### Invioce
+####### 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
+
+### 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;
@@ -32,25 +34,34 @@
  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
+### 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]);
+ 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]);
- my $parts_add = Wx::Button->new($self->{tab}, -1, 'Add', [260, 160], [60, 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');
@@ -63,6 +74,7 @@
  $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});
+
 ### Post
  Wx::StaticLine->new($self->{tab}, -1, [0, 490], [800, 2], wxLI_HORIZONTAL);
  Wx::StaticText->new($self->{tab}, -1, 'Net: ', [100, 500], [90, 24]);
@@ -164,6 +176,17 @@
   Wx::MessageBox("Please, try again.", "Part not Found!", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
   return 0;
  }
+ 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;

Modified: addons/1.3/wxPOS/scripts/WXPOS/Sysconfig.pm
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/Sysconfig.pm	2013-11-07 15:03:14 UTC (rev 6246)
+++ addons/1.3/wxPOS/scripts/WXPOS/Sysconfig.pm	2013-11-07 15:24:37 UTC (rev 6247)
@@ -44,9 +44,9 @@
 
 my $cfg = Config::IniFiles->new( -file => "wxpos.conf" ) 
        || die @Config::IniFiles::errors;
-
+our $money_places = 0;
 our $default_customer;
-for my $key (qw(default_language number_format default_customer)){
+for my $key (qw(default_language number_format default_customer money_places)){
    $$key = $cfg->val('main',$key) 
       if $cfg->val('main','default_language');
 }

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