View | Details | Raw Unified | Return to bug 6934
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc (+1 lines)
Lines 10-15 Link Here
10
		<li><a href="/cgi-bin/koha/reports/catalogue_stats.pl">Catalog</a></li>
10
		<li><a href="/cgi-bin/koha/reports/catalogue_stats.pl">Catalog</a></li>
11
		<li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
11
		<li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
12
        <li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
12
        <li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
13
        <li><a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash Register</a></li>
13
        <li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li>        
14
        <li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li>        
14
	</ul>
15
	</ul>
15
16
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt (+299 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Cash Register Statistics &rsaquo; Results[% ELSE %]&rsaquo; Cash Register Statistics[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'calendar.inc' %]
5
<script type="text/javascript">
6
//<![CDATA[
7
actTotal = "";
8
9
function isNull(f,noalert) {
10
    if (f.value.length > 0) {
11
        return false;
12
    }
13
    return true;
14
}
15
16
function Check(ff) {
17
    var ok=0;
18
    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
19
20
    _alertString +="-------------------------------------------------------------------\n\n";
21
22
    if ( isNull(ff.fromRO,1)  ||  isNull(ff.toRO,1)   ){
23
        ok=1;
24
        _alertString += "\n- " + _("Dates cannot be empty");
25
    }
26
27
    if (ok) {
28
       alert(_alertString);
29
   }else{
30
        ff.submit();
31
    }
32
33
}
34
35
//]]>
36
</script>
37
38
</head>
39
<body>
40
[% INCLUDE 'header.inc' %]
41
[% INCLUDE 'cat-search.inc' %]
42
43
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> [% IF ( do_it ) %]&rsaquo; <a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash Register Statistics</a> &rsaquo; Results[% ELSE %] &rsaquo; Cash Register Statistics [% END %]</div>
44
45
<div id="doc3" class="yui-t2">
46
47
   <div id="bd">
48
    <div id="yui-main">
49
    <div class="yui-b">
50
51
[% IF ( do_it ) %]
52
        <h1>Cash register statistics</h1>
53
        <form method="post" action="/cgi-bin/koha/reports/cash_register_stats.pl">
54
            <fieldset class="rows">
55
            <legend>Cash Register statistics [% beginDate %] to [% endDate %]</legend>
56
            <table>
57
                <thead>
58
                    <tr>
59
                        <th>Interval</th>
60
                    </tr>
61
                </thead>
62
                <tbody>
63
64
                    <tr>
65
                        <td> From <input type="text" size="10" id="fromRO" name="Filter" value="[% beginDate %]" />
66
                                    <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="openCalendarFromRO" style="cursor: pointer;" />
67
                                            <script type="text/javascript">
68
                                            //<![CDATA[
69
                                            function validate1(date) {
70
                                                var day = date.getDate();
71
                                                var month = date.getMonth() + 1;
72
                                                var year = date.getFullYear();
73
                                                var weekDay = date.getDay();
74
                                                var dayMonth = month + '-' + day;
75
                                                var dateString = year + '-' + month + '-' + day;
76
                                                var dateTo = document.getElementById('toRO').value.split("-");
77
                                                var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
78
                                                if (date > limitDate) {
79
                                                    return true;
80
                                                } else {
81
                                                    return false;
82
                                                }
83
                                            }
84
85
                                            Calendar.setup(
86
                                                {
87
                                                    inputField : "fromRO",
88
                                                    ifFormat : "[% DHTMLcalendar_dateformat %]",
89
                                                    button : "openCalendarFromRO",
90
                                                    disableFunc : validate1,
91
                                                    dateStatusFunc : validate1
92
                                                }
93
                                            );
94
                                            //]]>
95
                                            </script>
96
                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
97
                            To <input type="text" size="10" id="toRO" name="Filter" value="[% endDate %]" />
98
                                <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" id="openCalendarToRO" style="cursor: pointer;" border="0" />
99
                                        <script type="text/javascript">
100
                                        //<![CDATA[
101
                                        function validate2(date) {
102
                                            var day = date.getDate();
103
                                            var month = date.getMonth() + 1;
104
                                            var year = date.getFullYear();
105
                                            var weekDay = date.getDay();
106
                                            var dayMonth = month + '-' + day;
107
                                            var dateString = year + '-' + month + '-' + day;
108
                                            var dateFrom = document.getElementById('fromRO').value.split("-");
109
                                            var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
110
                                            if (limitDate > date) {
111
                                                return true;
112
                                            } else {
113
                                                return false;
114
                                            }
115
                                        }
116
117
                                        Calendar.setup(
118
                                            {
119
                                                inputField : "toRO",
120
                                                ifFormat : "[% DHTMLcalendar_dateformat %]",
121
                                                button : "openCalendarToRO",
122
                                                disableFunc : validate2,
123
                                                dateStatusFunc : validate2
124
                                            }
125
                                        );
126
                                        //]]>
127
                                        </script>
128
                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
129
                        </td>
130
                    </tr>
131
132
                </tbody>
133
            </table><br />
134
            </fieldset>
135
136
            <fieldset class="rows">
137
                <legend>Output</legend>
138
                <ol>
139
                    <li>
140
                        <label for="outputscreen">To screen into the browser: </label>
141
                        <input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
142
                    </li>
143
                    <li>
144
                        <label for="outputfile">To a file:</label>
145
                        <input type="radio" name="output" value="file" id="outputfile" />
146
                        <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
147
                        <label class="inline" for="MIME">Into an application</label>[% CGIextChoice %]
148
                        [% CGIsepChoice %]
149
                    </li>
150
                </ol>
151
            </fieldset>
152
153
            <fieldset class="action">
154
            <input type="button" value="Submit" onclick="Check(this.form)"/>
155
            <input type="hidden" name="report_name" value="[% report_name %]" />
156
            <input type="hidden" name="do_it" value="1" />
157
            </fieldset>
158
        </form>
159
160
        <table style="margin-top:30px;">
161
            <tr >
162
                <th>Borrower Number</th>
163
                <th>Date</th>
164
                <th>Surname</th>
165
                <th>Firstname</th>
166
                <th>Amount</th>
167
            </tr>
168
            [% FOREACH loopresul IN loopresult %]
169
                <tr>
170
                    <td>[% loopresul.borrowernumber %]</td>
171
                    <td>[% loopresul.date %]</td>
172
                    <td>[% loopresul.surname %]</td>
173
                    <td>[% loopresul.firstname %]</td>
174
                    <td style="text-align:right;">[% loopresul.amount %]</td>
175
                </tr>
176
            [% END %]
177
            <tr>
178
                <th colspan="4" style="text-align:right;">TOTAL</th>
179
                <th style="text-align:right;">[% total %]</th>
180
            </tr>
181
182
        </table>
183
184
[% ELSE %]
185
    <h1>Cash register report</h1>
186
    <form method="post" action="/cgi-bin/koha/reports/cash_register_stats.pl">
187
        <fieldset class="rows">
188
            <legend>Cash Register statistics</legend>
189
            <table>
190
                <thead>
191
                    <tr>
192
                        <th>Interval</th>
193
                    </tr>
194
                </thead>
195
                <tbody>
196
197
                    <tr>
198
                        <td> From <input type="text" size="10" id="fromRO" name="Filter" value="" />
199
                                    <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="openCalendarFromRO" style="cursor: pointer;" />
200
                                            <script type="text/javascript">
201
                                            //<![CDATA[
202
                                            function validate1(date) {
203
                                                var day = date.getDate();
204
                                                var month = date.getMonth() + 1;
205
                                                var year = date.getFullYear();
206
                                                var weekDay = date.getDay();
207
                                                var dayMonth = month + '-' + day;
208
                                                var dateString = year + '-' + month + '-' + day;
209
                                                var dateTo = document.getElementById('toRO').value.split("-");
210
                                                var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
211
                                                if (date > limitDate) {
212
                                                    return true;
213
                                                } else {
214
                                                    return false;
215
                                                }
216
                                            }
217
218
                                            Calendar.setup(
219
                                                {
220
                                                    inputField : "fromRO",
221
                                                    ifFormat : "[% DHTMLcalendar_dateformat %]",
222
                                                    button : "openCalendarFromRO",
223
                                                    disableFunc : validate1,
224
                                                    dateStatusFunc : validate1
225
                                                }
226
                                            );
227
                                            //]]>
228
                                            </script>
229
                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
230
                            To <input type="text" size="10" id="toRO" name="Filter" value="" />
231
                                <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" id="openCalendarToRO" style="cursor: pointer;" border="0" />
232
                                        <script type="text/javascript">
233
                                        //<![CDATA[
234
                                        function validate2(date) {
235
                                            var day = date.getDate();
236
                                            var month = date.getMonth() + 1;
237
                                            var year = date.getFullYear();
238
                                            var weekDay = date.getDay();
239
                                            var dayMonth = month + '-' + day;
240
                                            var dateString = year + '-' + month + '-' + day;
241
                                            var dateFrom = document.getElementById('fromRO').value.split("-");
242
                                            var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
243
                                            if (limitDate > date) {
244
                                                return true;
245
                                            } else {
246
                                                return false;
247
                                            }
248
                                        }
249
250
                                        Calendar.setup(
251
                                            {
252
                                                inputField : "toRO",
253
                                                ifFormat : "[% DHTMLcalendar_dateformat %]",
254
                                                button : "openCalendarToRO",
255
                                                disableFunc : validate2,
256
                                                dateStatusFunc : validate2
257
                                            }
258
                                        );
259
                                        //]]>
260
                                        </script>
261
                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
262
                        </td>
263
                    </tr>
264
265
                </tbody>
266
            </table><br />
267
        </fieldset>
268
269
        <fieldset class="rows">
270
            <legend>Output</legend>
271
            <ol>
272
                <li>
273
                    <label for="outputscreen">To screen into the browser: </label>
274
                    <input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
275
                </li>
276
                <li>
277
                    <label for="outputfile">To a file:</label>
278
                    <input type="radio" name="output" value="file" id="outputfile" />
279
                    <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
280
                    <label class="inline" for="MIME">Into an application</label>[% CGIextChoice %]
281
                    [% CGIsepChoice %]
282
                </li>
283
            </ol>
284
        </fieldset>
285
286
        <fieldset class="action">
287
            <input type="button" value="Submit" onclick="Check(this.form)"/>
288
            <input type="hidden" name="report_name" value="[% report_name %]" />
289
            <input type="hidden" name="do_it" value="1" />
290
        </fieldset>
291
    </form>
292
[% END %]
293
</div>
294
</div>
295
<div class="yui-b">
296
[% INCLUDE 'reports-menu.inc' %]
297
</div>
298
</div>
299
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt (+1 lines)
Lines 34-39 Link Here
34
		<li><a href="/cgi-bin/koha/reports/catalogue_stats.pl">Catalog</a></li>
34
		<li><a href="/cgi-bin/koha/reports/catalogue_stats.pl">Catalog</a></li>
35
		<li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
35
		<li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
36
		<li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
36
		<li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
37
        <li><a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash Register</a></li>
37
		<li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li>
38
		<li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li>
38
	</ul></div>
39
	</ul></div>
39
40
(-)a/misc/translator/po/zh-Hans-CN-i-staff-t-prog-v-3006000.po (+2 lines)
Lines 88488-88490 msgstr "
 " Link Here
88488
msgid "%s "
88488
msgid "%s "
88489
msgstr "%s "
88489
msgstr "%s "
88490
88490
88491
88492
(-)a/reports/cash_register_stats.pl (-1 / +117 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
#
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use strict;
19
#use warnings; FIXME - Bug 2505
20
use C4::Auth;
21
use CGI;
22
use C4::Context;
23
use C4::Reports;
24
use C4::Output;
25
use C4::Koha;
26
use C4::Circulation;
27
use C4::Dates qw/format_date format_date_in_iso/;
28
use C4::Budgets qw/GetCurrency GetCurrencies/;
29
30
BEGIN { $C4::Debug::debug = 1; }
31
32
my $input           = new CGI;
33
my $do_it           = $input->param('do_it');
34
my $fullreportname  = "reports/cash_register_stats.tt";
35
my @filters         = $input->param("Filter");
36
my $podsp           = $input->param("PlacedOnDisplay");
37
my $rodsp           = $input->param("ReceivedOnDisplay");
38
my $aodsp           = $input->param("AcquiredOnDisplay");   ##added by mason.
39
my $output          = $input->param("output");
40
my $basename        = $input->param("basename");
41
our $sep = "    ";
42
43
my ($template, $borrowernumber, $cookie)
44
    = get_template_and_user({template_name => $fullreportname,
45
                query => $input,
46
                type => "intranet",
47
                authnotrequired => 0,
48
                flagsrequired => {reports => '*'},
49
                debug => 1,
50
                });
51
52
$template->param(do_it => $do_it,
53
        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
54
        );
55
56
$filters[0]= format_date_in_iso($filters[0]);
57
$filters[1]= format_date_in_iso($filters[1]);
58
59
if ($do_it) {
60
   my $dbh = C4::Context->dbh;
61
   my $req = $dbh->prepare("SELECT round(amount,2),description,surname,firstname,t1.borrowernumber,t1.date,t1.amountoutstanding
62
        FROM accountlines t1 LEFT JOIN borrowers t2 ON t1.borrowernumber=t2.borrowernumber
63
        WHERE amount<0  AND accounttype IN ('C', 'FOR', 'Pay') AND CAST(t1.date AS DATE) between ? AND ? ORDER BY t1.date;");
64
    $req->execute($filters[0],$filters[1]);
65
66
    my @loopresult;
67
    my $grantotal =0;
68
    while ( my (@celvalue) = $req->fetchrow) {
69
        if((($celvalue[0]*-1)-$celvalue[6])>0){
70
            push @loopresult, { amount => sprintf("%.2f", ($celvalue[0] * -1)), surname => $celvalue[2], firstname => $celvalue[3],
71
                borrowernumber => $celvalue[4], date => format_date_in_iso($celvalue[5])};
72
            $grantotal += ($celvalue[0]*-1);
73
        }
74
    }
75
    my @currency = GetCurrency();
76
    $grantotal = sprintf("%.2f", $grantotal);
77
78
    if($output eq 'screen'){
79
        $template->param(   loopresult => \@loopresult,
80
                            total => $grantotal,
81
                            beginDate => $filters[0],
82
                            endDate => $filters[1]
83
            );
84
    }else{
85
        binmode STDOUT, ':utf8';
86
        print $input->header(
87
                        -type => 'application/vnd.sun.xml.calc',
88
                        -encoding => 'utf-8',
89
                        -name => "$basename.csv",
90
                        -attachment => "$basename.csv"
91
                        );
92
        print "Borrower Number".$sep;
93
        print "Date".$sep;
94
        print "Surname".$sep;
95
        print "Firstname".$sep;
96
        print "Amount"."\n";
97
98
        foreach my $item (@loopresult){
99
            print $item->{borrowernumber}.$sep;
100
            print $item->{date}.$sep;
101
            print $item->{surname}.$sep;
102
            print $item->{firstname}.$sep;
103
            print $item->{amount}."\n";
104
        }
105
106
        print $sep;
107
        print $sep;
108
        print $sep;
109
        print $sep;
110
        print $grantotal."\n";
111
        exit(1);
112
    }
113
114
}
115
output_html_with_http_headers $input, $cookie, $template->output;
116
117
1;

Return to bug 6934