From c9fa380195b62b75a9f585848b6efde056043566 Mon Sep 17 00:00:00 2001 From: venkataakhil Date: Sat, 24 Jun 2023 12:00:39 +0530 Subject: [PATCH] Test kilometer mapping --- smart_service/apis/support.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/smart_service/apis/support.py b/smart_service/apis/support.py index 5925e82..5fb7bbe 100644 --- a/smart_service/apis/support.py +++ b/smart_service/apis/support.py @@ -423,4 +423,23 @@ def clear_procedures(): # frappe.db.commit() except Exception as e: return e - + +@frappe.whitelist(allow_guest=1) +def circular_api(): + api = frappe.db.sql( + '''SELECT name,title,status,description,circular_image as FileUrl,valid_till from `tabCircular` WHERE valid_till >='{}' '''.format( + frappe.utils.today()), as_dict=True) + for i in api: + if i["status"] == "Active": + i["status"] = True + else: + i["status"] = False + return api +@frappe.whitelist(allow_guest=1) +def get_kms_mapping(sub_system,variant): + try: + data = frappe.db.sql(f'''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable + FROM `tabKilometer Mapping_Items` where sub_systems="{sub_system}" and parent LIKE "{variant}" order by kilometer_IDX;''') + return data + except Exception as e: + return e \ No newline at end of file