1 package C4::Interface::AccountsCDK; #asummes C4/Interface/AccountsCDK
5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
29 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
31 # set the version for version checking
35 @EXPORT = qw(&accountsdialog);
36 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
38 # your exported package globals go here,
39 # as well as any optionally exported functions
41 @EXPORT_OK = qw($Var1 %Hashit);
42 # non-exported package globals go here
43 use vars qw(@more $stuff);
45 # initalize package globals, first exported ones
50 # then the others (which are still accessible as $Some::Module::stuff)
54 # all file-scoped lexicals must be created before
55 # the functions below that use them.
57 # file-private lexicals go here
61 # here's a file-private function as a closure,
62 # callable as &$priv_func; it cannot be prototyped.
67 # make all your functions, whether exported or not;
72 my ($env,$title,$borrower,$accountlines,$amountowing)=@_;
73 my $titlepanel = titlepanel($env,$env->{'sysarea'},"Money Owing");
76 #$borinfo[0] = "$borrower->{'cardnumber'}";
77 #$borinfo[1] = "$borrower->{'surname'}, $borrower->{'title'} $borrower->{'firstname'} ";
78 #$borinfo[2] = "$borrower->{'streetaddress'}, $borrower->{'city'}";
79 #$borinfo[3] = "<R>Total Due: </B>".fmtdec($env,$amountowing,"52");
81 # new Cdk::Label ('Message' =>\@borinfo, 'Ypos'=>4, 'Xpos'=>"RIGHT");
82 my $borpanel = borrowerbox($env,$borrower,$amountowing);
84 my @sel = ("N ","Y ");
85 my $acctlist = new Cdk::Selection ('Title'=>"Outstanding Items",
86 'List'=>\@$accountlines,'Choices'=>\@sel,'Height'=>12,'Width'=>80,
87 'Xpos'=>1,'Ypos'=>10);
88 my @amounts=$acctlist->activate();
94 for (my $i=0;$i<$count;$i++){
95 if ($amounts[$i] == 1){
97 if ($accountlines->[$i]=~ /(^[0-9]+)/){
100 if ($accountlines->[$i]=~/([0-9]+\.[0-9]+)/){
103 my $borrowerno=$borrower->{'borrowernumber'};
104 makepayment($borrowerno,$accountno,$amount2);
109 my $amountentry = new Cdk::Entry('Label'=>"Amount: ",
110 'Max'=>"10",'Width'=>"10",
111 'Xpos'=>"1",'Ypos'=>"3",
113 $amountentry->preProcess ('Function' => sub{preamt(@_,$env,$acctlist);});
117 $amount =$amountentry->activate();
119 $amountentry->set('Value'=>$amount);
120 $amount=$amountentry->activate();
122 # debug_msg($env,"accounts $amount barcode=$accountno");
123 if (!defined $amount) {
124 #debug_msg($env,"escaped");
125 #$reason="Finished user";
129 $amountentry->erase();
137 return($amount,$reason);
141 my ($input,$env,$acctlist)= @_;
142 my $key_tab = chr(9);
143 if ($input eq $key_tab) {
144 actlist ($env,$acctlist);
151 my ($env,$acctlist) = @_;
152 $acctlist->activate();
156 END { } # module clean-up code here (global destructor)