packing slip related changes

This commit is contained in:
Nabin Hait 2011-10-11 12:50:55 +05:30
parent 5f66d60bdd
commit c1d4281718
3 changed files with 363 additions and 366 deletions

View File

@ -1,7 +1,7 @@
# REMEMBER to update this # REMEMBER to update this
# ======================== # ========================
last_patch = 384 last_patch = 385
#------------------------------------------- #-------------------------------------------
@ -454,3 +454,6 @@ def execute(patch_no):
reload_doc('stock', 'Module Def', 'Stock') reload_doc('stock', 'Module Def', 'Stock')
sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'") sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'")
sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'") sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'")
elif patch_no == 385:
# Patch for adding packing related columns (packed by, checked by, shipping mark etc)
reload_doc('stock','doctype','delivery_note')

View File

@ -562,7 +562,7 @@ pscript.feature_dict = {
'Timesheet': {'timesheet_details':['project_name']} 'Timesheet': {'timesheet_details':['project_name']}
}, },
'fs_packing_details': { 'fs_packing_details': {
'Delivery Note': {'fields':['packing_details','print_packing_slip'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']}, 'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
'Sales Order': {'fields':['packing_details']} 'Sales Order': {'fields':['packing_details']}
}, },
'fs_discounts': { 'fs_discounts': {

View File

@ -445,7 +445,7 @@ class DocType(TransactionBase):
for d in getlist(self.doclist, 'delivery_note_details'): for d in getlist(self.doclist, 'delivery_note_details'):
if d.item_code: if d.item_code:
item_wt = sql("select nett_weight from `tabItem` where name = %s", (d.item_code)) item_wt = sql("select nett_weight from `tabItem` where name = %s", (d.item_code))
d.pack_nett_wt = item_wt and flt(item_wt[0][0])*flt(d.qty) or 0 d.pack_nett_wt = item_wt and flt(item_wt[0][0]) or 0
# ========================================== # ==========================================
def print_packing_slip(self): def print_packing_slip(self):
@ -455,27 +455,21 @@ class DocType(TransactionBase):
tot_nett_wt,tot_gross_wt=0,0 tot_nett_wt,tot_gross_wt=0,0
for d in getlist(self.doclist, 'delivery_note_details'): for d in getlist(self.doclist, 'delivery_note_details'):
sno=sno+1 sno=sno+1
if sno!=1:#Footer goes here if sno!=1 and prev_pack!=d.pack_no:#Footer goes here
html+='</table><table width="100%"><tr><td>CASE NO</td><td>'+cstr(d.pack_no)+'</td><td>NETT WT</td><td>'+cstr(tot_nett_wt)+'</td><td>CHECKED BY</td><td></td></tr><tr><td>SIZE</td><td></td><td>GROSS WT</td><td>'+cstr(tot_gross_wt)+'</td><td>PACKED BY</td><td></td></tr></table>' html+='</table><table style="page-break-after:always" width="100%"><tr><td>CASE NO</td><td>'+cstr(d.pack_no)+'</td><td>NETT WT</td><td>'+cstr(tot_nett_wt)+'</td><td>CHECKED BY</td><td></td></tr><tr><td>SIZE</td><td></td><td>GROSS WT</td><td>'+cstr(tot_gross_wt)+'</td><td>PACKED BY</td><td></td></tr></table></div>'
if prev_pack!=d.pack_no: #Prepare Header Here if prev_pack!=d.pack_no: #Prepare Header Here
#Header code goes here #Header code goes here
html+='<div align="center">[HEADER GOES HERE]</div><div><center><h2>Packing Slip</h2></center></div> <table width="100%"><tr><td>Order No.</td><td>'+cstr(self.doc.sales_order_no)+'</td><td>Shipping Marks</td><td>'+cstr(d.pack_no)+'</td></tr></table>' html+='<div align="center">[HEADER GOES HERE]</div><div><center><h2>Packing Slip</h2></center></div> <table width="100%"><tr><td width="15%">Order No.</td><td width="35%">'+cstr(self.doc.sales_order_no)+'</td><td width="15%">Shipping Marks</td><td>'+cstr(d.shipping_mark)+'</td></tr></table>'
html+='<table class="cust_tbl" style="page-break-after:always" width="100%"><tr><td>S.NO.</td><td>QUANTITY</td><td>CS.NO.</td><td>DESCRIPTION</td><td>WEIGHT</td><tr>' html+='<table class="cust_tbl" width="100%"><tr><td>S.NO.</td><td>QUANTITY</td><td>CS.NO.</td><td>DESCRIPTION</td><td>WEIGHT</td><tr>'
sno=0 sno=0
tot_nett_wt,to_gross_wt=flt(d.pack_nett_wt),flt(d.pack_gross_wt) tot_nett_wt,to_gross_wt=flt(d.pack_nett_wt),flt(d.pack_gross_wt)
#Body code goes here #Body code goes here
html+='<tr><td>'+cstr(sno+1)+'</td><td>'+cstr(d.qty)+'</td><td></td><td>'+d.item_code+'</td><td>'+cstr(d.pack_nett_wt)+'</td></tr>' html+='<tr><td>'+cstr(sno+1)+'</td><td>'+cstr(d.qty)+'</td><td>'+d.item_code+'</td><td>'+d.description+'</td><td>'+cstr(d.pack_nett_wt)+'</td></tr>'
prev_pack=d.pack_no prev_pack=d.pack_no
tot_nett_wt+=flt(d.pack_nett_wt) tot_nett_wt+=flt(d.pack_nett_wt)
tot_gross_wt+=flt(d.pack_gross_wt) tot_gross_wt+=flt(d.pack_gross_wt)
if html!='':
html+='</table><table style="page-break-after:always" width="100%"><tr><td>CASE NO</td><td>'+cstr(d.pack_no)+'</td><td>NETT WT</td><td>'+cstr(tot_nett_wt)+'</td><td>CHECKED BY</td><td>'+cstr(self.doc.packing_checked_by)+'</td></tr><tr><td>SIZE</td><td>'+cstr(self.doc.pack_size)+'</td><td>GROSS WT</td><td>'+cstr(tot_gross_wt)+'</td><td>PACKED BY</td><td>'+cstr(self.doc.packed_by)+'</td></tr></table></div>'
html+='</html>' html+='</html>'
self.doc.print_packing_slip=html self.doc.print_packing_slip=html