1 package C4::Interface::AccountsCDK; #asummes C4/Interface/AccountsCDK
11 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
13 # set the version for version checking
17 @EXPORT = qw(&accountsdialog);
18 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
20 # your exported package globals go here,
21 # as well as any optionally exported functions
23 @EXPORT_OK = qw($Var1 %Hashit);
24 # non-exported package globals go here
25 use vars qw(@more $stuff);
27 # initalize package globals, first exported ones
32 # then the others (which are still accessible as $Some::Module::stuff)
36 # all file-scoped lexicals must be created before
37 # the functions below that use them.
39 # file-private lexicals go here
43 # here's a file-private function as a closure,
44 # callable as &$priv_func; it cannot be prototyped.
49 # make all your functions, whether exported or not;
54 my ($env,$title,$borrower,$accountlines,$amountowing)=@_;
55 my $titlepanel = titlepanel($env,$env->{'sysarea'},"Money Owing");
58 #$borinfo[0] = "$borrower->{'cardnumber'}";
59 #$borinfo[1] = "$borrower->{'surname'}, $borrower->{'title'} $borrower->{'firstname'} ";
60 #$borinfo[2] = "$borrower->{'streetaddress'}, $borrower->{'city'}";
61 #$borinfo[3] = "<R>Total Due: </B>".fmtdec($env,$amountowing,"52");
63 # new Cdk::Label ('Message' =>\@borinfo, 'Ypos'=>4, 'Xpos'=>"RIGHT");
64 my $borpanel = borrowerbox($env,$borrower,$amountowing);
66 my @sel = ("N ","Y ");
67 my $acctlist = new Cdk::Selection ('Title'=>"Outstanding Items",
68 'List'=>\@$accountlines,'Choices'=>\@sel,'Height'=>12,'Width'=>80,
69 'Xpos'=>1,'Ypos'=>10);
70 my @amounts=$acctlist->activate();
76 for (my $i=0;$i<$count;$i++){
77 if ($amounts[$i] == 1){
79 if ($accountlines->[$i]=~ /(^[0-9]+)/){
82 if ($accountlines->[$i]=~/([0-9]+\.[0-9]+)/){
85 my $borrowerno=$borrower->{'borrowernumber'};
86 makepayment($borrowerno,$accountno,$amount2);
91 my $amountentry = new Cdk::Entry('Label'=>"Amount: ",
92 'Max'=>"10",'Width'=>"10",
93 'Xpos'=>"1",'Ypos'=>"3",
95 $amountentry->preProcess ('Function' => sub{preamt(@_,$env,$acctlist);});
99 $amount =$amountentry->activate();
101 $amountentry->set('Value'=>$amount);
102 $amount=$amountentry->activate();
104 # debug_msg($env,"accounts $amount barcode=$accountno");
105 if (!defined $amount) {
106 #debug_msg($env,"escaped");
107 #$reason="Finished user";
111 $amountentry->erase();
119 return($amount,$reason);
123 my ($input,$env,$acctlist)= @_;
124 my $key_tab = chr(9);
125 if ($input eq $key_tab) {
126 actlist ($env,$acctlist);
133 my ($env,$acctlist) = @_;
134 $acctlist->activate();
138 END { } # module clean-up code here (global destructor)