[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6261] addons/1.3/wxPOS
- Subject: SF.net SVN: ledger-smb:[6261] addons/1.3/wxPOS
- From: ..hidden..
- Date: Fri, 8 Nov 2013 10:10:41 +0000
Revision: 6261
http://sourceforge.net/p/ledger-smb/code/6261
Author: einhverfr
Date: 2013-11-08 10:10:39 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
basic payment dialog done. Still need to code logic for buttons
Modified Paths:
--------------
addons/1.3/wxPOS/WXPOS/Sysconfig.pm
addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm
addons/1.3/wxPOS/WXPOS/UI/AR.pm
addons/1.3/wxPOS/wxpos.conf.template
Modified: addons/1.3/wxPOS/WXPOS/Sysconfig.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/Sysconfig.pm 2013-11-08 07:25:27 UTC (rev 6260)
+++ addons/1.3/wxPOS/WXPOS/Sysconfig.pm 2013-11-08 10:10:39 UTC (rev 6261)
@@ -10,6 +10,8 @@
=cut
+use strict;
+use warnings;
package WXPOS::Sysconfig;
use Config::IniFiles; # For future config parsing. For now, this is just
# written here for initial testing.
@@ -42,15 +44,28 @@
curr => 'IDR',
};
-my $cfg = Config::IniFiles->new( -file => "wxpos.conf" )
+our $payment_types;
+my $cfg;
+{
+no warnings;
+$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 money_places)){
- $$key = $cfg->val('main',$key)
- if $cfg->val('main','default_language');
+ no strict 'refs';
+ next unless $cfg->val('main',$key);
+ $$key = $cfg->val('main',$key);
}
+for my $key (qw(payment_types)){ # comma separated lists
+ no strict 'refs';
+ my $val = $cfg->val('main',$key);
+ my @list = split /,/, $val;
+ $$key = ..hidden..;
+}
+
for my $var (qw(database user host port password)){
$dbconfig->{$var} = $cfg->val('database', $var)
if $cfg->val('database', $var);
Modified: addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm 2013-11-08 07:25:27 UTC (rev 6260)
+++ addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm 2013-11-08 10:10:39 UTC (rev 6261)
@@ -1,8 +1,10 @@
package WXPOS::UI::AR::Pay;
-use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxTE_PASSWORD wxCLOSE_BOX wxBITMAP_TYPE_PNG);
+use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxTE_PASSWORD
+ wxCLOSE_BOX wxBITMAP_TYPE_PNG wxCB_READONLY wxLC_REPORT
+ wxALIGN_RIGHT :sizer);
use base qw(Wx::Dialog);
-use Wx::Event qw(EVT_BUTTON);
+use Wx::Event qw(EVT_BUTTON EVT_LIST_ITEM_SELECTED EVT_LIST_ITEM_DESELECTED);
use WXPOS::Sysconfig;
sub new{
@@ -11,7 +13,7 @@
[600, 400]);
bless $self, $class;
$self->{parent_window} = $parent; # Need this access for storing payments
- $self->{WxPanel} = Wx::Panel->new($self, -1, wxDefaultPosition, [800, 300]);
+ $self->{WxPanel} = Wx::Panel->new($self, -1, wxDefaultPosition, [600, 400]);
Wx::InitAllImageHandlers();
### ENTRY LINE: Amount, Type, Source
@@ -20,23 +22,76 @@
[130, 00], [60, 24]
);
Wx::StaticText->new($self->{WxPanel}, -1, 'Type', [200, 00], [80, 24]);
- $self->{memo} = Wx::ComboBox->new($self->{WxPanel}, -1, $list->[0],
- [250, 0], [60, 24], [''], wxCB_READONLY);
+ my $paytypes = $WXPOS::Sysconfig::payment_types;
+ $paytypes = [''] unless @$paytypes;
+ $self->{memo} = Wx::ComboBox->new($self->{WxPanel}, -1, $paytypes->[0],
+ [250, 0], [80, 24],
+ $paytypes, wxCB_READONLY);
- Wx::StaticText->new($self->{WxPanel}, -1, 'Source', [300, 00], [80, 24]);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Source', [360, 00], [80, 24]);
$self->{source} = Wx::TextCtrl->new($self->{WxPanel}, -1, '',
- [350, 00], [60, 24]
+ [405, 00], [60, 24]
);
-
+ my $add_pmt_btn = Wx::Button->new($self->{WxPanel}, -1, 'Add',
+ [460, 0], [60, 24]);
+ EVT_BUTTON($self->{WxPanel}, $add_pmt_btn, sub{$self->_AddPayment});
+
### LIST BOX
+ $self->{list} = Wx::ListCtrl->new($self->{WxPanel}, -1,
+ [10, 30], [580, 200], wxLC_REPORT);
+ $self->{list}->InsertColumn(1, 'Amount');
+ $self->{list}->InsertColumn(2, 'Type');
+ $self->{list}->InsertColumn(3, 'Source');
+ EVT_LIST_ITEM_SELECTED($self->{WxPanel}, $self->{list}, sub{$self->_selPay});
+ EVT_LIST_ITEM_DESELECTED($self->{WxPanel}, $self->{list}, sub{$self->_selPay});
- ### POST/CANCEL BUTTONS
+ ### SELECTION/REMOVAL LINE
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Selected: ',
+ [10, 240], [90, 24]);
+ $self->{delete_pay} = Wx::StaticText->new($self->{tab}, -1, '',
+ [100, 240], [30, 24]);
+ my $del_pay = Wx::Button->new($self->{WxPanel}, -1, 'Del',
+ [140, 240], [60, 24]);
+ EVT_BUTTON($self->{WxPanel}, $del_pay, sub{$self->_delPay});
+
+ ### TOTAL/POST/CANCEL BUTTONS
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Total: ',
+ [10, 280], [90, 24]
+ );
+ $self->{total} = Wx::StaticText->new($self->{WxPanel}, -1,
+ $self->{parent_window}->{total}->GetLabel,
+ [100, 280], [90, 24]
+ );
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Total Paid: ',
+ [10, 300], [90, 24]
+ );
+
+ $self->{total_paid} = Wx::StaticText->new($self->{WxPanel}, -1, '',
+ [100, 300], [90, 24]);
+ $self->{oweing_label} = Wx::StaticText->new($self->{WxPanel}, -1, 'Oweing: ',
+ [10, 320], [90, 24]);
+ $self->{oweing} = Wx::StaticText->new($self->{WxPanel}, -1, '',
+ [100, 320], [90, 24]);
+
+ $post_btn = Wx::Button->new($self->{WxPanel}, -1, 'Post',
+ [10, 360], [60, 24]);
+ $cancel_btn = Wx::Button->new($self->{WxPanel}, -1, 'Cancel',
+ [500, 360], [60, 24]);
+ EVT_BUTTON($self->{WxPanel}, $post_btn, sub{$self->_Post});
+ EVT_BUTTON($self->{WxPanel}, $cancel_btn, sub{$self->_Cancel});
+
### SHOW DIALOG
$self->ShowModal();
}
+sub _selPay {
+}
+
+sub _delPay {
+}
+
sub _AddPayment {
}
@@ -46,4 +101,10 @@
sub _Post {
}
+sub _Serialize {
+}
+
+sub _SerializeParent {
+}
+
1;
Modified: addons/1.3/wxPOS/WXPOS/UI/AR.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/UI/AR.pm 2013-11-08 07:25:27 UTC (rev 6260)
+++ addons/1.3/wxPOS/WXPOS/UI/AR.pm 2013-11-08 10:10:39 UTC (rev 6261)
@@ -191,7 +191,7 @@
return 0;
}
## Price/discount overrides
- if ($self->{part_sellprice}->GetValue()){
+ if ($self->{part_sellprice}->GetValue() eq '0' or $self->{part_sellprice}->GetValue()){
$sell = $self->{part_sellprice}->GetValue();
}
my $disc = $self->{part_discount}->GetValue();
@@ -270,6 +270,9 @@
sub _InvoicePay {
my($self) = @_;
- WXPOS::UI::AR::Pay->new();
+ my $total = $self->{total}->GetLabel;
+ $total =~ s/\s//;
+ return undef unless $total ne '' and defined $total; # Can't pay without anything here.
+ WXPOS::UI::AR::Pay->new($self);
}
1;
Modified: addons/1.3/wxPOS/wxpos.conf.template
===================================================================
--- addons/1.3/wxPOS/wxpos.conf.template 2013-11-08 07:25:27 UTC (rev 6260)
+++ addons/1.3/wxPOS/wxpos.conf.template 2013-11-08 10:10:39 UTC (rev 6261)
@@ -1,5 +1,7 @@
[main]
default_language=en
+money_places=2
+payment_types=cash,mc,visa,disc,debit
[database]
database=mtech_test
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