From 5cb455ee430831b631f5541d893390b8ef12a1a6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 18 Jan 2016 17:57:45 +0530 Subject: [PATCH] Smallest Currency Fraction value and remainder function --- frappe/geo/doctype/currency/currency.json | 36 +++++++++++++++++-- frappe/public/js/frappe/misc/number_format.js | 7 ++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/frappe/geo/doctype/currency/currency.json b/frappe/geo/doctype/currency/currency.json index 379d07e8db..48dbf6f717 100644 --- a/frappe/geo/doctype/currency/currency.json +++ b/frappe/geo/doctype/currency/currency.json @@ -27,6 +27,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -49,6 +50,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -72,6 +74,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -95,6 +98,32 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "description": "Smallest circulating fraction unit (coin). For e.g. 1 cent for USD and it should be entered as 0.01", + "fieldname": "smallest_currency_fraction_value", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Smallest Currency Fraction Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -118,6 +147,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -142,6 +172,7 @@ "options": "\n#,###.##\n#.###,##\n# ###.##\n# ###,##\n#'###.##\n#, ###.##\n#,##,###.##\n#,###.###\n#.###\n#,###", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -160,7 +191,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:43.978225", + "modified": "2016-01-18 15:36:23.026524", "modified_by": "Administrator", "module": "Geo", "name": "Currency", @@ -248,5 +279,6 @@ } ], "read_only": 0, - "read_only_onload": 0 + "read_only_onload": 0, + "sort_order": "DESC" } \ No newline at end of file diff --git a/frappe/public/js/frappe/misc/number_format.js b/frappe/public/js/frappe/misc/number_format.js index 3d114aab80..1c079afb3b 100644 --- a/frappe/public/js/frappe/misc/number_format.js +++ b/frappe/public/js/frappe/misc/number_format.js @@ -214,3 +214,10 @@ function in_list(list, item) { if(list[i]==item) return true; return false; } + +function remainder(numerator, denominator, precision) { + precision = cint(precision); + var multiplier = Math.pow(10, precision); + var _remainder = ((numerator * multiplier) % (denominator * multiplier)) / multiplier; + return flt(_remainder, precision); +};