[%PROCESS "$tdir/titles.txt"%] Untitled Document [%rec = DBI.query(" select branch_documents.*, tillclients.code, waitron.name, date(stamp) date, tillclients.name client, tillclients.pricelist, DATE_FORMAT(branch_documents.invoice_date, '%e/%m/%Y') date from branch_documents left join `$sharedclients`.tillclients on tillclients.id = branch_documents.branch_id left join waitron on waitron.id = branch_documents.user_id where branch_documents.id = ? ", pars.document).get()%] [%tinv = DBI.query("select * from tillinvoices where id = ?",rec.supplier_invoice).get()%] [%bal = DBI.query("SELECT tillclients.*, bal.entity_debit, bal.entity_credit, bal.entity_credit - bal.entity_debit credit_balance, tillclients.creditlimit + IF(bal.entity_credit IS NULL OR bal.entity_debit IS NULL,0, bal.entity_credit - bal.entity_debit) available_credit FROM `$sharedclients`.tillclients tillclients left join account_balance_entity bal on bal.account = 1 and entityid = tillclients.id where tillclients.id = ?;", rec.branch_id).get()%] [%balance = (bal.available_credit * 1) * -1%] [%client = DBI.query("select * from tillclients where id = ?",rec.branch_id).get()%] [%SWITCH rec.document_type%] [%CASE 201%] [%document_type = documents.1.0%] [%document_number = documents.1.1 _ rec.supplier_invoice _ '/' _ rec.seq_nr%] [%CASE 202%] [%document_type = documents.3.0%] [%document_number = documents.3.1 _ rec.supplier_invoice _ '/' _ rec.seq_nr%] [%CASE 203%] [%document_type = documents.2.0%] [%document_number = documents.2.1 _ rec.supplier_invoice _ '/' _ rec.seq_nr%] [%END%] [%document_date = rec.date%] [%client_company = client.clientgroup%] [%deliver_to = "$deliver_to
$client.ph_address" %] [%deliver_to = "$deliver_to
$client.ph_address1" %] [%deliver_to = "$deliver_to
$client.ph_address2" %] [%deliver_to = "$deliver_to
$client.ph_address3" %] [%deliver_to = "$deliver_to
$client.ph_postcode" %] [%deliver_to = "$deliver_to
ATT: $client.name" %] [%deliver_to = "$deliver_to
Cell: $client.cellphone Tel: $client.telephone Fax: $client.fax" %] [%client_address = "$client_address
$client.address" %] [%client_address = "$client_address
$client.address1" %] [%client_address = "$client_address
$client.address2" %] [%client_address = "$client_address
$client.address3" %] [%client_address = "$client_address
$client.postcode" %] [%records = DBI.query(" select bd.*,menu.units,menu.code from branch_documents_details bd, menu where menu.id = bd.stockitem_id and bd.document_id = ? ", pars.document) %] [% itemspage = 16 %] [% d = records.size / itemspage %] [% pages = int(d)%] [%IF pages < d%] [%pages = pages + 1%] [%END%] [%subtotal = 0%] [%cpage = 1%] [%data = {}%] [% data.$cpage = []%] [%lines = 1%] [%running_total = 0%] [%qtytotal = 0%] [%FOREACH record IN records %] [%linetotal = record.qty * record.price%] [%qtytotal = qtytotal + record.qty%] [%running_total = running_total + linetotal%] [%lines = lines + 1%] [%IF lines > itemspage %] [%cpage = cpage + 1%] [% data.$cpage = []%] [%lines = 1%] [%END%] [%page_subtotal.${cpage} = page_subtotal.${cpage} + record.qty * record.price%] [% m = {} %] [% m.name = record.description %] [% m.code = record.code %] [% m.count = record.count%] [% m.units = units.${record.units}%] [% m.qty = record.qty %] [% m.line_vat = (record.total - m.discount) * ( cvat / (100 + cvat) ) %] [% m.uprice = record.price %] [% m.total = linetotal %] [% m.discount = record.discount * record.qty%] [%total = total + linetotal%] [% data.$cpage.push(m) %] [%END%] [%discount = tinv.discount%] [%total = total - discount%] [%totalvat = ( (total) * ( cvat / (100 + cvat) ) )%] [%# USE Dumper %] [%# Dumper.dump_html(data) %] [%IF ! pars.email%]

   

[%END%] [%bbb = pars.copies%] [%IF pars.dn > 0%][%bbb = bbb + 1%][%END%] [%FOREACH cop = [1..bbb]%] [%FOREACH page = [1..pages]%]
Page [%page%] / [%pages%]
[%IF dnote == 0%][%END%]

VAN TONDER VLEIS CC T/A GOEDE HOOP VLEIS
Tel: 021 863 2965 Co. Reg. #: 2001/046935/23
Fax: 021 863 4027 Vat Reg. #: 4470235443
[%dnote = 0%][%IF pars.dn && cop <= pars.copies%][%document_type%] [%IF cop > 1%]***COPY***[%END%][%ELSE%]DELIVERY NOTE [%dnote = 1%][%END%]
Document No
[%document_number%]
Page [%page%]/[%pages%]
 
[%client_company%]

[%client_address%]

Deliver to

[%deliver_to%]

Account Your Reference Tax Exempt Tax Reference Sales Rep  
[%client.code%] [%client.name%] N [%client.tax_number%] [%rec.name%] Inclusive
[%IF dnote == 0%] [%END%]
Code Description Count/Vol Qty UnitsUnit Price [%IF pars.excloption == 1%](Ex)[%END%] VAT Nett Amount [%IF pars.excloption == 1%](Ex)[%END%]
[%FOREACH a = data.${page}%] [%IF dnote == 0%][%END%] [%IF dnote == 0%][%END%] [%IF dnote == 0%][%END%] [%END%]
[%a.code%] [%a.name%] [%a.count%] [%a.qty%] [%a.units%]R [%IF pars.excloption != 1%] [%pr(a.uprice)%] [%ELSE%] [%pr(a.uprice / ((100 + cvat) / 100))%] [%END%] 14.00%R [%IF pars.excloption != 1%] [%pr(a.total)%] [%ELSE%] [%pr(a.total / ((100 + cvat) / 100))%] [%END%]
NOTES:
CONDITIONS AND TERMS OF SALE
1) No claims will be recognised unless made within 24 HOURS after delivery.
2) Any accounts outstanding after 7 days from invoice are liable to interest charges at maximum permissible rates.
3) A handling fee of 10% will be imposed for the return of goods
4) Goods returned without relating invoice numbers will not be credited.
5) All goods supplied on this document remains the property of GOEDE HOOP VLEIS until paid in full.
0%]colspan=2[%END%]>
Payment Method:
[%IF tinv.cash >0%] CASH [%ELSIF tinv.cheque >0%] CHEQUE [%ELSIF tinv.ccard >0 and tinv.ccardtype == 'eft'%] EFT [%ELSIF tinv.ccard >0 and tinv.ccardtype != 'eft'%] CREDIT CARD [%ELSIF tinv.account >0 %] ACCOUNT, BALANCE: [%currency%] [%pr(balance)%] [%END%]
NAME: GOEDE HOOP VLEIS
BANK: ABSA BANK
BRANCH CODE: 632005
ACCOUNT NO: 4067578941
FAX PAYMENT TO: 021 863 4027
Document date: [%rec.date%]

Received in good order

Signed ____________________ Date ____________________

[%IF sett.discountbills == 1%] [%END%]
Sub Total ([%IF pars.excloption != 1%]Incl[%ELSE%]Excl[%END%]) R [%IF pars.excloption != 1%] [%pr(page_subtotal.${page})%] [%ELSE%] [%pr( page_subtotal.${page} / ((100 + cvat) / 100) )%] [%END%]
Discount [%IF page == pages%] [%IF discount >0%] [%discountperc = discount / ((total - totalvat) + discount) * 100 %] [%END%] @ [%pr(discountperc)%]% [%END%] [%IF page == pages%]R[%discount || '0.00'%][%END%]
Nett Amount (Excl Tax & Discount) [%IF page == pages%] [%theex = total - totalvat%] R[%pr(theex)%][%END%]
[%nvat%] Amount [%IF page == pages%] R[%pr(totalvat)%] [%END%]
Total Due (Incl) [%IF page == pages%] R [%pr(total)%] [%END%]
[%# USE Dumper %] [%# Dumper.dump_html(data) %] [%END%] [%#PAGE LOOP%] [%END%] [%#copiesloop%]