Beispiel #1
0
def list_table_data(quotation):
    data = [
	[
	    Paragraph('<para fontSize=9><b>S/N</b></para>', style["BodyText"]), \
	    Paragraph('<para fontSize=9><b>Product ID</b></para>', style["BodyText"]), \
	    Paragraph('<para fontSize=9><b>Reference</b></para>', style["BodyText"]), \
	    Paragraph('<para fontSize=9><b>Description</b></para>', style["BodyText"]), \
	    Paragraph('<para fontSize=9><b>Qty</b></para>', style["BodyText"]), \
	    Paragraph('<para fontSize=9><b>Price/Unit (GBP)</b></para>', style["BodyText"]), \
	    Paragraph('<para fontSize=9><b>Total (GBP)</b></para>', style["BodyText"])
	]
    ]

    line_item_list = h.change_id_serialno(list(quotation.lineitem_set.all()))

    for l in line_item_list:
	row = []
	row.append(str(l.id))
	row.append(str(l.product.product.code))
	row.append(str(l.product.part_number))
	row.append(Paragraph(l.product.description, style["BodyText"]))
	row.append(str(l.quantity))
	row.append(str(l.cost_per_unit))
	row.append(str(l.cost))
	data.append(row)

    quotation_details = return_quote_details(quotation.cost, quotation.courier_charge)

    data.append(["", "", "", "", "", "Sub-Total", str(quotation_details[0])])
    data.append(["", "", "", "", "", "VAT @ 5%", str(quotation_details[1])])
    data.append(["", "", "", "", "", "Logistics", str(quotation_details[2])])
    data.append(["", "", "", "", "", Paragraph('<b>Grand Total</b>', style["BodyText"]), str(quotation_details[3])])

    return data
Beispiel #2
0
def fetch_quote(request, quotation_id, form_class=UserDetailCheckForm, template="quote/quotation.html", **kwargs):
    quotation = get_object_or_404(Quotation, pk=quotation_id)
    quotation.VAT = settings.VAT/100.0 * int(quotation.cost)

    user_account = get_user_account(quotation.user.id)

    form = form_class()

    line_item_list = h.change_id_serialno(list(quotation.lineitem_set.all()))

    return render_to_response(template, {
	"menu": APP_MENU,
	"quotation": quotation,
	"line_items": line_item_list,
	"user_account": user_account,
	"user_detail_form": form,
    }, context_instance=RequestContext(request))