Generate Auto Receipt Number in Koha


Sometimes we need to add a unique receipt number (credit number) to each payment for audit purposes or any other reason. Koha allows you to generate credit numbers automatically.

let's know How to enable automatically generate credit numbers to patrons' payment receipts

Change some settings in Account credit types

Go to Koha Administration ➤ Accounting ➤ Credit types

Click on the edit button of "Payment"


1. Tick check the box to enable credit (Receipt) number options 

2. Save the credit type.


Go to Koha Administration ➤ Global system preferences ➤ AutoCreditNumber

There are the following values in the drop-down list

1. Do not automatically generate credit numbers
2. Automatically generate credit numbers in the form <year>-0001
3. Automatically generate credit numbers in the form <branchcode>yyyymm0001
4. Automatically generate credit numbers in forms 1, 2, 3

You can choose any format except the default one. For example, I choose here third one (Automatically generate credit numbers in the form <branchcode>yyyymm0001) for generating a unique receipt number followed by branch name, year, and month.  

Save all accounting preferences

Now you need to make a little change to the patron's table

Koha administration ➤ Additional parameters ➤Table setting ➤Patrons

Uncheck the credit number and save.

When you apply a payment to the patron's account, you will see that a credit number has been generated. This may be considered as a receipt number.

Now you can add the receipt number on the receipt while printing the receipt. Edit or create a new note in the ACCOUNT_CREDIT under the Notices & Slips Tools menu.

Koha Tools ➤ Notices & Slips  ACCOUNT_CREDIT ( Edit the notice script)

Copy and paste the following Codes into the print section and save.

 [% USE Price %]
[% PROCESS 'accounts.inc' %]
<table>
[% IF ( LibraryName ) %]
 <tr>
    <th colspan="5" class="centerednames">
        <h3>[% LibraryName | html %]</h3>
    </th>
 </tr>
[% END %]
<tr>
    <th colspan="5" class="centerednames">
        <h1>NAME OF INSTITUTE</h1>
        <h3>Address of Institute</h3>
    </th>
 </tr>

 <tr>
    <th colspan="5" class="centerednames">
        <h2><u>RECEIPT</u></h2>
    </th>
 </tr>
 <tr>
    <th colspan="5" class="centerednames">
        <h3>Receipt Number : [% credit.credit_number %]</h3>
    </th>
 </tr>
 <tr>
    <th colspan="5" class="centerednames">
        <h2>[% Branches.GetName( credit.patron.branchcode ) | html %]</h2>
    </th>
 </tr>
 <tr>
    <th colspan="5">
        Received with thanks from  [% credit.patron.firstname | html %] [% credit.patron.surname | html %] <br />
        Library Card Number : [% credit.patron.cardnumber | html %]<br />
    </th>
 </tr>
  <tr>
    <th>Created</th>
    <th>Updated</th>
    <th>Description</th>
    <th>Note</th>
    <th>Amount</th>
 </tr>

 <tr class="highlight">
    <td>[% credit.date | $KohaDates %]</td>
    <td>[% credit.timestamp | $KohaDates with_hours = 1 %]</td>
    <td>
      [% PROCESS account_type_description account=credit %]
      [%- IF credit.description %], [% credit.description | html %][% END %]
    </td>
    <td>[% credit.note | html %]</td>
    <td class="credit">[% credit.amount | $Price %]</td>
 </tr>

[% IF ( tendered ) %]
  <tr>
    <td colspan="3">Amount tendered: </td>
    <td>[% tendered | $Price %]</td>
  </tr>
  <tr>
    <td colspan="3">Change given: </td>
    <td>[% change | $Price %]</td>
  </tr>
[% END %]

<tfoot>
  <tr>
    <td colspan="4">Total outstanding dues as on date: </td>
    [% IF ( credit.patron.account.balance >= 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% credit.patron.account.balance | $Price %]</td>
  </tr>
</tfoot>
</table>

Post a Comment

0 Comments