<div id="pdf"><a href="javascript:genPDF()">Click to Download as PDF</a></div>
<div id="invoicing">
<div id="letterHead">
<span class="letterHead invoice">
<img src="{{=URL('static', 'images/logoicon.png')}}" width="100px" height="100px"/> <span style="font-weight: bold;">COMPANY</span><br />
TELEPHONE: ............<br />
EM@IL: .............@gmail.com<br />
CELL: ............<br />
POSTAL-ADDRESS:..............<br />
</span>
<span class="customerInv">Invoice No: ___________<br />
Contact: {{=invoice.proxy}}<br />
Company: {{=invoice.company}}<br />
Tel: {{=invoice.tel}}<br />
Postal Address: {{=invoice.postalAddress}}
</span>
</div>
<hr />
<div>
<table>
<tr>
<th>Order</th>
<th>Quantity</th>
<th>Order Price(VAT Exclusive)</th>
<th>Amount</th>
</tr>
{{for invoice in customer:}}
<tr>
<td>{{=invoice.client_order}}</td>
<td>{{=invoice.quantity}}</td>
<td>{{=MoneyFormat(invoice.beforeVat)}}</td>
<td>{{=MoneyFormat(invoice.quantity*invoice.beforeVat)}}</td>
</tr>
{{pass}}
{{for price in pricing:
try:
vat=round(price.total*0.12, 2)
totalPrice=price.total+vat
except:
redirect(URL('notInvoiced'))
}}
{{pass}}
<tr>
<td style="font-weight: bold; font-size: 14px; color: blue;" width: 29px;>Sub-Total:</td><td style="font-weight: bold; font-size: 14px; color: blue;" width: 29px>{{=MoneyFormat(price.total)}}</td><td style="font-weight: bold; font-size: 14px; color: black;" width: 29px;>(VAT EXCLUSIVE)</td>
</tr>
<tr>
<td style="font-weight: bold; font-size: 14px; color: red;" width: 29px;>12% VAT: </td><td style="font-weight: bold; font-size: 14px; color: red;" width: 29px>{{=MoneyFormat(vat)}}</td>
</tr>
<tr>
<td style="font-weight: bold; font-size: 14px; color: green;" width: 29px;>Total: </td><td style="font-weight: bold; font-size: 14px; color: green;" width: 29px>{{=MoneyFormat(totalPrice)}}</td><td style="font-weight: bold; font-size: 14px; color: black;" width: 29px;>(VAT INCLUSIVE)</td>
</tr>
{{pass}}
{{pass}}
</table>
<br />
<div style="font-weight: bold;">
Client Sinature: ____________________<br />
{{=invoice.Booked_By.first_name}} {{=invoice.Booked_By.last_name}}<br />
Date & Time: {{=invoice.Booking_Date}}<br />
</div>
<center><span style="font-weight: bold; font-style: italic;">
Thank you for your business!<br />
Company
</span></center>
</div>
</div>
<script>
$('document').ready(function(){
$(".delete").click(function(){
return confirm('Are you sure you want to delete this this INVOICE?!');
});
});
</script>
#BY CLICKING THE LINK BELOW I WANT TO BE ABLE TO DELETE ALL THE INVOICE ITEMS AT ONCE
<div id="delete"><a class="delete" href="{{=URL('deleteInvoice', args=invoice.id)}}">Delete Invoice</a></div>
<br />
<div id="editor"></div>
<button onclick="topFunction()" id="myBtn" title="Go to top">TOP</button>
def deleteInvoice():
#THE .first() FUNCTION IN THE LINE BELOW ONLY ALLOWS ME TO DELETE ITEMS ONE AT A TIME
query = db(db.invoice.id==request.args(0, cast=int)).select().first()
remove = db(db.invoice.id==query).delete()
if remove:
redirect(URL('registeredClients'))
return locals()
INVOICE DELETING CONTROLLER
def deleteInvoice():
#THE .first() FUNCTION IN THE LINE BELOW ONLY ALLOWS ME TO DELETE ITEMS ONE AT A TIME
query = db(db.invoice.id==request.args(0, cast=int)).select().first()
remove = db(db.invoice.id==query).delete()
Hey Anthony, thanks for the heads up in the garbage code in the controller i will address it, with regards to deleting invoices i want to be able to delete all invoices in the db.invoice table but only for a specific selected client. I want to be able to delete an entire invoice by clicking the link once.
db(db.invoice.client = some_client_id).delete()
def deleteInvoice():
query=db.invoice(request.args(0, cast=int))
remove=db(db.invoice.customer==query.id).delete()
if remove:
redirect(URL('registeredClients'))
return locals()
My delete function is not working, I think I am doing doing something wrong but i'm not sure where, I thought the code below would get me home but nothing is happening, nothing is getting deleted! Please advice:DELETE FUNCTION CONTROLLER CODE:
def deleteInvoice():
query=db.invoice(request.args(0, cast=int))
remove=db(db.invoice.customer==query.id).delete()
if db(db.invoice.customer == request.args(0, cast=int)).delete():
redirect(URL('registeredClients'))
if db(db.invoice.id == request.args(0, cast=int)).delete():
redirect(URL('registeredClients'))
if db(db.invoice.id > 0).delete():
redirect(URL('registeredClients'))
def View_Invoice():
ref=session.ref2
invoiceDetails=db.Client_Details(request.args(0, cast=int))
session.detailsInvoice=invoiceDetails
resCompany=db(db.resident_company).select()
customer=db(db.invoice.customer==invoiceDetails.id).select(db.invoice.ALL)
pricing=db(db.invoice.customer==invoiceDetails.id).select(db.invoice.totalPrice.sum().with_alias('total'))
return locals()
def deleteInvoice():
if db(db.invoice.customer == session.detailsInvoice).delete():
redirect(URL('registeredClients'))
return locals()