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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt (-3 / +13 lines)
Lines 130-135 $(document).ready(function() { Link Here
130
                        <option value="C">Credit</option>
130
                        <option value="C">Credit</option>
131
                        [% END %]
131
                        [% END %]
132
132
133
                        [% IF transaction_type == "CR" %]
134
                        <option value="CR" selected="selected">Credit (item returned)</option>
135
                        [% ELSE %]
136
                        <option value="CR">Credit (item returned)</option>
137
                        [% END %]
138
133
                        [% IF transaction_type == "FORW" %]
139
                        [% IF transaction_type == "FORW" %]
134
                        <option value="FORW" selected="selected">Write off</option>
140
                        <option value="FORW" selected="selected">Write off</option>
135
                        [% ELSE %]
141
                        [% ELSE %]
Lines 189-195 $(document).ready(function() { Link Here
189
                    </select>
195
                    </select>
190
                </li>
196
                </li>
191
                <li>
197
                <li>
192
                    <label>Library</label>
198
                    <label>Transaction branch</label>
193
                    <select name="branch" id="branch">
199
                    <select name="branch" id="branch">
194
                        <option value="ALL">All</option>
200
                        <option value="ALL">All</option>
195
                        [% FOREACH branchloo IN branchloop %]
201
                        [% FOREACH branchloo IN branchloop %]
Lines 245-253 $(document).ready(function() { Link Here
245
            <th>Manager name</th>
251
            <th>Manager name</th>
246
            <th>Patron cardnumber</th>
252
            <th>Patron cardnumber</th>
247
            <th>Patron name</th>
253
            <th>Patron name</th>
248
            <th>Library</th>
254
            <th>Transaction branch</th>
249
            <th>Transaction date</th>
255
            <th>Transaction date</th>
250
            <th>Transaction type</th>
256
            <th>Transaction type</th>
257
            <th>Notes</th>
251
            <th>Amount</th>
258
            <th>Amount</th>
252
            <th>Biblio title</th>
259
            <th>Biblio title</th>
253
            <th>Barcode</th>
260
            <th>Barcode</th>
Lines 292-297 $(document).ready(function() { Link Here
292
                        [% END %]
299
                        [% END %]
293
                    [% END %]
300
                    [% END %]
294
                </td>
301
                </td>
302
                <td>[% loopresul.note %]</td>
295
                <td style="text-align:right;">[% loopresul.amount %]</td>
303
                <td style="text-align:right;">[% loopresul.amount %]</td>
296
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber %]">[% loopresul.title %]</a></td>
304
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber %]">[% loopresul.title %]</a></td>
297
                <td>[% loopresul.barcode %]</td>
305
                <td>[% loopresul.barcode %]</td>
Lines 300-308 $(document).ready(function() { Link Here
300
        [% END %]
308
        [% END %]
301
        <tfoot>
309
        <tfoot>
302
        <tr>
310
        <tr>
303
            <th colspan="6" style="text-align:right;">TOTAL</th>
311
            [% IF transaction_type == "ACT" %]
312
            <th colspan="7" style="text-align:right;">TOTAL</th>
304
            <th style="text-align:right;">[% total %]</th>
313
            <th style="text-align:right;">[% total %]</th>
305
            <th colspan="3">&nbsp;</th>
314
            <th colspan="3">&nbsp;</th>
315
            [% END %]
306
        </tr>
316
        </tr>
307
        </tfoot>
317
        </tfoot>
308
    </table>
318
    </table>
(-)a/reports/cash_register_stats.pl (-7 / +16 lines)
Lines 45-51 my $do_it = $input->param('do_it'); Link Here
45
my $output           = $input->param("output");
45
my $output           = $input->param("output");
46
my $basename         = $input->param("basename");
46
my $basename         = $input->param("basename");
47
my $transaction_type = $input->param("transaction_type") || 'ACT';
47
my $transaction_type = $input->param("transaction_type") || 'ACT';
48
my $branchcode       = $input->param("branch") || C4::Context->userenv->{'branch'};
48
my $manager_branchcode       = $input->param("branch") || C4::Context->userenv->{'branch'};
49
our $sep = $input->param("sep") // ',';
49
our $sep = $input->param("sep") // ',';
50
$sep = "\t" if ($sep eq 'tabulation');
50
$sep = "\t" if ($sep eq 'tabulation');
51
51
Lines 88-95 if ($do_it) { Link Here
88
    }
88
    }
89
89
90
    my $whereBranchCode = '';
90
    my $whereBranchCode = '';
91
    if ($branchcode ne 'ALL') {
91
    if ($manager_branchcode ne 'ALL') {
92
        $whereBranchCode = "AND bo.branchcode = '$branchcode'";
92
        $whereBranchCode = "AND m.branchcode = '$manager_branchcode'";
93
    }
93
    }
94
94
95
    ### $transaction_type;
95
    ### $transaction_type;
Lines 98-104 if ($do_it) { Link Here
98
    SELECT round(amount,2) AS amount, description,
98
    SELECT round(amount,2) AS amount, description,
99
        bo.surname AS bsurname, bo.firstname AS bfirstname, m.surname AS msurname, m.firstname AS mfirstname,
99
        bo.surname AS bsurname, bo.firstname AS bfirstname, m.surname AS msurname, m.firstname AS mfirstname,
100
        bo.cardnumber, br.branchname, bo.borrowernumber,
100
        bo.cardnumber, br.branchname, bo.borrowernumber,
101
        al.borrowernumber, DATE(al.date) as date, al.accounttype, al.amountoutstanding,
101
        al.borrowernumber, DATE(al.date) as date, al.accounttype, al.amountoutstanding, al.note,
102
        bi.title, bi.biblionumber, i.barcode, i.itype
102
        bi.title, bi.biblionumber, i.barcode, i.itype
103
        FROM accountlines al
103
        FROM accountlines al
104
        LEFT JOIN borrowers bo ON (al.borrowernumber = bo.borrowernumber)
104
        LEFT JOIN borrowers bo ON (al.borrowernumber = bo.borrowernumber)
Lines 124-130 if ($do_it) { Link Here
124
            ### date : $row->{date}
124
            ### date : $row->{date}
125
125
126
            push (@loopresult, $row);
126
            push (@loopresult, $row);
127
            $grantotal += abs($row->{amount});
127
            if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^LR$|^Pay$/)){
128
                pop @loopresult;
129
                next;
130
            }
131
            if($row->{accounttype} =~ /^C$|^CR$|^LR$/){
132
                $grantotal -= abs($row->{amount});
133
                $row->{amount} = '-' . $row->{amount};
134
            }elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
135
            }else{
136
                $grantotal += abs($row->{amount});
137
            }
128
        #}
138
        #}
129
    }
139
    }
130
140
Lines 182-188 $template->param( Link Here
182
    beginDate        => dt_from_string($fromDate),
192
    beginDate        => dt_from_string($fromDate),
183
    endDate          => dt_from_string($toDate),
193
    endDate          => dt_from_string($toDate),
184
    transaction_type => $transaction_type,
194
    transaction_type => $transaction_type,
185
    branchloop       => C4::Branch::GetBranchesLoop($branchcode),
195
    branchloop       => C4::Branch::GetBranchesLoop($manager_branchcode),
186
    manualinv_types  => $manualinv_types,
196
    manualinv_types  => $manualinv_types,
187
    CGIsepChoice => GetDelimiterChoices,
197
    CGIsepChoice => GetDelimiterChoices,
188
);
198
);
189
- 

Return to bug 6934