From d8e5bed9e54f5d9f58ad1c77c18a8b8ae2d9bf63 Mon Sep 17 00:00:00 2001 From: Nijil Y Date: Thu, 8 Dec 2011 16:09:18 +0530 Subject: [PATCH] Discount in purchase cycle --- .../accounts/doctype/pv_detail/pv_detail.txt | 49 +++++++---- .../buying/doctype/po_detail/po_detail.txt | 12 +-- .../purchase_common/purchase_common.js | 65 ++++++++++++++- .../purchase_receipt_detail.txt | 83 ++++++++++--------- 4 files changed, 146 insertions(+), 63 deletions(-) mode change 100644 => 100755 erpnext/accounts/doctype/pv_detail/pv_detail.txt mode change 100644 => 100755 erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt diff --git a/erpnext/accounts/doctype/pv_detail/pv_detail.txt b/erpnext/accounts/doctype/pv_detail/pv_detail.txt old mode 100644 new mode 100755 index 1c1c0ae97a..557697f526 --- a/erpnext/accounts/doctype/pv_detail/pv_detail.txt +++ b/erpnext/accounts/doctype/pv_detail/pv_detail.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:17', 'docstatus': 0, - 'modified': '2011-10-20 18:41:17', + 'modified': '2011-12-08 15:58:58', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -14,7 +14,6 @@ { 'autoname': 'EVD.######', 'colour': 'White:FFF', - 'default_print_format': 'Standard', 'doctype': 'DocType', 'istable': 1, 'module': 'Accounts', @@ -22,7 +21,7 @@ 'section_style': 'Tray', 'server_code_error': ' ', 'show_in_menu': 0, - 'version': 27 + 'version': 28 }, # These values are common for all DocField @@ -115,7 +114,7 @@ 'doctype': 'DocField', 'fieldname': 'rate', 'fieldtype': 'Currency', - 'label': 'Rate (Default Curr.)', + 'label': 'Rate *(Default Curr.)', 'oldfieldname': 'rate', 'oldfieldtype': 'Currency', 'permlevel': 0, @@ -129,7 +128,7 @@ 'doctype': 'DocField', 'fieldname': 'import_rate', 'fieldtype': 'Currency', - 'label': 'Rate', + 'label': 'Rate ', 'oldfieldname': 'import_rate', 'oldfieldtype': 'Currency', 'permlevel': 0, @@ -138,6 +137,15 @@ 'trigger': 'Client' }, + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'discount_rate', + 'fieldtype': 'Currency', + 'label': 'Discount %', + 'permlevel': 0 + }, + # DocField { 'doctype': 'DocField', @@ -210,19 +218,6 @@ 'width': '120px' }, - # DocField - { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'project_name', - 'fieldtype': 'Link', - 'in_filter': 1, - 'label': 'Project Name', - 'options': 'Project', - 'permlevel': 0, - 'print_hide': 1 - }, - # DocField { 'doctype': 'DocField', @@ -308,5 +303,23 @@ 'permlevel': 0, 'print_hide': 1, 'report_hide': 1 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'purchase_ref_rate', + 'fieldtype': 'Currency', + 'label': 'Ref Rate *', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'import_ref_rate', + 'fieldtype': 'Currency', + 'label': 'Ref Rate ', + 'permlevel': 0 } ] \ No newline at end of file diff --git a/erpnext/buying/doctype/po_detail/po_detail.txt b/erpnext/buying/doctype/po_detail/po_detail.txt index 1cdc972fe0..ec854c3491 100755 --- a/erpnext/buying/doctype/po_detail/po_detail.txt +++ b/erpnext/buying/doctype/po_detail/po_detail.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:12', 'docstatus': 0, - 'modified': '2011-12-08 14:09:24', + 'modified': '2011-12-08 16:05:27', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -21,7 +21,7 @@ 'section_style': 'Tray', 'server_code_error': ' ', 'show_in_menu': 0, - 'version': 52 + 'version': 54 }, # These values are common for all DocField @@ -108,7 +108,7 @@ 'doctype': 'DocField', 'fieldname': 'purchase_rate', 'fieldtype': 'Currency', - 'label': 'Rate (Default Curr.)', + 'label': 'Rate (Default Curr.) *', 'oldfieldname': 'purchase_rate', 'oldfieldtype': 'Currency', 'permlevel': 0, @@ -123,7 +123,7 @@ 'doctype': 'DocField', 'fieldname': 'purchase_ref_rate', 'fieldtype': 'Currency', - 'label': 'Ref Rate', + 'label': 'Ref Rate *', 'permlevel': 0 }, @@ -172,7 +172,7 @@ 'fieldname': 'import_rate', 'fieldtype': 'Currency', 'hidden': 0, - 'label': 'Rate *', + 'label': 'Rate ', 'oldfieldname': 'import_rate', 'oldfieldtype': 'Currency', 'permlevel': 0, @@ -185,7 +185,7 @@ 'doctype': 'DocField', 'fieldname': 'import_ref_rate', 'fieldtype': 'Currency', - 'label': 'Ref Rate *', + 'label': 'Ref Rate ', 'permlevel': 0 }, diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index f91b1d88c7..029a413ccc 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -125,6 +125,22 @@ cur_frm.cscript.import_rate = function(doc, cdt, cdn) { cur_frm.cscript.calc_amount(doc, 1); } +//==================== Discount Rate ================================================================ +cur_frm.cscript.discount_rate = function(doc, cdt, cdn) { + // Calculate Amount + cur_frm.cscript.calc_amount(doc, 4); +} +//==================== Purchase Ref Rate ================================================================ +cur_frm.cscript.purchase_ref_rate = function(doc, cdt, cdn) { + // Calculate Amount + cur_frm.cscript.calc_amount(doc, 4); +} +//==================== Import Ref Rate ================================================================ +cur_frm.cscript.import_ref_rate = function(doc, cdt, cdn) { + // Calculate Amount + cur_frm.cscript.calc_amount(doc, 5); +} + //====================== Calculate Amount ============================================================ /*cur_frm.cscript.calc_amount = function(doc, n) { @@ -242,19 +258,64 @@ cur_frm.cscript.calc_amount = function(doc, n) { for(var i=0;i