[%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, bd.vat tax from branch_documents_details bd, menu where menu.id = bd.stockitem_id and bd.document_id = ? group by bd.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.discount = record.discount * record.qty%] [% m.line_vat = (linetotal - m.discount) * ( record.tax / (100 + record.tax) ) %] [% mtotaltax = mtotaltax + m.line_vat %] [% m.tax = record.tax%] [% m.uprice = record.price %] [% m.total = linetotal %] [%total = total + linetotal%] [% data.$cpage.push(m) %] [%END%] [%discount = tinv.discount%] [%total = total - discount%] [%IF discount > 0%] [%totalvat = ( (total) * ( cvat / (100 + cvat) ) )%] [%ELSE%] [%totalvat = mtotaltax%] [%END%] [%# 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%]

Robustrade 38(PTY) LTD - 75 Industria Ring Rd, Parow Industrial,7493
Tel: 021 931 0061 Co. Reg. #: 2000/026582/07 Vat Reg. #: 4660191851
Cell:
Fax: 021 931 0825
[%dnote = 0%][%IF pars.dn && cop <= pars.copies%][%document_type%] [%IF pars.document_reprint_copy ==1%]
***Copy***Copy***Copy*** [%END%] [%IF cop > 1%]***COPY***[%END%][%ELSE%]DELIVERY NOTE [%dnote = 1%][%END%]
Document No
[%document_number%]
Page [%page%]/[%pages%]
Document date: [%rec.date%]
[%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 + a.tax) / 100))%] [%END%] [%pr(a.tax)%]%R [%IF pars.excloption != 1%] [%pr(a.total)%] [%ELSE%] [%pr(a.total / ((100 + a.tax) / 100))%] [%END%]
NOTES:
CONDITIONS AND TERMS OF SALE
1) No claims will be recognised unless made within seven days after delivery.
2) Any accounts outstanding after 30 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 Robustrade 38 (Pty)Ltd 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 [%END%]
NAME: Robustrade 38(PTY) LTD
BANK: Nedbank
BRANCH CODE: 118602
ACCOUNT NO: 1186043822
FAX PAYMENT TO: 086 601 9004

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%]