diff --git a/landms/landms/doctype/land_acquisition_plot_type_rate/land_acquisition_plot_type_rate.json b/landms/landms/doctype/land_acquisition_plot_type_rate/land_acquisition_plot_type_rate.json index 5c47656..c8656cf 100644 --- a/landms/landms/doctype/land_acquisition_plot_type_rate/land_acquisition_plot_type_rate.json +++ b/landms/landms/doctype/land_acquisition_plot_type_rate/land_acquisition_plot_type_rate.json @@ -19,6 +19,15 @@ "label": "Selling Price per Sqm", "reqd": 1, "in_list_view": 1 + }, + { + "fieldname": "land_rent_rate", + "fieldtype": "Float", + "label": "Land Rent Rate (TZS/sqm)", + "fetch_from": "plot_type.land_rent_rate", + "fetch_if_empty": 0, + "read_only": 1, + "in_list_view": 1 } ] } diff --git a/landms/landms/doctype/landms_settings/landms_settings.json b/landms/landms/doctype/landms_settings/landms_settings.json index 5f6775b..2ebf32a 100644 --- a/landms/landms/doctype/landms_settings/landms_settings.json +++ b/landms/landms/doctype/landms_settings/landms_settings.json @@ -194,6 +194,37 @@ "default": "7", "description": "Days the paid application reserves the plot before the Sales Order must be created" }, + { + "fieldname": "govt_fees_section", + "fieldtype": "Section Break", + "label": "Government Fees (Informational)" + }, + { + "fieldname": "govt_appl_fee_amount", + "fieldtype": "Float", + "label": "Govt Application Fee (TZS)", + "default": "5000", + "description": "Fixed government application fee (APPL). Not your revenue — shown on plot documents for buyer reference." + }, + { + "fieldname": "govt_registration_fee_amount", + "fieldtype": "Float", + "label": "Govt Registration Fee (TZS)", + "default": "25000", + "description": "Fixed government registration fee (REGISTR). Not your revenue — shown on plot documents for buyer reference." + }, + { + "fieldname": "col_break_govt_fees", + "fieldtype": "Column Break" + }, + { + "fieldname": "govt_premium_rate", + "fieldtype": "Float", + "label": "Govt Premium Rate", + "precision": "4", + "default": "0.0025", + "description": "Premium rate applied to selling price (e.g. 0.0025 = 0.25%). Not your revenue." + }, { "fieldname": "app_fee_accounts_section", "fieldtype": "Section Break", diff --git a/landms/landms/doctype/plot_master/plot_master.json b/landms/landms/doctype/plot_master/plot_master.json index 4ec7989..9cb776b 100644 --- a/landms/landms/doctype/plot_master/plot_master.json +++ b/landms/landms/doctype/plot_master/plot_master.json @@ -184,6 +184,79 @@ "options": "Plot Master", "read_only": 1, "print_hide": 1 + }, + { + "fieldname": "govt_fees_section", + "fieldtype": "Section Break", + "label": "Government Fees (Informational)" + }, + { + "fieldname": "land_rent_rate", + "fieldtype": "Float", + "label": "Land Rent Rate (TZS/sqm)", + "read_only": 1 + }, + { + "fieldname": "land_rent", + "fieldtype": "Currency", + "label": "Land Rent (L/RENT)", + "read_only": 1 + }, + { + "fieldname": "registration_prep_fee", + "fieldtype": "Currency", + "label": "Registration Prep Fee (CT)", + "read_only": 1 + }, + { + "fieldname": "col_break_govt_fees", + "fieldtype": "Column Break" + }, + { + "fieldname": "govt_application_fee", + "fieldtype": "Currency", + "label": "Govt Application Fee (APPL)", + "read_only": 1 + }, + { + "fieldname": "premium", + "fieldtype": "Currency", + "label": "Premium", + "read_only": 1 + }, + { + "fieldname": "govt_registration_fee", + "fieldtype": "Currency", + "label": "Govt Registration Fee (REGISTR)", + "read_only": 1 + }, + { + "fieldname": "stamp_duty", + "fieldtype": "Currency", + "label": "Stamp Duty", + "read_only": 1 + }, + { + "fieldname": "govt_totals_section", + "fieldtype": "Section Break" + }, + { + "fieldname": "total_govt_fees", + "fieldtype": "Currency", + "label": "Total Government Fees", + "read_only": 1, + "bold": 1 + }, + { + "fieldname": "col_break_totals", + "fieldtype": "Column Break" + }, + { + "fieldname": "total_plot_amount", + "fieldtype": "Currency", + "label": "Total Amount (CAPS + Govt Fees)", + "read_only": 1, + "bold": 1 } ], "permissions": [ diff --git a/landms/landms/doctype/plot_master/plot_master.py b/landms/landms/doctype/plot_master/plot_master.py index a9d823d..dd1ba6e 100644 --- a/landms/landms/doctype/plot_master/plot_master.py +++ b/landms/landms/doctype/plot_master/plot_master.py @@ -108,6 +108,32 @@ def fill_financials(self): else: self.selling_price = 0 + self._fill_govt_fees(plot_sqm) + + def _fill_govt_fees(self, plot_sqm): + land_rent_rate = flt(frappe.db.get_value("Plot Type", self.plot_type, "land_rent_rate")) + settings = frappe.get_single("LandMS Settings") + appl = flt(settings.govt_appl_fee_amount) or 5000 + reg_fee = flt(settings.govt_registration_fee_amount) or 25000 + prem_rate = flt(settings.govt_premium_rate) or 0.0025 + + self.land_rent_rate = land_rent_rate + self.land_rent = flt(land_rent_rate * plot_sqm) + self.govt_application_fee = appl + self.premium = flt(prem_rate * flt(self.selling_price)) + self.registration_prep_fee = flt(0.2 * self.land_rent) + self.govt_registration_fee = reg_fee + self.stamp_duty = flt(((self.land_rent - 2000) / 20) + 500) if self.land_rent > 0 else 0 + self.total_govt_fees = flt( + self.govt_application_fee + + self.premium + + self.land_rent + + self.registration_prep_fee + + self.govt_registration_fee + + self.stamp_duty + ) + self.total_plot_amount = flt(self.selling_price) + self.total_govt_fees + def validate_coordinate_pair(self): """Either both lat/lon are set, or both are blank.""" has_lat = self.latitude not in (None, "", 0) diff --git a/landms/landms/doctype/plot_type/plot_type.json b/landms/landms/doctype/plot_type/plot_type.json index 57fa7e1..e20491c 100644 --- a/landms/landms/doctype/plot_type/plot_type.json +++ b/landms/landms/doctype/plot_type/plot_type.json @@ -21,6 +21,13 @@ "reqd": 1, "in_list_view": 1, "description": "ERPNext item used when this plot type enters inventory on Plot Master submit" + }, + { + "fieldname": "land_rent_rate", + "fieldtype": "Float", + "label": "Land Rent Rate (TZS/sqm)", + "in_list_view": 1, + "description": "Government land rent rate per square metre for this plot type. Used to calculate land rent and related fees on the plot." } ], "permissions": [ diff --git a/landms/patches/custom_fields/custom_fields_json/01_sales_order.json b/landms/patches/custom_fields/custom_fields_json/01_sales_order.json index ddd795d..aaa4c87 100644 --- a/landms/patches/custom_fields/custom_fields_json/01_sales_order.json +++ b/landms/patches/custom_fields/custom_fields_json/01_sales_order.json @@ -166,6 +166,14 @@ "depends_on": "eval:doc.plot", "description": "Tick to prevent the bank from accepting payments after the payment deadline date above." }, + { + "doctype": "Custom Field", + "dt": "Sales Order", + "module": "LandMS", + "fieldname": "col_break_tcb_checks", + "fieldtype": "Column Break", + "insert_after": "include_expire_date" + }, { "doctype": "Custom Field", "dt": "Sales Order", @@ -173,7 +181,7 @@ "fieldname": "include_related_ref", "fieldtype": "Check", "label": "Generate Related Reference Number", - "insert_after": "include_expire_date", + "insert_after": "col_break_tcb_checks", "default": "0", "depends_on": "eval:doc.plot", "description": "Tick if a second reference number is needed for this sale."