Delivery Note added with Packing Details
	1. Pack No
	2. Pack Nett Wt
	3. Pack Gross Wt
	4. Pack Weight UOM
Item is added with
	1. Customer, Code Table
	2. Nett Weight
	3. Gross Weight
	4. Weight UOM
	5. customer_code (for search in quotes etc)
Quotation is added with
	1. item search displays customer code
diff --git a/patches/patch.py b/patches/patch.py
index 8b7276b..f6cf288 100644
--- a/patches/patch.py
+++ b/patches/patch.py
@@ -1,7 +1,7 @@
 # REMEMBER to update this
 # ========================
 
-last_patch = 340
+last_patch = 341
 
 #-------------------------------------------
 
@@ -1409,3 +1409,15 @@
 		reload_doc('production','doctype','bill_of_materials')
 	elif patch_no == 340:
 		sql("update `tabDocField` set permlevel = 0 where (fieldname in ('process', 'production_order', 'fg_completed_qty') or label = 'Get Items') and parent = 'Stock Entry'")
+	elif patch_no == 341:
+		reload_doc('stock','doctype','delivery_note')
+		reload_doc('stock','doc_type','item')
+		reload_doc('selling','doc_type','quotation')
+		reload_doc('stock','Print Format','Delivery Note Packing List Wise')
+
+		if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"):
+			from webnotes.model.doc import addchild
+			dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1)
+			ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1)
+			ch.format = 'Delivery Note Packing List Wise'
+			ch.save(1)
diff --git a/stock/Print Format/Delivery Note Packing List Wise/Delivery Note Packing List Wise.txt b/stock/Print Format/Delivery Note Packing List Wise/Delivery Note Packing List Wise.txt
new file mode 100644
index 0000000..97f57a9
--- /dev/null
+++ b/stock/Print Format/Delivery Note Packing List Wise/Delivery Note Packing List Wise.txt
@@ -0,0 +1,27 @@
+# Print Format, Delivery Note Packing List Wise
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-08-18 16:29:14',
+		'docstatus': 0,
+		'modified': '2011-08-23 13:24:12',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Print Format
+	{
+		'doctype': 'Print Format',
+		'html': "<html>\n<head>\n\n<script>\nfunction replaceAll(s,s1,s2){ return s.split(s1).join(s2);}\n\nfunction get_letter_head(){\n  var cp = locals['Control Panel']['Control Panel'];\n    if(cp.letter_head != 'None') {return cp.letter_head; }\n      else{ return ''};\n  }\n</script>\n<style>\n.cust_tbl { border-collapse:collapse; }\n.cust_tbl td { border:1px solid #848484; }\n</style>\n</head>\n\n<body>\n<script>\nreplaceAll(doc.print_packing_slip,'[HEADER GOES HERE]',get_letter_head());\n</script>\n</body>\n</html>",
+		'module': 'Stock',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Print Format, Delivery Note Packing List Wise
+	{
+		'doctype': 'Print Format',
+		'name': 'Delivery Note Packing List Wise'
+	}
+]
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index 2a2900f..e5acd16 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -174,6 +174,9 @@
     self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
     self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
 
+    # ::::::: Set Net Weight of each Packing
+    self.update_pack_nett_weight()
+    self.print_packing_slip()
     # ::::::: Set actual qty for each item in selected warehouse :::::::
     self.update_current_stock()
     # :::::: set DN status :::::::
@@ -182,7 +185,6 @@
     if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
     if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
 
-
   # ************** Validate Mandatory *************************
   def validate_mandatory(self):
     # :::::::::: Amendment Date ::::::::::::::
@@ -439,4 +441,41 @@
 
   # Packing Slip Related
   # ==========================================
-  #def get
\ No newline at end of file
+  def update_pack_nett_weight(self):
+      for d in getlist(self.doclist, 'delivery_note_details'):
+        if d.item_name:
+          item_wt = sql("select nett_weight from `tabItem` where item_name = '%s'" % (d.item_name))
+          d.pack_nett_wt = item_wt and flt(item_wt[0][0])*flt(d.qty) or 0
+
+  # ==========================================
+  def print_packing_slip(self):
+    prev_pack='0'
+    sno=0
+    html=''
+    tot_nett_wt,tot_gross_wt=0,0
+    for d in getlist(self.doclist, 'delivery_note_details'):
+      sno=sno+1
+      if sno!=1:#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>'
+      if prev_pack!=d.pack_no: #Prepare Header 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+='<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>'
+        sno=0
+        tot_nett_wt,to_gross_wt=flt(d.pack_nett_wt),flt(d.pack_gross_wt)
+      #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>'
+      prev_pack=d.pack_no
+      tot_nett_wt+=flt(d.pack_nett_wt)
+      tot_gross_wt+=flt(d.pack_gross_wt)
+    html+='</html>'
+    self.doc.print_packing_slip=html
+
+
+
+
+
+
+
+
+
diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt
index 3ec4b38..1ab19e0 100644
--- a/stock/doctype/delivery_note/delivery_note.txt
+++ b/stock/doctype/delivery_note/delivery_note.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2011-04-18 15:58:20',
 		'docstatus': 0,
-		'modified': '2011-08-18 16:31:02',
+		'modified': '2011-08-23 15:26:57',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -21,7 +21,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1313485457',
+		'_last_update': '1313665263',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
 		'document_type': 'Transaction',
@@ -36,12 +36,13 @@
 		'show_in_menu': 0,
 		'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
 		'tag_fields': 'billing_status',
-		'version': 447
+		'version': 449
 	},
 
 	# These values are common for all DocFormat
 	{
 		'doctype': 'DocFormat',
+		'format': 'Delivery Note Packing List Wise',
 		'name': '__common__',
 		'parent': 'Delivery Note',
 		'parentfield': 'formats',
@@ -135,14 +136,12 @@
 	# DocFormat
 	{
 		'doctype': 'DocFormat',
-		'format': 'Delivery Note Format',
 		'idx': 1
 	},
 
 	# DocFormat
 	{
 		'doctype': 'DocFormat',
-		'format': 'Delivery Note Packing List Wise',
 		'idx': 2
 	},
 
@@ -1481,5 +1480,18 @@
 		'options': 'repair_delivery_note',
 		'permlevel': 0,
 		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'print_packing_slip',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'idx': 95,
+		'in_filter': 0,
+		'label': 'Print Packing Slip',
+		'permlevel': 0,
+		'print_hide': 0
 	}
 ]
\ No newline at end of file