Gnumed.business.gmBilling

Package Gnumed :: Package business :: Module gmBilling |
[frames] | no frames]

# Module gmBilling

source code

Billing code.

Copyright: authors

Author: Nico Latzer <nl@mnet-online.de>, Karsten Hilbert <Karsten.Hilbert@gmx.net>

License: GPL v2 or later (details at http://www.gnu.org)

Classes
| cBillable Items which can be billed to patients.
| cBillItem
| cBill Represents a bill

Functions
get_billables(active_only=True, order_by=None, return_pks=False) | source code
create_billable(code=None, term=None, data_source=None, return_existing=False) | source code
delete_billable(pk_billable=None) | source code
get_bill_items(pk_patient=None, non_invoiced_only=False, return_pks=False) | source code
create_bill_item(pk_encounter=None, pk_billable=None, pk_staff=None) | source code
delete_bill_item(link_obj=None, pk_bill_item=None) | source code
get_bills(order_by=None, pk_patient=None, return_pks=False) | source code
get_bills4document(pk_document=None) | source code
create_bill(conn=None, invoice_id=None) | source code
delete_bill(link_obj=None, pk_bill=None) | source code
get_bill_receiver(pk_patient=None) | source code
generate_invoice_id(template=None, pk_patient=None, person=None, date_format='%Y-%m-%d', time_format='%H%M%S') Generate invoice ID string, based on template. | source code
lock_invoice_id(invoice_id) Lock an invoice ID. | source code
unlock_invoice_id(invoice_id) | source code
get_scan2pay_data(branch, bill, provider=None, comment=None) Create scan2pay data for generating a QR code. | source code

Variables
| INVOICE_DOCUMENT_TYPE = `'invoice'`
| DEFAULT_INVOICE_ID_TEMPLATE = `'GM%(pk_pat)s / %(date)s / %(tim`...``

Imports: sys, logging, zlib, gmPG2, gmBusinessDBObject, gmTools, gmDateTime, gmDemographicRecord, gmDocuments

Function Details

### generate_invoice_id(template=None, pk_patient=None, person=None, date_format='%Y-%m-%d', time_format='%H%M%S') | source code
    Generate invoice ID string, based on template.

    No template given -> generate old style fixed format invoice ID.

    Placeholders:
            %(pk_pat)s
            %(date)s
            %(time)s
                    if included, $counter$ is not *needed* (but still possible)
            %(firstname)s
            %(lastname)s
            %(dob)s

            #counter#
                    will be replaced by a counter, counting up from 1 until the invoice id is unique, max 999999

### lock_invoice_id(invoice_id) | source code
Lock an invoice ID. The lock taken is an exclusive advisory lock in PostgreSQL. Because the data is short _and_ crc32/adler32 are fairly weak we assume that collisions can be created "easily". Therefore we apply both algorithms concurrently.

### get_scan2pay_data(branch, bill, provider=None, comment=None) | source code
    Create scan2pay data for generating a QR code.

    https://www.scan2pay.info
    --------------------------------
    BCD                                                                                                             # (3) fixed, barcode tag
    002                                                                                                             # (3) fixed, version
    1                                                                                                               # (1) charset, 1 = utf8
    SCT                                                                                                             # (3) fixed
    $<praxis_id::BIC//Bank//%(value)s::11>$                                 # (11) <BIC>
    $2<range_of::$<current_provider_name::%(lastnames)s::>$,$<praxis::%(praxis)s::>$::70>2$                 # (70) <Name of beneficiary> "Empfänger" - Praxis
    $<praxis_id::IBAN//Bank//%(value)s::34>$                                # (34) <IBAN>
    EUR$<bill::%(total_amount_with_vat)s::12>$                              # (12) <Amount in EURO> "EUR12.5"
                                                                                                                    # (4) <purpose of transfer> - leer
                                                                                                                    # (35) <remittance info - struct> - only this XOR the next field - GNUmed: leer
    $2<range_of::InvID=$<bill::%(invoice_id)s::>$/Date=$<today::%d.%B %Y::>$::140$>2$       # (140) <remittance info - text> "Client:Marie Louise La Lune" - "Rg Nr, date"
    <beneficiary-to-payor info>                                                             # (70)  "pay soon :-)" - optional - GNUmed nur wenn bytes verfügbar
    --------------------------------
    total: 331 bytes (not chars ! - cave UTF8)
    EOL: LF or CRLF
    last *used* element not followed by anything, IOW can omit pending non-used elements

Variables Details

  ### DEFAULT_INVOICE_ID_TEMPLATE Value:
      'GM%(pk_pat)s / %(date)s / %(time)s'