commit 976ecee926be2075438d983995234063f35cc270 Author: Anoop Date: Fri Oct 21 20:44:28 2022 +0530 Rebranded diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..c2162e3 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,9 @@ +version = 1 + +[[analyzers]] +name = "python" +enabled = true + + [analyzers.meta] + runtime_version = "3.x.x" + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d7c6abc --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +*.pyc +*.egg-info +*.swp +tags +csf_tz/docs/current +node_modules +.vscode/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..11c12ab --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,18 @@ +include MANIFEST.in +include requirements.txt +include *.json +include *.md +include *.py +include *.txt +recursive-include csf_tz *.css +recursive-include csf_tz *.csv +recursive-include csf_tz *.html +recursive-include csf_tz *.ico +recursive-include csf_tz *.js +recursive-include csf_tz *.json +recursive-include csf_tz *.md +recursive-include csf_tz *.png +recursive-include csf_tz *.py +recursive-include csf_tz *.svg +recursive-include csf_tz *.txt +recursive-exclude csf_tz *.pyc \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..674cb8f --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +## CSF TZ + +Country Specific Functionality Tanzania + +It includes modules for: +### Tanzanian Specific Customizations +- The functionality that is related to Tanzania business environment. +- It also allows easy tax compliance and helps to ensure that necessary automation are in place. +- It also has features such as polling sites for Vehicle Fines and Parking Tickets based on Vehicles defined in the system. +- Open Invoice Exchange Rate Revaluation for companies that have lots of open invoices in foreign currency +- Electronic Fiscal Device definition and EFD Z Report reconciliation for statutory compliance +- Special Closing Balance for retro creation of manfucture entries based on new stock taking done +- Piecework based additional salary assignment +- Simple Expense Record registration for Branch managers or non-accountants + +### After Sales Service +- Doctypes for After Sales Service for companies who wish to use it. + +### Clearing and Forwarding +- Tanzanian specific Clearing and Forwarding doctypes. + +### Fleet Management +- Tanzanian specific Fleet Management doctypes. + +### Workshop +- Tanzanian specific company Workshop doctypes. + +### Utilities for productivity +- Set visibility of documennts so that users are only shown specific documents based on access rights set +- Automatic add dependant permissions for a doctype granted access rights +- Enhanced Bank Clearance (to be deprecated once InfluxERP gets these features) +- Enhanced Payment Reconciliation for managing student invoices (to be deprecated once InfluxERP gets these features) + + + +#### License + +GPL diff --git a/csf_tz/__init__.py b/csf_tz/__init__.py new file mode 100644 index 0000000..8966b1c --- /dev/null +++ b/csf_tz/__init__.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +import os +import importlib + +import frappe + +__version__ = "2.1.0" + +patches_loaded = False +app_name = "csf_tz" + + +def load_monkey_patches(): + """ + Loads all modules present in monkey_patches to override some logic + in InfluxERP / InfluxERP. Returns if patches have already been loaded earlier. + """ + global patches_loaded + + if patches_loaded: + return + + patches_loaded = True + + if app_name not in frappe.get_installed_apps(): + return + + for module_name in os.listdir(frappe.get_app_path(app_name, "monkey_patches")): + if not module_name.endswith(".py") or module_name == "__init__.py": + continue + + importlib.import_module(app_name + ".monkey_patches." + module_name[:-3]) + + +old_get_hooks = frappe.get_hooks + + +def get_hooks(*args, **kwargs): + load_monkey_patches() + return old_get_hooks(*args, **kwargs) + + +frappe.get_hooks = get_hooks + +old_connect = frappe.connect + + +def connect(*args, **kwargs): + """ + Patches frappe.connect to load monkey patches once a connection is + established with the database. + """ + + old_connect(*args, **kwargs) + load_monkey_patches() + + +frappe.connect = connect + + +def console(*data): + frappe.publish_realtime("out_to_console", data, user=frappe.session.user) diff --git a/csf_tz/after_sales_services/__init__.py b/csf_tz/after_sales_services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/__init__.py b/csf_tz/after_sales_services/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request/__init__.py b/csf_tz/after_sales_services/doctype/machine_strip_request/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.js b/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.js new file mode 100644 index 0000000..443ba80 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.js @@ -0,0 +1,40 @@ +// Copyright (c) 2020, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Machine Strip Request', { + refresh: function(frm) { + frm.set_query("stripped_serial_no", function(doc){ + return{ + "filters": { + "item_code": doc.stripped_item_code, + "delivery_document_type": '' + } + } + }) + + frm.set_query("target_serial_no", function(doc){ + return{ + "filters": { + "item_code": doc.target_item_code, + "delivery_document_type": '' + } + } + }) + + //Make job card button + if (frm.doc.docstatus == 1){ + frm.add_custom_button(__('Make Job Card'), + function() { + frm.events.make_job_card(); + } + ); + } + }, + + make_job_card: function() { + frappe.model.open_mapped_doc({ + method: "erpnext.after_sales_services.doctype.machine_strip_request.machine_strip_request.make_job_card", + frm: cur_frm + }) + } +}); diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.json b/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.json new file mode 100644 index 0000000..e29bcba --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.json @@ -0,0 +1,345 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "MSREQ.###", + "beta": 0, + "creation": "2020-03-26 16:21:57.534696", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stripped_item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Stripped Machine Item Code", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stripped_serial_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Stripped Machine Serial No", + "length": 0, + "no_copy": 0, + "options": "Serial No", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "target_item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Target Machine Item Code", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "target_serial_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Target Machine Serial No", + "length": 0, + "no_copy": 0, + "options": "Serial No", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stripping_reason", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Stripping Reason", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_items", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Items to be Stripped", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stripped_items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Stripped Items", + "length": 0, + "no_copy": 0, + "options": "Machine Strip Request Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Machine Strip Request", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2020-03-26 20:00:57.771866", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Machine Strip Request", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.py b/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.py new file mode 100644 index 0000000..726ff48 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request/machine_strip_request.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe.model.mapper import get_mapped_doc +from frappe import _ + +class MachineStripRequest(Document): + pass + + + +@frappe.whitelist() +def make_job_card(source_name, target_doc=None, ignore_permissions=False): + def postprocess(source, doc): + doc.job_type = "Machine Parts Strip" + doc.append('items', { + "item_code": source.stripped_item_code, + "requested_for": 'Serial No', + "serial_number": source.stripped_serial_no + }) + doc.append('items', { + "item_code": source.target_item_code, + "requested_for": 'Serial No', + "serial_number": source.target_serial_no + }) + description = 'Parts strip job from {} {} to {} {} for items: \n'.format(source.stripped_item_code, source.stripped_serial_no, source.target_item_code, source.target_serial_no) + for item in source.stripped_items: + description += '{} {} {} \n'.format(item.item, item.qty, item.uom) + doc.job_description = description + + docs = get_mapped_doc("Machine Strip Request", source_name, { + "Machine Strip Request": { + "doctype": "Job Card", + "field_map": { + "name": "machine_strip_request" + }, + } + }, target_doc, postprocess, ignore_permissions=ignore_permissions) + return docs diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request/test_machine_strip_request.js b/csf_tz/after_sales_services/doctype/machine_strip_request/test_machine_strip_request.js new file mode 100644 index 0000000..f7a9c0c --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request/test_machine_strip_request.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Machine Strip Request", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Machine Strip Request + () => frappe.tests.make('Machine Strip Request', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request/test_machine_strip_request.py b/csf_tz/after_sales_services/doctype/machine_strip_request/test_machine_strip_request.py new file mode 100644 index 0000000..e46b83a --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request/test_machine_strip_request.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestMachineStripRequest(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request_item/__init__.py b/csf_tz/after_sales_services/doctype/machine_strip_request_item/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request_item/machine_strip_request_item.json b/csf_tz/after_sales_services/doctype/machine_strip_request_item/machine_strip_request_item.json new file mode 100644 index 0000000..4c4c583 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request_item/machine_strip_request_item.json @@ -0,0 +1,168 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2020-03-26 17:19:39.031613", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item Name", + "length": 0, + "no_copy": 0, + "options": "item.item_name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "uom", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "UOM", + "length": 0, + "no_copy": 0, + "options": "item.stock_uom", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2020-03-26 17:19:39.031613", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Machine Strip Request Item", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/machine_strip_request_item/machine_strip_request_item.py b/csf_tz/after_sales_services/doctype/machine_strip_request_item/machine_strip_request_item.py new file mode 100644 index 0000000..82fbcd5 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/machine_strip_request_item/machine_strip_request_item.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class MachineStripRequestItem(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/maintenance_schedule/__init__.py b/csf_tz/after_sales_services/doctype/maintenance_schedule/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.js b/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.js new file mode 100644 index 0000000..c7ad6ea --- /dev/null +++ b/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Maintenance Schedule', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.json b/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.json new file mode 100644 index 0000000..c4131b9 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.json @@ -0,0 +1,826 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2013-01-10 16:34:30", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 0, + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-user", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 1, + "options": "MS", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 1, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Customer", + "length": 0, + "no_copy": 0, + "oldfieldname": "customer", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Status", + "length": 0, + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nCancelled", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transaction_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transaction Date", + "length": 0, + "no_copy": 0, + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "items_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-shopping-cart", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Items", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_maintenance_detail", + "oldfieldtype": "Table", + "options": "Maintenance Schedule Item", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "schedule", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Schedule", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-time", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "generate_schedule", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Generate Schedule", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Button", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "schedules", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Schedules", + "length": 0, + "no_copy": 0, + "oldfieldname": "schedules", + "oldfieldtype": "Table", + "options": "Maintenance Schedule Detail", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "contact_info", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Contact Info", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Customer Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "customer_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "fieldname": "contact_person", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Contact Person", + "length": 0, + "no_copy": 0, + "options": "Contact", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "fieldname": "contact_mobile", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Mobile No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "fieldname": "contact_email", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Contact Email", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Contact", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_17", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "fieldname": "customer_address", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Address", + "length": 0, + "no_copy": 0, + "options": "Address", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Address", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "description": "", + "fieldname": "territory", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Territory", + "length": 0, + "no_copy": 0, + "oldfieldname": "territory", + "oldfieldtype": "Link", + "options": "Territory", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "customer", + "description": "", + "fieldname": "customer_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Group", + "length": 0, + "no_copy": 0, + "options": "Customer Group", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 1, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Maintenance Schedule", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "fa fa-calendar", + "idx": 1, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-27 14:59:15.629203", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Maintenance Schedule", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "status,customer,customer_name", + "show_name_in_global_search": 0, + "sort_order": "DESC", + "timeline_field": "customer", + "track_changes": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.py b/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.py new file mode 100644 index 0000000..d750fd4 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/maintenance_schedule/maintenance_schedule.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class MaintenanceSchedule(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/maintenance_schedule/test_maintenance_schedule.js b/csf_tz/after_sales_services/doctype/maintenance_schedule/test_maintenance_schedule.js new file mode 100644 index 0000000..e0f05b1 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/maintenance_schedule/test_maintenance_schedule.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Maintenance Schedule", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Maintenance Schedule + () => frappe.tests.make('Maintenance Schedule', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/maintenance_schedule/test_maintenance_schedule.py b/csf_tz/after_sales_services/doctype/maintenance_schedule/test_maintenance_schedule.py new file mode 100644 index 0000000..b658ded --- /dev/null +++ b/csf_tz/after_sales_services/doctype/maintenance_schedule/test_maintenance_schedule.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestMaintenanceSchedule(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/# installation_note_dashboard.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/# installation_note_dashboard.py new file mode 100644 index 0000000..ea482cd --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/# installation_note_dashboard.py @@ -0,0 +1,32 @@ +# installation_note_dashboard.py +from frappe import _ + +def get_data(): + return { + 'fieldname': 'installation_note_dashboard', + 'non_standard_fieldnames': { + 'Delivery Note': 'against_sales_invoice', + 'Journal Entry': 'reference_name', + 'Payment Entry': 'reference_name', + 'Payment Request': 'reference_name', + 'Auto Repeat': 'reference_document', + }, + 'internal_links': { + 'Sales Invoice': ['readings', 'sales_invoice'], + 'Sales Order': ['items', 'sales_order'] + }, + 'transactions': [ + { + 'label': _('Reference'), + 'items': ['Sales Invoice', 'Delivery Note', 'Sales Order'] + }, + { + 'label': _('Payment'), + 'items': ['Payment Entry', 'Payment Request', 'Journal Entry'] + }, + { + 'label': _('Subscription'), + 'items': ['Auto Repeat'] + }, + ] + } diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/__init__.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.js new file mode 100644 index 0000000..caef390 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.js @@ -0,0 +1,81 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +var data = sessionStorage.getItem("item_code_stored_predelivery"); +var data2 = sessionStorage.getItem("serial_stored_predelivery"); + + +frappe.ui.form.on('Pre Delivery Inspection', { + refresh: function(frm) { + //console.log(cur_frm) + //console.log(data); + if (!frm.doc.item_code) { + frm.set_value("item_code", data); + } + if (!frm.doc.item_serial_no) { + frm.set_value("item_serial_no", data2); + } + /*frm.set_value("quality_inspection_template", data); + frappe.after_ajax(function(){ + frm.events.quality_inspection_template(frm); + });*/ + + frm.events.load_delivery_note(frm); + + }, + + item_code: function(frm) { + if (frm.doc.item_code && frm.doc.item_code != '') { + frappe.model.with_doc("Sales Invoice", frm.doc.sales_invoice_ref, function(){ + var ref_doc = frappe.get_doc("Sales Invoice", frm.doc.sales_invoice_ref); + //console.log(ref_doc); + + if (ref_doc.items && ref_doc.items.length > 0) { + ref_doc.items.forEach(function(row){ + + if(row.item_code == data){ + frm.doc.item_name = row.item_name; + frm.doc.description = row.description; + frm.doc.batch_no = row.batch_no; + frm.set_value("quality_inspection_template", row.item_code); + //frm.doc.quality_inspection_template = row.item_code; + } + + }) + } + + }); + } + + frappe.after_ajax(function(){ + frm.refresh_field("item_name") + frm.refresh_field("description") + frm.refresh_field("batch_no") + frm.events.quality_inspection_template(frm); + }) + }, + + quality_inspection_template: function(frm){ + if(frm.doc.quality_inspection_template){ + frappe.model.with_doc("Pre Delivery Inspection Template", frm.doc.quality_inspection_template, function(){ + var ref_doc = frappe.get_doc("Pre Delivery Inspection Template", frm.doc.quality_inspection_template); + if(ref_doc && ref_doc.item_quality_inspection_parameter){ + frm.clear_table("readings"); + ref_doc.item_quality_inspection_parameter.forEach(function(row){ + var new_row = frm.add_child("readings"); + new_row.specification = row.specification; + }) + } + }); + frappe.after_ajax(function(){ + frm.refresh_field('readings'); + }) + } + }, + + load_delivery_note: function(frm){ + if(frm.fields_dict['dashboard_links_html'] && "dashboard_links_html" in frm.doc.__onload) { + frm.fields_dict['dashboard_links_html'].wrapper.innerHTML = frm.doc.__onload.dashboard_links_html.display; + } + }, +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.json b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.json new file mode 100644 index 0000000..5984ae8 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.json @@ -0,0 +1,1065 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2018-07-25 18:42:38.717224", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_dashboard", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dashboard", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "dashboard_links_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dashboard Links", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_2", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 1, + "options": "PDI-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 1, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Today", + "fieldname": "report_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Report Date", + "length": 0, + "no_copy": 0, + "oldfieldname": "report_date", + "oldfieldtype": "Date", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "inspection_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Inspection Type", + "length": 0, + "no_copy": 0, + "oldfieldname": "inspection_type", + "oldfieldtype": "Select", + "options": "\nIncoming\nOutgoing\nIn Process", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Type", + "length": 0, + "no_copy": 0, + "options": "\nPurchase Receipt\nPurchase Invoice\nDelivery Note\nSales Invoice\nStock Entry", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "reference_name", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Reference Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "purchase_receipt_no", + "oldfieldtype": "Link", + "options": "reference_type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_code", + "oldfieldtype": "Link", + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_serial_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Serial No", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_serial_no", + "oldfieldtype": "Link", + "options": "Serial No", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "batch_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Batch No", + "length": 0, + "no_copy": 0, + "oldfieldname": "batch_no", + "oldfieldtype": "Link", + "options": "Batch", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sample_size", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sample Size", + "length": 0, + "no_copy": 0, + "oldfieldname": "sample_size", + "oldfieldtype": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "50%" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "300px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "specification_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "Simple", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quality_inspection_template", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quality Inspection Template", + "length": 0, + "no_copy": 0, + "options": "Pre Delivery Inspection Template", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "readings", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Readings", + "length": 0, + "no_copy": 0, + "oldfieldname": "qa_specification_details", + "oldfieldtype": "Table", + "options": "Pre Delivery Inspection Reading", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_14", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "user", + "fieldname": "inspected_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspected By", + "length": 0, + "no_copy": 0, + "oldfieldname": "inspected_by", + "oldfieldtype": "Data", + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "verified_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verified By", + "length": 0, + "no_copy": 0, + "oldfieldname": "verified_by", + "oldfieldtype": "Data", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bom_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BOM No", + "length": 0, + "no_copy": 0, + "options": "BOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_17", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "remarks", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Remarks", + "length": 0, + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "Text", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Pre Delivery Inspection", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_invoice", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Invoice", + "length": 0, + "no_copy": 0, + "options": "Sales Invoice", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_order", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Order", + "length": 0, + "no_copy": 0, + "options": "Sales Order", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "installation_note", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Installation Note", + "length": 0, + "no_copy": 0, + "options": "Installation Note", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "fa fa-search", + "idx": 0, + "image_view": 0, + "in_create": 1, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-02-28 18:47:29.104428", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Quality Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "item_code, report_date, reference_name", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "ASC", + "track_changes": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.py new file mode 100644 index 0000000..b043860 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _, msgprint, throw +import json + +class PreDeliveryInspection(Document): + def onload(self): + """ Load delivery Note link """ + dashboard_links_html = self.load_delivery_note() + self.set_onload("dashboard_links_html", {"display": dashboard_links_html}) + + def load_delivery_note(self): + delivery_note_links = [] + delivery_note_links = frappe.db.sql(""" + SELECT + tdni.item_code, + tdni.parent, + tdni.serial_no, + tdni.against_sales_invoice, + tip.name As installation + FROM + (`tabDelivery Note Item` tdni) + LEFT JOIN + (`tabInstallation Note` tip) + ON tdni.parent = tip.delivery_note + where + tdni.against_sales_invoice = %(inv)s + AND + tdni.item_code = %(item)s + AND + tdni.serial_no = %(serial)s + """,{'inv':self.reference_name, 'item':self.item_code, 'serial':self.item_serial_no}, as_dict=True) + self.set_onload("delivery_note_links", delivery_note_links) + #frappe.msgprint(_(json.dumps(delivery_note_links))) + + return frappe.render_template("templates/pre_delivery_links.html", {"delivery_note_links": delivery_note_links}) diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection_dashboard.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection_dashboard.py new file mode 100644 index 0000000..9189955 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/pre_delivery_inspection_dashboard.py @@ -0,0 +1,12 @@ +# from frappe import _ + +# def get_data(): +# return { +# 'fieldname': 'pre_delivery_inspection', +# 'transactions': [ +# { +# 'label': _('Delivery and Installation'), +# 'items': ['Delivery Note', 'Installation Note'] +# }, +# ] +# } diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/test_pre_delivery_inspection.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/test_pre_delivery_inspection.js new file mode 100644 index 0000000..922b59d --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/test_pre_delivery_inspection.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Pre-delivery Inspection", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Pre-delivery Inspection + () => frappe.tests.make('Pre-delivery Inspection', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection/test_pre_delivery_inspection.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/test_pre_delivery_inspection.py new file mode 100644 index 0000000..99b614f --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection/test_pre_delivery_inspection.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPredeliveryInspection(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/__init__.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.js new file mode 100644 index 0000000..92dcab4 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Pre Delivery Inspection - old', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.json b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.json new file mode 100644 index 0000000..38f99e1 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.json @@ -0,0 +1,435 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "PDI.####", + "beta": 0, + "creation": "2018-07-09 05:25:54.165592", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "verified_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verified By", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "remarks", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Overall Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "inspection_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspection Details", + "length": 0, + "no_copy": 0, + "options": "Pre Delivery Inspection Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_remarks", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "heading_customer_signature", + "fieldtype": "Heading", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Signature", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Customer Signature", + "description": "Customer Signature", + "fieldname": "customer_signature", + "fieldtype": "Signature", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Signature", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Pre Delivery Inspection - old", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-07-25 18:38:22.390447", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection - old", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.py new file mode 100644 index 0000000..b7f19d7 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/pre_delivery_inspection___old.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PreDeliveryInspectionOld(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/test_pre_delivery_inspection___old.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/test_pre_delivery_inspection___old.js new file mode 100644 index 0000000..0b17f76 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/test_pre_delivery_inspection___old.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Pre Delivery Inspection - old", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Pre Delivery Inspection - old + () => frappe.tests.make('Pre Delivery Inspection - old', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/test_pre_delivery_inspection___old.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/test_pre_delivery_inspection___old.py new file mode 100644 index 0000000..9584644 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection___old/test_pre_delivery_inspection___old.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPreDeliveryInspectionOld(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/__init__.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/pre_delivery_inspection_details.json b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/pre_delivery_inspection_details.json new file mode 100644 index 0000000..c1eae3c --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/pre_delivery_inspection_details.json @@ -0,0 +1,199 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-07-09 17:56:13.244299", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "serial_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Serial Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "checked_parameter", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Checked Parameter", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_invoice", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Invoice", + "length": 0, + "no_copy": 0, + "options": "Sales Invoice", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_order", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Order", + "length": 0, + "no_copy": 0, + "options": "Sales Order", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-07-26 10:30:02.581501", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/pre_delivery_inspection_details.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/pre_delivery_inspection_details.py new file mode 100644 index 0000000..06c97d1 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_details/pre_delivery_inspection_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PreDeliveryInspectionDetails(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/__init__.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.js new file mode 100644 index 0000000..db333e9 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Pre Delivery Inspection Old', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.json b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.json new file mode 100644 index 0000000..13210df --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.json @@ -0,0 +1,435 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "PDI.####", + "beta": 0, + "creation": "2018-07-09 05:25:54.165592", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "verified_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verified By", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "remarks", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Overall Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "inspection_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspection Details", + "length": 0, + "no_copy": 0, + "options": "Pre Delivery Inspection Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_remarks", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "heading_customer_signature", + "fieldtype": "Heading", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Signature", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Customer Signature", + "description": "Customer Signature", + "fieldname": "customer_signature", + "fieldtype": "Signature", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Signature", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Pre Delivery Inspection Old", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-07-25 18:39:13.934350", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection Old", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.py new file mode 100644 index 0000000..b7f19d7 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/pre_delivery_inspection_old.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PreDeliveryInspectionOld(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/test_pre_delivery_inspection_old.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/test_pre_delivery_inspection_old.js new file mode 100644 index 0000000..d84045b --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/test_pre_delivery_inspection_old.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Pre Delivery Inspection Old", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Pre Delivery Inspection Old + () => frappe.tests.make('Pre Delivery Inspection Old', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/test_pre_delivery_inspection_old.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/test_pre_delivery_inspection_old.py new file mode 100644 index 0000000..9584644 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_old/test_pre_delivery_inspection_old.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPreDeliveryInspectionOld(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/__init__.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/pre_delivery_inspection_reading.json b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/pre_delivery_inspection_reading.json new file mode 100644 index 0000000..69ad13c --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/pre_delivery_inspection_reading.json @@ -0,0 +1,270 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "hash", + "beta": 0, + "creation": "2018-07-25 18:45:21.438389", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "specification", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Parameter", + "length": 0, + "no_copy": 0, + "oldfieldname": "specification", + "oldfieldtype": "Data", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "value", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Acceptance Criteria", + "length": 0, + "no_copy": 0, + "oldfieldname": "value", + "oldfieldtype": "Data", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Accepted", + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "Accepted\nRejected", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_invoice", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Invoice", + "length": 0, + "no_copy": 0, + "options": "Sales Invoice", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_order", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Order", + "length": 0, + "no_copy": 0, + "options": "Sales Order", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_invoice_item", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Invoice Item", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_order_item", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Order Item", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-07-26 16:42:28.475938", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection Reading", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/pre_delivery_inspection_reading.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/pre_delivery_inspection_reading.py new file mode 100644 index 0000000..b300b37 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_reading/pre_delivery_inspection_reading.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PreDeliveryInspectionReading(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/__init__.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.js new file mode 100644 index 0000000..72c2e41 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Pre Delivery Inspection Template', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.json b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.json new file mode 100644 index 0000000..4efc8ce --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.json @@ -0,0 +1,182 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:quality_inspection_template_name", + "beta": 0, + "creation": "2018-07-25 18:44:06.024204", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quality_inspection_template_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quality Inspection Template Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_quality_inspection_parameter", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Quality Inspection Parameter", + "length": 0, + "no_copy": 0, + "options": "Item Quality Inspection Parameter", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-07-25 18:50:06.701732", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection Template", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Quality Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.py new file mode 100644 index 0000000..436c21e --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/pre_delivery_inspection_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PreDeliveryInspectionTemplate(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/test_pre_delivery_inspection_template.js b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/test_pre_delivery_inspection_template.js new file mode 100644 index 0000000..ca63cc6 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/test_pre_delivery_inspection_template.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Pre Delivery Inspection Template", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Pre Delivery Inspection Template + () => frappe.tests.make('Pre Delivery Inspection Template', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/test_pre_delivery_inspection_template.py b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/test_pre_delivery_inspection_template.py new file mode 100644 index 0000000..4099ebd --- /dev/null +++ b/csf_tz/after_sales_services/doctype/pre_delivery_inspection_template/test_pre_delivery_inspection_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPreDeliveryInspectionTemplate(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/reference_payment_table/__init__.py b/csf_tz/after_sales_services/doctype/reference_payment_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/reference_payment_table/reference_payment_table.json b/csf_tz/after_sales_services/doctype/reference_payment_table/reference_payment_table.json new file mode 100644 index 0000000..efcea98 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/reference_payment_table/reference_payment_table.json @@ -0,0 +1,317 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-25 14:10:41.177611", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Pastel", + "fieldname": "accounting_system", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounting System", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date_of_payment", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date of Payment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reference Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "paid_to", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Paid To", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payment_method", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Payment Method", + "length": 0, + "no_copy": 0, + "options": "\nCash\nCheque\nBank Transfer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payment_account", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Payment Account", + "length": 0, + "no_copy": 0, + "options": "\nCRDB\nBank M\nStanbic Bank\nEco Bank\nPetty Cash Fund\nM-Pesa\nInter Africa\nYash International (Fuel Account)\nMount Meru (Fuel Account)\nPetcom (Fuel Account)\nVital Oil (Fuel Account)", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "new", + "fieldname": "status", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-07-14 10:59:00.661721", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Reference Payment Table", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/reference_payment_table/reference_payment_table.py b/csf_tz/after_sales_services/doctype/reference_payment_table/reference_payment_table.py new file mode 100644 index 0000000..34d176e --- /dev/null +++ b/csf_tz/after_sales_services/doctype/reference_payment_table/reference_payment_table.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ReferencePaymentTable(Document): + pass + + +def update_child_table(self, fieldname, df=None): + '''Updated function to prevent saving of approved or rejected funds request''' + '''sync child table for given fieldname''' + rows = [] + if not df: + df = self.meta.get_field(fieldname) + + for d in self.get(df.fieldname): + if df.fieldname in ["requested_funds", "main_requested_funds", "return_requested_funds"]: + if d.get("request_status") not in ["Approved", "Rejected"]: + d.db_update() + else: + d.db_update() + rows.append(d.name) + + if df.options in (self.flags.ignore_children_type or []): + # do not delete rows for this because of flags + # hack for docperm :( + return + + if rows: + # select rows that do not match the ones in the document + deleted_rows = frappe.db.sql("""select name from `tab{0}` where parent=%s + and parenttype=%s and parentfield=%s + and name not in ({1})""".format(df.options, ','.join(['%s'] * len(rows))), + [self.name, self.doctype, fieldname] + rows) + if len(deleted_rows) > 0: + # delete rows that do not match the ones in the document + frappe.db.sql("""delete from `tab{0}` where name in ({1})""".format(df.options, + ','.join(['%s'] * len(deleted_rows))), tuple(row[0] for row in deleted_rows)) + + else: + # no rows found, delete all rows + frappe.db.sql("""delete from `tab{0}` where parent=%s + and parenttype=%s and parentfield=%s""".format(df.options), + (self.name, self.doctype, fieldname)) diff --git a/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/__init__.py b/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/requested_funds_accounts_table.json b/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/requested_funds_accounts_table.json new file mode 100644 index 0000000..07fd4c2 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/requested_funds_accounts_table.json @@ -0,0 +1,1289 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-09-29 04:20:52.990609", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required On Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expense Type", + "length": 0, + "no_copy": 0, + "options": "Expense Claim Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "party_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Party Type", + "length": 0, + "no_copy": 0, + "options": "Employee\nSupplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "party", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Party", + "length": 0, + "no_copy": 0, + "options": "party_type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "invoice_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quote_attachment", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quatation/Invoice", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_account_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expense Account Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Exchange Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "9", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "status_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "posting_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Posting Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expense Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payable_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Payable Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payee", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payee", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "comment", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_25", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_for", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested on Behalf of", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_hidden_status", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "payable_account_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payable Account Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cost_center", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cost Center", + "length": 0, + "no_copy": 0, + "options": "Cost Center", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "open", + "fieldname": "request_status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_10", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested By", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_15", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommended_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommended By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommended_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommended On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommender_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommender Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_16", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approver_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approver Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_37", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approved_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approved By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approved_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approved On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approver_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approver Comment", + "length": 0, + "no_copy": 0, + "permlevel": 4, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-18 19:21:41.613214", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Requested Funds Accounts Table", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/requested_funds_accounts_table.py b/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/requested_funds_accounts_table.py new file mode 100644 index 0000000..79aa8cd --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_funds_accounts_table/requested_funds_accounts_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class RequestedFundsAccountsTable(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/requested_funds_details/__init__.py b/csf_tz/after_sales_services/doctype/requested_funds_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/requested_funds_details/requested_funds_details.json b/csf_tz/after_sales_services/doctype/requested_funds_details/requested_funds_details.json new file mode 100644 index 0000000..8868fb8 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_funds_details/requested_funds_details.json @@ -0,0 +1,1257 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "RFD.####", + "beta": 0, + "creation": "2017-02-06 13:50:49.087123", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Required On Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expense Type", + "length": 0, + "no_copy": 0, + "options": "Expense Claim Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "party_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Party Type", + "length": 0, + "no_copy": 0, + "options": "Employee\nSupplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "party", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Party", + "length": 0, + "no_copy": 0, + "options": "party_type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "invoice_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quote_attachment", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quatation/Invoice", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_account_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expense Account Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Exchange Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "9", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_10", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested By", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_15", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommended_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommended By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommended_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommended On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommender_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommender Comment", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_16", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approver_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approver Comment", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_24", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approved_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approved By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approved_on", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approved On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approver_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approver Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "status_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "posting_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Posting Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expense Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payable_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payable Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payee", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payee", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "comment", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_25", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_for", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested on Behalf of", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_hidden_status", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payable_account_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payable Account Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cost_center", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cost Center", + "length": 0, + "no_copy": 0, + "options": "Cost Center", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "open", + "fieldname": "request_status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-29 11:14:58.502503", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Requested Funds Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/requested_funds_details/requested_funds_details.py b/csf_tz/after_sales_services/doctype/requested_funds_details/requested_funds_details.py new file mode 100644 index 0000000..3690254 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_funds_details/requested_funds_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class RequestedFundsDetails(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/requested_payments/__init__.py b/csf_tz/after_sales_services/doctype/requested_payments/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.js b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.js new file mode 100644 index 0000000..6410f16 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.js @@ -0,0 +1,611 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +// +frappe.ui.form.on('Requested Payments', { + onload: function(frm){ + //Load the approve and reject buttons + var html = ' '; + html += '' + $(frm.fields_dict.html1.wrapper).html(html); + + //Load the recommend and recommend against buttons + var html2 = ' '; + html2 += '' + $(frm.fields_dict.html2.wrapper).html(html2); + + //Load the accounts approval buttons + var html3 = ' '; + html3 += '' + $(frm.fields_dict.account_approval_buttons.wrapper).html(html3); + + //cur_frm.disable_save(); + frappe.after_ajax(function(){ + frm.events.show_hide_sections(frm); + }); + }, + + refresh: function(frm){ + console.log(frm); + + //Beautify the previous approved table + $(frm.wrapper).on("grid-row-render", function(e, grid_row) { + if(grid_row.doc.request_status == "Approved") + { + $(grid_row.columns.request_status).css({"font-weight": "bold", "color": "green"}); + } + else if(grid_row.doc.request_status == "Rejected") + { + $(grid_row.columns.request_status).css({"font-weight": "bold", "color": "red"}); + } + }); + + frappe.after_ajax(function(){ + frm.events.show_hide_sections(frm); + }); + + //For total requested + var total_request_tsh = 0; + var total_request_usd = 0; + var all_approved = true; + cur_frm.doc.requested_funds.forEach(function(row){ + if(row.request_currency == 'TZS') + { + total_request_tsh += row.request_amount; + } + else if(row.request_currency == 'USD') + { + total_request_usd += row.request_amount; + } + }); + + //If all requests have been processed, change approval status + if(total_request_tsh == 0 && total_request_usd == 0 && frm.doc.approval_status != "Processed") + { + frm.set_value('approval_status', 'Processed'); + frm.save_or_update(); + } + + cur_frm.get_field("request_total_amount").wrapper.innerHTML = '

Total Amount Approved

USD ' + total_request_usd.toLocaleString() + '
TZS ' + total_request_tsh.toLocaleString() + '
'; + + + //For total approved + var total_approved_tsh = 0; + var total_approved_usd = 0; + /*cur_frm.doc.previous_requested_funds.forEach(function(row){ + if(row.request_status == "Approved" && row.request_currency == 'TZS') + { + total_approved_tsh += row.request_amount; + } + else if(row.request_status == "Approved" && row.request_currency == 'USD') + { + total_approved_usd += row.request_amount; + } + }); + + cur_frm.get_field("total_approved_amount").wrapper.innerHTML = '

Total Amount Approved

USD ' + total_approved_usd.toLocaleString() + '
TZS ' + total_approved_tsh.toLocaleString() + '
'; */ + + //For total paid amount + var total_tsh = 0; + var total_usd = 0; + frm.doc.payments_reference.forEach(function(row){ + if(row.currency == "TZS") + { + total_tsh += row.amount; + } + else if(row.currency == 'USD') + { + total_usd += row.amount; + } + }); + + //For payment status (If all payments have been paid, payment status == 'Paid') + if(total_usd > 0 && total_tsh > 0 && total_usd >= total_approved_usd && total_tsh >= total_approved_tsh && frm.doc.payment_status != "Paid") + { + frm.set_value('payment_status', "Paid"); + frm.save_or_update(); + } + else if((total_approved_tsh > total_tsh || total_approved_usd > total_usd) && frm.doc.payment_status != "Waiting Payment") + { + frm.set_value('payment_status', 'Waiting Payment'); + frm.save_or_update(); + } + + cur_frm.get_field("total_paid_amount").wrapper.innerHTML = '

Total Amount Paid

USD ' + total_usd.toLocaleString() + '
TZS ' + total_tsh.toLocaleString() + '
'; + + //Make payment button + frm.add_custom_button(__('Make Payment'), + function() { + frm.events.make_payment(); + } + ); + + frm.add_custom_button(__('Accounting Ledger'), function() { + frappe.route_options = { + voucher_no: frm.doc.name, + company: frm.doc.company, + group_by_voucher: false + }; + frappe.set_route("query-report", "General Ledger"); + }, __("View")); + }, + + make_payment: function() { + frappe.model.open_mapped_doc({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.make_payment", + frm: cur_frm + }) + }, + + validate_payment: function(frm){ + var to_return = true; + frm.doc.payments_reference.forEach(function(row){ + if(row.amount <= 0 || !row.date_of_payment || row.date_of_payment == "" || !row.reference_no || row.reference_no == "" || !row.paid_to || row.paid_to == "" || row.payment_method == "" || row.payment_account == "") + { + to_return = false; + } + }); + return to_return; + }, + + show_hide_sections: function(frm){ + frm.toggle_display(['request_total_amount', 'html1', 'html2'], (frm.doc.requested_funds.length > 0)); + //frm.toggle_display('section_previous_requested_funds', (frm.doc.previous_requested_funds.length > 0)); + //frm.toggle_display('section_payments_details', frm.doc.previous_requested_funds.length > 0); + //frm.toggle_display('total_paid_amount', (frm.doc.previous_requested_funds.length > 0)); + //frm.toggle_display(['requested_funds', 'request_total_amount', 'section_previous_requested_funds', 'total_approved_amount', 'payments_reference', 'total_paid_amount'], true); + }, + + get_account_currency(frm, cdt, cdn, account){ + if(account){ + frappe.call({ + 'method': 'frappe.client.get_value', + 'args': { + 'doctype': 'Account', + 'filters': { + 'name': account + }, + 'fieldname':'account_currency' + }, + 'callback': function(res){ + return res.message.account_currency; + } + }); + } + } +}); + + +frappe.ui.form.on('Requested Funds Accounts Table', { + form_render: function(frm, cdt, cdn){ + frappe.call({ + 'method': 'frappe.client.get_value', + 'args': { + 'doctype': 'Company', + 'filters': { + name: frm.doc.company + }, + 'fieldname':'cost_center' + }, + 'callback': function(r){ + frappe.model.set_value(cdt, cdn, 'cost_center', r.message.cost_center); + } + }); + + if(!locals[cdt][cdn].posting_date){ + frappe.model.set_value(cdt, cdn, 'posting_date', frappe.datetime.get_today()); + } + + if(locals[cdt][cdn].conversion_rate == 0){ + frappe.model.set_value(cdt, cdn, 'conversion_rate', 1); + } + }, + + expense_type: function(frm, cdt, cdn){ + frappe.call({ + method: "erpnext.hr.doctype.expense_claim.expense_claim.get_expense_claim_account", + args: { + "expense_claim_type": locals[cdt][cdn].expense_type, + "company": frm.doc.company + }, + callback: function(r) { + if (r.message) { + locals[cdt][cdn].expense_account = r.message.account; + if(r.message.account){ + frappe.model.set_value(cdt, cdn, 'expense_account_currency', frm.events.get_account_currency(frm, cdt, cdn, r.message.account)); + } + } + } + }); + }, + + expense_account: function(frm, cdt, cdn){ + if(locals[cdt][cdn].expense_account){ + var expense_account_currency = frm.events.get_account_currency(frm, cdt, cdn, locals[cdt][cdn].expense_account); + if(expense_account_currency){ + frappe.model.set_value(cdt, cdn, 'expense_account_currency', expense_account_currency); + } + } + }, + + payable_account: function(frm, cdt, cdn){ + if(locals[cdt][cdn].payable_account){ + var payable_account_currency = frm.events.get_account_currency(frm, cdt, cdn, locals[cdt][cdn].payable_account); + if(payable_account_currency){ + frappe.model.set_value(cdt, cdn, 'payable_account_currency', payable_account_currency); + } + } + } +}); + + +frappe.ui.form.on('Requested Payments', { + form_render: function(frm, cdt, cdn){ + if(locals[cdt][cdn].status == ""){ + } + } +}); + + +//For recommend button +cur_frm.cscript.recommend_request = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['requested_funds']) + { + frappe.confirm( + 'Confirm: Recommend selected requests?', + function(){ + $.each(selected['requested_funds'], function(index, value){ + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.recommend_request", + freeze: true, + args: { + request_doctype: "Requested Funds Details", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +//For recommend against button +cur_frm.cscript.recommend_against_request = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['requested_funds']) + { + frappe.confirm( + 'Confirm: Recommend against the selected requests?', + function(){ + $.each(selected['requested_funds'], function(index, value){ + frappe.call({ + method: "erpnext.accounts.doctype.requested_payments.requested_payments.recommend_against_request", + freeze: true, + args: { + request_doctype: "Requested Funds Details", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +//For approve button +cur_frm.cscript.approve_request = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['requested_funds']) + { + frappe.confirm( + 'Confirm: Approve selected requests?', + function(){ + $.each(selected['requested_funds'], function(index, value){ + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.approve_request", + freeze: true, + args: { + request_doctype: "Requested Funds Details", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + +//For reject button +cur_frm.cscript.reject_request = function(frm){ + //cur_frm.cscript.populate_child(cur_frm.doc.reference_doctype, cur_frm.doc.reference_docname); + var selected = cur_frm.get_selected(); + if(selected['requested_funds']) + { + frappe.confirm( + 'Confirm: Reject selected requests?', + function(){ + $.each(selected['requested_funds'], function(index, value){ + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.reject_request", + freeze: true, + args: { + request_doctype: "Requested Funds Details", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +//For accounts approval +cur_frm.cscript.accounts_approval = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['accounts_approval']) + { + frappe.confirm( + 'Confirm: Approve selected requests?', + function(){ + $.each(selected['accounts_approval'], function(index, value){ + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.accounts_approval", + freeze: true, + args: { + request_doctype: "Requested Funds Accounts Table", + request_docname: value, + parent_doctype: cur_frm.doctype, + parent_docname: cur_frm.docname, + local: locals['Requested Funds Accounts Table'][value], + reference: locals['Requested Funds Accounts Table'][value].reference, + user: frappe.user.full_name() + }, + callback: function(data){ + console.log(JSON.stringify(data)); + } + }); + }); + frappe.after_ajax(function(){ + cur_frm.reload_doc(); + }) + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +//For accounts cancel +cur_frm.cscript.accounts_cancel = function(frm){ + var selected = cur_frm.get_selected(); + var reload = false; + if(selected['accounts_approval']) + { + frappe.confirm( + 'Confirm: Cancel selected requests?', + function(){ + $.each(selected['accounts_approval'], function(index, value){ + reload = false; + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.accounts_cancel", + freeze: true, + args: { + request_doctype: "Requested Funds Accounts Table", + request_docname: value, + parent_doctype: cur_frm.doctype, + parent_docname: cur_frm.docname, + local: locals['Requested Funds Accounts Table'][value], + reference: locals['Requested Funds Accounts Table'][value].reference, + user: frappe.user.full_name() + }, + callback: function(data){ + console.log(data.message); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +cur_frm.cscript.populate_child = function(reference_doctype, reference_docname){ + frappe.model.with_doc(reference_doctype, reference_docname, function(){ + var request_total_amount_tsh = 0; + var request_total_amount_usd = 0; + var reference_doc = frappe.get_doc(reference_doctype, reference_docname); + + //If its requested from vehicle trip, there is main and return requested funds + if('Vehicle Trip' == reference_doctype) + { + //For main trip + reference_doc.main_requested_funds.forEach(function(row){ + //if(row.request_hidden_status == "0") + if(row.request_status != "Approved" && row.request_status != "Rejected") + { + var new_row = cur_frm.add_child("requested_funds"); + new_row.name = row.name; + new_row.request_date = row.request_date; + new_row.request_amount = row.request_amount; + new_row.request_currency = row.request_currency; + new_row.request_description = row.request_description; + new_row.request_comment = row.request_comment; + new_row.request_status = row.request_status; + if(row.request_currency == 'TZS') + { + request_total_amount_tsh += row.request_amount; + } + else if(row.request_currency == 'USD') + { + request_total_amount_usd += row.request_amount; + } + cur_frm.refresh_field("requested_funds"); + } + else{ + console.log("Executing"); + var new_row = cur_frm.add_child("previous_requested_funds"); + new_row.name = row.name; + new_row.request_date = row.request_date; + new_row.request_amount = row.request_amount; + new_row.request_currency = row.request_currency; + new_row.request_description = row.request_description; + new_row.request_comment = row.request_comment; + new_row.request_status = row.request_status; + cur_frm.refresh_field("previous_requested_funds"); + } + }); + + //For return trip + reference_doc.return_requested_funds.forEach(function(row){ + //if(row.request_hidden_status == "0") + if(row.request_status != "Approved" && row.request_status != "Rejected") + { + var new_row = cur_frm.add_child("requested_funds"); + new_row.name = row.name; + new_row.request_date = row.request_date; + new_row.request_amount = row.request_amount; + new_row.request_currency = row.request_currency; + new_row.request_description = row.request_description; + new_row.request_comment = row.request_comment; + new_row.request_status = row.request_status; + if(row.request_currency == 'TZS') + { + request_total_amount_tsh += row.request_amount; + } + else if(row.request_currency == 'USD') + { + request_total_amount_usd += row.request_amount; + } + cur_frm.refresh_field("requested_funds"); + } + else{ + var new_row = cur_frm.add_child("previous_requested_funds"); + new_row.name = row.name; + new_row.request_date = row.request_date; + new_row.request_amount = row.request_amount; + new_row.request_currency = row.request_currency; + new_row.request_description = row.request_description; + new_row.request_comment = row.request_comment; + new_row.request_status = row.request_status; + cur_frm.refresh_field("previous_requested_funds"); + } + }); + } + else + { + reference_doc.requested_funds.forEach(function(row){ + //if(row.request_hidden_status == "0") + if(row.request_status != "Approved" && row.request_status != "Rejected") + { + var new_row = cur_frm.add_child("requested_funds"); + new_row.name = row.name; + new_row.request_date = row.request_date; + new_row.request_amount = row.request_amount; + new_row.request_currency = row.request_currency; + new_row.request_description = row.request_description; + new_row.request_comment = row.request_comment; + new_row.request_status = row.request_status; + if(row.request_currency == 'TZS') + { + request_total_amount_tsh += row.request_amount; + } + else if(row.request_currency == 'USD') + { + request_total_amount_usd += row.request_amount; + } + cur_frm.refresh_field("requested_funds"); + } + else{ + var new_row = cur_frm.add_child("previous_requested_funds"); + new_row.name = row.name; + new_row.request_date = row.request_date; + new_row.request_amount = row.request_amount; + new_row.request_currency = row.request_currency; + new_row.request_description = row.request_description; + new_row.request_comment = row.request_comment; + new_row.request_status = row.request_status; + cur_frm.refresh_field("previous_requested_funds"); + } + }); + } + if(request_total_amount_tsh != 0 || request_total_amount_usd != 0) + { + cur_frm.set_df_property("html1", "hidden", 0); + cur_frm.set_df_property("html2", "hidden", 0); + console.log(cur_frm.get_field('request_total_amount')); + cur_frm.get_field("request_total_amount").$wrapper[0].innerHTML = '

Total Requested Amount

USD ' + request_total_amount_usd + '
TZS ' + request_total_amount_tsh.toLocaleString() + '
'; + //cur_frm.refresh_field("request_total_amount"); + } + else + { + cur_frm.set_df_property("request_total_amount", "hidden", 1); + cur_frm.set_df_property("html1", "hidden", 1); + cur_frm.set_df_property("html2", "hidden", 1); + } + }); +}; diff --git a/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.json b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.json new file mode 100644 index 0000000..12854df --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.json @@ -0,0 +1,755 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "REQ.###", + "beta": 0, + "creation": "2017-01-25 20:04:28.414635", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_date", + "fieldtype": "Date", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Requested Funds", + "fieldname": "requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "html2", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommendation Buttons", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "html1", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approval Buttons", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_total_amount", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Requested Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_previous_requested_funds", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_approved_amount", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Approved Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_payments_details", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payments Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "payments_reference", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payments Reference", + "length": 0, + "no_copy": 0, + "options": "Reference Payment Table", + "permlevel": 3, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_paid_amount", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Paid Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_accounts_approval", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Accounts Approval", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "accounts_approval", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Requested Funds Accounts Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "account_approval_buttons", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 4, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Requested From Module", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Requested From", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_10", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Requested Payments", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approval_status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Approval Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payment_status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Payment Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 1, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 1, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-12-12 21:47:02.706062", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Requested Payments", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Expense Approver", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Expense Recommender", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Expense Recommender", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.py b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.py new file mode 100644 index 0000000..958da53 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments.py @@ -0,0 +1,516 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import time +import datetime +import json +from frappe.model.document import Document +from frappe.utils import flt, comma_or, nowdate +from frappe import msgprint, _ +from erpnext.accounts.general_ledger import process_gl_map, save_entries +from erpnext.accounts.utils import get_fiscal_years, validate_fiscal_year, get_account_currency +from erpnext.controllers.accounts_controller import set_balance_in_account_currency +from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget + +class RequestedPayments(Document): + def onload(self): + pass + + def get_all_children(self, parenttype=None): + #For getting children + return self.get('payments_reference') + + def update_children(self): + '''update child tables''' + self.update_child_table('payments_reference') + + def load_from_db(self): + """Load document and children from database and create properties + from fields""" + if not getattr(self, "_metaclass", False) and self.meta.issingle: + single_doc = frappe.db.get_singles_dict(self.doctype) + if not single_doc: + single_doc = frappe.new_doc(self.doctype).as_dict() + single_doc["name"] = self.doctype + del single_doc["__islocal"] + + super(Document, self).__init__(single_doc) + self.init_valid_columns() + self._fix_numeric_types() + + else: + d = frappe.db.get_value(self.doctype, self.name, "*", as_dict=1) + if not d: + frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError) + + super(Document, self).__init__(d) + + if self.name=="DocType" and self.doctype=="DocType": + from frappe.model.meta import doctype_table_fields + table_fields = doctype_table_fields + else: + table_fields = self.meta.get_table_fields() + + for df in table_fields: + #Load details for payments already paid + if df.fieldname == "payments_reference": + children = frappe.db.get_values(df.options, + {"parent": self.name, "parenttype": self.doctype, "parentfield": df.fieldname}, + "*", as_dict=True, order_by="idx asc") + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + elif df.fieldname == "requested_funds": #Load requests which are not approved nor rejected + children = frappe.db.get_values(df.options, + {"parent": ["=", self.get('reference_docname')], "parenttype": ["=", self.get('reference_doctype')], "parentfield": ["in", ("requested_funds", "main_requested_funds", "return_requested_funds")], "request_status": ["in", ("open", "Requested", "Recommended")]}, + "*", as_dict=True, order_by="idx asc") + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + elif df.fieldname == "accounts_approval": + children = frappe.db.get_values("Requested Funds Details", + {"parent": ["=", self.get('reference_docname')], "parenttype": ["=", self.get('reference_doctype')], "parentfield": ["in", ("requested_funds", "main_requested_funds", "return_requested_funds")], "request_status": ["in", ("Approved", "Rejected", "Accounts Approved", "Accounts Rejected", "Accounts Cancelled")]}, + "*", as_dict=True, order_by="idx asc") + if children: + for child in children: + child.reference = child.name + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + + # sometimes __setup__ can depend on child values, hence calling again at the end + if hasattr(self, "__setup__"): + self.__setup__() + + + +def get_outstanding_payments(self, account_currency): + #Timestamp + ts = time.time() + + #Initialize values + total_amount = outstanding_amount = 0 + due_date = datetime.datetime.now().date() + + requested_from = frappe.get_doc(self.reference_doctype, self.reference_docname) + if self.reference_doctype == 'Vehicle Trip': + for request in requested_from.main_requested_funds: + if request.request_status == "Approved" and request.request_currency == account_currency: + total_amount = total_amount + request.request_amount + #request_date = datetime.datetime.strptime(request.request_date, '%Y-%m-%d') + if request.request_date < due_date: + due_date = request.request_date + + for request in requested_from.return_requested_funds: + if request.request_status == "Approved" and request.request_currency == account_currency: + total_amount = total_amount + request.request_amount + if request.request_date < due_date: + due_date = request.request_date + else: + for request in requested_from.requested_funds: + if request.request_status == "Approved" and request.request_currency == account_currency: + total_amount = total_amount + request.request_amount + if request.request_date < due_date: + due_date = request.request_date + + paid_amount = frappe.db.sql("""SELECT (CASE WHEN SUM(debit_in_account_currency) > 0 THEN SUM(debit_in_account_currency) ELSE 0 END) AS paid_amount + FROM `tabGL Entry` WHERE debit_in_account_currency > 0 AND account_currency = %s + AND voucher_type = 'Requested Payments' AND voucher = %s""", (account_currency, self.name), as_dict=True) + #frappe.msgprint(paid_amount[0].paid_amount) + outstanding_amount = total_amount - float(paid_amount[0].paid_amount) + + return frappe._dict({ + "due_date": due_date, + "total_amount": total_amount, + "outstanding_amount": outstanding_amount, + "exchange_rate": 1 + }) + +def validate_requested_funds(doc): + make_request = False + open_requests = [] + for requested_fund in doc.requested_funds: + if requested_fund.request_status == "open": + make_request = True + open_requests.append(requested_fund) + + if make_request: + args = {"reference_doctype": doc.doctype, "reference_docname": doc.name, "company": doc.company} + request_status = request_funds(reference_doctype = doc.doctype, reference_docname = doc.name, company = doc.company) + if request_status == "Request Inserted" or request_status == "Request Updated": + for open_request in open_requests: + open_request.set("request_status", "Requested") + + +@frappe.whitelist(allow_guest=True) +def request_funds(**args): + args = frappe._dict(args) + + existing_payment_request = frappe.db.get_value("Requested Payments", + {"reference_doctype": args.reference_doctype, "reference_docname": args.reference_docname}) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + if existing_payment_request: + #Mark the request as open + doc = frappe.get_doc("Requested Payments", existing_payment_request) + doc.db_set("approval_status", "Waiting Approval") + doc.db_set("modified", timestamp) + doc.db_set("company", args.company) + return "Request Updated" + else: + request = frappe.new_doc("Requested Payments") + request.update({ + "reference_doctype":args.reference_doctype, + "reference_docname": args.reference_docname, + "company": args.company, + "approval_status": "Waiting Approval", + "payment_status": "Waiting Approval" + }) + request.insert(ignore_permissions=True) + return "Request Inserted" + + +@frappe.whitelist(allow_guest=True) +def recommend_request(**args): + args = frappe._dict(args) + + #frappe.db.sql("UPDATE `tabRequested Funds Details` SET request_status = 'Recommended', request_hidden_status = 0 WHERE name = %s", args.request_docname) + #return args.request_docname + #Mark the request as open + doc = frappe.get_doc("Requested Funds Details", args.request_docname) + doc.db_set("request_status", "Recommended") + doc.db_set("request_hidden_status", "0") + doc.db_set("recommended_by", args.user) + return "Request Updated" + + +@frappe.whitelist(allow_guest=True) +def recommend_against_request(**args): + args = frappe._dict(args) + + #frappe.db.sql("UPDATE `tabRequested Funds Details` SET request_status = 'Recommended', request_hidden_status = 0 WHERE name = %s", args.request_docname) + #return args.request_docname + #Mark the request as open + doc = frappe.get_doc("Requested Funds Details", args.request_docname) + doc.db_set("request_status", "Recommended Against") + doc.db_set("request_hidden_status", "0") + doc.db_set("recommended_by", args.user) + return "Request Updated" + + +@frappe.whitelist(allow_guest=True) +def approve_request(**args): + args = frappe._dict(args) + + #frappe.db.sql("UPDATE `tabRequested Funds Details` SET request_status = 'Approved', request_hidden_status = 0 WHERE name = %s", args.request_docname) + #return args.request_docname + #Mark the request as open + doc = frappe.get_doc("Requested Funds Details", args.request_docname) + doc.db_set("request_status", "Approved") + doc.db_set("request_hidden_status", "1") + doc.db_set("approved_by", args.user) + return "Request Updated" + +@frappe.whitelist(allow_guest=True) +def reject_request(**args): + args = frappe._dict(args) + + #frappe.db.sql("UPDATE `tabRequested Funds Details` SET request_status = 'Rejected', request_hidden_status = 0 WHERE name = %s", args.request_docname) + #return "OK" + #Mark the request as open + doc = frappe.get_doc("Requested Funds Details", args.request_docname) + doc.db_set("request_status", "Rejected") + doc.db_set("request_hidden_status", "2") + doc.db_set("approved_by", args.user) + return "Request Updated" + + +@frappe.whitelist(allow_guest=True) +def accounts_approval(**args): + args = frappe._dict(args) + local = json.loads(args.local) + + if args.reference: + reference = frappe.get_doc("Requested Funds Details", args.reference) + if reference.request_status in ['Approved', 'Accounts Cancelled']: + to_validate = [ + {"fieldname": "posting_date", "label": "Posting Date"}, + {"fieldname": "cost_center", "label": "Cost Center"}, + {"fieldname": "expense_account", "label": "Expense Account"}, + {"fieldname": "payable_account", "label": "Payable Account"}, + {"fieldname": "party_type", "label": "Party Type"}, + {"fieldname": "party", "label": "Party"}, + ] + for field in to_validate: + if not local.get(field["fieldname"]): + frappe.throw('Error: Please enter ' + field["label"] + ' for all rows') + + + #Save changes made to accounts info + to_save = ['expense_account', 'payable_account', 'party_type', 'expense_type', 'party', 'invoice_number', 'expense_account_currency', + 'conversion_rate', 'payable_account_currency', 'cost_center', 'posting_date', 'accounts_approved_by', 'accounts_approved_on', 'accounts_approver_comment'] + for field in to_save: + reference.db_set(field, local.get(field)) + + #Make GL Entries + gl_entries = get_gl_entries(reference, args.parent_doctype, args.parent_docname) + make_gl_entries(gl_entries) + + reference.db_set("request_status", "Accounts Approved") + reference.db_set("request_hidden_status", "1") + reference.db_set("accounts_approved_by", args.user) + parent = frappe.get_doc("Requested Payments", args.parent_docname) + update_payment_status(parent) + return "Request Updated" + + +@frappe.whitelist(allow_guest=True) +def accounts_cancel(**args): + args = frappe._dict(args) + local = json.loads(args.local) + + if args.reference: + reference = frappe.get_doc("Requested Funds Details", args.reference) + + if reference.request_status == 'Accounts Approved': + paid_amount = get_paid_amount(args.parent_doctype, args.parent_docname, reference.party_type, reference.party, reference.payable_account) + total_approved = get_total_approved(args.parent_doctype, args.parent_docname, reference.party_type, reference.party, reference.payable_account) + in_account_currency = reference.request_amount * reference.conversion_rate + + if (total_approved - (paid_amount + in_account_currency)) < 0: + frappe.throw('Unable to cancel. Payment has already been made against the account. Please cancel the payment entry first.' + 'Paid: ' + str(paid_amount) + ' Total Approved: ' + str(total_approved) + ' Account Currency: ' + str(in_account_currency)) + else: + #Make GL Entries + gl_entries = get_gl_entries(reference, args.parent_doctype, args.parent_docname) + make_gl_entries(gl_entries, True) + + reference.db_set("request_status", "Accounts Cancelled") + reference.db_set("request_hidden_status", "1") + reference.db_set("accounts_approved_by", args.user) + parent = frappe.get_doc("Requested Payments", args.parent_docname) + update_payment_status(parent) + return "Request Updated" + + +def get_paid_amount(dt, dn, party_type, party, account): + if party_type=="Customer": + dr_or_cr = "credit_in_account_currency - debit_in_account_currency" + else: + dr_or_cr = "debit_in_account_currency - credit_in_account_currency" + + paid_amount = frappe.db.sql(""" + select ifnull(sum({dr_or_cr}), 0) as paid_amount + from `tabGL Entry` + where against_voucher_type = %s + and against_voucher = %s + and party_type = %s + and party = %s + and account = %s + and {dr_or_cr} > 0 + """.format(dr_or_cr=dr_or_cr), (dt, dn, party_type, party, account)) + + return paid_amount[0][0] if paid_amount else 0 + +def get_total_approved(dt, dn, party_type, party, account): + total_approved = frappe.db.sql(""" + select ifnull(sum(credit_in_account_currency), 0) as total_approved + from `tabGL Entry` + where against_voucher_type = %s + and against_voucher = %s + and party_type = %s + and party = %s + and account = %s + """, (dt, dn, party_type, party, account)) + + return total_approved[0][0] if total_approved else 0 + + +def get_gl_entries(data, reference_doctype, reference_docname): + gl_entry = [] + doc = frappe.get_doc(reference_doctype, reference_docname) + company_currency = frappe.db.get_value('Company', doc.company, "default_currency") + + # payable entry + payable_account_currency = get_account_currency(data.payable_account) + gl_entry.append( + get_gl_dict(doc, data, + { + "account": data.payable_account, + "credit": data.request_amount, + "credit_in_account_currency": data.request_amount \ + if payable_account_currency==company_currency else data.request_amount/data.conversion_rate, + "against": data.name, + "party_type": data.party_type, + "party": data.party, + "against_voucher_type": doc.doctype, + "against_voucher": doc.name + } + ) + ) + + # expense entries + expense_account_currency = get_account_currency(data.expense_account) + gl_entry.append( + get_gl_dict(doc, data, + { + "account": data.expense_account, + "debit": data.request_amount, + "debit_in_account_currency": data.request_amount \ + if expense_account_currency==company_currency else data.request_amount/data.conversion_rate, + "against": data.name, + "cost_center": data.cost_center, + 'against_voucher_type': doc.doctype, + 'against_voucher': doc.name + } + ) + ) + + return gl_entry + +def get_gl_dict(doc, data, args, account_currency=None): + """this method populates the common properties of a gl entry record""" + + fiscal_years = get_fiscal_years(data.request_date, company=doc.company) + if len(fiscal_years) > 1: + frappe.throw(_("Multiple fiscal years exist for the date {0}. Please set company in Fiscal Year").format(formatdate(self.posting_date))) + else: + fiscal_year = fiscal_years[0][0] + + gl_dict = frappe._dict({ + 'company': doc.company, + 'posting_date': data.posting_date, + 'fiscal_year': fiscal_year, + 'voucher_type': doc.doctype, + 'voucher_no': doc.name, + 'remarks': data.get("remarks"), + 'debit': 0, + 'credit': 0, + 'debit_in_account_currency': 0, + 'credit_in_account_currency': 0, + 'is_opening': "No", + 'party_type': None, + 'party': None, + 'project': data.get("project") + }) + gl_dict.update(args) + + company_currency = frappe.db.get_value('Company', doc.company, "default_currency") + + if not account_currency: + account_currency = get_account_currency(gl_dict.account) + + if gl_dict.account and doc.doctype not in ["Journal Entry", + "Period Closing Voucher", "Payment Entry"]: + + #self.validate_account_currency(gl_dict.account, account_currency) + set_balance_in_account_currency(gl_dict, account_currency, data.get("conversion_rate"), company_currency) + + return gl_dict + +def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, update_outstanding='Yes', from_repost=False): + if gl_map: + if not cancel: + gl_map = process_gl_map(gl_map, merge_entries) + if gl_map and len(gl_map) > 1: + save_entries(gl_map, adv_adj, update_outstanding, from_repost) + else: + frappe.throw(_("Incorrect number of General Ledger Entries found. You might have selected a wrong Account in the transaction.")) + else: + delete_gl_entries(gl_map, adv_adj=adv_adj, update_outstanding=update_outstanding) + + +def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None, + adv_adj=False, update_outstanding="Yes"): + + from erpnext.accounts.doctype.gl_entry.gl_entry import validate_balance_type, \ + check_freezing_date, update_outstanding_amt, validate_frozen_account + + if not gl_entries: + gl_entries = frappe.db.sql(""" + select account, posting_date, party_type, party, cost_center, fiscal_year,voucher_type, + voucher_no, against_voucher_type, against_voucher, cost_center, company + from `tabGL Entry` + where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no), as_dict=True) + + if gl_entries: + check_freezing_date(gl_entries[0]["posting_date"], adv_adj) + + for entry in gl_entries: + frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s AND against=%s""", + (entry.voucher_type, entry.voucher_no, entry.against)) + + validate_frozen_account(entry["account"], adv_adj) + validate_balance_type(entry["account"], adv_adj) + if not adv_adj: + validate_expense_against_budget(entry) + + if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj: + update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"), + entry.get("against_voucher"), on_cancel=True) + + +def update_payment_status(doc): + paid_amount = frappe.db.sql("""select ifnull(sum(debit_in_account_currency), 0) as amt + from `tabGL Entry` where against_voucher_type = 'Requested Payments' and against_voucher = %s AND voucher_type <> 'Requested Payments'""", + (doc.name) ,as_dict=1)[0].amt + + total_approved = frappe.db.sql(""" + select ifnull(sum(credit_in_account_currency), 0) as total_approved + from `tabGL Entry` + where against_voucher_type = 'Requested Payments' + and against_voucher = %s + """, (doc.name), as_dict=1)[0].total_approved + + if paid_amount >= total_approved: + frappe.db.set_value("Requested Payments", doc.name, "payment_status", "Paid") + else: + frappe.db.set_value("Requested Payments", doc.name, "payment_status", "Waiting Payment") + + + +@frappe.whitelist(allow_guest=True) +def reference_payment(**args): + args = frappe._dict(args) + + request = frappe.new_doc("Reference Payment Table") + request.update({ + "parent":args.parent, + "parentfield": args.parentfield, + "parenttype": args.parenttype, + "date_of_payment": args.date_of_payment, + "accounting_system": args.accounting_system, + "amount": args.amount, + "currency": args.currency, + "reference_no": args.reference_no, + "status": "paid" + }) + request.insert(ignore_permissions=True) + + parent = frappe.get_doc('Requested Payments', args.parent) + parent.db_set("payment_status", args.payment_status) + return "inserted" + +@frappe.whitelist(allow_guest=True) +def make_payment(source_name, target_doc=None, ignore_permissions=False): + pe = frappe.new_doc("Payment Entry") + pe.payment_type = "Pay" + pe.posting_date = nowdate() + pe.mode_of_payment = "Cash" + pe.party_type = "Employee" + pe.allocate_payment_amount = 1 + + return pe + + + + + + diff --git a/csf_tz/after_sales_services/doctype/requested_payments/requested_payments_dashboard.py b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments_dashboard.py new file mode 100644 index 0000000..6a6b82d --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments_dashboard.py @@ -0,0 +1,18 @@ +from frappe import _ + +def get_data(): + return { + 'fieldname': 're', + 'non_standard_fieldnames': { + 'Payment Entry': 'reference_name' + }, + 'internal_links': { + 'Sales Order': ['references', 'reference_name'] + }, + 'transactions': [ + { + 'label': _('Payments'), + 'items': ['Payment Entry'] + } + ] + } diff --git a/csf_tz/after_sales_services/doctype/requested_payments/requested_payments_list.js b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments_list.js new file mode 100644 index 0000000..e052b35 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/requested_payments_list.js @@ -0,0 +1,3 @@ +frappe.listview_settings['Requested Payments'] = { + add_fields: ['reference_docname', "approval_status", "payment_status"] +}; diff --git a/csf_tz/after_sales_services/doctype/requested_payments/test_requested_payments.js b/csf_tz/after_sales_services/doctype/requested_payments/test_requested_payments.js new file mode 100644 index 0000000..4ca2029 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/test_requested_payments.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Requested Payments", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Requested Payments + () => frappe.tests.make('Requested Payments', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/requested_payments/test_requested_payments.py b/csf_tz/after_sales_services/doctype/requested_payments/test_requested_payments.py new file mode 100644 index 0000000..3d3d3da --- /dev/null +++ b/csf_tz/after_sales_services/doctype/requested_payments/test_requested_payments.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Requested Payments') + +class TestRequestedPayments(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/doctype/sales_test/__init__.py b/csf_tz/after_sales_services/doctype/sales_test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/doctype/sales_test/sales_test.js b/csf_tz/after_sales_services/doctype/sales_test/sales_test.js new file mode 100644 index 0000000..fc34473 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/sales_test/sales_test.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Sales Test', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/after_sales_services/doctype/sales_test/sales_test.json b/csf_tz/after_sales_services/doctype/sales_test/sales_test.json new file mode 100644 index 0000000..8891c0c --- /dev/null +++ b/csf_tz/after_sales_services/doctype/sales_test/sales_test.json @@ -0,0 +1,92 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-06-27 11:46:19.260681", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "test", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "test", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-27 13:59:51.973937", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Sales Test", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/doctype/sales_test/sales_test.py b/csf_tz/after_sales_services/doctype/sales_test/sales_test.py new file mode 100644 index 0000000..dfb2e7f --- /dev/null +++ b/csf_tz/after_sales_services/doctype/sales_test/sales_test.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SalesTest(Document): + pass diff --git a/csf_tz/after_sales_services/doctype/sales_test/test_sales_test.js b/csf_tz/after_sales_services/doctype/sales_test/test_sales_test.js new file mode 100644 index 0000000..a0ce382 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/sales_test/test_sales_test.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Sales Test", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Sales Test + () => frappe.tests.make('Sales Test', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/after_sales_services/doctype/sales_test/test_sales_test.py b/csf_tz/after_sales_services/doctype/sales_test/test_sales_test.py new file mode 100644 index 0000000..2f738c6 --- /dev/null +++ b/csf_tz/after_sales_services/doctype/sales_test/test_sales_test.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestSalesTest(unittest.TestCase): + pass diff --git a/csf_tz/after_sales_services/report/__init__.py b/csf_tz/after_sales_services/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/report/delivery_note_report/__init__.py b/csf_tz/after_sales_services/report/delivery_note_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.js b/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.js new file mode 100644 index 0000000..175ff30 --- /dev/null +++ b/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.js @@ -0,0 +1,30 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 30); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Delivery Note Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + ] +} diff --git a/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.json b/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.json new file mode 100644 index 0000000..c46d21c --- /dev/null +++ b/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.json @@ -0,0 +1,40 @@ +{ + "add_total_row": 0, + "creation": "2019-05-22 15:35:36.348245", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-05-22 15:35:36.348245", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Delivery Note Report", + "owner": "Administrator", + "ref_doctype": "Delivery Note", + "report_name": "Delivery Note Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Accounts User" + }, + { + "role": "Stock Manager" + }, + { + "role": "Sales User" + }, + { + "role": "Sales Executive" + }, + { + "role": "Branch In Charge" + }, + { + "role": "Stock Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.py b/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.py new file mode 100644 index 0000000..1ce5300 --- /dev/null +++ b/csf_tz/after_sales_services/report/delivery_note_report/delivery_note_report.py @@ -0,0 +1,144 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "delivery_note", + "label": _("Delivery Note"), + "fieldtype": "Link", + "options": "Delivery Note", + "width": 150 + }, + { + "fieldname": "customer_name", + "label": _("Customer"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "customer_address", + "label": _("Customer Address"), + "fieldtype": "Small Text", + "width": 200 + }, + { + "fieldname": "phone_number", + "label": _("Phone Number"), + "fieldtype": "Data", + "width": 150 + }, + # { + # "fieldname": "item_name", + # "label": _("Item"), + # "fieldtype": "Data", + # "width": 150 + # }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "quantity", + "label": _("Quantity"), + "fieldtype": "Float", + "width": 150 + }, + # { + # "fieldname": "uom", + # "label": _("UOM"), + # "fieldtype": "Data", + # "width": 150 + # }, + { + "fieldname": "serial_no", + "label": _("Serial Numbers"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "actual_quantity", + "label": _("Actual Quantity"), + "fieldtype": "Float", + "width": 100 + }, + # { + # "fieldname": "projected_quantity", + # "label": _("Projected Quantity"), + # "fieldtype": "Float", + # "width": 100 + # }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "sales_invoice", + "label": _("Sales Invoice"), + "fieldtype": "Link", + "options": "Sales Invoice", + "width": 150 + } + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where = '' + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date} + + if filters.warehouse: + where += ' AND dni.warehouse = %(warehouse)s' + where_filter.update({"warehouse": filters.warehouse}) + + data = frappe.db.sql('''SELECT + dn.customer_name, + CONCAT(ta.address_line1,",", ta.city,',', ta.country) AS customer_address, + ta.phone AS phone_number, + dn.posting_date, + dni.item_name, + dni.item_code, + dni.serial_no, + dni.qty AS quantity, + dni.uom, + dni.warehouse, + dn.name AS delivery_note, + so.name AS sales_invoice, + `tabBin`.actual_qty AS actual_quantity, + `tabBin`.projected_qty AS projected_quantity + FROM + (`tabDelivery Note Item`dni) + LEFT JOIN + (`tabSales Invoice` so) + ON (dni.against_sales_invoice = so.name) + LEFT JOIN + (`tabDelivery Note` dn) + ON (dni.parent=dn.name) + LEFT JOIN + `tabBin` ON (`tabBin`.item_code = dni.item_code + and `tabBin`.warehouse = dni.warehouse) + LEFT JOIN + tabItem ON tabItem.item_code = dni.item_code + LEFT JOIN + (`tabAddress` ta) ON ta.name=(SELECT dl.parent + FROM (`tabDynamic Link` dl) + WHERE + dl.parenttype='Address' AND dl.link_doctype='Customer' AND + dl.link_name=dn.customer ORDER BY ta.creation LIMIT 1 + ) + WHERE + dn.docstatus = 1 AND dn.status IN ('Completed', 'To Bill', 'Closed') + AND dn.posting_date BETWEEN %(from_date)s AND %(to_date)s + AND (SELECT name FROM `tabDelivery Note` WHERE return_against = dn.name) IS NULL''' + where, + where_filter, as_dict=1 + ); + return columns, data diff --git a/csf_tz/after_sales_services/report/installation_note_report/__init__.py b/csf_tz/after_sales_services/report/installation_note_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.js b/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.js new file mode 100644 index 0000000..3a2e18a --- /dev/null +++ b/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.js @@ -0,0 +1,31 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Installation Note Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"branch", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + } + ] +} diff --git a/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.json b/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.json new file mode 100644 index 0000000..a34898a --- /dev/null +++ b/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.json @@ -0,0 +1,34 @@ +{ + "add_total_row": 0, + "creation": "2019-05-22 14:55:06.120622", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-05-22 14:56:02.838056", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Installation Note Report", + "owner": "Administrator", + "ref_doctype": "Installation Note", + "report_name": "Installation Note Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Sales User" + }, + { + "role": "Sales Executive" + }, + { + "role": "Branch Service Controller" + }, + { + "role": "Branch In Charge" + }, + { + "role": "Stock Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.py b/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.py new file mode 100644 index 0000000..c53305b --- /dev/null +++ b/csf_tz/after_sales_services/report/installation_note_report/installation_note_report.py @@ -0,0 +1,87 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label": _("Installation Note"), + "fieldtype": "Link", + "options": "Installation Note", + "width": 100 + }, + { + "fieldname": "inst_date", + "label": _("Installation Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "item_code", + "label": _("Item code"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "Text", + "width": 200 + } + ] + + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where = '' + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date} + + if filters.branch: + where += ' AND `tabDelivery Note Item`.warehouse = %(branch)s' + where_filter.update({"branch": filters.branch}) + + data = frappe.db.sql('''SELECT + `tabInstallation Note`.name AS reference, + `tabInstallation Note`.inst_date AS inst_date, + `tabInstallation Note`.customer AS customer, + `tabInstallation Note`.item_code AS item_code, + `tabInstallation Note`.remarks AS remarks, + `tabInstallation Note`.status AS status, + `tabInstallation Note`.delivery_note, + `tabDelivery Note Item`.warehouse + + FROM + `tabInstallation Note` + LEFT JOIN + `tabDelivery Note Item` + ON + (`tabDelivery Note Item`.parent = `tabInstallation Note`.delivery_note) + WHERE + `tabInstallation Note`.docstatus <> 2 \ + AND `tabInstallation Note`.inst_date BETWEEN %(from_date)s AND %(to_date)s + '''+ where, + where_filter, as_dict=1,) + + return columns, data diff --git a/csf_tz/after_sales_services/report/pre_delivery_inspection_report/__init__.py b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.js b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.js new file mode 100644 index 0000000..b441d07 --- /dev/null +++ b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.js @@ -0,0 +1,31 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Pre Delivery Inspection Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"branch", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + } + ] +} diff --git a/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.json b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.json new file mode 100644 index 0000000..5fbb8e9 --- /dev/null +++ b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.json @@ -0,0 +1,34 @@ +{ + "add_total_row": 0, + "creation": "2019-05-22 14:24:38.122103", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-05-22 14:55:26.715680", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Pre Delivery Inspection Report", + "owner": "Administrator", + "ref_doctype": "Pre Delivery Inspection", + "report_name": "Pre Delivery Inspection Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Quality Manager" + }, + { + "role": "Sales Executive" + }, + { + "role": "Branch Service Controller" + }, + { + "role": "Branch In Charge" + }, + { + "role": "Stock Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.py b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.py new file mode 100644 index 0000000..a427cac --- /dev/null +++ b/csf_tz/after_sales_services/report/pre_delivery_inspection_report/pre_delivery_inspection_report.py @@ -0,0 +1,113 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label": _("Pre Delivery Inspection Reference"), + "fieldtype": "Link", + "options": "Pre Delivery Inspection", + "width": 100 + }, + { + "fieldname": "report_date", + "label": _("Done On"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "inspection_type", + "label": _("Inspection Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "item_code", + "label": _("Item code"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "item_serial_no", + "label": _("Serial no"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "inspected_by", + "label": _("Inspected By"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "verified_by", + "label": _("Verified By"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "Text", + "width": 200 + } + ] + + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where = '' + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date} + + if filters.branch: + where += ' AND sit.warehouse = %(branch)s' + where_filter.update({"branch": filters.branch}) + + data = frappe.db.sql('''SELECT + `tabPre Delivery Inspection`.name AS reference, + `tabPre Delivery Inspection`.report_date, + `tabPre Delivery Inspection`.customer, + `tabPre Delivery Inspection`.inspection_type, + `tabPre Delivery Inspection`.item_code, + `tabPre Delivery Inspection`.item_serial_no, + `tabPre Delivery Inspection`.inspected_by, + `tabPre Delivery Inspection`.verified_by, + `tabPre Delivery Inspection`.reference_name, + `tabPre Delivery Inspection`.remarks, + sit.warehouse + + FROM + `tabPre Delivery Inspection` + LEFT JOIN + (`tabSales Invoice Item` sit) + ON (`tabPre Delivery Inspection`.sales_invoice = sit.parent) + WHERE + `tabPre Delivery Inspection`.docstatus <> 2 \ + AND `tabPre Delivery Inspection`.report_date BETWEEN %(from_date)s AND %(to_date)s + '''+ where, + where_filter, as_dict=1) + + return columns, data \ No newline at end of file diff --git a/csf_tz/after_sales_services/report/technicians_performance_report/__init__.py b/csf_tz/after_sales_services/report/technicians_performance_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.js b/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.js new file mode 100644 index 0000000..024d7f5 --- /dev/null +++ b/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.js @@ -0,0 +1,51 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Technicians Performance Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"status", + "label": __("Status"), + "fieldtype": "Select", + "options": ["", "Open", "Closed"], + }, + { + "fieldname":"user", + "label": __("Technician"), + "fieldtype": "Link", + "options": "Employee", + }, + { + "fieldname":"workshop", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + }, + { + "fieldname":"custm", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + }, + ] +} diff --git a/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.json b/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.json new file mode 100644 index 0000000..2e894e0 --- /dev/null +++ b/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.json @@ -0,0 +1,38 @@ +{ + "add_total_row": 1, + "creation": "2020-04-03 18:13:32.274707", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Default Letter Head", + "modified": "2020-04-09 14:09:12.974702", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Technicians Performance Report", + "owner": "Administrator", + "ref_doctype": "Job Card", + "report_name": "Technicians Performance Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "After Sales User" + }, + { + "role": "After Sales Manager" + }, + { + "role": "After Sales Branch Manager" + }, + { + "role": "Parts Consultant" + }, + { + "role": "Service and Training Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.py b/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.py new file mode 100644 index 0000000..0552c31 --- /dev/null +++ b/csf_tz/after_sales_services/report/technicians_performance_report/technicians_performance_report.py @@ -0,0 +1,106 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.desk.query_report import add_total_row +import datetime + +def execute(filters=None): + return _execute(filters) + +def _execute(filters=None, additional_table_columns=None, additional_query_columns=None): + if not filters: filters = {} + columns = get_columns(additional_table_columns) + item_list = get_items(filters, additional_query_columns) + + data = [] + for d in item_list: + #For actual hours time calculation = date difference in hours + time difference. There may be a simpler way to do it but ...... + time_difference = 0 + if d.end_date == d.start_date: + time_difference = (d.end_time.seconds - d.start_time.seconds) / 3600 + else: + time_difference = ((86400 - d.start_time.seconds) + d.end_time.seconds) / 3600 + date_difference = (d.end_date - d.start_date).total_seconds() / 3600 + actual_hrs = date_difference + time_difference + + service_value = d.billable_hours * d.standard_cost + hrs_difference = actual_hrs - d.standard_hours + row = [d.name, d.technician, d.employee_name, d.start_date, d.start_time, d.end_date, d.end_time, d.service, d.standard_hours, + actual_hrs, hrs_difference, d.billable_hours, d.standard_cost, service_value, d.warehouse, d.customer] + data.append(row) + return columns, data + +def get_columns(additional_table_columns): + columns = [ + _("Job Card") + ":Link/Job Card:120", + _("Technician") + ":Link/User:100", + _("Technician Name") + ":Data:100", + _("Start Date") + ":Date:80", + _("Start Time") + ":Time:80", + _("End Date") + ":Date:80", + _("End Time") + ":Time:80", + _("Service") + ":Link/Maintenance Service:120", + _("Standard Hrs") + ":Float:120", + _("Actual Hrs") + ":Float:120", + _("Hrs Difference") + ":Float:120", + _("Billable Hrs") + ":Float:120", + _("Standard Rate") + ":Currency/currency:120", + _("Service Value") + ":Currency/currency:120", + _("Warehouse") + ":Link/Warehouse:120", + _("Customer") + ":Link/Customer:120"] + + return columns + +def get_conditions(filters): + conditions = "" + + for opts in (("custm", " and `tabJob Card`.customer=%(custm)s"), + ("workshop", " and `tabJob Card`.warehouse = %(workshop)s"), + ("user", " and `tabMaintenance Services Table`.technician = %(user)s"), + ("from_date", " and `tabMaintenance Services Table`.start_date>=%(from_date)s"), + ("to_date", " and `tabMaintenance Services Table`.start_date<=%(to_date)s")): + if filters.get(opts[0]): + conditions += opts[1] + + return conditions + +def get_items(filters, additional_query_columns): + conditions = get_conditions(filters) + match_conditions = frappe.build_match_conditions("Job Card") + + if match_conditions: + match_conditions = " and {0} ".format(match_conditions) + + if additional_query_columns: + additional_query_columns = ', ' + ', '.join(additional_query_columns) + + return frappe.db.sql(""" + select + `tabJob Card`.name, + `tabMaintenance Services Table`.start_date, + `tabMaintenance Services Table`.end_date, + `tabMaintenance Services Table`.start_time, + `tabMaintenance Services Table`.end_time, + `tabJob Card`.name, + `tabJob Card`.customer, + `tabJob Card`.status, + `tabJob Card`.warehouse, + `tabEmployee`.employee_name, + `tabMaintenance Services Table`.service, + `tabMaintenance Services Table`.billable_hours, + `tabMaintenance Services Table`.standard_hours, + `tabMaintenance Services Table`.technician, + `tabMaintenance Services Table`.standard_cost + from + `tabJob Card`, `tabMaintenance Services Table` + left join + `tabEmployee` on `tabEmployee`.name = `tabMaintenance Services Table`.technician + where + `tabJob Card`.name = `tabMaintenance Services Table`.parent and `tabJob Card`.docstatus = 1 %s %s + order by + `tabMaintenance Services Table`.start_date + """.format(additional_query_columns or '') % (conditions, match_conditions), filters, as_dict=1) + diff --git a/csf_tz/after_sales_services/report/workshop_performance_report/__init__.py b/csf_tz/after_sales_services/report/workshop_performance_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.js b/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.js new file mode 100644 index 0000000..0c311b7 --- /dev/null +++ b/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.js @@ -0,0 +1,39 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Workshop Performance Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"technician", + "label": __("Technician"), + "fieldtype": "Link", + "options": "Employee", + }, + { + "fieldname":"workshop", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + }, + ] +} diff --git a/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.json b/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.json new file mode 100644 index 0000000..f3ba844 --- /dev/null +++ b/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.json @@ -0,0 +1,38 @@ +{ + "add_total_row": 1, + "creation": "2020-04-09 15:05:49.073861", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Default Letter Head", + "modified": "2020-04-09 15:05:49.073861", + "modified_by": "Administrator", + "module": "After Sales Services", + "name": "Workshop Performance Report", + "owner": "Administrator", + "ref_doctype": "Job Card", + "report_name": "Workshop Performance Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "After Sales User" + }, + { + "role": "After Sales Manager" + }, + { + "role": "After Sales Branch Manager" + }, + { + "role": "Parts Consultant" + }, + { + "role": "Service and Training Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.py b/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.py new file mode 100644 index 0000000..864a3fe --- /dev/null +++ b/csf_tz/after_sales_services/report/workshop_performance_report/workshop_performance_report.py @@ -0,0 +1,102 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.desk.query_report import add_total_row + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "technician", + "label": _("Technician"), + "fieldtype": "Link", + "options": "Employee", + "width": 150 + }, + { + "fieldname": "employee_name", + "label": _("Technician Name"), + "fieldtype": "Data", + "width": 150, + "hidden": True + }, + { + "fieldname": "workshop", + "label": _("Workshop"), + "fieldtype": "link", + "options": "Warehouse", + "width": 150 + }, + { + "fieldname": "no_of_jobs_completed", + "label": _("No of Jobs Completed"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "total_billable_hours", + "label": _("Total Billable Hours"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "total_standard_hours", + "label": _("Standard Hours"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "total_work_value", + "label": _("Total Work Value"), + "fieldtype": "Currency", + "width": 150 + }, + { + "fieldname": "job_efficiency", + "label": _("Technician Efficiency (%)"), + "fieldtype": "Float", + "width": 150 + }, + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + + if filters.workshop: + where += ' AND tjc.warehouse = %(workshop)s ' + where_filter.update({"workshop": filters.workshop}) + + if filters.technician: + where += ' AND tmst.technician = %(technician)s ' + where_filter.update({"technician": filters.technician}) + + + data = frappe.db.sql('''SELECT + tmst.technician, + tabEmployee.employee_name, + tjc.warehouse AS workshop, + COUNT(tmst.name) AS no_of_jobs_completed, + SUM(tmst.billable_hours) AS total_billable_hours, + SUM(tmst.standard_hours) AS total_standard_hours, + SUM(tmst.standard_cost * tmst.billable_hours) as total_work_value, + (SUM(tmst.billable_hours) / SUM(tmst.standard_hours)) * 100 AS job_efficiency + FROM + (`tabMaintenance Services Table` tmst) + LEFT JOIN + (`tabJob Card` tjc) ON (tmst.parent = tjc.name) + LEFT JOIN + tabEmployee ON tabEmployee.name = tmst.technician + WHERE + tmst.start_date BETWEEN %(from_date)s AND %(to_date)s AND tjc.docstatus = 1 + AND tmst.service_status = 'Fully Completed' '''+ where + ''' + GROUP BY + tmst.technician, tjc.warehouse + ''', + where_filter, as_list=1); + return columns, data diff --git a/csf_tz/bank_api.py b/csf_tz/bank_api.py new file mode 100644 index 0000000..44808ae --- /dev/null +++ b/csf_tz/bank_api.py @@ -0,0 +1,449 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Youssef Restom and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +import json +import requests +from frappe.utils import get_host_name, flt +from time import sleep +import binascii +import os +from werkzeug import url_fix +import urllib.parse as urlparse +from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry +from frappe.utils.background_jobs import enqueue +from datetime import datetime +from frappe.utils.password import get_decrypted_password +from csf_tz.csf_tz.doctype.csf_api_response_log.csf_api_response_log import add_log + + +class ToObject(object): + def __init__(self, data): + self.__dict__ = json.loads(data) + + +def set_callback_token(doc, method): + send_fee_details_to_bank = ( + frappe.get_value("Company", doc.company, "send_fee_details_to_bank") or 0 + ) + if not send_fee_details_to_bank: + return + doc.callback_token = binascii.hexlify(os.urandom(14)).decode() + series = frappe.get_value("Company", doc.company, "nmb_series") or "" + if not series: + frappe.throw(_("Please set NMB User Series in Company {0}".format(doc.company))) + reference = str(series) + "F" + str(doc.name) + if not doc.abbr: + doc.abbr = frappe.get_value("Company", doc.company, "abbr") or "" + doc.bank_reference = reference.replace("-", "").replace("FEE" + doc.abbr, "") + if method == "invoice_submission": + doc.save() + frappe.db.commit() + + +def get_nmb_token(company): + url = frappe.get_value("Company", company, "nmb_url") + if not url: + frappe.throw(_("Please set NMB URL in Company {0}".format(company))) + url = url + str("auth") + username = frappe.get_value("Company", company, "nmb_username") + if not username: + frappe.throw(_("Please set NMB User Name in Company {0}".format(company))) + password = get_decrypted_password("Company", company, "nmb_password") + if not password: + frappe.throw(_("Please set NMB Password in Company {0}".format(company))) + data = { + "username": username, + "password": password, + } + for i in range(3): + try: + r = requests.post(url, data=json.dumps(data), timeout=5) + r.raise_for_status() + frappe.logger().debug({"get_nmb_token webhook_success": r.text}) + if json.loads(r.text): + add_log( + request_type="NMB token", + request_url=url, + request_header="no header", + request_body=json.dumps(data), + response_data=json.loads(r.text), + ) + if json.loads(r.text)["status"] == 1: + return json.loads(r.text)["token"] + else: + frappe.throw(json.loads(r.text)) + except Exception as e: + frappe.logger().debug({"get_nmb_token webhook_error": e, "try": i + 1}) + sleep(3 * i + 1) + if i != 2: + continue + else: + raise e + + +def send_nmb(method, data, company): + url = frappe.get_value("Company", company, "nmb_url") + if not url: + frappe.throw(_("Please set NMB URL in Company {0}".format(company))) + data["token"] = get_nmb_token(company) + url = url + str(method) + for i in range(3): + try: + r = requests.post(url, data=json.dumps(data), timeout=5) + r.raise_for_status() + frappe.logger().debug({"send_nmb webhook_success": r.text}) + if json.loads(r.text): + add_log( + request_type="NMB " + method, + request_url=url, + request_header="no header", + request_body=json.dumps(data), + response_data=json.loads(r.text), + ) + if json.loads(r.text)["status"] == 1: + frappe.msgprint( + "Response from bank:

" + json.loads(r.text)["description"] + ) + return json.loads(r.text) + else: + print(json.loads(r.text)["description"]) + if json.loads(r.text)["description"] == "Duplicate Invoice Number": + return json.loads(r.text) + frappe.msgprint( + "Error detected at bank:

" + + json.loads(r.text)["description"] + ) + frappe.throw(json.loads(r.text)) + except Exception as e: + frappe.logger().debug({"send_nmb webhook_error": e, "try": i + 1}) + sleep(3 * i + 1) + if i != 2: + continue + else: + raise e + + +@frappe.whitelist() +def invoice_submission(doc=None, method=None, fees_name=None): + send_fee_details_to_bank = ( + frappe.get_value("Company", doc.company, "send_fee_details_to_bank") or 0 + ) + if not send_fee_details_to_bank: + return + if not doc and fees_name: + doc = frappe.get_doc("Fees", fees_name) + if not doc.callback_token: + frappe.msgprint( + _( + "This fee is not set with a token to be sent to the Bank. Generating the token..." + ), + alert=True, + ) + set_callback_token(doc, "invoice_submission") + series = frappe.get_value("Company", doc.company, "nmb_series") or "" + abbr = frappe.get_value("Company", doc.company, "abbr") or "" + if not series: + frappe.throw(_("Please set NMB User Series in Company {0}".format(doc.company))) + data = { + "reference": doc.bank_reference, + "student_name": doc.student_name, + "student_id": doc.student, + "amount": doc.grand_total, + "type": "Fees Invoice", + "code": 10, + "allow_partial": "FALSE", + "callback_url": "https://" + + get_host_name() + + "/api/method/csf_tz.bank_api.receive_callback?token=" + + doc.callback_token, + } + send_nmb("invoice_submission", data, doc.company) + + +@frappe.whitelist(allow_guest=True) +def receive_callback(*args, **kwargs): + r = frappe.request + uri = url_fix(r.url.replace("+", " ")) + # http_method = r.method + body = r.get_data() + # headers = r.headers + message = {} + if body: + data = body.decode("utf-8") + msgs = ToObject(data) + atr_list = list(msgs.__dict__) + for atr in atr_list: + if getattr(msgs, atr): + message[atr] = getattr(msgs, atr) + else: + frappe.throw("This has no body!") + parsed_url = urlparse.urlparse(uri) + message["fees_token"] = parsed_url[4][6:] + message["doctype"] = "NMB Callback" + nmb_doc = frappe.get_doc(message) + + if nmb_doc.insert(ignore_permissions=True): + frappe.response["status"] = 1 + frappe.response["description"] = "success" + else: + frappe.response["description"] = "insert failed" + frappe.response["http_status_code"] = 409 + + enqueue( + method=make_payment_entry, + queue="short", + timeout=10000, + is_async=True, + kwargs=nmb_doc, + ) + + +def make_payment_entry(method="callback", **kwargs): + for key, value in kwargs.items(): + nmb_doc = value + doc_info = get_fee_info(nmb_doc.reference) + accounts = get_fees_default_accounts(doc_info["company"]) + + nmb_amount = flt(nmb_doc.amount) + frappe.flags.ignore_account_permission = True + if doc_info["doctype"] == "Fees": + if method == "callback": + frappe.set_user("Administrator") + fees_name = doc_info["name"] + bank_reference = frappe.get_value("Fees", fees_name, "bank_reference") + if bank_reference == nmb_doc.reference: + payment_entry = get_payment_entry( + "Fees", fees_name, party_amount=nmb_amount + ) + payment_entry.update( + { + "reference_no": nmb_doc.reference, + "reference_date": nmb_doc.timestamp, + "remarks": "Payment Entry against {0} {1} via NMB Bank Payment {2}".format( + "Fees", fees_name, nmb_doc.reference + ), + "paid_to": accounts["bank"], + } + ) + payment_entry.flags.ignore_permissions = True + # payment_entry.references = [] + # payment_entry.set_missing_values() + payment_entry.save() + payment_entry.submit() + return nmb_doc + + elif doc_info["doctype"] == "Student Applicant Fees": + doc = frappe.get_doc("Student Applicant Fees", doc_info["name"]) + if not doc.callback_token == nmb_doc.fees_token: + return + # Below remarked after introducing VFD in AV solutions + # jl_rows = [] + # debit_row = dict( + # account=accounts["bank"], + # debit_in_account_currency=nmb_amount, + # account_currency=accounts["currency"], + # cost_center=doc.cost_center, + # ) + # jl_rows.append(debit_row) + + # credit_row_1 = dict( + # account=accounts["income"], + # credit_in_account_currency=nmb_amount, + # account_currency=accounts["currency"], + # cost_center=doc.cost_center, + # ) + # jl_rows.append(credit_row_1) + + # user_remark = ( + # "Journal Entry against {0} {1} via NMB Bank Payment {2}".format( + # "Student Applicant Fees", doc_info["name"], nmb_doc.reference + # ) + # ) + # jv_doc = frappe.get_doc( + # dict( + # doctype="Journal Entry", + # posting_date=nmb_doc.timestamp, + # accounts=jl_rows, + # company=doc.company, + # multi_currency=0, + # user_remark=user_remark, + # ) + # ) + + # jv_doc.flags.ignore_permissions = True + # frappe.flags.ignore_account_permission = True + # jv_doc.save() + # jv_doc.submit() + # jv_url = frappe.utils.get_url_to_form(jv_doc.doctype, jv_doc.name) + # si_msgprint = "Journal Entry Created {1}".format( + # jv_url, jv_doc.name + # ) + # frappe.msgprint(_(si_msgprint)) + frappe.db.set_value( + "Student Applicant", doc.student, "application_status", "Approved" + ) + return nmb_doc + + +@frappe.whitelist(allow_guest=True) +def receive_validate_reference(*args, **kwargs): + r = frappe.request + # uri = url_fix(r.url.replace("+"," ")) + # http_method = r.method + body = r.get_data() + # headers = r.headers + message = {} + if body: + data = body.decode("utf-8") + msgs = ToObject(data) + atr_list = list(msgs.__dict__) + for atr in atr_list: + if getattr(msgs, atr): + message[atr] = getattr(msgs, atr) + else: + frappe.throw("This has no body!") + + doc_info = get_fee_info(message["reference"]) + if doc_info["name"]: + doc = frappe.get_doc(doc_info["doctype"], doc_info["name"]) + response = dict( + status=1, + reference=doc.bank_reference, + student_name=doc.student_name, + student_id=doc.student, + amount=doc.grand_total, + type="Fees Invoice", + code=10, + allow_partial="FALSE", + callback_url="https://" + + get_host_name() + + "/api/method/csf_tz.bank_api.receive_callback?token=" + + doc.callback_token, + token=message["token"], + ) + return response + else: + frappe.response["status"] = 0 + frappe.response["description"] = "Not Exist" + + +def cancel_invoice(doc, method): + send_fee_details_to_bank = ( + frappe.get_value("Company", doc.company, "send_fee_details_to_bank") or 0 + ) + if not send_fee_details_to_bank: + return + data = { + "reference": str(doc.bank_reference), + } + message = send_nmb("invoice_cancel", data, doc.company) + frappe.msgprint(str(message)) + + +def reconciliation(doc=None, method=None): + companys = frappe.get_all("Company") + for company in companys: + if not frappe.get_value("Company", company["name"], "nmb_username"): + continue + data = {"reconcile_date": datetime.today().strftime("%d-%m-%Y")} + frappe.msgprint(str(data)) + message = send_nmb("reconcilliation", data, company["name"]) + if message["status"] == 1 and len(message["transactions"]) > 0: + for i in message["transactions"]: + if ( + len( + frappe.get_all( + "NMB Callback", + filters=[ + ["NMB Callback", "reference", "=", i.reference], + ["NMB Callback", "receipt", "=", i.receipt], + ], + fields=["name"], + ) + ) + == 1 + ): + doc_info = get_fee_info(message["reference"]) + if doc_info["name"]: + message["fees_token"] = frappe.get_value( + doc_info["doctype"], doc_info["name"], "callback_token" + ) + message["doctype"] = "NMB Callback" + nmb_doc = frappe.get_doc(message) + enqueue( + method=make_payment_entry, + queue="short", + timeout=10000, + is_async=True, + kwargs=nmb_doc, + ) + + +def get_fee_info(bank_reference): + data = {"name": "", "doctype": ""} + doc_list = frappe.get_all( + "Fees", + filters=[ + ["Fees", "bank_reference", "=", bank_reference], + ["Fees", "docstatus", "=", 1], + ], + fields=["name", "company"], + ) + if len(doc_list): + data["name"] = doc_list[0]["name"] + data["doctype"] = "Fees" + data["company"] = doc_list[0]["company"] + return data + else: + doc_list = frappe.get_all( + "Student Applicant Fees", + filters=[ + ["Student Applicant Fees", "bank_reference", "=", bank_reference], + ["Student Applicant Fees", "docstatus", "=", 1], + ], + fields=["name", "company"], + ) + if len(doc_list): + data["name"] = doc_list[0]["name"] + data["doctype"] = "Student Applicant Fees" + data["company"] = doc_list[0]["company"] + return data + + +def get_fees_default_accounts(company): + data = {"bank": "", "income": "", "currency": ""} + data["currency"] = frappe.get_value("Company", company, "default_currency") or "" + data["bank"] = frappe.get_value("Company", company, "fee_bank_account") or "" + if not data["bank"]: + data["bank"] = ( + frappe.get_value("Company", company, "default_bank_account") or "" + ) + data["income"] = ( + frappe.get_value("Company", company, "student_applicant_fees_revenue_account") + or "" + ) + if not data["income"]: + data["bank"] = ( + frappe.get_value("Company", company, "default_income_account") or "" + ) + if not data["bank"]: + frappe.throw(_("Please set Fee Bank Account in Company {0}".format(company))) + if not data["income"]: + frappe.throw( + _( + "Please set Student Applicant Fees Revenue Account in Company {0}".format( + company + ) + ) + ) + return data + + +@frappe.whitelist() +def make_payment_entry_from_call(docname): + nmb_doc = frappe.get_doc("NMB Callback", docname) + make_payment_entry(method="frontend", kwargs=nmb_doc) diff --git a/csf_tz/bench-restart.sh b/csf_tz/bench-restart.sh new file mode 100644 index 0000000..7af1dd8 --- /dev/null +++ b/csf_tz/bench-restart.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +bench restart +bench clear-cache diff --git a/csf_tz/bloodbank-push.sh b/csf_tz/bloodbank-push.sh new file mode 100644 index 0000000..b21d95e --- /dev/null +++ b/csf_tz/bloodbank-push.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd apps/bloodbank/ +git pull upstream master +git status diff --git a/csf_tz/check-all-git.sh b/csf_tz/check-all-git.sh new file mode 100644 index 0000000..5f9aaf5 --- /dev/null +++ b/csf_tz/check-all-git.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +for dir in apps/* ; do + if [ -d "$dir" ]; then + echo "$dir" + cd $dir + git status + cd ../.. + fi +done + diff --git a/csf_tz/check-git.sh b/csf_tz/check-git.sh new file mode 100644 index 0000000..025773e --- /dev/null +++ b/csf_tz/check-git.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd apps +cd $1 +git diff diff --git a/csf_tz/clear-cache.sh b/csf_tz/clear-cache.sh new file mode 100644 index 0000000..937b81e --- /dev/null +++ b/csf_tz/clear-cache.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +bench clear-cache diff --git a/csf_tz/clearing_and_forwarding/__init__.py b/csf_tz/clearing_and_forwarding/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/__init__.py b/csf_tz/clearing_and_forwarding/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/bond/__init__.py b/csf_tz/clearing_and_forwarding/doctype/bond/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/bond/bond.js b/csf_tz/clearing_and_forwarding/doctype/bond/bond.js new file mode 100644 index 0000000..63c5796 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond/bond.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Bond', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/bond/bond.json b/csf_tz/clearing_and_forwarding/doctype/bond/bond.json new file mode 100644 index 0000000..3ab4c83 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond/bond.json @@ -0,0 +1,336 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:reference_no", + "beta": 0, + "creation": "2017-06-16 15:43:39.697040", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Bond Reference Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 1 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bond_value", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "no_of_packages", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "No of Packages", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_bond_history", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Cancellation History", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bond_history", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Bond History Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_references", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Doctype", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Docname", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-11-21 18:38:33.249955", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Bond", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/bond/bond.py b/csf_tz/clearing_and_forwarding/doctype/bond/bond.py new file mode 100644 index 0000000..07c6f21 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond/bond.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Bond(Document): + pass + +@frappe.whitelist(allow_guest=True) +def cancel_bond(bond_ref, no_of_packages, cancel_date, cancel_doctype, cancel_docname): + existing_bond = frappe.get_value("Bond", {"reference_no": bond}) + if existing_bond: + bond = frappe.get_doc('Bond', existing_bond) + #Check if it has been cancelled + existing_cancel_ref = False + if bond.bond_history: + for cancel_history in bond.bond_history: + if cancel_history.reference_doctype == cancel_doctype and cancel_history.reference_docname == cancel_docname: + check_total_bundles(bond, no_of_packages, cancel_history.name) + cancel_history.set('no_of_packages', no_of_packages) + cancel_history.set('date', cancel_date) + doc.db_set('bond_history', bond.bond_history) + existing_cancel_ref = True + elif not bond.bond_history or existing_cancel_ref == False: + check_total_bundles(bond, no_of_packages) + new_bond_history = {'date': cancel_date, 'no_of_bundles': no_of_packages, 'reference_doctype': cancel_doctype, 'reference_docname': cancel_docname} + doc.db_set('bond_history', [new_bond_history]) + + +def check_total_bundles(doc, no_of_packages, exclude=None): + if doc.bond_history: + total_cancelled = 0 + for cancellation in doc.bond_history: + if not exclude or (exclude and cancellation.name != exclude): + total_cancelled = total_cancelled + float(cancellation.no_of_bundles) + + if (total_cancelled + no_of_packages) > doc.no_of_packages: + frappe.throw("Error: The number of cancelled bond bundles is greater than the number of bundles in the bond.") + + +@frappe.whitelist(allow_guest=True) +def create_update_bond(**args): + args = frappe._dict(args) + + existing_bond = frappe.db.get_value("Bond", + {"reference_no": args.reference_no}) + + #If existing, update value and no of packages information + if existing_bond: + doc = frappe.get_doc("Bond", existing_bond) + doc.db_set("bond_value", args.bond_value) + doc.db_set("no_of_packages", args.no_of_packages) + doc.db_set("cargo", args.cargo) + return doc + else: + new_bond = frappe.new_doc("Bond") + new_bond.update({ + "reference_no": args.reference_no, + "bond_value": args.bond_value, + "no_of_packages": args.no_of_packages, + "cargo": args.cargo, + "reference_doctype": args.reference_doctype, + "reference_docname": args.reference_docname + }) + new_bond.insert(ignore_permissions=True) + return new_bond diff --git a/csf_tz/clearing_and_forwarding/doctype/bond/test_bond.js b/csf_tz/clearing_and_forwarding/doctype/bond/test_bond.js new file mode 100644 index 0000000..29f383f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond/test_bond.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Bond", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Bond + () => frappe.tests.make('Bond', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/bond/test_bond.py b/csf_tz/clearing_and_forwarding/doctype/bond/test_bond.py new file mode 100644 index 0000000..be172d1 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond/test_bond.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestBond(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/bond_history_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/bond_history_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/bond_history_table/bond_history_table.json b/csf_tz/clearing_and_forwarding/doctype/bond_history_table/bond_history_table.json new file mode 100644 index 0000000..2e153d6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond_history_table/bond_history_table.json @@ -0,0 +1,163 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-07-01 19:52:32.335125", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reference Document", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reference Document Name", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "no_of_bundles", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "No of Bundles", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-07-01 19:54:36.101510", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Bond History Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/bond_history_table/bond_history_table.py b/csf_tz/clearing_and_forwarding/doctype/bond_history_table/bond_history_table.py new file mode 100644 index 0000000..b323573 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond_history_table/bond_history_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BondHistoryTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/bond_reference_table.json b/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/bond_reference_table.json new file mode 100644 index 0000000..a738324 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/bond_reference_table.json @@ -0,0 +1,161 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-07-25 19:08:03.326735", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customs_ref_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Customs Reference Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "number_of_bundles", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Number of Bundles", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Weight (kg)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bond_value", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Bond Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-05-24 14:49:44.224136", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Bond Reference Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/bond_reference_table.py b/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/bond_reference_table.py new file mode 100644 index 0000000..4661c46 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/bond_reference_table/bond_reference_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BondReferenceTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/border_clearance/__init__.py b/csf_tz/clearing_and_forwarding/doctype/border_clearance/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.js b/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.js new file mode 100644 index 0000000..2239b0a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.js @@ -0,0 +1,380 @@ +// Copyright (c) 2017, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Border Clearance', { + refresh: function(frm) { + console.log(frappe); + frm.events.show_hide_sections(frm); + frm.events.new_fund_request(frm); + frm.events.billing_type(frm); + }, + + after_save: function(frm){ + frm.reload_doc(); + }, + + billing_type: function(frm){ + //frm.events.show_hide_sections(frm); + //If for later billing only show clearance information with no trip references + /*if(frm.doc.billing_type && frm.doc.billing_type != "") + { + frm.toggle_display('trip_reference_no', true); + frm.toggle_display('main_return_select', true); + //frm.toggle_display(['section_exit_border', 'section_entry_border', 'section_border3', 'section_border4'], true); + frm.toggle_display('clearance_type', true); + frm.toggle_display(['location', 'documents_received', 'documents_submitted_by_driver', 'documents_submitted_by_driver_time', 'cargo_type'], true); + }*/ + }, + + no_of_borders: function(frm){ + frm.events.show_hide_sections(frm); + }, + + clearance_type: function(frm){ + if(frm.doc.clearance_type != "") + { + //Load default border procedures + /*frm.clear_table('procedures'); + frappe.model.with_doc('Border Procedures', 'DEFAULT', function(){ + var reference_doc = frappe.model.get_doc('Border Procedures', 'DEFAULT'); + var table = null; + if(frm.doc.clearance_type == 'Entry') + { + table = reference_doc.border_entry; + } + else if(frm.doc.clearance_type == 'Exit') + { + table = reference_doc.border_exit; + } + table.forEach(function(row){ + var new_row = frm.add_child('procedures'); + new_row.procedure = row.procedure; + }); + });*/ + + + //Load required permits according to cargo details + if(frm.doc.clearance_type && frm.doc.clearance_type != "") + { + frm.clear_table('required_permits'); + var goods_description = null; + if(frm.doc.cargo_type == "Container") + { + goods_description = frm.doc.cargo_category; + } + else if(frm.doc.cargo_type == "Loose Cargo") + { + goods_description = frm.doc.loose_cargo_category; + } + + if(goods_description) + { + frappe.model.with_doc('Cargo Type', goods_description, function(){ + var reference_doc = frappe.model.get_doc('Cargo Type', goods_description); + var table = null; + if(frm.doc.clearance_type == "Entry") + { + table = reference_doc.border_entry; + } + else if(frm.doc.clearance_type == "Exit") + { + table = reference_doc.border_exit + } + table.forEach(function(row){ + var new_row = frm.add_child('required_permits'); + new_row.description = row.permit_name; + }); + }); + } + } + + frappe.after_ajax(function(){ + frm.refresh_fields(); + }); + } + }, + + cargo_reference_no: function(frm){ + frm.clear_table('cargo_details'); + frm.clear_table('required_permits'); + var cargo = frm.doc.cargo_reference_no; + + //Load the cargo details + frappe.model.with_doc('Cargo Details', cargo, function(){ + var reference_doc = frappe.model.get_doc('Cargo Details', cargo); + var new_row = frm.add_child('cargo_details'); + new_row.container_number = reference_doc.container_number; + new_row.container_size = reference_doc.container_size; + new_row.seal_number = reference_doc.seal_number; + new_row.cargo_status = reference_doc.cargo_status; + new_row.no_of_packages = reference_doc.no_of_packages; + new_row.goods_description = reference_doc.goods_description; + new_row.gross_weight = reference_doc.gross_weight; + new_row.net_weight = reference_doc.net_weight; + new_row.tare_weight = reference_doc.tare_weight; + + //Load required permits according to cargo details + if(frm.doc.clearance_type && frm.doc.clearance_type != "") + { + var goods_description = reference_doc.goods_description; + frappe.model.with_doc('Cargo Type', goods_description, function(){ + var reference_doc = frappe.model.get_doc('Cargo Type', goods_description); + var table = null; + if(frm.doc.clearance_type == "Entry") + { + table = reference_doc.border_entry; + } + else if(frm.doc.clearance_type == "Exit") + { + table = reference_doc.border_exit + } + table.forEach(function(row){ + var new_row = frm.add_child('required_permits'); + new_row.description = row.permit_name; + }); + }); + } + }); + + frappe.after_ajax(function(){ + frm.refresh_fields(); + }); + }, + + trip_reference_no: function(frm){ + frm.events.check_trip(frm); + }, + + main_return_select: function(frm){ + frm.events.check_trip(frm); + }, + + cargo_type: function(frm){ + frm.events.show_hide_sections(frm); + }, + + cargo_category: function(frm){ + frm.events.show_hide_sections(frm); + }, + + cargo_description: function(frm){ + frm.events.show_hide_sections(frm); + }, + + cargo_details: function(frm){ + frm.events.show_hide_sections(frm); + }, + + loose_cargo_category: function(frm){ + frm.events.show_hide_sections(frm); + }, + + goods_description: function(frm){ + frm.events.show_hide_sections(frm); + }, + + goods_quantity: function(frm){ + frm.events.show_hide_sections(frm); + }, + + goods_unit: function(frm){ + frm.events.show_hide_sections(frm); + }, + + transporter_type: function(frm){ + frm.events.show_hide_sections(frm); + }, + + //Check if the referenced trip already has a border clearing record associated with it + check_trip: function(frm){ + if((frm.doc.trip_reference_no && frm.doc.trip_reference_no != "") && (frm.doc.main_return_select && frm.doc.main_return_select != "")) + { + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.border_clearance.border_clearance.check_existing", + args: { + "trip_reference": frm.doc.trip_reference_no, + "main_return_select": frm.doc.main_return_select + }, + callback: function(data){ + if(data.message == "Exists") + { + msgprint("The trip you entered already has a border clearance asociated with it.", "Error"); + } + else if(data.message == "Not Exist") + { + //Load cargo information + frappe.model.with_doc('Vehicle Trip', cur_frm.doc.trip_reference_no, function(){ + var reference_doc = frappe.model.get_doc('Vehicle Trip', cur_frm.doc.trip_reference_no); + + //Load transporter information + if(reference_doc.transporter_type == "Bravo") + { + cur_frm.set_value('transporter_type', 'Bravo'); + cur_frm.toggle_display('transporter_name', false); + } + else + { + cur_frm.set_value('transporter_type', 'Other'); + cur_frm.set_value('transporter_name', reference_doc.sub_contractor); + cur_frm.toggle_display('transporter_name', true); + } + + //Load vehicle and trailer information + cur_frm.set_value('vehicle_plate_number', reference_doc.vehicle_plate_number); + cur_frm.set_value('driver_name', reference_doc.driver_name); + cur_frm.set_value('trailer_plate_number', reference_doc.trailer_plate_number); + + //Load the variables depending if it is main or return trip + if(frm.doc.main_return_select == "Main Trip") + { + cur_frm.set_value('cargo_type', reference_doc.main_cargo_type); + cur_frm.set_value('reference_trip_route', reference_doc.main_route); + cur_frm.set_value('cargo_category', reference_doc.main_cargo_category); + cur_frm.set_value('cargo_description', reference_doc.main_goods_description); + cur_frm.set_value('border1_clearing_agent', reference_doc.main_border1_clearing); + cur_frm.set_value('border2_clearing_agent', reference_doc.main_border2_clearing); + cur_frm.set_value('border3_clearing_agent', reference_doc.main_border3_clearing); + if(reference_doc.main_cargo_type == "Container") + { + cur_frm.clear_table('cargo_details'); + var new_row = cur_frm.add_child('cargo_details'); + reference_doc.main_cargo.forEach(function(row){ + new_row.container_number = row.container_number; + new_row.container_size = row.container_size; + new_row.seal_number = row.seal_number; + new_row.status = row.status; + new_row.no_of_packages = row.no_of_packages; + new_row.gross_weight = row.gross_weight; + new_row.net_weight = row.net_weight; + new_row.tare_weight = row.tare_weight; + }); + } + else if(reference_doc.main_cargo_type == "Loose Cargo") + { + cur_frm.set_value('loose_cargo_category', reference_doc.main_cargo_category); + cur_frm.set_value('goods_description', reference_doc.main_goods_description); + cur_frm.set_value('goods_quantity', reference_doc.main_amount); + cur_frm.set_value('goods_unit', reference_doc.main_unit); + } + } + else if(frm.doc.main_return_select == "Return Trip") + { + cur_frm.set_value('cargo_type', reference_doc.return_cargo_type); + cur_frm.set_value('reference_trip_route', reference_doc.return_route); + cur_frm.set_value('cargo_category', reference_doc.return_cargo_category); + cur_frm.set_value('cargo_description', reference_doc.return_goods_description); + cur_frm.set_value('border1_clearing_agent', reference_doc.return_border1_clearing); + cur_frm.set_value('border2_clearing_agent', reference_doc.return_border2_clearing); + cur_frm.set_value('border3_clearing_agent', reference_doc.return_border3_clearing); + if(reference_doc.return_cargo_type == "Container") + { + cur_frm.clear_table('cargo_details'); + var new_row = cur_frm.add_child('cargo_details'); + reference_doc.return_cargo.forEach(function(row){ + new_row.container_number = row.container_number; + new_row.container_size = row.container_size; + new_row.seal_number = row.seal_number; + new_row.status = row.status; + new_row.no_of_packages = row.no_of_packages; + new_row.gross_weight = row.gross_weight; + new_row.net_weight = row.net_weight; + new_row.tare_weight = row.tare_weight; + }); + } + else if(reference_doc.return_cargo_type == "Loose Cargo") + { + cur_frm.set_value('loose_cargo_category', reference_doc.main_cargo_category); + cur_frm.set_value('goods_description', reference_doc.return_goods_description); + cur_frm.set_value('goods_quantity', reference_doc.return_amount); + cur_frm.set_value('goods_unit', reference_doc.return_unit); + } + } + }); + } + } + }); + + frappe.after_ajax(function(){ + cur_frm.refresh_fields(); + cur_frm.events.reference_trip_route(cur_frm); + }); + } + + frm.events.show_hide_sections(frm); + frm.events.clearance_type(frm); + }, + + reference_trip_route: function(frm){ + if(frm.doc.reference_trip_route && frm.doc.reference_trip_route != "") + { + var no_of_borders = 0; + frappe.model.with_doc('Trip Route', frm.doc.reference_trip_route, function(){ + var reference_doc = frappe.model.get_doc('Trip Route', frm.doc.reference_trip_route); + reference_doc.trip_steps.forEach(function(row){ + if(1 == row.is_local_border) + { + no_of_borders++; + cur_frm.set_value('local_border', 'Border ' + no_of_borders); + cur_frm.set_value('border' + no_of_borders + '_name', row.location); + } + else if(1 == row.is_international_border) + { + no_of_borders++; + cur_frm.set_value('border' + no_of_borders + '_name', row.location); + } + }); + }); + cur_frm.set_value('no_of_borders', no_of_borders); + } + frm.events.show_hide_sections(frm); + }, + + show_hide_sections: function(frm){ + //frm.toggle_display('section_basic_details', (frm.doc.billing_type && frm.doc.billing_type != '')); + + //if cargo is not entered + var cargo_entered = false; + if(frm.doc.cargo_type && frm.doc.cargo_type == 'Loose Cargo' && frm.doc.loose_cargo_category && frm.doc.goods_description && frm.doc.goods_quantity && frm.doc.goods_unit) + { + cargo_entered = true; + } + else if(frm.doc.cargo_type && frm.doc.cargo_type == "Container" && frm.doc.cargo_category && frm.doc.cargo_description && frm.doc.cargo_details && frm.doc.cargo_details.length > 0) + { + cargo_entered = true; + } + frm.toggle_display(['section_extra_details', 'section_reporting_status'], cargo_entered); + frm.toggle_display('section_container_cargo_details', (frm.doc.cargo_type && frm.doc.cargo_type == 'Container')); + frm.toggle_display('section_loose_cargo_details', (frm.doc.cargo_type && frm.doc.cargo_type == 'Loose Cargo')); + frm.toggle_display('section_exit_border', (frm.doc.no_of_borders && frm.doc.no_of_borders > 0) && cargo_entered); + frm.toggle_display('section_entry_border', (frm.doc.no_of_borders && frm.doc.no_of_borders > 1) && cargo_entered); + frm.toggle_display('section_border3', (frm.doc.no_of_borders && frm.doc.no_of_borders > 2) && cargo_entered); + frm.toggle_display('section_border4', (frm.doc.no_of_borders && frm.doc.no_of_borders > 3) && cargo_entered); + frm.toggle_display(['section_required_permits', 'section_bond_information', 'section_requested_funds', 'section_expenses', 'section_attachments', 'section_customer_consignee', 'section_transporter_details', 'section_cargo_origin_destination', 'section_clearing_procedures'], (frm.doc.billing_type && frm.doc.billing_type != "")); + frm.toggle_display(['section_required_permits', 'section_bond_information', 'section_requested_funds', 'section_expenses', 'section_attachments', 'section_customer_consignee', 'section_transporter_details', 'section_cargo_origin_destination', 'section_clearing_procedures'], cargo_entered); + frm.toggle_display('section_expenses', (frm.doc.requested_funds && frm.doc.requested_funds.length > 0)); + frm.toggle_display('transporter_name', (frm.doc.transporter_type && frm.doc.transporter_type != "Bravo")); + } + +}); + +frappe.ui.form.on('Cargo Details', { + cargo_details_add: function(frm){ + frm.events.show_hide_sections(frm); + } +}); + +cur_frm.set_query('location', function(frm){ + return{ + filters: [ + ['Locations', 'location_type', '=', 'Border Post'] + ] + } +}); + +cur_frm.set_query('trip_reference_no', function(frm){ + return{ + filters: [ + ['Vehicle Trip', 'status', '!=', 'Closed'] + ] + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.json b/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.json new file mode 100644 index 0000000..c703e02 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.json @@ -0,0 +1,4071 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "BORDER.###", + "beta": 0, + "creation": "2017-05-25 15:41:52.421991", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "billing_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Billing Type", + "length": 0, + "no_copy": 0, + "options": "\nCurrent Billing\nLater Billing", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_basic_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Basic Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "location", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Location", + "length": 0, + "no_copy": 0, + "options": "Locations", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documents_received", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Received Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "crn_reference_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "CRN Reference Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "no_of_borders", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Number of Borders", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documents_submitted_by_driver", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Submitted by Driver (Date)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documents_submitted_by_driver_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Submitted by Driver (Time)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "clearance_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearance Type", + "length": 0, + "no_copy": 0, + "options": "\nEntry\nExit\nPass Through", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "options": "\nContainer\nLoose Cargo", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_container_cargo_details", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Category", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_loose_cargo_details", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loose_cargo_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Category", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "goods_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Goods Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "goods_quantity", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "goods_unit", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Unit", + "length": 0, + "no_copy": 0, + "options": "Unit of Measure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_21", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loose_sub_t1_ref", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sub-T1 Ref No.", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loose_bond_value", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sub-T1 Bond Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loose_gross_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Gross Weight (kg)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loose_net_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Weight (kg)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_customer_consignee", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Client & Consignee Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "client", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Client", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_84", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "consignee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_transporter_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transporter Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transporter_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transporter", + "length": 0, + "no_copy": 0, + "options": "Bravo\nOther", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transporter_name", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transporter Name", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_85", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trailer_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trailer Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driver_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Driver Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_cargo_origin_destination", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Origin and Destination", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_origin_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Origin Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_origin_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Origin City", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_origin_exact", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Origin (Exact Place)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_90", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_destination_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_destination_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination City", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_destination_exact", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination (Exact Location)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_exit_border", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 1", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_name", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Name", + "length": 0, + "no_copy": 0, + "options": "Trip Location", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_clearing_agent", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_documents_submitted", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Submitted to Agent (Date)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_documents_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents received By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_22", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_arrival", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_departure", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border1_crossing", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Crossing Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_entry_border", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 2", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_clearing_agent", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_documents_submitted", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Submitted to Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_documents_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Received By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_28", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_arrival", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_departure", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border2_crossing", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Crossing Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_border3", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 3", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_clearing_agent", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_documents_submitted", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Submitted to Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_documents_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Received By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_58", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_arrival", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_departure", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border3_crossing", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Crossing Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_border4", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 4", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_clearing_agent", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_documents_submitted", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Submitted to Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_documents_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents Received By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_66", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_arrival", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_departure", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border4_crossing", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Crossing Date & Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_clearing_procedures", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Procedures", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "procedures", + "fieldtype": "Table", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Import Border Procedure Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "manifest_creation_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manifest Creation Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "manifest_approval_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manifest Approval Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "manifest_approval_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manifest Approval Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customs_assessment_submited", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Assessment Submission Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "final_assessment_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Final Assessment Received Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "tansad_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "TANSAD Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_29", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "verification_sealing_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verification & Sealing Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "manifest_comparison_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manifest Comparison Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customs_release_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Release Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodge_for_t1", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge for T1 date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bt_approval_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BT Approval Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_required_permits", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "required_permits", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Permits Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_bond_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BT Reference Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_value", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_78", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_canceled_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Canceled", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "no_of_packages", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "No of Packages", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_requested_funds", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_attachments", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attachments", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "options": "File Attachment", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_reporting_status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reporting_status", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting Status", + "length": 0, + "no_copy": 0, + "options": "Reporting Status Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_extra_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "offloading_point_arrival", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival at Offloading Point", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "offloading_datetime", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Date and Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "closing_remarks", + "fieldtype": "Long Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Closing Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference_trip_route", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Trip Route", + "length": 0, + "no_copy": 0, + "options": "Trip Route", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_72", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "local_border", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Border", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trip_reference_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Trip Reference Number", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_return_select", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main or Return Trip", + "length": 0, + "no_copy": 0, + "options": "\nMain Trip\nReturn Trip", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-05 16:08:19.101492", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Border Clearance", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.py b/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.py new file mode 100644 index 0000000..6e44b39 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_clearance/border_clearance.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from csf_tz.clearing_and_forwarding.doctype.bond.bond import cancel_bond +from csf_tz.after_sales_services.doctype.requested_payments.requested_payments import validate_requested_funds + +class BorderClearance(Document): + from csf_tz.after_sales_services.doctype.reference_payment_table.reference_payment_table import update_child_table + + + def onload(self): + if not self.company: + self.company = frappe.defaults.get_user_default("Company") or frappe.defaults.get_global_default("company") + + def before_save(self): + validate_requested_funds(self) + + +@frappe.whitelist(allow_guest=True) +def create_border_clearance(**args): + args = frappe._dict(args) + + existing_border_clearance = frappe.db.get_value("Border Clearance", + {"file_number": args.file_number}) + + + if existing_border_clearance: + doc = frappe.get_doc("Border Clearance", existing_border_clearance) + doc.db_set("no_of_borders", args.number_of_borders) + doc.db_set("location", args.location) + doc.db_set("documents_received", args.documents_received_date) + doc.db_set("client", args.customer) + return existing_border_clearance + else: + new_border_clearance = frappe.new_doc("Border Clearance") + new_border_clearance.update({ + "no_of_borders":args.number_of_borders, + "location": args.location, + "documents_received": args.documents_received_date, + "client": args.customer, + "file_number": args.file_number + }) + new_border_clearance.insert(ignore_permissions=True) + return new_border_clearance.name + + +@frappe.whitelist(allow_guest=True) +def check_existing(**args): + args = frappe._dict(args) + + existing_clearance = frappe.db.get_value("Border Clearance", + {"trip_reference_no": args.trip_reference, "main_return_select": args.main_return_select}) + + + if existing_clearance: + return "Exists" + else: + return "Not Exist" diff --git a/csf_tz/clearing_and_forwarding/doctype/border_clearance/test_border_clearance.js b/csf_tz/clearing_and_forwarding/doctype/border_clearance/test_border_clearance.js new file mode 100644 index 0000000..4a1fdd6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_clearance/test_border_clearance.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Border Clearance", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Border Clearance + () => frappe.tests.make('Border Clearance', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/border_clearance/test_border_clearance.py b/csf_tz/clearing_and_forwarding/doctype/border_clearance/test_border_clearance.py new file mode 100644 index 0000000..9972246 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_clearance/test_border_clearance.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestBorderClearance(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/border_procedure_table.json b/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/border_procedure_table.json new file mode 100644 index 0000000..ddfe36f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/border_procedure_table.json @@ -0,0 +1,67 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-25 11:32:51.284445", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "procedure", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Procedure", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-04-25 11:34:20.317272", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Border Procedure Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/border_procedure_table.py b/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/border_procedure_table.py new file mode 100644 index 0000000..dd26116 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_procedure_table/border_procedure_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BorderProcedureTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedures/__init__.py b/csf_tz/clearing_and_forwarding/doctype/border_procedures/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.js b/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.js new file mode 100644 index 0000000..f74f0fc --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Border Procedures', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.json b/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.json new file mode 100644 index 0000000..a306d57 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.json @@ -0,0 +1,213 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:procedure_name", + "beta": 0, + "creation": "2017-05-25 20:06:45.518045", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "procedure_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_border_entry", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Entry Procedures", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border_entry", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Border Procedure Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_border_exit", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Exit Procedures", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border_exit", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Border Procedure Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-05-25 20:08:15.396199", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Border Procedures", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.py b/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.py new file mode 100644 index 0000000..118ccd0 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_procedures/border_procedures.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BorderProcedures(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/border_procedures/test_border_procedures.py b/csf_tz/clearing_and_forwarding/doctype/border_procedures/test_border_procedures.py new file mode 100644 index 0000000..90a805b --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_procedures/test_border_procedures.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestBorderProcedures(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/__init__.py b/csf_tz/clearing_and_forwarding/doctype/border_processing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.js b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.js new file mode 100644 index 0000000..f2b6c95 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.js @@ -0,0 +1,110 @@ +// Copyright (c) 2019, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Border Processing', { + refresh: function (frm) { + + }, + + + new_fund_request: function (frm) { + new_request = false + if (frm.doc.requested_funds && frm.doc.requested_funds.length > 0) { + frm.doc.requested_funds.forEach(function (row) { + if (row.request_status == "open") { + new_request = true + } + }) + if (new_request == true) { + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.request_funds", + args: { + reference_doctype: "Border Processing", + reference_docname: cur_frm.doc.name + }, + callback: function (data) { + console.log(data); + } + }) + } + } + }, + + + after_save: function (frm) { + //If there is unrequested funds + frm.events.new_fund_request(frm); + frm.events.toggle_editable_funds_rows(frm); + frm.reload_doc(); + }, + + + toggle_editable_funds_rows: function (frm) { + if (frm.doc.requested_funds && frm.doc.requested_funds.length > 0) { + frm.doc.requested_funds.forEach(function (row) { + if (row.request_status.toUpperCase() != "OPEN") { + //Make fields read only + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_date" + })[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_amount" + })[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_currency" + })[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_description" + })[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "comment" + })[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "requested_for" + })[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "quote_attachment" + })[0].read_only = true; + } else { + //Make fields read only + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_date" + })[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_amount" + })[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_currency" + })[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "request_description" + })[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "comment" + })[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "requested_for" + })[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, { + "fieldname": "quote_attachment" + })[0].read_only = false; + } + }) + } + } +}); + +frappe.ui.form.on("Requested Funds Details", { + requested_funds_add: function(frm, cdt, cdn){ + //Make fields editable + frm.events.toggle_editable_funds_rows(frm); + }, + + before_requested_funds_remove: function(frm, doctype, name) { + var row = frappe.get_doc(doctype, name); + if(row.request_status != 'open') { + msgprint(__("Error: Cannot delete a processed request.")); + throw "Error: cannot delete a processed request"; + } + }, +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.json b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.json new file mode 100644 index 0000000..979eb2f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.json @@ -0,0 +1,664 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "BPR.####", + "beta": 0, + "creation": "2019-09-17 15:10:21.320529", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference_file", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "creation_document_no", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "creation_document_no", + "length": 0, + "no_copy": 0, + "options": "reference_file", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "creation_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Creation Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cross_border_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Cross Border No.", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_2", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_vehicle_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Details", + "length": 0, + "no_copy": 0, + "options": "Border Processing Vehicle Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_date", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dates", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "arrival_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "departure_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "crossing_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Crossing Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_cancellation_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Cancellation Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_fund", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Fund", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2020-01-13 21:12:39.689487", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Border Processing", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.py b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.py new file mode 100644 index 0000000..65933e7 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from csf_tz.after_sales_services.doctype.requested_payments.requested_payments import validate_requested_funds + +class BorderProcessing(Document): + from csf_tz.after_sales_services.doctype.reference_payment_table.reference_payment_table import update_child_table + + def before_save(self): + validate_requested_funds(self) + + def onload(self): + if not self.company: + self.company = frappe.defaults.get_user_default("Company") or frappe.defaults.get_global_default("company") + + + +@frappe.whitelist(allow_guest=True) +def create_border_processing(**args): + + args = frappe._dict(args) + + existing_border_processing = frappe.db.get_value("Border Processing", + {"cross_border_no": args.cross_border_no}) + + if existing_border_processing: + doc = frappe.get_doc("Border Processing", existing_border_processing) + #doc.db_set("no_of_borders", args.number_of_borders) + #doc.db_set("number_of_borders", args.number_of_borders) + #doc.db_set("documents_received", args.documents_received_date) + doc.db_set("customer", args.customer) + return existing_border_processing + else: + new_border_processing = frappe.new_doc("Border Processing") + new_border_processing.update({ + "cross_border_no": args.cross_border_no, + "reference_file": args.doctype, + "creation_document_no": args.file_number, + "customer": args.customer, + }) + new_border_processing.insert(ignore_permissions=True) + return new_border_processing.name + diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing_dashboard.py b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing_dashboard.py new file mode 100644 index 0000000..156118e --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing/border_processing_dashboard.py @@ -0,0 +1,20 @@ +from frappe import _ + +def get_data(): + return { + 'fieldname': 'border_processing', + 'non_standard_fieldnames': { + 'Requested Payments': 'reference_docname', + 'Files':'border_processing_reference', + }, + + 'transactions': [ + + { + 'label': _('Reference'), + 'items': ['Requested Payments','Files'] + }, + + ] + } + \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/test_border_processing.js b/csf_tz/clearing_and_forwarding/doctype/border_processing/test_border_processing.js new file mode 100644 index 0000000..4223c6d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing/test_border_processing.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Border Processing", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Border Processing + () => frappe.tests.make('Border Processing', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing/test_border_processing.py b/csf_tz/clearing_and_forwarding/doctype/border_processing/test_border_processing.py new file mode 100644 index 0000000..9ea871b --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing/test_border_processing.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestBorderProcessing(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/__init__.py b/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/border_processing_vehicle_details.json b/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/border_processing_vehicle_details.json new file mode 100644 index 0000000..12d4b09 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/border_processing_vehicle_details.json @@ -0,0 +1,191 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-09-17 16:44:52.555100", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transporter", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Transporter", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "driver", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Driver", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "driver_contact", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Driver Contact", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Vehicle No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "plate_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Plate No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-09-18 15:21:50.200264", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Border Processing Vehicle Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/border_processing_vehicle_details.py b/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/border_processing_vehicle_details.py new file mode 100644 index 0000000..b4c5044 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/border_processing_vehicle_details/border_processing_vehicle_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BorderProcessingVehicleDetails(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_details/__init__.py b/csf_tz/clearing_and_forwarding/doctype/cargo_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.js b/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.js new file mode 100644 index 0000000..33551fe --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Cargo Details', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.json b/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.json new file mode 100644 index 0000000..d49f7f8 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.json @@ -0,0 +1,494 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "CARGO.###", + "beta": 0, + "creation": "2017-02-22 18:57:43.573632", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 0, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_size", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Size", + "length": 0, + "no_copy": 0, + "options": "40 FT GP\n20 FT GP\n40 OT\n20 OT\n20RF\n40RF\n40 FT Heavy", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "seal_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Seal Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "options": "\nLoose Cargo\nRoro\nSOC\n40 FT Container\n20 FT Light\n20 FT\nBB OOG", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "no_of_packages", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Number of Packages", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "gross_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Gross Weight (kgs)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "net_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Weight (kgs)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tare_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tare Weight (kgs)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assigned_vehicle", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Vehicle", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assigned_driver", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Driver", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fieldname": "transport_status", + "fieldtype": "Int", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bond_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sub-T1 Ref. No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bond_value", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "extra_details", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-10-03 16:56:01.917274", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Cargo Details", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.py b/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.py new file mode 100644 index 0000000..041e0a3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_details/cargo_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class CargoDetails(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_details/test_cargo_details.js b/csf_tz/clearing_and_forwarding/doctype/cargo_details/test_cargo_details.js new file mode 100644 index 0000000..90b90ca --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_details/test_cargo_details.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Cargo Details", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Cargo Details + () => frappe.tests.make('Cargo Details', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_details/test_cargo_details.py b/csf_tz/clearing_and_forwarding/doctype/cargo_details/test_cargo_details.py new file mode 100644 index 0000000..20729f7 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_details/test_cargo_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestCargoDetails(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_type/__init__.py b/csf_tz/clearing_and_forwarding/doctype/cargo_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.js b/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.js new file mode 100644 index 0000000..1e449c6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Cargo Type', { + refresh: function(frm) { + console.log(frm); + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.json b/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.json new file mode 100644 index 0000000..4384b29 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.json @@ -0,0 +1,519 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:cargo_name", + "beta": 0, + "creation": "2017-04-06 16:43:32.209178", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_local_import_required_permits", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Import Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "local_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "options": "Required Permit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_transit_import_required_transport", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Import Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transit_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "options": "Required Permit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_local_export", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Export Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "local_export", + "fieldtype": "Check", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Export", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "required_local_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "options": "Required Permit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_transit_export", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Export Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transit_export", + "fieldtype": "Check", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Export", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "required_transit_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "options": "Required Permit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_border_exit", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Exit", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border_exit", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Exit", + "length": 0, + "no_copy": 0, + "options": "Required Permit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_border_entry", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Entry", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border_entry", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Entry", + "length": 0, + "no_copy": 0, + "options": "Required Permit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-05-28 15:12:26.580941", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Cargo Type", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.py b/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.py new file mode 100644 index 0000000..6e06b8d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_type/cargo_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class CargoType(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_type/test_cargo_type.js b/csf_tz/clearing_and_forwarding/doctype/cargo_type/test_cargo_type.js new file mode 100644 index 0000000..d7b4450 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_type/test_cargo_type.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Cargo Type", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Cargo Type + () => frappe.tests.make('Cargo Type', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/cargo_type/test_cargo_type.py b/csf_tz/clearing_and_forwarding/doctype/cargo_type/test_cargo_type.py new file mode 100644 index 0000000..31e0df3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/cargo_type/test_cargo_type.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Cargo Type') + +class TestCargoType(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container/container.js b/csf_tz/clearing_and_forwarding/doctype/container/container.js new file mode 100644 index 0000000..a1f2160 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container/container.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Container', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container/container.json b/csf_tz/clearing_and_forwarding/doctype/container/container.json new file mode 100644 index 0000000..92dc396 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container/container.json @@ -0,0 +1,545 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "CT.#####", + "beta": 0, + "creation": "2019-08-01 14:38:16.133900", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_container_entry", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "creation_document_no", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Creation Document No", + "length": 0, + "no_copy": 0, + "options": "reference_container_entry", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "collection_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Creation Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipping_line", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "options": "Shipping Line", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "export_reference", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Reference", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "booking_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Booking Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_size", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Size", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "seal_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Seal Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_11", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "number_of_bundles", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Number of Bundles", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "net_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Net Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "gross_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Gross Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-11-11 14:13:19.223238", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container/container.py b/csf_tz/clearing_and_forwarding/doctype/container/container.py new file mode 100644 index 0000000..1667761 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container/container.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import msgprint + + +class Container(Document): + pass + +@frappe.whitelist(allow_guest=True) +def remove_booking(**args): + args = frappe._dict(args) + + doc_list=frappe.get_list("Container",filters= {"booking_number": args.booking_number,"export_reference":args.name}) + + for ref in doc_list: + doc=frappe.get_doc("Container",ref.name) + doc.db_set("export_reference","") + doc.db_set("seal_number","") + doc.db_set("number_of_bundles",0) + doc.db_set("gross_weight",0.0) + doc.db_set("net_weight",0.0) + doc.db_set("parenttype","") + doc.db_set("parent","") + doc.db_set("parentfield","") + doc.save() + + doc_list2 = frappe.get_list("Container Seals", + filters={"booking_number": args.booking_number, "export_reference": args.name}) + + for ref in doc_list2: + doc = frappe.get_doc("Container Seals", ref.name) + doc.db_set("export_reference", "") + doc.db_set("parenttype", "") + doc.db_set("parent", "") + doc.db_set("parentfield", "") + doc.db_set("container_no","") + doc.save() + + + + + + + + + diff --git a/csf_tz/clearing_and_forwarding/doctype/container/test_container.js b/csf_tz/clearing_and_forwarding/doctype/container/test_container.js new file mode 100644 index 0000000..e52b89f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container/test_container.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Container", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Container + () => frappe.tests.make('Container', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container/test_container.py b/csf_tz/clearing_and_forwarding/doctype/container/test_container.py new file mode 100644 index 0000000..4a81be3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container/test_container.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestContainer(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_detail/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_detail/container_detail.json b/csf_tz/clearing_and_forwarding/doctype/container_detail/container_detail.json new file mode 100644 index 0000000..bce0335 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_detail/container_detail.json @@ -0,0 +1,163 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-08-01 13:27:30.955777", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "seal_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Seal Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Type", + "length": 0, + "no_copy": 0, + "options": "Container Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_size", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Size ", + "length": 0, + "no_copy": 0, + "options": "40 FT GP\n20 FT GP\n40 OT\n20 OT\n20RF\n40RF\n40 FT Heavy", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-11-25 09:35:44.145903", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Detail", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_detail/container_detail.py b/csf_tz/clearing_and_forwarding/doctype/container_detail/container_detail.py new file mode 100644 index 0000000..7a01525 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_detail/container_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerDetail(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_entry/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_entry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.js b/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.js new file mode 100644 index 0000000..fb4388c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.js @@ -0,0 +1,51 @@ +// Copyright (c) 2015, InfluxERP // License: GNU General Public License v3. See license.txt + + +frappe.ui.form.on('Container Entry', { + onload:function(frm){ + frm.fields_dict['export_reference'].get_query = function(doc) { + return{ + filters:[ + ['shipping_line', '=', frm.doc.shipping_line] + ] + } + } + } + + +}) + + /*on_submit:function(frm){ + console.log(frm); + frappe.model.with_doc('Container', frm.doc.container_reference, function(){ + var reference_doc = frappe.model.get_doc('Container', frm.doc.container_reference); + }); + //console.log(referene_doc); + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.container_entry.container_entry.create_container", + freeze: true, + args: { + booking_number: frm.doc.booking_number, + collection_date: frm.doc.collection_date, + container_number: frm.docname, + container_type:frm.doctype + + + + }, + callback: function(data){ + if(!frm.doc.container_reference) + { + frm.set_value('container_reference', data.message); + frm.save(); + } + } + }) + + }*/ + + + + + +//} ) \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.json b/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.json new file mode 100644 index 0000000..662d32d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.json @@ -0,0 +1,438 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2019-08-02 14:10:26.930509", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "{purpose}", + "fetch_if_empty": 0, + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Title", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 0, + "options": "CTI-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "purpose", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Purpose", + "length": 0, + "no_copy": 0, + "options": "Container Receipt", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "collection_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Collection Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipping_line", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "options": "Shipping Line", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export", + "length": 0, + "no_copy": 0, + "options": "Export", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "booking_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Booking No", + "length": 0, + "no_copy": 0, + "options": "export_reference.booking_number", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 1, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_detail", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Container Detail", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Container Entry", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Reference", + "length": 0, + "no_copy": 0, + "options": "Container", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-05 15:31:06.454031", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Entry", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "shipping_line,export_reference", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "timeline_field": "", + "title_field": "title", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.py b/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.py new file mode 100644 index 0000000..d630d6d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_entry/container_entry.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import msgprint +from frappe.model.mapper import get_mapped_doc + + +class ContainerEntry(Document): + + + def on_submit(self): + create_container(self); + + +@frappe.whitelist(allow_guest=True) +def create_container(doc): + # check if container exists + + for value in doc.container_detail: + new_container = frappe.new_doc("Container") + new_container.update({ + "reference_container_entry": doc.doctype, + "creation_document_no": doc.name, + "booking_number":doc.booking_number, + "shipping_line":doc.shipping_line, + "collection_date": doc.collection_date, + "container_type": value.container_type, + "container_size": value.container_size, + "container_no": value.container_no, + "parenttype": 'Export', + "parent": doc.export_reference, + "parentfield": 'container_information' + }) + new_container.insert(ignore_permissions=True) + + new_container_seal = frappe.new_doc("Container Seals") + new_container_seal.update({ + "reference_container_entry": doc.doctype, + "creation_document_no": doc.name, + "booking_number": doc.booking_number, + "shipping_line": doc.shipping_line, + "seal_number": value.seal_number, + "collection_date": doc.collection_date, + "parenttype": 'Export', + "parent": doc.export_reference, + "parentfield": 'container_information' + }) + new_container_seal.insert(ignore_permissions=True) + + + + diff --git a/csf_tz/clearing_and_forwarding/doctype/container_entry/test_container_entry.js b/csf_tz/clearing_and_forwarding/doctype/container_entry/test_container_entry.js new file mode 100644 index 0000000..21ee2c5 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_entry/test_container_entry.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Container Entry", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Container Entry + () => frappe.tests.make('Container Entry', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_entry/test_container_entry.py b/csf_tz/clearing_and_forwarding/doctype/container_entry/test_container_entry.py new file mode 100644 index 0000000..cf694a6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_entry/test_container_entry.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestContainerEntry(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/container_file_closing_information.json b/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/container_file_closing_information.json new file mode 100644 index 0000000..b59731a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/container_file_closing_information.json @@ -0,0 +1,161 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-02-07 14:36:01.982768", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "proof_of_delivery", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Prrof of Delivery", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_return_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Return Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "inward_interchange_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Inward Interchange No.", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-02-07 14:36:01.982768", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container File Closing Information", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/container_file_closing_information.py b/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/container_file_closing_information.py new file mode 100644 index 0000000..ba5d8d0 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_file_closing_information/container_file_closing_information.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerFileClosingInformation(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_issue/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.js b/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.js new file mode 100644 index 0000000..dbadeeb --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.js @@ -0,0 +1,47 @@ +// Copyright (c) 2019, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Container Issue', { + onload: function (frm) { + frm.set_query("container_no", "container_detail", function (doc, cdt, cdn) { + var d = locals[cdt][cdn]; + return { + filters: [ + + + //Add filter ,got booking_no but no export reference + //['Container', 'booking_number', '=', doc.booking_number], + ['Container', 'export_reference', '=', ''], + ['Container', 'shipping_line', '=', doc.shipping_line] + ] + } + }); + + frm.set_query("seal_number", "container_detail", function (doc, cdt, cdn) { + var d = locals[cdt][cdn]; + return { + filters: [ + + + //Add filter for Container Seals + //['Container Seals', 'booking_number', '=', doc.booking_number], + ['Container Seals', 'export_reference', '=', ''], + ['Container Seals', 'shipping_line', '=', doc.shipping_line] + ] + } + }); + //filter export based on shipping line + frm.fields_dict['export_reference'].get_query = function (doc) { + return { + filters: [ + ['shipping_line', '=', frm.doc.shipping_line] + ] + } + } + + }, + refresh: function (frm) { + //frappe.msgprint(cstr(frm.doc.container_detail.length)); + console.log(frm); + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.json b/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.json new file mode 100644 index 0000000..9f005d1 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.json @@ -0,0 +1,372 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2019-08-01 17:46:56.580417", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "{purpose}", + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Title", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 0, + "options": "CTI-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "purpose", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Purpose", + "length": 0, + "no_copy": 0, + "options": "Container Issue", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "collection_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Collection Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipping_line", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "options": "Shipping Line", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "export_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export", + "length": 0, + "no_copy": 0, + "options": "Export", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "booking_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Booking Number", + "length": 0, + "no_copy": 0, + "options": "export_reference.booking_number", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 1, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_detail", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Container Issue Detail", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Container Issue", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-11-22 18:33:50.065481", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Issue", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "booking_number,shipping_line", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "timeline_field": "", + "title_field": "title", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.py b/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.py new file mode 100644 index 0000000..cbe912f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue/container_issue.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerIssue(Document): + + def on_submit(self): + update_container(self); + update_container_seal(self); + #update_container_seal_child(self); + + #def on_cancel(self): + #remove_booking_container(self); + + + +@frappe.whitelist(allow_guest=True) +def update_container(doc): + docs = doc.container_detail + for d in docs: + update_container= frappe.get_doc("Container",d.container_no) + update_container.booking_number=doc.booking_number, + update_container.export_reference=doc.export_reference, + update_container.seal_number= frappe.db.get_value('Container Seals', d.seal_number,'seal_number'), + update_container.db_set("number_of_bundles", d.number_of_bundles) + update_container.db_set("gross_weight", d.gross_weight) + update_container.db_set("net_weight", d.net_weight) + update_container.parenttype= 'Export', + update_container.parent= doc.export_reference, + update_container.parentfield= 'container_information' + update_container.save() + + +@frappe.whitelist(allow_guest=True) +def update_container_seal(doc): + seals = doc.container_detail + + for seal in seals: + update_container_seal = frappe.get_doc("Container Seals", seal.seal_number) + update_container_seal.export_reference = doc.export_reference, + update_container_seal.booking_number = doc.booking_number, + update_container_seal.parenttype = 'Export', + update_container_seal.parent = doc.export_reference, + update_container_seal.parentfield = 'container_information' + update_container_seal.save() + diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue/test_container_issue.js b/csf_tz/clearing_and_forwarding/doctype/container_issue/test_container_issue.js new file mode 100644 index 0000000..3365d2b --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue/test_container_issue.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Container Issue", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Container Issue + () => frappe.tests.make('Container Issue', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue/test_container_issue.py b/csf_tz/clearing_and_forwarding/doctype/container_issue/test_container_issue.py new file mode 100644 index 0000000..ad5762c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue/test_container_issue.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestContainerIssue(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/container_issue_detail.json b/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/container_issue_detail.json new file mode 100644 index 0000000..90a0959 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/container_issue_detail.json @@ -0,0 +1,255 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-08-07 11:29:08.651939", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container No", + "length": 0, + "no_copy": 0, + "options": "Container", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "seal_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Seal Number", + "length": 0, + "no_copy": 0, + "options": "Container Seals", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Type", + "length": 0, + "no_copy": 0, + "options": "Container Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_size", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Size ", + "length": 0, + "no_copy": 0, + "options": "40 FT GP\n20 FT GP\n40 OT\n20 OT\n20RF\n40RF\n40 FT Heavy", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "number_of_bundles", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Number of Bundles", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "net_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Net Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "gross_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Gross Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-11-25 09:04:28.723060", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Issue Detail", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/container_issue_detail.py b/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/container_issue_detail.py new file mode 100644 index 0000000..2fc5064 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_issue_detail/container_issue_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerIssueDetail(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_seals/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_seals/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.js b/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.js new file mode 100644 index 0000000..dcc276d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Container Seals', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.json b/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.json new file mode 100644 index 0000000..2360a3e --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.json @@ -0,0 +1,304 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "CS.####", + "beta": 0, + "creation": "2019-11-05 15:44:33.073223", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_container_entry", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "creation_document_no", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Creation Document No", + "length": 0, + "no_copy": 0, + "options": "reference_container_entry", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "collection_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Creation Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipping_line", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "export_reference", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "booking_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Booking Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "seal_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Seal Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-11-25 09:36:16.073168", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Seals", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.py b/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.py new file mode 100644 index 0000000..37d5cd6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_seals/container_seals.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerSeals(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_seals/test_container_seals.js b/csf_tz/clearing_and_forwarding/doctype/container_seals/test_container_seals.js new file mode 100644 index 0000000..05bf022 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_seals/test_container_seals.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Container Seals", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Container Seals + () => frappe.tests.make('Container Seals', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_seals/test_container_seals.py b/csf_tz/clearing_and_forwarding/doctype/container_seals/test_container_seals.py new file mode 100644 index 0000000..3f157d7 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_seals/test_container_seals.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestContainerSeals(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_transfer/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_transfer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.js b/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.js new file mode 100644 index 0000000..8400023 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Container Transfer', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.json b/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.json new file mode 100644 index 0000000..19b5bab --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.json @@ -0,0 +1,122 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-08-01 15:49:53.251021", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "from_booking_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "From Booking No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "to_booking_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "To Booking No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-08-01 15:51:33.262988", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Transfer", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.py b/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.py new file mode 100644 index 0000000..e30b87c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_transfer/container_transfer.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerTransfer(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_transfer/test_container_transfer.js b/csf_tz/clearing_and_forwarding/doctype/container_transfer/test_container_transfer.js new file mode 100644 index 0000000..c44adf5 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_transfer/test_container_transfer.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Container Transfer", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Container Transfer + () => frappe.tests.make('Container Transfer', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_transfer/test_container_transfer.py b/csf_tz/clearing_and_forwarding/doctype/container_transfer/test_container_transfer.py new file mode 100644 index 0000000..5ef5726 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_transfer/test_container_transfer.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestContainerTransfer(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_type/__init__.py b/csf_tz/clearing_and_forwarding/doctype/container_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.js b/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.js new file mode 100644 index 0000000..cd08bdb --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Container Type', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.json b/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.json new file mode 100644 index 0000000..08f4ca7 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.json @@ -0,0 +1,93 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:container_type", + "beta": 0, + "creation": "2019-08-01 13:36:31.065276", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-08-01 14:20:45.630598", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Container Type", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.py b/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.py new file mode 100644 index 0000000..c901061 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_type/container_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ContainerType(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/container_type/test_container_type.js b/csf_tz/clearing_and_forwarding/doctype/container_type/test_container_type.js new file mode 100644 index 0000000..343de45 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_type/test_container_type.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Container Type", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Container Type + () => frappe.tests.make('Container Type', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/container_type/test_container_type.py b/csf_tz/clearing_and_forwarding/doctype/container_type/test_container_type.py new file mode 100644 index 0000000..921c627 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/container_type/test_container_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestContainerType(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/expenses/__init__.py b/csf_tz/clearing_and_forwarding/doctype/expenses/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/expenses/expenses.json b/csf_tz/clearing_and_forwarding/doctype/expenses/expenses.json new file mode 100644 index 0000000..fdbb0e4 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/expenses/expenses.json @@ -0,0 +1,224 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "expense.", + "beta": 0, + "creation": "2017-01-15 19:54:39.112100", + "custom": 0, + "description": "Expenses for the clearing and forwarding module", + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_receipt", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Receipt", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_extra_details", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Extra Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-07-06 13:05:29.698945", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Expenses", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/expenses/expenses.py b/csf_tz/clearing_and_forwarding/doctype/expenses/expenses.py new file mode 100644 index 0000000..2413980 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/expenses/expenses.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Expenses(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/export/__init__.py b/csf_tz/clearing_and_forwarding/doctype/export/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/export/export.js b/csf_tz/clearing_and_forwarding/doctype/export/export.js new file mode 100644 index 0000000..d7dbbeb --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/export/export.js @@ -0,0 +1,501 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Export', { + onload:function(frm){ + console.log(frm); + }, + + refresh: function(frm) { + frm.events.open_close_buttons(frm); + //For filtering the cargo type depending on if it is enabled in cargo type settings + frm.set_query('material', function(){ + if(cur_frm.doc.export_type == 'Local') + { + return{ + "filters": { + "local_export": "1" + } + }; + } + }); + + //Show or hide sections according to what has been entered + frm.events.show_hide_sections(frm); + + //If there is unrequested funds + frm.events.new_fund_request(frm); + + frappe.after_ajax(function(){ + frm.events.grid_upload_buttons(frm) + }) + + frm.events.download_buttons(frm); + + if(frm.doc.status == "Closed" || frm.doc.status == "Cancelled") + { + frm.meta.fields.forEach(function(field){ + frm.toggle_enable(field.fieldname, false); + }); + } + }, + + open_close_buttons: function(frm){ + if (!frm.doc.__islocal) { + if(frm.doc.status=="Open") { + frm.add_custom_button(__("Close"), function() { + if(frm.events.validate_close(frm)) + { + frm.set_value("status", "Closed"); + frappe.call({ + doc: frm.doc, + method: 'validate_containers', + callback: function(r) { + frm.save(); + frm.refresh(); + + } + }) + } + }, "fa fa-check", "btn-success"); + + //Cancel Button + frm.add_custom_button(__("Cancel Export"), function() { + //frm.set_value("status", "Cancelled"); + frm.events.booking_cancellation(frm); + + //frm.save(); + //frm.refresh_fields(); + console.log("its cancelled"); + }, "fa fa-check", "btn-success"); + } else { + frm.add_custom_button(__("Re-open"), function() { + frm.set_value("status", "Open"); + frappe.call({ + doc: frm.doc, + method: 'validate_containers', + callback: function(r) { + frm.save(); + frm.refresh(); + + } + }) + }, null, "btn-default"); + } + } + }, + + disable_enable_fields: function(frm){ + if(frm.doc.status == "Closed") + { + frm.meta.fields.forEach(function(field){ + frm.toggle_enable(field.fieldname, false); + }); + } + }, + + validate_close: function(frm){ + var excluded_fields = ['attachments', 'download_buttons', 'required_permits', 'reporting_status', 'bond_reference']; + if(frm.doc.customs_processing_type && frm.doc.customs_processing_type == 'Old System') + { + excluded_fields.push('received_repacking_manifest', 'customs_assessment_submission', 'final_assessment_obtained', 'customs_release_date', 'bt_submission_date', + 'bt_approval_date', 'verification_date', 'declaration_number_approval', 'bt_ref_no'); + } + else if(frm.doc.customs_processing_type && frm.doc.customs_processing_type == 'New System') + { + excluded_fields.push('packing_list_received', 'packing_list_received_by', 'loading_list_sent_new', 'lodge_port_permit', 'receive_port_permit', 'delivery_date', + 'containers', 'cargo_information'); + } + var excluded_field_type = ["Table", "Section Break", "Column Break"] + var error_fields = []; + frm.meta.fields.forEach(function(field){ + if(!(excluded_field_type.indexOf(field.fieldtype) > -1) && !(excluded_fields.indexOf(field.fieldname) > -1) && !(field.fieldname in frm.doc)) + { + error_fields.push(field.label); + return false; + } + + if(field.fieldtype == "Table" && !(excluded_fields.indexOf(field.fieldname) > -1) && frm.doc[field.fieldname].length == 0) + { + error_fields.push(field.label); + return false; + } + }) + + //For back compatibility to be able to close field file if either containers or cargo_information entered + if(frm.doc.cargo_information.length == 0 && frm.doc.containers.length == 0){ + error_fields.push("Container Information") + } + + if(error_fields.length > 0) + { + var error_msg = "Mandatory fields required before closing
"; + frappe.msgprint(error_msg, "Missing Fields"); + return false; + } + else + { + return true; + } + }, + + + after_save: function(frm){ + /*if(frm.doc.cargo_information.length > 0) + { + frm.doc.cargo_information.forEach(function(row){ + frappe.call({ + method: 'frappe.client.get_list', + args: { + doctype: 'Bond', + filters: { + 'name': row.customs_ref_no, + } + }, + callback: function(data){ + if(!data.message) + { + frappe.model.set_value('Packing List', row.name, 'customs_ref_no', ""); + msgprint(__('Customs reference no. ' + row.customs_ref_no + ' does not exist.', 'Error')); + } + else if(data.message.length > 0) + { + console.log(data); + frappe.model.with_doc('Bond', row.customs_ref_no, function(){ + reference_doc = frappe.model.get_doc('Bond', row.customs_ref_no); + reference_doc.bond_history.forEach(function(row){ + total_no_of_bundles += row.no_of_bundles; + }) + + if((no_of_packages - total_no_of_bundles) > 0) //If the re are no of packages left + { + + } + }); + + + } + } + }) + }); + }*/ + frm.reload_doc(); + }, + + //For the upload buttons on cargo informationa nd bond reference tables + grid_upload_buttons: function(frm){ + if(frm.doc.cargo_information) + { + //Add button for uploading cargo information in the cargo information grid + frm.fields_dict['cargo_information'].grid.add_custom_button('Upload Information', function(){ + var d = new frappe.ui.Dialog({ + 'fields': [ + {'fieldname': 'ht', 'fieldtype': 'HTML'} + ], + primary_action: function(){ + var fileInput = document.getElementById("csv"); + var reader = new FileReader(); + reader.readAsBinaryString(fileInput.files[0]); + reader.onload = function () { + console.log(reader.result); + cur_frm.events.upload_cargo(cur_frm, reader.result); + }; + d.hide(); + cur_frm.fields_dict['cargo_information'].grid.clear_custom_buttons(); + + } + }); + d.fields_dict.ht.$wrapper.html(' '); + d.show(); + }); + + //Add button for uploading bond reference information in the bond referene grid + frm.fields_dict['bond_reference'].grid.add_custom_button('Upload Information', function(){ + var d = new frappe.ui.Dialog({ + 'fields': [ + {'fieldname': 'ht2', 'fieldtype': 'HTML'} + ], + primary_action: function(){ + var fileInput = document.getElementById("csv2"); + var reader = new FileReader(); + reader.readAsBinaryString(fileInput.files[0]); + reader.onload = function () { + console.log(reader.result); + cur_frm.events.upload_bond_information(cur_frm, reader.result); + }; + d.hide(); + cur_frm.fields_dict['bond_reference'].grid.clear_custom_buttons(); + + } + }); + d.fields_dict.ht2.$wrapper.html(' '); + d.show(); + }); + } + }, + + //For the cargo information upload button + upload_cargo: function(frm, str){ + var rows = str.split("\n"); + var row_arrays = []; + rows.forEach(function(row){ + row_arrays.push(row.split(',')); + }); + row_arrays.forEach(function(row){ + if(row[0] && row[0] != "Container Number") //If the row is not empty nor a header row + { + var new_row = frm.add_child('cargo_information'); + new_row.container_number = row[0]; + new_row.seal_number = row[1]; + new_row.no_of_bundles = row[2]; + new_row.net_weight = row[3]; + new_row.gross_weight = row[4]; + } + }); + frm.refresh_field('cargo_information'); + }, + + //For the bond reference upload button + upload_bond_information: function(frm, str){ + var rows = str.split("\n"); + var row_arrays = []; + rows.forEach(function(row){ + row_arrays.push(row.split(',')); + }); + row_arrays.forEach(function(row){ + if(row[0] && row[0] != "Customs Reference Number") //If the row is not empty nor a header row + { + var new_row = frm.add_child('bond_reference'); + new_row.customs_ref_number = row[0]; + new_row.number_of_bundles = row[1]; + new_row.weight = row[2]; + } + }); + frm.refresh_field('bond_reference'); + }, + + //For loading list download buttons + download_buttons: function(frm){ + //Load the bttons + var html = '   '; + html += '' + $(frm.fields_dict.download_buttons.wrapper).html(html); + }, + + + download_tra_loading_list: function(frm){ + window.open("/api/method/csf_tz.clearing_and_forwarding.doctype.export.export.download_ticts_loading_list?args=test1"); + }, + + + download_ticts_loading_list: function(frm){ + + }, + + material: function(frm) { + if(frm.doc.material == "") + { + frm.clear_table('required_permits'); + frm.refresh_field('required_permits'); + } + else + { + frappe.model.with_doc('Cargo Type', frm.doc.material, function(){ + var reference_doc = frappe.get_doc('Cargo Type', frm.doc.material); + + //Load required permits + if(frm.doc.export_type == 'Local') + { + frm.clear_table('required_permits'); + frm.refresh_field('required_permits'); + reference_doc.required_local_export.forEach(function(row){ + var new_row = frm.add_child('required_permits'); + new_row.description = row.permit_name; + frappe.after_ajax(function(){ + frm.refresh_field("required_permits"); + }); + }); + } + else if(frm.doc.export_type == 'Transit') + { + frm.clear_table('required_permits'); + frm.refresh_field('required_permits'); + reference_doc.required_transit_export.forEach(function(row){ + var new_row = frm.add_child('required_permits'); + new_row.description = row.permit_name; + frappe.after_ajax(function(){ + frm.refresh_field("required_permits"); + }); + }); + } + }); + } + frm.events.show_hide_sections(frm); + }, + + booking_received: function(frm){ + frm.events.show_hide_sections(frm); + }, + + booking_number: function(frm){ + frm.events.show_hide_sections(frm); + }, + + export_type: function(frm){ + frm.events.show_hide_sections(frm); + }, + + shipper: function(frm){ + frm.events.show_hide_sections(frm); + }, + + notify_party: function(frm){ + frm.events.show_hide_sections(frm); + }, + + consignee: function(frm){ + frm.events.show_hide_sections(frm); + }, + + client: function(frm){ + frm.events.show_hide_sections(frm); + }, + + vessel_name: function(frm){ + frm.events.show_hide_sections(frm); + }, + + voyage_no: function(frm){ + frm.events.show_hide_sections(frm); + }, + + engagement_date: function(frm){ + frm.events.show_hide_sections(frm); + }, + + eta: function(frm){ + frm.events.show_hide_sections(frm); + }, + + cut_off_date: function(frm){ + frm.events.show_hide_sections(frm); + }, + + shipping_line: function(frm){ + frm.events.show_hide_sections(frm); + }, + + port_of_loading: function(frm){ + frm.events.show_hide_sections(frm); + }, + + loading_terminal: function(frm){ + frm.events.show_hide_sections(frm); + }, + + destination: function(frm){ + frm.events.show_hide_sections(frm); + }, + + customs_processing_type: function(frm){ + frm.events.show_hide_sections(frm); + }, + + show_hide_sections: function(frm){ + /*frm.toggle_display('client_information_section', (frm.doc.booking_received && frm.doc.booking_number && frm.doc.export_type)); + frm.toggle_display('shipping_information_section', (frm.doc.shipper && frm.doc.notify_party && frm.doc.consignee && frm.doc.client)); + frm.toggle_display('clearing_documentation_section', (frm.doc.vessel_name && frm.doc.voyage_no && frm.doc.engagement_date && frm.doc.eta && frm.doc.cut_off_date && + frm.doc.shipping_line && frm.doc.port_of_loading && frm.doc.loading_terminal && frm.doc.destination)); + frm.toggle_display('clearing_documentation_section', (frm.doc.vessel_name && frm.doc.voyage_no && frm.doc.engagement_date && frm.doc.eta && frm.doc.cut_off_date && + frm.doc.shipping_line && frm.doc.port_of_loading && frm.doc.loading_terminal && frm.doc.destination)); + frm.toggle_display('section_required_permits', (frm.doc.shipper && frm.doc.notify_party && frm.doc.consignee && frm.doc.client)); + frm.toggle_display('section_containers_information', frm.doc.material); + frm.toggle_display('documentation_section', (frm.doc.cargo_information && frm.doc.cargo_information.length > 0)); + frm.toggle_display('requested_funds_section', (frm.doc.vessel_name && frm.doc.voyage_no && frm.doc.engagement_date && frm.doc.eta && frm.doc.cut_off_date && + frm.doc.shipping_line && frm.doc.port_of_loading && frm.doc.loading_terminal && frm.doc.destination)); + frm.toggle_display('expenses_section', (frm.doc.requested_funds && frm.doc.requested_funds.length > 0));*/ + frm.toggle_display('documentation_section', (frm.doc.customs_processing_type && frm.doc.customs_processing_type == 'Old System')); + frm.toggle_display('clearing_documentation_section', (frm.doc.customs_processing_type && frm.doc.customs_processing_type == 'New System')); + }, + + //For sending funds request + new_fund_request: function(frm){ + var new_request = false + if(frm.doc.requested_funds && frm.doc.requested_funds.length > 0) + { + frm.doc.requested_funds.forEach(function(row){ + if(row.request_status == "open") + { + new_request = true + } + }) + if(new_request == true) + { + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.request_funds", + args: { + reference_doctype: "Export", + reference_docname: cur_frm.doc.name, + company: cur_frm.doc.company + }, + callback: function(data){ + console.log(data); + } + }) + } + } + }, + + //for container when booking is cancelled ,i.e cancel export + booking_cancellation:function(frm){ + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.container.container.remove_booking", + args: { + booking_number: frm.doc.booking_number, + name:frm.doc.name + }, + callback: function(r){ + console.log(r); + frm.set_value("status", "Cancelled"); + frm.save(); + frm.clear_table("container_information"); + + + } + }) + + }, + + +}); + +frappe.ui.form.on("Requested Funds Details", { + before_requested_funds_remove: function(frm, doctype, name) { + var row = frappe.get_doc(doctype, name); + if(row.request_status != 'open') { + msgprint(__("Error: Cannot delete a processed request.")); + throw "Error: cannot delete a processed request"; + } + }, +}); + +frappe.ui.form.on("File Attachment", { + before_attachments_remove: function(frm){ + var selected = frm.get_selected(); + //Checking if attachment is mandatory + if(selected['attachments'] != null) + { + selected['attachments'].forEach(function(index){ + if(locals['File Attachment'][index].mandatory == 1) + { + msgprint(__("Error: Cannot delete a mandatory attachment.")); + throw "Error: cannot delete a mandatory attachment"; + } + }) + } + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/export/export.json b/csf_tz/clearing_and_forwarding/doctype/export/export.json new file mode 100644 index 0000000..6652bc5 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/export/export.json @@ -0,0 +1,3335 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "EXP.###", + "beta": 0, + "creation": "2017-03-27 20:17:23.560864", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "booking_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Booking Received Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "booking_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Booking Number", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Type", + "length": 0, + "no_copy": 0, + "options": "Local\nTransit", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "client_information_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "CLIENT, SHIPPER, CONSIGNEE, NOTIFY PARTY INFORMATION", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipper", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipper/Exporter", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "notify_party", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Notify Party", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_33", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "consignee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "client", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Client", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipping_information_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vessel_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vessel Name", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "voyage_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Voyage No", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "engagement_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Engagement Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "eta", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ETA", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cut_off_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payment Cut-Off Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_34", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipping_line", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "options": "Shipping Line", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "port_of_loading", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port of Loading", + "length": 0, + "no_copy": 0, + "options": "Port", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_terminal", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Terminal", + "length": 0, + "no_copy": 0, + "options": "Terminal", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "destination", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port of Discharge/Destination", + "length": 0, + "no_copy": 0, + "options": "Port", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_containers_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "origin", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Origin", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "material", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Description", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_information", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container", + "length": 0, + "no_copy": 0, + "options": "Container", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_information", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Containers Information", + "length": 0, + "no_copy": 0, + "options": "Packing List", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_bond_reference", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_reference", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Reference", + "length": 0, + "no_copy": 0, + "options": "Bond Reference Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "download_buttons", + "fieldtype": "HTML", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_customs_common_procedure", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Common Procedures", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customs_assessment_submission", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Assessment Submission", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "final_assessment_obtained", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Final Assessment Obtained", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "verification_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verification Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customs_physical_verification", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Physical Verification", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodge_for_release", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge for Release", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "release_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Release Received", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customs_release_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Release Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_61", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bt_submission_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BT Submission Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bt_approval_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BT Approval Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bt_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BT Ref Number", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_lodged_for_validation", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Lodged for Validation", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bond_validated", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bond Validated", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "New System", + "fetch_if_empty": 0, + "fieldname": "customs_processing_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Processing Type", + "length": 0, + "no_copy": 0, + "options": "\nOld System\nNew System", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "clearing_documentation_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Processing New System", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "stuffing_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Stuffing Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "received_repacking_manifest", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Received Repacking Manifest", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_36", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "declaration_number_approval", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Declaration Number Approval Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documentation_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Processing New Manual", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "packing_list_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Packing List Received", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "packing_list_received_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Packing List Received By", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_list_sent_new", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading List Sent", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_38", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodge_port_permit", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge Port Delivery Permit", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "receive_port_permit", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Receive Port Delivery Permit", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "delivery_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Delivery date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_shipping_line_processes", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line Processes", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "request_empty_container", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Request Empty Containers Date", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "empty_container_collected", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Empty Container Collected", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_list_sent", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading List Sent", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_51", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "declaration_number_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Declaration Number Received", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "declaration_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Declaration Number", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vgm_submited", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "VGM submitted", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_port_processes", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port Processes", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodge_port_charges", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge for Port Invoice", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "invoice_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Received", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "invoice_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Number", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "port_charges_paid", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port Charges Paid", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transport_requested", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Requested", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodge_loading_permit", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge for Loading Permit", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_permit_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Received ", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_70", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Loading Time", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_permit_handover_transporter", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Handover to Transporter", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_permit_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Received By", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "containers_arrived_at_port", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Containers Arrived At Port", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "file_submitted_to_scanner", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Submitted to Scanner", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_scanned", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Scanned", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "scanner_report_collected", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Scanner Report Collected", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "scanner_report_sent_to_client", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Scanner Report Sent to Client", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "scanner_report_sent_to_client_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Scanner Report Sent to Client (Time)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_required_permits", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "required_permits", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "options": "Permits Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_funds_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 3, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expenses_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 3, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attachments_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attachments", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "options": "File Attachment", + "permlevel": 4, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_reporting_status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reporting_status", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting Status", + "length": 0, + "no_copy": 0, + "options": "Reporting Status Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_references", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_81", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "Open\nClosed\nCancelled", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-03 23:29:04.537681", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Export", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Expense Recommender", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 0 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "booking_number", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/export/export.py b/csf_tz/clearing_and_forwarding/doctype/export/export.py new file mode 100644 index 0000000..a87962f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/export/export.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe, json +from frappe.model.document import Document +from frappe.utils import encode, cstr, cint, flt, comma_or +from frappe import _ + +import openpyxl +from io import StringIO +from openpyxl.styles import Font +from openpyxl import load_workbook +from frappe.utils.xlsxutils import handle_html +from csf_tz.after_sales_services.doctype.requested_payments.requested_payments import validate_requested_funds + +class Export(Document): + from csf_tz.after_sales_services.doctype.reference_payment_table.reference_payment_table import update_child_table + + def onload(self): + if not self.company: + self.company = frappe.defaults.get_user_default("Company") or frappe.defaults.get_global_default("company") + + def before_save(self): + validate_requested_funds(self) + + +@frappe.whitelist(allow_guest=True) +def create_export(**args): + args = frappe._dict(args) + + existing_export = frappe.db.get_value("Export", + {"booking_number": args.booking_number}) + + + if existing_export: + doc = frappe.get_doc("Export", existing_export) + doc.db_set("booking_received", args.documents_received_date) + doc.db_set("client", args.customer) + doc.db_set("export_type", args.export_type) + doc.db_set("file_number", args.file_number) + return existing_export + else: + new_export = frappe.new_doc("Export") + new_export.update({ + "booking_number":args.booking_number, + "booking_received": args.documents_received_date, + "client": args.customer, + "export_type": args.export_type, + "file_number": args.file_number + }) + new_export.insert(ignore_permissions=True) + return new_export.name + +@frappe.whitelist(allow_guest=True) +def download_ticts_loading_list(**args): + args = frappe._dict(args) + + data = [['Test 5', 'Test 6', args.args], ['Test 7', 'Test 8']] + + sheet_name = "Loading List" + wb = openpyxl.Workbook(write_only=True) + ws = wb.create_sheet(sheet_name, 0) + + row1 = ws.row_dimensions[1] + row1.font = Font(name='Calibri',bold=True) + + #data = [['Test 5', 'Test 6'], ['Test 7', 'Test 8']] + + for row in data: + clean_row = [] + for item in row: + if isinstance(item, basestring) and sheet_name != "Data Import Template": + value = handle_html(item) + else: + value = item + clean_row.append(value) + + ws.append(clean_row) + + xlsx_file = StringIO() + wb.save(xlsx_file) + + frappe.response['filename'] = sheet_name + '.xlsx' + frappe.response['filecontent'] = xlsx_file.getvalue() + frappe.response['type'] = 'download' + + +@frappe.whitelist(allow_guest=True) +def check_export_status(**args): + args = frappe._dict(args) + #get export + existing_export = frappe.db.get_value("Export", + {"file_number": args.file_number}) + if existing_export: + doc = frappe.get_doc("Export", existing_export) + status=doc.status + if status=='Open' or status=='Cancelled': + frappe.msgprint("Cannot Close the File because it's EXPORT is not closed,Please Close the EXPORT first") + else: + return status diff --git a/csf_tz/clearing_and_forwarding/doctype/export/export_dashboard.py b/csf_tz/clearing_and_forwarding/doctype/export/export_dashboard.py new file mode 100644 index 0000000..4ae8ae1 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/export/export_dashboard.py @@ -0,0 +1,23 @@ +from frappe import _ + +def get_data(): + return { + 'fieldname': 'export', + 'non_standard_fieldnames': { + 'Files': 'export_reference', + 'Requested Payments': 'reference_docname', + + }, + 'internal_links': { + #'Purchase Order': ['items', 'purchase_order'], + #'Purchase Receipt': ['items', 'purchase_receipt'], + }, + 'transactions': [ + + { + 'label': _('Reference'), + 'items': ['Files', 'Requested Payments'] + }, + + ] + } \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/export/test_export.js b/csf_tz/clearing_and_forwarding/doctype/export/test_export.js new file mode 100644 index 0000000..284269a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/export/test_export.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Export", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Export + () => frappe.tests.make('Export', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/export/test_export.py b/csf_tz/clearing_and_forwarding/doctype/export/test_export.py new file mode 100644 index 0000000..03e1067 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/export/test_export.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Export') + +class TestExport(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/__init__.py b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.js b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.js new file mode 100644 index 0000000..a795185 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Fabrizio Test Form', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.json b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.json new file mode 100644 index 0000000..68c18d8 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.json @@ -0,0 +1,149 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:frmname", + "beta": 0, + "creation": "2017-01-27 13:07:18.633724", + "custom": 0, + "description": "Test form for Fabrizio !! Whohooo my first form!!", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "frmdate", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "frmname", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "options": "fabrizio\naisenyi\nmike\nJohn\ngeorge\nhamisi", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "frmsurname", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Surname", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-01-27 13:10:25.047792", + "modified_by": "fabrizio@greencity.co.tz", + "module": "Clearing and Forwarding", + "name": "Fabrizio Test Form", + "name_case": "UPPER CASE", + "owner": "fabrizio@greencity.co.tz", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "frmname", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.py b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.py new file mode 100644 index 0000000..2dcbb72 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/fabrizio_test_form.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FabrizioTestForm(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/test_fabrizio_test_form.py b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/test_fabrizio_test_form.py new file mode 100644 index 0000000..82cdd51 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/fabrizio_test_form/test_fabrizio_test_form.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Fabrizio Test Form') + +class TestFabrizioTestForm(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/files/__init__.py b/csf_tz/clearing_and_forwarding/doctype/files/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/files/files.js b/csf_tz/clearing_and_forwarding/doctype/files/files.js new file mode 100644 index 0000000..0c956f9 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/files/files.js @@ -0,0 +1,724 @@ +// Copyright (c) 2017, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Files', { + refresh: function (frm) { + console.log(frm); + frm.events.hide_show_sections(frm); + frm.events.load_expenses(frm); + frm.events.load_invoices(frm); + frm.events.load_payments(frm); + frm.events.load_purchase_invoices(frm); + + frm.events.close_buttons(frm); + + //Load import|export|transport reference status + //something to add + if ((frm.doc.requested_service == "Importation-Transit" || frm.doc.requested_service == "Importation-Local") && frm.doc.import_reference) { + frappe.model.with_doc('Import', frm.doc.import_reference, function () { + var reference_doc = frappe.model.get_doc('Import', frm.doc.import_reference); + var html = 'Import Status

' + reference_doc.status + '

'; + $(frm.fields_dict.import_status.wrapper).html(html); + }); + } + /*else if (frm.doc.requested_service == "Border Processing") { + frappe.model.with_doc('Border Processing', frm.doc.border_processing_reference, function () { + var reference_doc = frappe.model.get_doc('Border Processing', frm.doc.border_processing_reference); + var html = 'Border Processing Status

' + reference_doc.status + '

'; + $(frm.fields_dict.border_processing_status.wrapper).html(html); + }); + }*/ + + //Add sales Invoice button + frm.add_custom_button(__('Sales Invoice'), + function () { + frm.events.make_sales_invoice(); + }, __("Make") + ); + + //Add purchase invoice button + frm.add_custom_button(__('Purchase Invoice'), + function () { + frm.events.make_purchase_invoice(); + }, __("Make") + ); + }, + + /* validate: function (frm) { + if (frm.doc.import_transit || frm.doc.import_local) { + if (!frm.doc.bl_number) { + frappe.msgprint("Please enter BL Number", "Error"); + frappe.validated = false; + } + } else if (frm.doc.export_transit || frm.doc.export_local) { + if (!frm.doc.booking_number) { + frappe.msgprint("Please enter a Booking Number", "Error"); + frappe.validated = false; + } + } else if (frm.doc.transport_transit || frm.doc.transport_local) { + if (!frm.doc.source_country || !frm.doc.source_city) { + frappe.msgprint("Please enter the cargo location", "Error"); + frappe.validated = false; + } else if (!frm.doc.destination_country || !frm.doc.destination_city) { + frappe.msgprint("Please enter the cargo destination", "Error"); + frappe.validated = false; + } + } else if (frm.doc.border_clearance) { + if (!frm.doc.number_of_borders || frm.doc.number_of_borders < 1) { + frappe.msgprint("Please enter number of borders greater than 0", "Error"); + frappe.validated = false; + } + } else { + frappe.msgprint("Please choose at least one service", "Error"); + frappe.validated = false; + } + }, +*/ + + + //validation after checkbox removed + validate: function (frm) { + if (frm.doc.requested_service == "Importation-Transit" || + frm.doc.requested_service == "Importation-Local") { + if (!frm.doc.bl_number) { + frappe.msgprint("Please enter BL Number", "Error"); + frappe.validated = false; + } + } else if (frm.doc.requested_service == "Border Processing") { + if (!frm.doc.cross_border_no) { + frappe.msgprint("Please enter border processing number reference", "Error"); + frappe.validated = false; + } + } else if (frm.doc.requested_service == "Export-Transit" || frm.doc.requested_service == "Export-Local") { + if (!frm.doc.booking_number) { + frappe.msgprint("Please enter a Booking Number", "Error"); + frappe.validated = false; + } + } else if (frm.doc.requested_service == "Transport-Transit" || frm.doc.requested_service == "Transport-Local") { + if (!frm.doc.source_country || !frm.doc.source_city) { + frappe.msgprint("Please enter the cargo location", "Error"); + frappe.validated = false; + } else if (!frm.doc.destination_country || !frm.doc.destination_city) { + frappe.msgprint("Please enter the cargo destination", "Error"); + frappe.validated = false; + } + } else if (frm.doc.requested_service == "Border Clearance") { + if (!frm.doc.number_of_borders || frm.doc.number_of_borders < 1) { + frappe.msgprint("Please enter number of borders greater than 0", "Error"); + frappe.validated = false; + } + } else { + frappe.msgprint("Please choose at least one service", "Error"); + frappe.validated = false; + } + }, + + + close_buttons: function (frm) { + if (!frm.doc.__islocal) { + if (frm.doc.status == "Open") { + frm.add_custom_button(__("Close"), function () { + if (frm.events.validate_close(frm)) { + frm.set_value("status", "Closed"); + frm.save(); + } + }, "fa fa-check", "btn-success"); + } + } + }, + + /* after_save: function (frm) { + //If there is unrequested funds + frm.events.new_fund_request(frm); + + + //needs to be edited + //If import service selected + if (frm.doc.import_transit || frm.doc.import_local) { + var import_typ = null; + if (frm.doc.import_transit) { + import_typ = 'Transit'; + } else if (frm.doc.import_local) { + import_typ = 'Local'; + } + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.import.import.create_import", + freeze: true, + args: { + bl_number: frm.doc.bl_number, + documents_received_date: frm.doc.documents_received_date, + location: frm.doc.location, + customer: frm.doc.customer, + file_number: frm.docname, + import_type: import_typ + }, + callback: function (data) { + if (!frm.doc.import_reference) { + frm.set_value('import_reference', data.message); + frm.save(); + } + } + }) + } else if (frm.doc.export_transit || frm.doc.export_local) //If export is selected + { + var export_typ = null; + if (frm.doc.export_local) { + export_typ = 'Local'; + } else if (frm.doc.export_transit) { + export_typ = 'Transit'; + } + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.export.export.create_export", + freeze: true, + args: { + booking_number: frm.doc.booking_number, + documents_received_date: frm.doc.documents_received_date, + location: frm.doc.location, + customer: frm.doc.customer, + export_type: export_typ, + file_number: frm.docname + }, + callback: function (data) { + if (!frm.doc.export_reference) { + frm.set_value('export_reference', data.message); + frm.save(); + } + } + }) + } else if (frm.doc.transport_transit || frm.doc.transport_local) //If transport is selected + { + var transport_typ = null; + if (frm.doc.transport_local) { + transport_typ = 'Internal'; + } else if (frm.doc.transport_transit) { + transport_typ = 'Cross Border'; + } + frappe.call({ + method: "fleet_management.fleet_management.doctype.transport_request.transport_request.create_transport_request", + freeze: true, + args: { + request_received: frm.doc.documents_received_date, + customer: frm.doc.customer, + transport_type: transport_typ, + file_number: frm.docname, + cargo_location_country: frm.doc.source_country, + cargo_location_city: frm.doc.source_city, + cargo_destination_country: frm.doc.destination_country, + cargo_destination_city: frm.doc.destination_city, + }, + callback: function (data) { + if (!frm.doc.transport_reference) { + setTimeout(function () { + frm.set_value('transport_reference', data.message); + frm.save(); + }, 1000); + } + } + }) + } else if (frm.doc.border_clearance) //If border clearance is selected + { + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.border_clearance.border_clearance.create_border_clearance", + freeze: true, + args: { + number_of_borders: frm.doc.number_of_borders, + location: frm.doc.location, + documents_received_date: frm.doc.documents_received_date, + customer: frm.doc.customer, + file_number: frm.docname + }, + callback: function (data) { + if (!frm.doc.border_clearance_ref) { + frm.set_value('border_clearance_ref', data.message); + frm.save(); + } + } + }) + } + frm.reload_doc(); + },*/ + + //after_save after checkbox removed + after_save: function (frm) { + //If there is unrequested funds + frm.events.new_fund_request(frm); + + //If import service selected + if (frm.doc.requested_service == "Importation-Transit" || frm.doc.requested_service == "Importation-Local") { + var import_typ = null; + if (frm.doc.requested_service == "Importation-Transit") { + import_typ = 'Transit'; + } else if (frm.doc.requested_service == "Importation-Local") { + import_typ = 'Local'; + } + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.import.import.create_import", + freeze: true, + args: { + bl_number: frm.doc.bl_number, + documents_received_date: frm.doc.documents_received_date, + location: frm.doc.location, + customer: frm.doc.customer, + file_number: frm.docname, + import_type: import_typ + }, + callback: function (data) { + if (!frm.doc.import_reference) { + frm.set_value('import_reference', data.message); + frm.save(); + } + } + }) + } else if (frm.doc.requested_service == "Export-Transit" || frm.doc.requested_service == "Export-Local") //If export is selected + { + var export_typ = null; + if (frm.doc.requested_service == "Export-Local") { + export_typ = 'Local'; + } else if (frm.doc.requested_service == "Export-Transit") { + export_typ = 'Transit'; + } + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.export.export.create_export", + freeze: true, + args: { + booking_number: frm.doc.booking_number, + documents_received_date: frm.doc.documents_received_date, + location: frm.doc.location, + customer: frm.doc.customer, + export_type: export_typ, + file_number: frm.docname + }, + callback: function (data) { + if (!frm.doc.export_reference) { + frm.set_value('export_reference', data.message); + frm.save(); + } + } + }) + } else if (frm.doc.requested_service == "Transport-Transit" || frm.doc.requested_service == "Transport-Local") //If transport is selected + { + var transport_typ = null; + if (frm.doc.requested_service == "Transport-Local") { + transport_typ = 'Internal'; + } else if (frm.doc.requested_service == "Transport-Transit") { + transport_typ = 'Cross Border'; + } + frappe.call({ + method: "fleet_management.fleet_management.doctype.transport_request.transport_request.create_transport_request", + freeze: true, + args: { + request_received: frm.doc.documents_received_date, + customer: frm.doc.customer, + transport_type: transport_typ, + file_number: frm.docname, + cargo_location_country: frm.doc.source_country, + cargo_location_city: frm.doc.source_city, + cargo_destination_country: frm.doc.destination_country, + cargo_destination_city: frm.doc.destination_city, + }, + callback: function (data) { + if (!frm.doc.transport_reference) { + setTimeout(function () { + frm.set_value('transport_reference', data.message); + frm.save(); + }, 1000); + } + } + }) + } else if (frm.doc.requested_service == "Border Clearance") //If border clearance is selected + { + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.border_clearance.border_clearance.create_border_clearance", + freeze: true, + args: { + number_of_borders: frm.doc.number_of_borders, + location: frm.doc.location, + documents_received_date: frm.doc.documents_received_date, + customer: frm.doc.customer, + file_number: frm.docname + }, + callback: function (data) { + if (!frm.doc.border_clearance_ref) { + frm.set_value('border_clearance_ref', data.message); + frm.save(); + } + } + }) + } else if (frm.doc.requested_service == "Border Processing") //If border processing is selected + { + console.log("create function to create border processing doc"); + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.border_processing.border_processing.create_border_processing", + freeze: true, + args: { + cross_border_no: frm.doc.cross_border_no, + //location: frm.doc.location, + //documents_received_date: frm.doc.documents_received_date, + customer: frm.doc.customer, + file_number: frm.docname, + doctype: frm.doctype + }, + callback: function (data) { + if (!frm.doc.border_processing_reference) { + frm.set_value('border_processing_reference', data.message); + frm.save(); + } + } + }) + } + frm.reload_doc(); + }, + + + validate_close: function (frm) { + var excluded_fields = ['requested_funds', 'attachments', 'expenses', 'purchase_invoices_html', 'total_expenses_html', 'invoices_html', 'payments_html', 'sales_order_reference', 'quotation', 'cross_border_no', 'border_processing_reference', 'border_processing_status']; + if (frm.doc.requested_service == "Importation-Transit" || frm.doc.requested_service == "Importation-Local") { + + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.import.import.check_import_status", + freeze: true, + args: { + import_reference: frm.import_reference, + file_number: frm.docname + }, + callback: function (status) { + if (status == 'Closed') { + console.log(status); + + excluded_fields.push('per_unit', 'export_reference', 'booking_number', 'source_country', 'source_city', 'destination_country', 'destination_city', 'number_of_borders', 'export_status', 'transport_reference', 'transport_status', 'border_clearance_ref', 'border_clearance_status'); + } + } + }) + + } else if (frm.doc.requested_service == 'Export-Transit' || frm.doc.requested_service == 'Export-Local') { + + frappe.call({ + method: "csf_tz.clearing_and_forwarding.doctype.export.export.check_export_status", + freeze: true, + args: { + //import_reference: frm.import_reference, + file_number: frm.docname + }, + callback: function (status) { + if (status == 'Closed') { + console.log(status); + + excluded_fields.push('per_unit', 'import_status', 'bl_number', 'import_reference', 'import_status', 'source_country', 'source_city', 'destination_country', 'destination_city', 'number_of_borders', 'export_status', 'transport_reference', 'transport_status', 'border_clearance_ref', 'border_clearance_status'); + } + } + }) + + } else if (frm.doc.requested_service == 'Transport-Transit' || frm.doc.requested_service == 'Transport-Local') { + console.log("okk"); + frappe.call({ + method: "fleet_management.fleet_management.doctype.vehicle_trip.vehicle_trip.check_trip_status", + freeze: true, + args: { + //import_reference: frm.import_reference, + file_number: frm.docname + }, + + callback: function (status) { + console.log("okk2"); + + if (status == 'Closed') { + console.log(status); + + excluded_fields.push('per_unit', 'export_reference', 'import_status', 'bl_number', 'booking_number', 'import_reference', 'import_status', 'number_of_borders', 'export_status', 'border_clearance_ref', 'border_clearance_status'); + + } + } + }) + + } else if (frm.doc.requested_service == 'Border Clearance') { + + excluded_fields.push('per_unit', 'export_reference', 'import_status', 'bl_number', 'booking_number', 'import_reference', 'import_status', 'number_of_borders', 'export_status', 'transport_reference', 'destination_city', 'destination_country', 'source_city'); + } + var excluded_field_type = ["Table", "Section Break", "Column Break", "HTML"]; + var error_fields = []; + frm.meta.fields.forEach(function (field) { + if (!(excluded_field_type.indexOf(field.fieldtype) > -1) && !(excluded_fields.indexOf(field.fieldname) > -1) && !(field.fieldname in frm.doc)) { + error_fields.push(field.label); + return false; + } + + if (field.fieldtype == "Table" && !(excluded_fields.indexOf(field.fieldname) > -1) && frm.doc[field.fieldname].length == 0) { + error_fields.push(field.label); + return false; + } + }) + + if (error_fields.length > 0) { + var error_msg = "Mandatory fields required before closing
"; + frappe.msgprint(error_msg, "Missing Fields"); + return false; + } else { + return true; + } + }, + + + /* services_selection: function (frm) { + /Allow only one import or export to be selected and only one transport (local or transit) + if (frm.doc.import_transit && frm.doc.import_transit == 1) { + frm.set_value('import_local', 0); + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.import_local && frm.doc.import_local == 1) { + frm.set_value('import_transit', 0); + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.export_transit && frm.doc.export_transit == 1) { + frm.set_value('export_local', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.export_local && frm.doc.export_local == 1) { + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.border_clearance && frm.doc.border_clearance == 1) { + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.transport_transit && frm.doc.transport_transit == 1) { + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + } else if (frm.doc.transport_local && frm.doc.transport_local == 1) { + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_transit', 0); + } + },*/ + + + services_selection: function (frm) { + //Allow only one import or export to be selected and only one transport (local or transit) + if (frm.doc.requested_service == 'Importation-Transit') { + //frm.events.hide_show_sections(frm); + frm.set_value('import_local', 0); + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.requested_service == 'Importation-Local') { + //frm.events.hide_show_sections(frm); + frm.set_value('import_transit', 0); + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.requested_service == 'Export-Transit') { + //frm.events.hide_show_sections(frm); + frm.set_value('export_local', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + + } else if (frm.doc.requested_service == 'Export-Local') { + //frm.events.hide_show_sections(frm); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + + } else if (frm.doc.requested_service == "Border Clearance") { + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('transport_local', 0); + frm.set_value('transport_transit', 0); + } else if (frm.doc.requested_service == "Transport-Transit") { + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_local', 0); + } else if (frm.doc.requested_service == "Transport-Local") { + frm.set_value('export_local', 0); + frm.set_value('export_transit', 0); + frm.set_value('import_local', 0); + frm.set_value('import_transit', 0); + frm.set_value('border_clearance', 0); + frm.set_value('transport_transit', 0); + } + }, + + + + + requested_service: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + import_transit: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + import_local: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + export_transit: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + export_local: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + transport_transit: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + transport_local: function (frm) { + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + + + border_clearance: function (frm) { + //Set number of borders to 2 and allow user to edit + frm.set_value('number_of_borders', 1); + frm.toggle_enable('number_of_borders', 1); + frm.events.services_selection(frm); + frm.events.hide_show_sections(frm); + }, + + /*hide_show_sections: function (frm) { + frm.toggle_display('section_import_reference', (frm.doc.import_transit || frm.doc.import_local)); + frm.toggle_display('section_export_reference', (frm.doc.export_transit || frm.doc.export_local)); + frm.toggle_display('section_transport_reference', (!frm.doc.export_transit && !frm.doc.export_local && !frm.doc.import_local && !frm.doc.import_transit) && + (frm.doc.transport_local || frm.doc.transport_transit)); + frm.toggle_display('section_border_clearance', (frm.doc.border_clearance)); + frm.toggle_display("section_requested_funds", (frm.doc.import_reference || frm.doc.export_reference || frm.doc.transport_reference)); + frm.toggle_display("section_expenses", (frm.doc.requested_funds && frm.doc.requested_funds.length > 0)); + },*/ + + hide_show_sections: function (frm) { + frm.toggle_display('section_import_reference', (frm.doc.requested_service == "Importation-Transit" || frm.doc.requested_service == "Importation-Local")); + frm.toggle_display('section_export_reference', (frm.doc.requested_service == "Export-Transit" || frm.doc.requested_service == "Export-Local")); + frm.toggle_display('section_cross_border_reference', (frm.doc.requested_service == "Border Processing")); + frm.toggle_display('section_transport_reference', (!(frm.doc.requested_service == "Export-Transit") && !(frm.doc.requested_service == "Export-Local") && !(frm.doc.requested_service == "Importation-Local") && !(frm.doc.requested_service == "Importation-Transit") && + (frm.doc.requested_service == "Transport-Local" || frm.doc.requested_service == "Transport-Transit"))); + frm.toggle_display('section_border_clearance', (frm.doc.requested_service == "Border Clearance")); + frm.toggle_display("section_requested_funds", (frm.doc.import_reference || frm.doc.export_reference || frm.doc.transport_reference)); + frm.toggle_display("section_expenses", (frm.doc.requested_funds && frm.doc.requested_funds.length > 0)); + }, + + new_fund_request: function (frm) { + var new_request = false + if (frm.doc.requested_funds && frm.doc.requested_funds.length > 0) { + frm.doc.requested_funds.forEach(function (row) { + if (row.request_status == "open") { + new_request = true + } + }) + if (new_request == true) { + frappe.call({ + method: "erpnext.accounts.doctype.requested_payments.requested_payments.request_funds", + args: { + reference_doctype: "Files", + reference_docname: cur_frm.doc.name, + company: cur_frm.doc.company + }, + callback: function (data) { + console.log(data); + } + }) + } + } + }, + + load_expenses: function (frm) { + if (frm.fields_dict['total_expenses_html'] && "expenses_html" in frm.doc.__onload) { + frm.fields_dict['total_expenses_html'].wrapper.innerHTML = frm.doc.__onload.expenses_html.display; + } + }, + + load_invoices: function (frm) { + if (frm.fields_dict['invoices_html'] && "invoices_html" in frm.doc.__onload) { + frm.fields_dict['invoices_html'].wrapper.innerHTML = frm.doc.__onload.invoices_html.display; + } + }, + + load_purchase_invoices: function (frm) { + if (frm.fields_dict['purchase_invoices_html'] && "purchase_invoices_html" in frm.doc.__onload) { + frm.fields_dict['purchase_invoices_html'].wrapper.innerHTML = frm.doc.__onload.purchase_invoices_html.display; + } + }, + + load_payments: function (frm) { + if (frm.fields_dict['payments_html'] && "payments_html" in frm.doc.__onload) { + frm.fields_dict['payments_html'].wrapper.innerHTML = frm.doc.__onload.payments_html.display; + } + }, + + make_sales_invoice: function () { + frappe.model.open_mapped_doc({ + //method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice", + method: "csf_tz.clearing_and_forwarding.doctype.files.files.make_sales_invoice", + frm: cur_frm, + + }) + }, + + make_purchase_invoice: function () { + frappe.model.open_mapped_doc({ + method: "csf_tz.clearing_and_forwarding.doctype.files.files.make_purchase_invoice", + frm: cur_frm + }) + }, + + +}); + +frappe.ui.form.on("Requested Funds Details", { + before_requested_funds_remove: function (frm, doctype, name) { + var row = frappe.get_doc(doctype, name); + if (row.request_status != 'open') { + msgprint(__("Error: Cannot delete a processed request.")); + throw "Error: cannot delete a processed request"; + } + }, +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/files/files.json b/csf_tz/clearing_and_forwarding/doctype/files/files.json new file mode 100644 index 0000000..8460e39 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/files/files.json @@ -0,0 +1,2547 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "BRV.###", + "beta": 0, + "creation": "2017-06-07 13:20:36.591791", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documents_received_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Documents Received Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "location", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location", + "length": 0, + "no_copy": 0, + "options": "Locations", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "quotation", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quotation", + "length": 0, + "no_copy": 0, + "options": "Quotation", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_service", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Service ", + "length": 0, + "no_copy": 0, + "options": "Importation-Transit\nImportation-Local\nExport-Transit\nExport-Local\nTransport-Transit\nTransport-Local\nBorder Clearance\nBorder Processing", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_services", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Services", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_import", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Import", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "import_transit", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Importation - Transit", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "import_local", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Importation - Local", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_export", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export_transit", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export - Transit", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export_local", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export - Local", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_transport", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transport_transit", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport - Transit", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transport_local", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport - Local", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_14", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Clearance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border_clearance", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Clearance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_cross_border_reference", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Processing Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cross_border_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Processing No ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_21", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border_processing_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Processing Reference", + "length": 0, + "no_copy": 0, + "options": "Border Processing", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_23", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border_processing_status", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Processing Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_import_reference", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Import Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bl_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BL Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_37", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "import_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Import Reference", + "length": 0, + "no_copy": 0, + "options": "Import", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_38", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Import Status", + "fetch_if_empty": 0, + "fieldname": "import_status", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Import Status", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_export_reference", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "booking_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Booking Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_39", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Reference", + "length": 0, + "no_copy": 0, + "options": "Export", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_40", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export_status", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_transport_reference", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_cargo_location", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Location", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "source_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "source_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "City/Town", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_cargo_destination", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "destination_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Destination Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "destination_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Destination City/Town", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_33", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transport_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Reference", + "length": 0, + "no_copy": 0, + "options": "Transport Request", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transport_status", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_border_clearance", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Clearance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "number_of_borders", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Number of Borders", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_53", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border_clearance_ref", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Clearance Reference", + "length": 0, + "no_copy": 0, + "options": "Border Clearance", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_55", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border_clearance_status", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Clearance Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_trip_reference", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Trip references", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fetch_if_empty": 0, + "fieldname": "trip_references_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "billing_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Billing Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fetch_if_empty": 0, + "fieldname": "per_unit", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Per Unit", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_requested_funds", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_attachments", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attachments", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachemnts", + "length": 0, + "no_copy": 0, + "options": "File Attachment", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_purchase_invoices", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Purchase/Supplier Invoices", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "purchase_invoices_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_total_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total File Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "total_expenses_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_invoices", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoices and Payments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "invoices_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_customer_payments", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Payments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "payments_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_66", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "sales_order_reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Order Reference", + "length": 0, + "no_copy": 0, + "options": "Sales Order", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-03 23:25:15.902284", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Files", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/files/files.py b/csf_tz/clearing_and_forwarding/doctype/files/files.py new file mode 100644 index 0000000..c54d29a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/files/files.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe.model.mapper import get_mapped_doc +from frappe.contacts.doctype.address.address import get_company_address +from frappe.model.utils import get_fetch_values +from frappe.utils import cstr, flt, getdate, comma_and, cint +from frappe import msgprint + + +class Files(Document): + from csf_tz.after_sales_services.doctype.reference_payment_table.reference_payment_table import update_child_table + def onload(self): + expenses_html = self.load_expenses() + invoices_html = self.load_invoices() + purchase_invoices_html = self.load_purchase_invoices() + payments_html = self.load_payments() + self.set_onload("expenses_html", {"display": expenses_html}) + self.set_onload("invoices_html", {"display": invoices_html}) + self.set_onload("purchase_invoices_html", {"display": purchase_invoices_html}) + self.set_onload("payments_html", {"display": payments_html}) + #check_import_status(self) + #Set default company + if not self.company: + self.company = frappe.defaults.get_user_default("Company") or frappe.defaults.get_global_default("company") + + + + def load_expenses(self): + expenses_list = [] + expenses_import = frappe.db.sql("""SELECT * FROM `tabExpenses` WHERE parenttype = 'Import' AND parent IN (SELECT name FROM `tabImport` WHERE reference_file_number = %s)""", self.name, as_dict=True) + expenses_export = frappe.db.sql("""SELECT * FROM `tabExpenses` WHERE parenttype = 'Export' AND parent IN (SELECT name FROM `tabExport` WHERE file_number = %s)""", self.name, as_dict=True) + expenses_trip_main = frappe.db.sql("""SELECT * FROM `tabExpenses` WHERE parenttype = 'Vehicle Trip' AND parentfield = 'main_expenses' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE main_file_number = %s)""", self.name, as_dict=True) + expenses_trip_return = frappe.db.sql("""SELECT * FROM `tabExpenses` WHERE parenttype = 'Vehicle Trip' AND parentfield = 'return_expenses' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE return_file_number = %s)""", self.name, as_dict=True) + expenses_border = frappe.db.sql("""SELECT * FROM `tabExpenses` WHERE parenttype = 'Border Clearance' AND parent IN (SELECT name FROM `tabBorder Clearance` WHERE file_number = %s)""", self.name, as_dict=True) + expenses_list = expenses_import + expenses_export + expenses_trip_main + expenses_trip_return + expenses_border + + self.set_onload("expenses_list", expenses_list) + return frappe.render_template("templates/file_expenses.html", {"expenses_list": expenses_list}) + + def load_invoices(self): + invoices_list = [] + invoices_list = frappe.db.sql("""SELECT * FROM `tabSales Invoice` where files = %s""", self.name,as_dict=True) + self.set_onload("invoices_list", invoices_list) + return frappe.render_template("templates/file_invoices.html", {"invoices_list": invoices_list}) + + def load_purchase_invoices(self): + purchase_invoices_list = [] + purchase_invoices_list = frappe.db.sql("""SELECT * FROM `tabPurchase Invoice` where reference_doctype = 'Files' AND reference_docname = %s""", self.name,as_dict=True) + self.set_onload("purchase_invoices_list", purchase_invoices_list) + return frappe.render_template("templates/file_purchase_invoices.html", {"purchase_invoices_list": purchase_invoices_list}) + + def load_payments(self): + payments_list = [] + payments_list = frappe.db.sql("""SELECT * FROM `tabGL Entry` WHERE credit_in_account_currency > 0 AND against_voucher_type = 'Sales Invoice' AND against_voucher IN (SELECT name + FROM `tabSales Invoice` where files = %s)""", self.name, as_dict=True) + self.set_onload("payments_list", payments_list) + return frappe.render_template("templates/file_payments.html", {"payments_list": payments_list}) + + + +@frappe.whitelist() +def make_sales_invoice(source_name): + #get SO reference + docs = frappe.get_doc("Files", source_name) + ref = docs.sales_order_reference + + #get data for referenced SO + source_name = frappe.get_doc("Sales Order", ref) + + #create invoice + new_invoice = frappe.new_doc("Sales Invoice") + new_invoice.update({ + "customer": source_name.customer, + "taxes_and_charges": source_name.taxes_and_charges + }) + stock = source_name.items + for value in stock: + value.update({ + "docstatus": 0, + "doctype": "Sales Invoice Item", + "__islocal": 1, + "__unsaved": 1, + "parent": None, + "parenttype": None, + "sales_order": source_name.name, + "so_detail": value.name, + "qty": 1 + }) + new_invoice.append('items', value) + '''new_invoice.append('items', + { + "item_code": value.item_code, + "item_name": value.item_name, + "description": value.description, + "qty": value.qty, + "stock_uom": value.stock_uom, + "uom": value.uom, + "conversion_factor": value.conversion_factor, + "margin_type": value.margin_type, + "margin_rate_or_amount": value.margin_rate_or_amount, + "rate_with_margin": value.rate_with_margin, + "discount_percentage": value.discount_percentage, + "discount_amount": value.discount_amount, + "base_rate_with_margin": value.base_rate_with_margin, + "rate": value.rate, + "amount": value.amount + }) + new_invoice.update({ + "items": stock + })''' + charges=source_name.taxes + for taxes in charges: + new_invoice.append('taxes', + { + "charge_type": taxes.charge_type, + "account_head": taxes.account_head, + "description": taxes.description, + "rate": taxes.rate, + "tax_amount": taxes.tax_amount + + + }) + #new_invoice.save() + #new_invoice.insert() + return new_invoice + + +@frappe.whitelist(allow_guest=True) +def check_import_status(doc): + # update booking no value in container doctype selected + + docs = doc.name + #for d in docs: + frappe.msgprint(docs) + + # get Container doctype ambayo ina jina la d.container_no + #update_container = frappe.get_doc("Container", d.container_no) + #update_container.booking_number = "" + #update_container.save() + + +@frappe.whitelist() +def make_purchase_invoice(source_name, target_doc=None, ignore_permissions=False): + def postprocess(source, target): + set_missing_values(source, target) + #Get the advance paid Journal Entries in Sales Invoice Advance + target.set_advances() + + def set_missing_values(source, target): + target.ignore_pricing_rule = 1 + target.status = "Draft" + target.reference_doctype = source.doctype + target.reference_docname = source.name + '''target.run_method("set_missing_values") + target.run_method("calculate_taxes_and_totals") + + # set company address + target.update(get_company_address(target.company)) + if target.company_address: + target.update(get_fetch_values("Purchase Invoice", 'company_address', target.company_address))''' + + def update_item(source, target, source_parent): + target.amount = flt(source.amount) - flt(source.billed_amt) + target.base_amount = target.amount * flt(source_parent.conversion_rate) + target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty + + item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1) + target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \ + or item.selling_cost_center \ + or frappe.db.get_value("Item Group", item.item_group, "default_cost_center") + + doclist = get_mapped_doc("Files", source_name, { + "Files": { + "doctype": "Purchase Invoice", + } + }, target_doc, postprocess) + + return doclist diff --git a/csf_tz/clearing_and_forwarding/doctype/files/files_dashboard.py b/csf_tz/clearing_and_forwarding/doctype/files/files_dashboard.py new file mode 100644 index 0000000..a798e5c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/files/files_dashboard.py @@ -0,0 +1,32 @@ +from frappe import _ + +def get_data(): + return { + 'fieldname': 'files', + 'non_standard_fieldnames': { + 'Import': 'reference_file_number', + 'Export': 'file_number', + 'Transport Request' :'file_number', + 'Sales Invoice':'reference_docname', + 'Purchase Invoice':'reference_docname', + 'Border Clearance':'file_number', + + + + }, + 'internal_links': { + + + }, + 'transactions': [ + { + 'label': _('Service References'), + 'items': ['Import', 'Export','Transport Request','Border Clearance'] + }, + { + 'label': _('Order References'), + 'items': ['Sales Invoice', 'Purchase Invoice'] + }, + + ] + } \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/files/test_files.js b/csf_tz/clearing_and_forwarding/doctype/files/test_files.js new file mode 100644 index 0000000..630c2ce --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/files/test_files.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Files", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Files + () => frappe.tests.make('Files', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/files/test_files.py b/csf_tz/clearing_and_forwarding/doctype/files/test_files.py new file mode 100644 index 0000000..7220ffd --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/files/test_files.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestFiles(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/icd/__init__.py b/csf_tz/clearing_and_forwarding/doctype/icd/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/icd/icd.js b/csf_tz/clearing_and_forwarding/doctype/icd/icd.js new file mode 100644 index 0000000..6ac545f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/icd/icd.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('ICD', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/icd/icd.json b/csf_tz/clearing_and_forwarding/doctype/icd/icd.json new file mode 100644 index 0000000..38673b2 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/icd/icd.json @@ -0,0 +1,90 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:icd_name", + "beta": 0, + "creation": "2017-04-24 21:02:43.921006", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "icd_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-04-24 21:02:43.921006", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "ICD", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/icd/icd.py b/csf_tz/clearing_and_forwarding/doctype/icd/icd.py new file mode 100644 index 0000000..3fb5ba8 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/icd/icd.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ICD(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/icd/test_icd.py b/csf_tz/clearing_and_forwarding/doctype/icd/test_icd.py new file mode 100644 index 0000000..882fd1f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/icd/test_icd.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('ICD') + +class TestICD(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/import/__init__.py b/csf_tz/clearing_and_forwarding/doctype/import/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/import/import.js b/csf_tz/clearing_and_forwarding/doctype/import/import.js new file mode 100644 index 0000000..720ecfd --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import/import.js @@ -0,0 +1,714 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + + +frappe.ui.form.on('Import', { + refresh: function(frm){ + console.log(frm); + frm.events.open_close_buttons(frm); + + // Show/hide sections + frm.events.show_hide_sections(frm); + //Show or hide elements depending on Import type + frm.events.import_type(frm); + frm.events.point_of_entry(frm); + + /* + * Hide employee link. Note: If the position of the grid is changed + * (e.g another grid is added above it) the grid number needs to change + */ + frm.grids[1].grid.set_column_disp('assigned_driver'); + + //For loading mandatory attachments + if(!frm.doc.attachments || frm.doc.attachments.length == 0) + { + frappe.model.with_doc('Mandatory Attachments', 'Mandatory Attachments', function(){ + var reference_doc = frappe.get_doc('Mandatory Attachments', 'Mandatory Attachments'); + console.log(reference_doc); + if(reference_doc.common_import.length > 0) + { + reference_doc.common_import.forEach(function(row){ + var new_row = frm.add_child('attachments'); + new_row.description = row.attachment_name; + new_row.mandatory = 1; + }); + frm.refresh_field('attachments'); + } + }); + } + }, + + onload: function(frm){ + frm.events.disable_enable_fields(frm); + + //Show request transport button only if cargo has been added + if(frm.doc.cargo_information && frm.doc.cargo_information.length != 0) + { + //Check if there is unrequested cargo + var need_assign = false; + frm.doc.cargo_information.forEach(function(row){ + if(row.transport_status == 0) + { + need_assign = true; + } + }); + + //Check if eta < 10 days + var today = new Date(); + var eta = frm.doc.eta.split('-'); + var eta_date = new Date(eta[0], eta[1]-1, eta[2]); + var difference = Math.round(Math.abs((eta_date.getTime()-today.getTime())/(1000*60*60*24))); + + //If there is unrequested cargo and eta < 10 + if(need_assign && difference < 10) + { + frappe.call({ + method: "fleet_management.fleet_management.doctype.transport_request.transport_request.create_transport_request", + args: { + reference_doctype: "Import", + reference_docname: cur_frm.doc.name, + file_number: cur_frm.doc.reference_file_number + }, + callback: function(data){ + //alert(JSON.stringify(data)); + frm.doc.cargo_information.forEach(function(row){ + if(row.transport_status == 0) + { + row.transport_status = 1; + } + }); + show_alert("Transport Request Sent", 5); + frm.save_or_update(); + } + }) + } + + + frm.events.toggle_editable_funds_rows(frm); + } + }, + + open_close_buttons: function(frm){ + //if (!frm.doc.__islocal) { + if(frm.doc.status=="Open") { + frm.add_custom_button(__("Close"), function() { + if(frm.events.validate_close(frm)) + { + frm.set_value("status", "Closed"); + frm.save(); + } + }, "fa fa-check", "btn-success"); + } else { + frm.add_custom_button(__("Re-open"), function() { + frm.set_value("status", "Open"); + frm.save(); + }, null, "btn-default"); + } + //} + }, + + disable_enable_fields: function(frm){ + if(frm.doc.status == "Closed") + { + frm.meta.fields.forEach(function(field){ + frm.toggle_enable(field.fieldname, false); + }); + } + }, + + + validate_close: function(frm){ + var excluded_fields = ["clearing_agent_border_1", "clearing_agent_border_2", "clearing_agent_border_3", "house_bill_of_lading", "assign_transport", + "required_permits", "requested_funds", "expenses", "attachments", "procedures", "border_customer", "reference_trip", "cargo_type", + "amended_from", "transport_requested", "special_instructions_to_transporter"]; + var local_excluded_fields = ['t1_generated', 't1_approved']; //For local imports + var excluded_field_type = ["Table", "Section Break", "Column Break"] + var error_fields = []; + frm.meta.fields.forEach(function(field){ + if(!(excluded_field_type.indexOf(field.fieldtype) > -1) && !(excluded_fields.indexOf(field.fieldname) > -1) && !(field.fieldname in frm.doc)) + { + if(frm.doc.import_type && frm.doc.import_type == 'Local' && local_excluded_fields.indexOf(field.fieldname) != -1) + { + return false; + } + else + { + error_fields.push(field.label); + return false; + } + } + + if(field.fieldtype == "Table" && !(excluded_fields.indexOf(field.fieldname) > -1) && frm.doc[field.fieldname].length == 0) + { + error_fields.push(field.label); + return false; + } + }) + + if(error_fields.length > 0) + { + var error_msg = "Mandatory fields required before closing
"; + frappe.msgprint(error_msg, "Missing Fields"); + return false; + } + else + { + return true; + } + }, + + + // Show or Hide sections depending on previously entered information. + show_hide_sections: function(frm){ + frm.toggle_display('section_border', (frm.doc.point_of_entry == 'Border Post' && frm.doc.location && frm.doc.documents_received_date)); + + frm.toggle_display("client_information_section", (frm.doc.bl_number && + frm.doc.location && frm.doc.documents_received_date)); + frm.toggle_display("shipping_line_information", true); + + if(frm.doc.shipper && frm.doc.consignee && frm.doc.notify_party && frm.doc.customer) + { + frm.toggle_display("shipping_line_information", true); + frm.set_df_property("client_information_section", "collapsible", "1"); + } + + frm.toggle_display("cargo_information_section", (frm.doc.shipping_line && + frm.doc.vessel_name && frm.doc.voyage && frm.doc.port_of_loading && frm.doc.port_of_discharge && frm.doc.eta)); + + frm.toggle_display('cargo_information', (frm.doc.cargo && frm.doc.cargo != "")); + + frm.toggle_display("documentation_information", (frm.doc.cargo_information && frm.doc.cargo_information.length != 0)); + frm.toggle_display("section_required_permits", (frm.doc.cargo_information && frm.doc.cargo_information.length != 0)); + frm.toggle_display("section_customs_processing", (frm.doc.cargo_information && frm.doc.cargo_information.length != 0)); + frm.toggle_display("section_shipping_line_processes", (frm.doc.cargo_information && frm.doc.cargo_information.length != 0)); + frm.toggle_display("section_port_processes", (frm.doc.cargo_information && frm.doc.cargo_information.length != 0)); + frm.toggle_display("section_assigned_transport", (frm.doc.cargo_information && frm.doc.cargo_information.length != 0)); + frm.toggle_display("requested_funds_section", ((frm.doc.cargo_information && frm.doc.cargo_information.length != 0) || (frm.doc.point_of_entry == 'Border Post' && frm.doc.location && frm.doc.documents_received_date))); + frm.toggle_display("expenses_section", (frm.doc.requested_funds && frm.doc.requested_funds.length != 0)); + frm.toggle_display("closing_information_section", ((frm.doc.requested_funds && frm.doc.requested_funds.length != 0) && (frm.doc.point_of_entry != 'Border Post'))); + + frm.refresh_fields() + }, + + point_of_entry: function(frm){ + if(frm.doc.point_of_entry == "Port") + { + frm.toggle_display("bl_number", true); + } + + frm.toggle_display('location', true); + frm.toggle_display('documents_received_date', true); + frm.events.show_hide_sections(frm); + }, + + bl_number: function(frm){ + frm.events.show_hide_sections(frm); + }, + + location: function(frm){ + frm.events.show_hide_sections(frm); + }, + + documents_received_date: function(frm){ + frm.events.show_hide_sections(frm); + }, + + cargo_type: function(frm){ + if(frm.doc.cargo_type && frm.doc.cargo_type != "") + { + frappe.model.with_doc('Cargo Type', frm.doc.cargo_type, function(frm){ + reference = frappe.model.get_doc('Cargo Type', cur_frm.doc.cargo_type); + reference.border_procedure.forEach(function(row){ + var new_row = cur_frm.add_child('procedures'); + new_row.procedure = row.procedure; + }); + }); + frappe.after_ajax(function(frm){ + cur_frm.refresh_field('procedures'); + }); + } + }, + + shipper: function(frm){ + frm.events.show_hide_sections(frm); + }, + + consignee: function(frm){ + frm.events.show_hide_sections(frm); + }, + + notify_party: function(frm){ + frm.events.show_hide_sections(frm); + }, + + customer: function(frm){ + frm.events.show_hide_sections(frm); + }, + + house_bill_of_lading: function(frm){ + frm.events.show_hide_sections(frm); + }, + + shipping_line: function(frm){ + frm.events.show_hide_sections(frm); + }, + + vessel_name: function(frm){ + frm.events.show_hide_sections(frm); + }, + + voyage: function(frm){ + frm.events.show_hide_sections(frm); + }, + + port_of_loading: function(frm){ + frm.events.show_hide_sections(frm); + }, + + port_of_discharge: function(frm){ + frm.events.show_hide_sections(frm); + }, + + eta: function(frm){ + frm.events.show_hide_sections(frm); + }, + + cargo: function(frm){ + if(frm.doc.cargo && frm.doc.cargo != "") + { + frm.toggle_display('cargo_information', true); + } + + //Load required permits + if(frm.doc.cargo == "") + { + frm.clear_table('required_permits'); + frm.refresh_field('required_permits'); + } + else + { + frappe.model.with_doc('Cargo Type', frm.doc.cargo, function(){ + var reference_doc = frappe.get_doc('Cargo Type', frm.doc.cargo); + + //Load required permits + if(frm.doc.import_type == 'Local') + { + frm.clear_table('required_permits'); + frm.refresh_field('required_permits'); + if(reference_doc.local_import.length > 0) + { + reference_doc.local_import.forEach(function(row){ + var new_row = frm.add_child('required_permits'); + new_row.description = row.permit_name; + frappe.after_ajax(function(){ + frm.refresh_field("required_permits"); + }); + }); + } + } + else if(frm.doc.import_type == 'Transit') + { + frm.clear_table('required_permits'); + frm.refresh_field('required_permits'); + if(reference_doc.transit_import.length > 0) + { + reference_doc.transit_import.forEach(function(row){ + var new_row = frm.add_child('required_permits'); + new_row.description = row.permit_name; + frappe.after_ajax(function(){ + frm.refresh_field("required_permits"); + }); + }); + } + } + }); + } + }, + + import_type: function(frm){ + if(frm.doc.import_type == 'Local') + { + frm.toggle_display("t1_generated", false); + frm.toggle_display("t1_approved", false); + } + else + { + frm.toggle_display("t1_generated", true); + frm.toggle_display("t1_approved", true); + } + + //For loading mandatory attachments + if(frm.doc.attachments && frm.doc.attachments.length > 0) + { + frappe.model.with_doc('Mandatory Attachments', 'Mandatory Attachments', function(){ + var reference_doc = frappe.get_doc('Mandatory Attachments', 'Mandatory Attachments'); + var transit_loaded = false; + var local_loaded = false; + + //Check if transit mandatory attachemnts loaded + if(reference_doc.transit_import.length > 0) + { + frm.doc.attachments.forEach(function(row){ + if(row.description.toUpperCase() == reference_doc.transit_import[0].attachment_name.toUpperCase()) //If transit attachments loaded + { + transit_loaded = true; + } + }); + } + + //Check if local mandatory attachemnts loaded + if(reference_doc.local_import.length > 0) + { + frm.doc.attachments.forEach(function(row){ + if(row.description.toUpperCase() == reference_doc.local_import[0].attachment_name.toUpperCase()) //If transit attachments loaded + { + local_loaded = true; + } + }); + } + + //Check if import type is local and transit attachments loaded + if('Local' == frm.doc.import_type && transit_loaded) + { + //Delete transit attachments + reference_doc.transit_import.forEach(function(reference_row){ + frm.get_field('attachments').grid.grid_rows.forEach(function(attachment_row){ + if(reference_row.attachment_name.toUpperCase() == attachment_row.doc.description.toUpperCase()) + { + attachment_row.remove(); + } + }); + }); + } + else if('Transit' == frm.doc.import_type && local_loaded) //If import type is transit and local attachments loaded + { + //Delete local attachments + reference_doc.local_import.forEach(function(reference_row){ + frm.get_field('attachments').grid.grid_rows.forEach(function(attachment_row){ + if(reference_row.attachment_name.toUpperCase() == attachment_row.description.toUpperCase()) + { + attachment_row.remove(); + } + }); + }); + } + + //Load local attachments + if('Local' == frm.doc.import_type && !local_loaded && reference_doc.local_import.length > 0) + { + reference_doc.local_import.forEach(function(row){ + var new_row = frm.add_child('attachments'); + new_row.description = row.attachment_name; + new_row.mandatory = 1; + }); + frm.refresh_field('attachments'); + } + else if('Transit' == frm.doc.import_type && !transit_loaded && reference_doc.transit_import.length > 0) //Load transit attachments + { + reference_doc.transit_import.forEach(function(row){ + var new_row = frm.add_child('attachments'); + new_row.description = row.attachment_name; + new_row.mandatory = 1; + }); + frm.refresh_field('attachments'); + } + }); + } + }, + + new_fund_request: function(frm){ + var new_request = false + if(frm.doc.requested_funds && frm.doc.requested_funds.length > 0) + { + frm.doc.requested_funds.forEach(function(row){ + if(row.request_status == "open") + { + new_request = true + } + }) + if(new_request == true) + { + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.request_funds", + args: { + reference_doctype: "Import", + reference_docname: cur_frm.doc.name, + company: cur_frm.doc.company + }, + callback: function(data){ + console.log(data); + } + }) + } + } + }, + + validate: function(frm){ + //Check if for each bond reference no entered, there is also a bond value entered + /*if(frm.doc.cargo_information && frm.doc.cargo_information.length > 0) + { + frm.doc.cargo_information.forEach(function(row){ + if(row.bond_ref_no != null && row.bond_value == null) + { + msgprint('Please enter bond value for cargo with bond reference no', 'Error'); + validated = false; + } + else if(row.bond_value != null && row.bond_ref_no == null) + { + msgprint('Please enter bond reference no for cargo with bond value', 'Error'); + validated = false; + } + }); + }*/ + }, + + before_save: function(frm){ + if(frm.doc.cargo_information && frm.doc.cargo_information.length > 0) + { + var container_numbers = []; + var closed_containers = []; + var to_be_added = []; + var to_be_removed = []; + + frm.doc.cargo_information.forEach(function(row){ + container_numbers.push(row.container_number); + }); + + if(frm.doc.container_file_closing_information && frm.doc.container_file_closing_information.length > 0) + { + frm.doc.container_file_closing_information.forEach(function(row){ + closed_containers.push(row.container_no); + }); + } + + //Container numbers to be added + container_numbers.forEach(function(container_number){ + if(closed_containers.indexOf(container_number) == -1) + { + to_be_added.push(container_number); + } + }); + + //Container numbers to be removed + var i = 0; + closed_containers.forEach(function(closed_container){ + if(container_numbers.indexOf(closed_container) == -1) + { + to_be_removed.push(i); + } + i++; + }); + + //Add containers + to_be_added.forEach(function(container_number){ + var new_row = frappe.model.add_child(frm.doc, "Container File Closing Information", "container_file_closing_information"); + new_row.container_no = container_number; + }); + + //Remove containers + to_be_removed.forEach(function(container_index){ + frm.get_field("container_file_closing_information").grid.grid_rows[container_index].remove(); + }); + } + }, + + after_save: function(frm){ + //If there is unrequested funds + frm.events.new_fund_request(frm); + frm.events.toggle_editable_funds_rows(frm); + frm.reload_doc(); + + /*if(frm.doc.cargo_information && frm.doc.cargo_information.length > 0) + { + frm.doc.cargo_information.forEach(function(row){ + if(row.bond_ref_no != null && row.bond_value != null) + { + //Send request to create new bond + frappe.call({ + method: 'csf_tz.clearing_and_forwarding.doctype.bond.bond.create_bond', + args: { + reference_no: row.bond_ref_no, + bond_value: row.bond_value, + no_of_packages: row.no_of_packages, + cargo: cur_frm.doc.cargo, + reference_doctype: 'Import', + reference_docname: frm.docname + }, + callback: function(data){ + } + }); + } + }); + }*/ + }, + + toggle_editable_funds_rows: function(frm){ + if(frm.doc.requested_funds && frm.doc.requested_funds.length > 0) + { + frm.doc.requested_funds.forEach(function(row){ + if(row.request_status.toUpperCase() != "OPEN") + { + //Make fields read only + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_date"})[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_amount"})[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_currency"})[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_description"})[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "comment"})[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "requested_for"})[0].read_only = true; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "quote_attachment"})[0].read_only = true; + } + else + { + //Make fields read only + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_date"})[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_amount"})[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_currency"})[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "request_description"})[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "comment"})[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "requested_for"})[0].read_only = false; + frappe.utils.filter_dict(cur_frm.fields_dict["requested_funds"].grid.grid_rows_by_docname[row.name].docfields, {"fieldname": "quote_attachment"})[0].read_only = false; + } + }) + } + } + +}) + + +//To only show office locations +cur_frm.set_query('location', function(frm){ + return{ + filters: [ + ['Locations', 'location_type', '!=', 'Border Post'] + ] + } +}); + +frappe.ui.form.on("Cargo Details", { + cargo_information_add: function(frm, cdt, cdn){ + frm.events.show_hide_sections(frm); + }, + + before_cargo_information_remove: function(frm){ + var selected = frm.get_selected(); + + //For checking if alert is needed according to transport status so that ones without transport request can just be deleted. + var alert = false; + selected['cargo_information'].forEach(function(index){ + if(locals['Cargo Details'][index].transport_status > 0) + { + alert = true; + } + }) + + if(alert) + { + frappe.confirm( + 'Are you sure you want to delete the cargo information?', + function(){ + //console.log(selected); + selected['cargo_information'].forEach(function(index){ + var row = locals['Cargo Details'][index]; + if(row.transport_status < 3) + { + //Check if it is the only one with tranport status > 0 + var only_row = true; + frm.doc.cargo_information.forEach(function(crow){ + if(crow.request_status > 0 && crow.name != row.name) + { + only_row = false; + } + }) + + //If it is the only one with tranport request, delete the transport request + if(only_row) + { + frappe.call({ + method: 'frappe.client.get_list', + args: { + doctype: 'Transport Request', + filters: { + 'reference_docname': frm.docname + } + }, + callback: function(data){ + console.log(data.message[0].name); + frappe.call({ + method: 'frappe.model.delete_doc.delete_doc', + args: { + doctype: 'Transport Request', + name: data.message[0].name, + ignore_permissions:'True', + }, + callback: function(data){ + console.log(data.message); + } + }); + //frappe.delete_doc("Transport Request", data.message[0].name, ignore_permissions=true); + } + }); + } + } + else + { + //If the cargo has already been picked up for transport + msgprint('You cannot delete cargo that has already been picked up for transport', 'Error'); + throw "Error: cannot delete cargo that has already been picked up for transport"; + } + }) + return true; + }, + function(){ + return false; + //window.close(); + throw "User canceled delete"; + } + ) + } + //msgprint(__("Error: Cannot delete a processed request.")); + throw "Wait"; + }, +}); + +frappe.ui.form.on("Requested Funds Details", { + requested_funds_add: function(frm, cdt, cdn){ + //Make fields editable + frm.events.toggle_editable_funds_rows(frm); + }, + + before_requested_funds_remove: function(frm, doctype, name) { + var row = frappe.get_doc(doctype, name); + if(row.request_status != 'open') { + msgprint(__("Error: Cannot delete a processed request.")); + throw "Error: cannot delete a processed request"; + } + }, +}); + +frappe.ui.form.on("File Attachment", { + before_attachments_remove: function(frm){ + var selected = frm.get_selected(); + //Checking if attachment is mandatory + if(selected['attachments'] != null) + { + selected['attachments'].forEach(function(index){ + if(locals['File Attachment'][index].mandatory == 1) + { + msgprint(__("Error: Cannot delete a mandatory attachment.")); + throw "Error: cannot delete a mandatory attachment"; + } + }) + } + } +}); + + + + + + + diff --git a/csf_tz/clearing_and_forwarding/doctype/import/import.json b/csf_tz/clearing_and_forwarding/doctype/import/import.json new file mode 100644 index 0000000..7d9e8d3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import/import.json @@ -0,0 +1,3499 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "IMP.###", + "beta": 0, + "creation": "2017-01-10 19:05:35.050685", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference_file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "point_of_entry", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Point of Entry", + "length": 0, + "no_copy": 0, + "options": "\nPort\nAirport", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bl_number", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "B/L Number", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "original_bl_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Original B/L Received", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "location", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Location", + "length": 0, + "no_copy": 0, + "options": "Locations", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documents_received_date", + "fieldtype": "Date", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Documents Received Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_border", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Procedures", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "border_customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference_trip", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Trip", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Procedures", + "fetch_if_empty": 0, + "fieldname": "procedures", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Procedures", + "length": 0, + "no_copy": 0, + "options": "Import Border Procedure Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "client_information_section", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Client, Shipper, Consignee, Notify Party Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipper", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipper/Exporter", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "consignee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "notify_party", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Notify Party", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Client", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "clearing_agent_border_1", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent Border 1", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "clearing_agent_border_2", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent Border 2", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "clearing_agent_border_3", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent Border 3", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipping_line_information", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "house_bill_of_lading", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "House Bill of Lading", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "shipping_line", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "options": "Shipping Line", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vessel_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vessel Name", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "voyage", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Voyage No", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_destination_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_destination_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination City/Town", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "port_of_loading", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port of Loading", + "length": 0, + "no_copy": 0, + "options": "Port", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "port_of_discharge", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port of Discharge", + "length": 0, + "no_copy": 0, + "options": "Port", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "eta", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ETA (Expected Time of Arrival)", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "ata", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ATA (Actual Time of Arrival)", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "discharge", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Discharge Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "terminal", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Discharge Terminal", + "length": 0, + "no_copy": 0, + "options": "Terminal", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "icd", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ICD", + "length": 0, + "no_copy": 0, + "options": "ICD", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "carry_in_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Carry In Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "demurrage_start_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Demurrage Start Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_information_section", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Category", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Description", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_owner", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container Owner", + "length": 0, + "no_copy": 0, + "options": "SOC (Shipper Owned Container)\nShipping Line Container\nBravo Container\nRental", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_information", + "fieldtype": "Table", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Information", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "documentation_information", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documentation Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Import", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_customs_processing", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Processing", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "import_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Import Type", + "length": 0, + "no_copy": 0, + "options": "Local\nTransit", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "declaration_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Declaration Type", + "length": 0, + "no_copy": 0, + "options": "PAD\nPMD", + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "assessment_submission_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Assessment Submission Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "manifest_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manifest Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "tansad_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tansad Number", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "tansad_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "TanSad Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "manifest_comparison_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manifest Comparison Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "final_assessment_obtained", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Final Assessment Obtained", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodged_for_verification", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for Verification", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "verification_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verification Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_66", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "customs_release_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Release Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodged_for_port_charges", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for Port Charges", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "port_charges_payment", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port Charges Payment Date", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transport_requested", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Requested", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "t1_generated", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for T1 (BT)", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "t1_approved", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "T1(BT) Received", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bt_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BT Ref. Number", + "length": 0, + "no_copy": 0, + "permlevel": 5, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_shipping_line_processes", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipping Line Processes", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodged_for_do_invoice", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for DO Invoice", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "invoice_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Received", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodged_for_do", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for DO", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "do_obtained", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "DO Obtained", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_77", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "do_reference", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "DO Reference", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "storing_order_obtained", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Storing Order Obtained", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "storing_order_validity", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Storing Order Validity Date", + "length": 0, + "no_copy": 0, + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "employee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "DO Handed Over to ", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "employee_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Employee Name", + "length": 0, + "no_copy": 0, + "options": "employee.employee_name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_port_processes", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Port Processes", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodged_for_port_invoice", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for Port Invoice", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "invoice_obtained", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Obtained", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodged_for_loading_permit", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodged for Loading Permit", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_permit_obtained", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Obtained", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Time", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_86", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_permit_handover", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Handover to Transporter (Date)", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_permit_handed_to_transporter_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Handed to Transporter (Time)", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "permit_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Permit Received By", + "length": 0, + "no_copy": 0, + "permlevel": 2, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "special_instructions_to_transporter", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Special Instructions To Transporter", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_assigned_transport", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Transport", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Assigned Transport", + "fetch_if_empty": 0, + "fieldname": "assign_transport", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Transport", + "length": 0, + "no_copy": 0, + "options": "Transport Assignment", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_required_permits", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Permits", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "required_permits", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Permits Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "requested_funds_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Requested Funds", + "fetch_if_empty": 0, + "fieldname": "requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 3, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expenses_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Expenses Incurred", + "fetch_if_empty": 0, + "fieldname": "expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 3, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_attachments", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attachments", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachments", + "length": 0, + "no_copy": 0, + "options": "File Attachment", + "permlevel": 4, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_reporting_status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reporting_status", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting Status", + "length": 0, + "no_copy": 0, + "options": "Reporting Status Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "closing_information_section", + "fieldtype": "Section Break", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Closing Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_file_closing_information", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Closing Information", + "length": 0, + "no_copy": 0, + "options": "Container File Closing Information", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "Open\nClosed", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cheque_time", + "fieldtype": "Time", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "cheque_time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-03 22:35:47.600004", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Import", + "name_case": "UPPER CASE", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "bl_number", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/import/import.py b/csf_tz/clearing_and_forwarding/doctype/import/import.py new file mode 100644 index 0000000..541a5db --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import/import.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from csf_tz.after_sales_services.doctype.requested_payments.requested_payments import validate_requested_funds +from csf_tz.clearing_and_forwarding.doctype.bond.bond import create_update_bond + + +class Import(Document): + from csf_tz.after_sales_services.doctype.reference_payment_table.reference_payment_table import update_child_table + + def onload(self): + if not self.company: + self.company = frappe.defaults.get_user_default("Company") or frappe.defaults.get_global_default("company") + + def before_save(self): + validate_requested_funds(self) + + if self.cargo_information: + for cargo in self.cargo_information: + if cargo.get('bond_ref_no') and cargo.get('bond_value'): + bond = create_update_bond(reference_no=cargo.bond_ref_no, bond_value=cargo.bond_value, no_of_packages=cargo.no_of_packages, cargo=self.cargo, + reference_doctype='Import', reference_docname=self.name) + + + +@frappe.whitelist(allow_guest=True) +def create_import(**args): + args = frappe._dict(args) + + existing_import = frappe.db.get_value("Import", + {"bl_number": args.bl_number}) + + + if existing_import: + doc = frappe.get_doc("Import", existing_import) + doc.db_set("reference_file_number", args.file_number) + doc.db_set("import_type", args.import_type) + return existing_import + else: + new_import = frappe.new_doc("Import") + new_import.update({ + "bl_number":args.bl_number, + "documents_received_date": args.documents_received_date, + "location": args.location, + "customer": args.customer, + "reference_file_number": args.file_number, + "import_type": args.import_type + }) + new_import.insert(ignore_permissions=True) + return new_import.name + +@frappe.whitelist(allow_guest=True) +def check_import_status(**args): + args = frappe._dict(args) + #get import + existing_import = frappe.db.get_value("Import", + {"reference_file_number": args.file_number}) + if existing_import: + doc = frappe.get_doc("Import", existing_import) + status=doc.status + if status=='Open': + frappe.msgprint("Cannot Close the File because it's IMPORT is not closed,Please Close the IMPORT first") diff --git a/csf_tz/clearing_and_forwarding/doctype/import/import_dashboard.py b/csf_tz/clearing_and_forwarding/doctype/import/import_dashboard.py new file mode 100644 index 0000000..4d87eb9 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import/import_dashboard.py @@ -0,0 +1,24 @@ +from frappe import _ + +def get_data(): + return { + 'fieldname': 'import', + 'non_standard_fieldnames': { + 'Files': 'import_reference', + 'Transport Request': 'reference_docname', + 'Requested Payments': 'reference_docname', + 'Landed Cost Voucher': 'receipt_document', + 'Purchase Invoice': 'return_against' + }, + 'internal_links': { + #'Purchase Order': ['items', 'purchase_order'], + #'Purchase Receipt': ['items', 'purchase_receipt'], + }, + 'transactions': [ + { + 'label': _('References'), + 'items': ['Files','Transport Request','Requested Payments' ] + }, + + ] + } \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/import/test_import.js b/csf_tz/clearing_and_forwarding/doctype/import/test_import.js new file mode 100644 index 0000000..0d1119d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import/test_import.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Import", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Import + () => frappe.tests.make('Import', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/import/test_import.py b/csf_tz/clearing_and_forwarding/doctype/import/test_import.py new file mode 100644 index 0000000..5d15556 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import/test_import.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Import') + +class TestImport(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/import_border_procedure_table.json b/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/import_border_procedure_table.json new file mode 100644 index 0000000..31bb8c6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/import_border_procedure_table.json @@ -0,0 +1,151 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-25 11:59:46.193803", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "procedure", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Procedure", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "attachment", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Attachment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "extra_comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Extra Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-04-25 12:46:15.729769", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Import Border Procedure Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/import_border_procedure_table.py b/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/import_border_procedure_table.py new file mode 100644 index 0000000..9b69b09 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import_border_procedure_table/import_border_procedure_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ImportBorderProcedureTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/import_file/__init__.py b/csf_tz/clearing_and_forwarding/doctype/import_file/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.js b/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.js new file mode 100644 index 0000000..7fedbde --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Import File', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.json b/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.json new file mode 100644 index 0000000..88bf5fd --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.json @@ -0,0 +1,98 @@ +{ + "actions": [], + "autoname": "field:import_file_number", + "creation": "2021-01-20 10:53:40.586792", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "import_file_number", + "bl_number", + "no_of_containers", + "tansad_no", + "clearing_agent_name", + "column_break_6", + "supplier_name", + "supplier_invoice_no", + "invoice_currency", + "invoice_amount" + ], + "fields": [ + { + "fieldname": "import_file_number", + "fieldtype": "Data", + "label": "Import File Number", + "unique": 1 + }, + { + "fieldname": "bl_number", + "fieldtype": "Data", + "label": "BL Number" + }, + { + "fieldname": "no_of_containers", + "fieldtype": "Data", + "label": "No of Containers" + }, + { + "fieldname": "clearing_agent_name", + "fieldtype": "Data", + "label": "Clearing Agent Name" + }, + { + "fieldname": "supplier_name", + "fieldtype": "Link", + "label": "Supplier Name", + "options": "Supplier" + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + }, + { + "fieldname": "supplier_invoice_no", + "fieldtype": "Data", + "label": "Supplier Invoice No" + }, + { + "fieldname": "invoice_currency", + "fieldtype": "Link", + "label": "Invoice Currency", + "options": "Currency" + }, + { + "fieldname": "invoice_amount", + "fieldtype": "Currency", + "label": "Invoice Amount" + }, + { + "fieldname": "tansad_no", + "fieldtype": "Data", + "label": "TANSAD No." + } + ], + "links": [], + "modified": "2022-03-01 15:26:26.262866", + "modified_by": "Administrator", + "module": "Clearing And Forwarding", + "name": "Import File", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "search_fields": "supplier_name, bl_number, supplier_invoice_no", + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.py b/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.py new file mode 100644 index 0000000..911238a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import_file/import_file.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class ImportFile(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/import_file/test_import_file.py b/csf_tz/clearing_and_forwarding/doctype/import_file/test_import_file.py new file mode 100644 index 0000000..946fa14 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/import_file/test_import_file.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestImportFile(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/locations/__init__.py b/csf_tz/clearing_and_forwarding/doctype/locations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/locations/locations.js b/csf_tz/clearing_and_forwarding/doctype/locations/locations.js new file mode 100644 index 0000000..f1e62f3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/locations/locations.js @@ -0,0 +1,11 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Locations', { + refresh: function(frm) { + + }, + + onload: function(frm){ + }, +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/locations/locations.json b/csf_tz/clearing_and_forwarding/doctype/locations/locations.json new file mode 100644 index 0000000..d9cef39 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/locations/locations.json @@ -0,0 +1,124 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:location_name", + "beta": 0, + "creation": "2017-02-22 17:58:01.982288", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Type", + "length": 0, + "no_copy": 0, + "options": "Office\nBorder Post", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-05-28 15:11:39.285626", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Locations", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/locations/locations.py b/csf_tz/clearing_and_forwarding/doctype/locations/locations.py new file mode 100644 index 0000000..2169fb5 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/locations/locations.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Locations(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/locations/test_locations.js b/csf_tz/clearing_and_forwarding/doctype/locations/test_locations.js new file mode 100644 index 0000000..a76a1dc --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/locations/test_locations.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Locations", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Locations + () => frappe.tests.make('Locations', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/locations/test_locations.py b/csf_tz/clearing_and_forwarding/doctype/locations/test_locations.py new file mode 100644 index 0000000..9a2d037 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/locations/test_locations.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestLocations(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/__init__.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.js b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.js new file mode 100644 index 0000000..3111f19 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Mandatory Attachment', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.json b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.json new file mode 100644 index 0000000..68bf670 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.json @@ -0,0 +1,248 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-06-05 12:36:29.702056", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "local_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Import", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transit_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Import", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "local_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Export", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transit_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Export", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border_exit", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Exit", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border_entry", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Entry", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-06-05 12:50:51.241213", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Mandatory Attachment", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.py new file mode 100644 index 0000000..c3854db --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/mandatory_attachment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class MandatoryAttachment(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/test_mandatory_attachment.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/test_mandatory_attachment.py new file mode 100644 index 0000000..10ea481 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment/test_mandatory_attachment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestMandatoryAttachment(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/mandatory_attachment_table.json b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/mandatory_attachment_table.json new file mode 100644 index 0000000..9a5bd3c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/mandatory_attachment_table.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-06-05 12:42:36.242684", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "attachment_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Attachment Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-06-05 15:15:47.423332", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Mandatory Attachment Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/mandatory_attachment_table.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/mandatory_attachment_table.py new file mode 100644 index 0000000..9be0058 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachment_table/mandatory_attachment_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class MandatoryAttachmentTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/__init__.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.js b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.js new file mode 100644 index 0000000..cddec7e --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Mandatory Attachments', { + refresh: function(frm) { + console.log(frm); + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.json b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.json new file mode 100644 index 0000000..a1187f9 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.json @@ -0,0 +1,410 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-06-05 12:57:02.844078", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Common (For Import)", + "fieldname": "common_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Common (For Import)", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Local Import", + "fieldname": "local_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Import", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Transit Import", + "fieldname": "transit_import", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Import", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_export", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Common (For Export)", + "fieldname": "common_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Common (For Export)", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Local Export", + "fieldname": "local_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Local Export", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Transit Export", + "fieldname": "transit_export", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transit Export", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_border", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Clearing", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Common (For Border Clearing)", + "fieldname": "common_border", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Common (For Border Clearing)", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Border Exit", + "fieldname": "border_exit", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Exit", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Border Entry", + "fieldname": "border_entry", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Entry", + "length": 0, + "no_copy": 0, + "options": "Mandatory Attachment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2017-06-05 14:45:49.452505", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Mandatory Attachments", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.py b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.py new file mode 100644 index 0000000..6d6f374 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/mandatory_attachments/mandatory_attachments.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class MandatoryAttachments(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/packing_list/__init__.py b/csf_tz/clearing_and_forwarding/doctype/packing_list/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/packing_list/packing_list.json b/csf_tz/clearing_and_forwarding/doctype/packing_list/packing_list.json new file mode 100644 index 0000000..535821c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/packing_list/packing_list.json @@ -0,0 +1,191 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-03-29 17:54:57.243112", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "seal_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Seal Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "no_of_bundles", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Number of Bundles", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "net_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Net Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "gross_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Gross Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-07-25 18:31:46.917839", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Packing List", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/packing_list/packing_list.py b/csf_tz/clearing_and_forwarding/doctype/packing_list/packing_list.py new file mode 100644 index 0000000..637f761 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/packing_list/packing_list.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PackingList(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/permits_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/permits_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/permits_table/permits_table.json b/csf_tz/clearing_and_forwarding/doctype/permits_table/permits_table.json new file mode 100644 index 0000000..0a5e5d3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/permits_table/permits_table.json @@ -0,0 +1,179 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-11 19:02:16.931304", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lodged", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Lodged Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Received Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "certificate", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Attachment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "additional_notes", + "fieldtype": "Long Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Additional Notes", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-04-29 03:29:19.165219", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Permits Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/permits_table/permits_table.py b/csf_tz/clearing_and_forwarding/doctype/permits_table/permits_table.py new file mode 100644 index 0000000..47fc4ac --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/permits_table/permits_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PermitsTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/port/__init__.py b/csf_tz/clearing_and_forwarding/doctype/port/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/port/port.js b/csf_tz/clearing_and_forwarding/doctype/port/port.js new file mode 100644 index 0000000..61e8e12 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/port/port.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Port', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/port/port.json b/csf_tz/clearing_and_forwarding/doctype/port/port.json new file mode 100644 index 0000000..efe8e15 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/port/port.json @@ -0,0 +1,126 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:port", + "beta": 0, + "creation": "2017-03-14 16:15:24.706950", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "port", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Port", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-05-28 15:11:58.479459", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Port", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "port, country", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "port", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/port/port.py b/csf_tz/clearing_and_forwarding/doctype/port/port.py new file mode 100644 index 0000000..57fb88d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/port/port.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Port(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/port/test_port.js b/csf_tz/clearing_and_forwarding/doctype/port/test_port.js new file mode 100644 index 0000000..50ef908 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/port/test_port.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Port", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Port + () => frappe.tests.make('Port', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/port/test_port.py b/csf_tz/clearing_and_forwarding/doctype/port/test_port.py new file mode 100644 index 0000000..48c272c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/port/test_port.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Port') + +class TestPort(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/__init__.py b/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/reporting_status_table.json b/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/reporting_status_table.json new file mode 100644 index 0000000..018206c --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/reporting_status_table.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-01-25 11:35:25.119218", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 2, + "fieldname": "datetime", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date and Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-01-25 11:47:54.106771", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Reporting Status Table", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/reporting_status_table.py b/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/reporting_status_table.py new file mode 100644 index 0000000..4ce0654 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/reporting_status_table/reporting_status_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ReportingStatusTable(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/required_permit/__init__.py b/csf_tz/clearing_and_forwarding/doctype/required_permit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/required_permit/required_permit.json b/csf_tz/clearing_and_forwarding/doctype/required_permit/required_permit.json new file mode 100644 index 0000000..ff78de4 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/required_permit/required_permit.json @@ -0,0 +1,96 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2017-04-06 16:08:41.868645", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 3, + "fieldname": "permit_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mandatory", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mandatory", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-04-11 18:40:32.697344", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Required Permit", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/required_permit/required_permit.py b/csf_tz/clearing_and_forwarding/doctype/required_permit/required_permit.py new file mode 100644 index 0000000..80349bd --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/required_permit/required_permit.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class RequiredPermit(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/shipping_line/__init__.py b/csf_tz/clearing_and_forwarding/doctype/shipping_line/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.js b/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.js new file mode 100644 index 0000000..b89752f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.js @@ -0,0 +1,13 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Shipping Line', { + refresh: function(frm) { + frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Shipping Line'}; + if(!frm.doc.__islocal) { + frappe.contacts.render_address_and_contact(frm); + }else { + frappe.contacts.clear_address_and_contact(frm); + } + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.json b/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.json new file mode 100644 index 0000000..8827b37 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.json @@ -0,0 +1,182 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:shipping_line_name", + "beta": 0, + "creation": "2017-02-22 18:36:37.168955", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipping_line_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Shipping Line", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Address HTML", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "contact_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Contact HTML", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-05-30 19:05:20.620451", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Shipping Line", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.py b/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.py new file mode 100644 index 0000000..c9dd575 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/shipping_line/shipping_line.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address + + +class ShippingLine(Document): + def onload(self): + """Load address and contacts in `__onload`""" + load_address_and_contact(self, "customer") diff --git a/csf_tz/clearing_and_forwarding/doctype/shipping_line/test_shipping_line.js b/csf_tz/clearing_and_forwarding/doctype/shipping_line/test_shipping_line.js new file mode 100644 index 0000000..35d8df6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/shipping_line/test_shipping_line.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Shipping Line", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Shipping Line + () => frappe.tests.make('Shipping Line', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/shipping_line/test_shipping_line.py b/csf_tz/clearing_and_forwarding/doctype/shipping_line/test_shipping_line.py new file mode 100644 index 0000000..b0cc39a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/shipping_line/test_shipping_line.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Shipping Line') + +class TestShippingLine(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/terminal/__init__.py b/csf_tz/clearing_and_forwarding/doctype/terminal/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.js b/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.js new file mode 100644 index 0000000..e7c8f8f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Terminal', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.json b/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.json new file mode 100644 index 0000000..a94fc33 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.json @@ -0,0 +1,90 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:terminal", + "beta": 0, + "creation": "2017-04-24 21:00:43.360994", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "terminal", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Terminal", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-04-24 21:00:43.360994", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Terminal", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.py b/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.py new file mode 100644 index 0000000..76ca534 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/terminal/terminal.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Terminal(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/terminal/test_terminal.py b/csf_tz/clearing_and_forwarding/doctype/terminal/test_terminal.py new file mode 100644 index 0000000..c8294f9 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/terminal/test_terminal.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Terminal') + +class TestTerminal(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/test_doctype/__init__.py b/csf_tz/clearing_and_forwarding/doctype/test_doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.js b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.js new file mode 100644 index 0000000..be1c227 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Test Doctype', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.json b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.json new file mode 100644 index 0000000..0ba54a0 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.json @@ -0,0 +1,117 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-01-27 12:14:16.331332", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "test1", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "test ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "test_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Test Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-01-27 12:14:16.331332", + "modified_by": "info@aakvatech.com", + "module": "Clearing and Forwarding", + "name": "Test Doctype", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.py b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.py new file mode 100644 index 0000000..8530ce8 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_doctype.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TestDoctype(Document): + pass diff --git a/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_test_doctype.py b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_test_doctype.py new file mode 100644 index 0000000..965f14d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/doctype/test_doctype/test_test_doctype.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logisitcs and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Test Doctype') + +class TestTestDoctype(unittest.TestCase): + pass diff --git a/csf_tz/clearing_and_forwarding/print_format/__init__.py b/csf_tz/clearing_and_forwarding/print_format/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/print_format/cheque_handover_document/__init__.py b/csf_tz/clearing_and_forwarding/print_format/cheque_handover_document/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/print_format/cheque_handover_document/cheque_handover_document.json b/csf_tz/clearing_and_forwarding/print_format/cheque_handover_document/cheque_handover_document.json new file mode 100644 index 0000000..a801e75 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/print_format/cheque_handover_document/cheque_handover_document.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 1, + "creation": "2019-07-31 12:15:40.625346", + "custom_format": 0, + "disabled": 0, + "doc_type": "Import", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\n\\t\\t\\t\\t\\t\\n\\t

CHEQUE HANDOVER DOCUMENT
{{ doc.name }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n
Date
\\n
{{ frappe.format(doc.date, 'Date') }}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Time
\\n
{{frappe.utils.get_datetime(doc.cheque_time).strftime('%H:%M:%S') }}
\\n
\\n\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Import No
\\n
{{ doc.name}}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Amount
\\n

\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Cheque Reference
\\n

\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n \\n
\\n
From
\\n

\\n
\\n \\n
\\n
\\n \\n
\\n
Signature
\\n

\\n
\\n \\n
\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n
\\n
Handed to
\\n\\t

\\n\\n\\n
\\n \\n
\\n
\\n \\n
\\n
Signature
\\n

\\n
\\n \\n
\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}]", + "idx": 0, + "line_breaks": 1, + "modified": "2019-08-14 14:55:02.335458", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Cheque Handover Document", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/print_format/do_handover/__init__.py b/csf_tz/clearing_and_forwarding/print_format/do_handover/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/print_format/do_handover/do_handover.json b/csf_tz/clearing_and_forwarding/print_format/do_handover/do_handover.json new file mode 100644 index 0000000..bff0ab4 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/print_format/do_handover/do_handover.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 1, + "creation": "2019-07-29 12:13:18.803362", + "custom_format": 0, + "disabled": 0, + "doc_type": "Import", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\n\\t\\t\\t\\t\\t\\n\\t

DO HANDOVER DOCUMENT
{{ doc.name }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n
Date
\\n
{{ frappe.format(doc.date, 'Date') }}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
DO Reference
\\n
{{ doc.do_reference}}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Import No
\\n
{{ doc.name}}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n \\n
\\n
From
\\n
{{ frappe.session.user }}
\\n
\\n \\n
\\n
\\n \\n
\\n
Signature
\\n

\\n
\\n \\n
\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n \\n
\\n
Handed to
\\n
{{ doc.employee_name}}
\\n
\\n
\\n\\n
\\n \\n
\\n
Signature
\\n

\\n
\\n
\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}]", + "idx": 0, + "line_breaks": 1, + "modified": "2019-07-29 17:22:52.511221", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "DO Handover", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/print_format/permit_handover_document/__init__.py b/csf_tz/clearing_and_forwarding/print_format/permit_handover_document/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/print_format/permit_handover_document/permit_handover_document.json b/csf_tz/clearing_and_forwarding/print_format/permit_handover_document/permit_handover_document.json new file mode 100644 index 0000000..54c718a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/print_format/permit_handover_document/permit_handover_document.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 1, + "creation": "2019-07-31 12:14:36.893065", + "custom_format": 0, + "disabled": 0, + "doc_type": "Import", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\n\\t\\t\\t\\t\\t\\n\\t

PERMIT HANDOVER DOCUMENT
{{ doc.name }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n
Date
\\n
{{ frappe.format(doc.date, 'Date') }}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Time
\\n
{{frappe.utils.get_datetime(doc.cheque_time).strftime('%H:%M:%S') }}
\\n
\\n\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Import No
\\n
{{ doc.name}}
\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Permit Reference
\\n

\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"options\": \"
\\n
Transporter
\\n

\\n
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n \\n
\\n
From
\\n

\\n
\\n \\n
\\n
\\n \\n
\\n
Signature
\\n

\\n
\\n \\n
\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"
\\n \\n
\\n
Handed to
\\n

\\n
\\n
\\n\\n
\\n \\n
\\n
Signature
\\n

\\n
\\n
\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}]", + "idx": 0, + "line_breaks": 1, + "modified": "2019-08-14 14:04:03.724465", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Permit Handover Document", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/__init__.py b/csf_tz/clearing_and_forwarding/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/bond_report/__init__.py b/csf_tz/clearing_and_forwarding/report/bond_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.js b/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.js new file mode 100644 index 0000000..1a45d7f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.js @@ -0,0 +1,44 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Bond Report"] = { + "filters": [ + { + "fieldname":"filter_by", + "label": __("Filter By"), + "fieldtype": "Select", + "options": "Bond Date\nBond Cancelation Date", + "default": "Bond Date" + }, + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"bt", + "label": __("BT/T1"), + "fieldtype": "Data" + }, + { + "fieldname":"status", + "label": __("Status"), + "fieldtype": "Select", + "options": "Not Cancelled\nCancelled\nAll", + "default": "Not Cancelled" + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.json b/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.json new file mode 100644 index 0000000..e92adf5 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.json @@ -0,0 +1,41 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2018-02-16 12:27:45.372617", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-03-09 11:27:54.596752", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Bond Report", + "owner": "Administrator", + "ref_doctype": "Files", + "report_name": "Bond Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Declaration Officer - Border" + }, + { + "role": "Declaration Officer" + }, + { + "role": "Assistant Declaration Officer - Tunduma" + }, + { + "role": "Import Key Account Manager" + }, + { + "role": "Export Documentation Officer" + }, + { + "role": "Export Key Account Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.py b/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.py new file mode 100644 index 0000000..4b73ce6 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/bond_report/bond_report.py @@ -0,0 +1,162 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "bond_reference", + "label": _("Bond Reference"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname":"sub_t1", + "label": _("Sub T1"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname":"bond_date", + "label": _("Bond Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname":"bond_value", + "label": _("Bond Value"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname":"cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname":"bond_cancellation_date", + "label": _("Bond Cancelled"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname":"reference_type", + "label": _("Reference Type"), + "fieldtype": "Link", + "options": "Doctype", + "width": 100 + }, + { + "fieldname":"reference_doc", + "label": _("Reference"), + "fieldtype": "Dynamic Link", + "options": "reference_type", + "width": 100 + } + ] + + where = "" + where_filter = {} + + if filters: + where += ' WHERE ' + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + if filters.from_date and filters.to_date: + if filters.filter_by == 'Bond Date': + where += " bond_date >= %(from_date)s AND bond_date <= %(to_date)s " + where_filter.update({'from_date': filters.from_date, "to_date": filters.to_date}) + elif filters.filter_by == 'Bond Cancelation Date': + where += " bond_cancellation_date >= %(from_date)s AND bond_cancellation_date <= %(to_date)s " + where_filter.update({'from_date': filters.from_date, "to_date": filters.to_date}) + + if filters.bt: + where += " AND bond_reference LIKE %(bond_reference)s " + where_filter.update({"bond_reference": filters.bt}) + + if filters.status == 'Not Cancelled': + where += " AND bond_cancellation_date IS NULL " + elif filters.status == 'Cancelled': + where += " AND bond_cancellation_date IS NOT NULL " + + data = frappe.db.sql('''SELECT * FROM + ( + SELECT + `tabImport`.bt_number AS bond_reference, + cargo1.bond_ref_no AS sub_t1, + `tabImport`.t1_approved AS bond_date, + cargo1.bond_value, + `tabImport`.cargo, + `tabBorder Clearance`.bond_canceled_date AS bond_cancellation_date, + 'Import' AS reference_type, + `tabImport`.name AS reference_doc + FROM + `tabCargo Details` AS cargo1 + LEFT JOIN + `tabImport` ON `tabImport`.name = cargo1.parent + LEFT JOIN + `tabBorder Clearance` ON `tabBorder Clearance`.name = (SELECT cargo2.parent FROM `tabCargo Details` AS cargo2 \ + WHERE cargo2.parenttype = 'Border Clearance' AND cargo2.bond_ref_no = cargo1.bond_ref_no LIMIT 1) + WHERE + cargo1.parenttype = 'Import' AND `tabImport`.bt_number IS NOT NULL AND `tabImport`.bt_number != '' + UNION ALL + SELECT + `tabExport`.bt_ref_no AS bond_reference, + `tabBond Reference Table`.customs_ref_number AS sub_t1, + `tabExport`.bt_approval_date AS bond_date, + `tabBond Reference Table`.bond_value, + `tabExport`.material AS cargo, + `tabExport`.bond_validated AS bond_cancellation_date, + 'Export' AS reference_type, + `tabExport`.name AS reference_doc + FROM + `tabBond Reference Table` + LEFT JOIN + `tabExport` ON `tabExport`.name = `tabBond Reference Table`.parent + WHERE + `tabBond Reference Table`.parenttype = 'Export' AND `tabExport`.bt_ref_no IS NOT NULL AND `tabExport`.bt_ref_no != '' + UNION ALL + SELECT + `tabBorder Clearance`.bond_ref_no AS bond_reference, + `tabCargo Details`.bond_ref_no AS sub_t1, + `tabBorder Clearance`.bt_approval_date AS bond_date, + `tabCargo Details`.bond_value, + `tabBorder Clearance`.cargo_description AS cargo, + `tabBorder Clearance`.bond_canceled_date AS bond_cancellation_date, + 'Border Clearance' AS reference_type, + `tabBorder Clearance`.name AS reference_doc + FROM + `tabCargo Details` + LEFT JOIN + `tabBorder Clearance` ON `tabBorder Clearance`.name = `tabCargo Details`.parent + WHERE + `tabCargo Details`.parenttype = 'Border Clearance' AND `tabBorder Clearance`.bond_ref_no IS NOT NULL \ + AND `tabBorder Clearance`.bond_ref_no != '' AND `tabBorder Clearance`.cargo_type = 'Container' \ + AND `tabBorder Clearance`.clearance_type IN ('Entry', 'Pass Through') + UNION ALL + SELECT + `tabBorder Clearance`.bond_ref_no AS bond_reference, + `tabBorder Clearance`.loose_sub_t1_ref AS sub_t1, + `tabBorder Clearance`.bt_approval_date AS bond_date, + `tabBorder Clearance`.loose_bond_value AS bond_value, + `tabBorder Clearance`.cargo_description AS cargo, + `tabBorder Clearance`.bond_canceled_date AS bond_cancellation_date, + 'Border Clearance' AS reference_type, + `tabBorder Clearance`.name AS reference_doc + FROM + `tabBorder Clearance` + WHERE + `tabBorder Clearance`.bond_ref_no IS NOT NULL \ + AND `tabBorder Clearance`.bond_ref_no != '' AND `tabBorder Clearance`.cargo_type = 'Loose Cargo' \ + AND `tabBorder Clearance`.clearance_type IN ('Entry', 'Pass Through') + ) AS a''' + + where + + '''ORDER BY bond_date ASC''', where_filter, as_dict=1) + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/border_clearance/__init__.py b/csf_tz/clearing_and_forwarding/report/border_clearance/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.js b/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.js new file mode 100644 index 0000000..308dbfa --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.js @@ -0,0 +1,40 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ +var aday = new Date(); +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 60); +var to_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Border Clearance"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"client", + "label": __("Client"), + "fieldtype": "Link", + "options": "Customer", + }, + { + "fieldname":"type", + "label": __("type"), + "fieldtype": "Select", + "options": "All\nImport\nExport", + "default": "All" + } + ] +} + diff --git a/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.json b/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.json new file mode 100644 index 0000000..7360151 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2017-08-30 21:23:44.922371", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:27:06.944302", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Border Clearance", + "owner": "Administrator", + "query": "SELECT\n\t`tabBorder Clearance`.name AS \"File Number:Link/Border Clearance:100\",\n\t`tabBorder Clearance`.client AS \"Client:Data:100\",\n\t`tabBorder Clearance`.billing_type AS \"Billing Type:Data:100\",\n\t`tabBorder Clearance`.documents_received AS \"Documents Received:Date:100\",\n\tCASE\n\t\tWHEN `tabBorder Clearance`.transporter_type = 'Bravo' THEN 'Bravo'\n\tELSE `tabBorder Clearance`.transporter_name\n\tEND AS \"Transporter Name:Data:100\",\n\t`tabBorder Clearance`.trip_reference_no AS \"Trip Number:Link/Vehicle Trip:100\",\n\t`tabBorder Clearance`.vehicle_plate_number AS \"Vehicle Reg:Data:100\",\n\t`tabBorder Clearance`.trailer_plate_number AS \"Trailer Reg:Data:100\",\n\t`tabBorder Clearance`.driver_name AS \"Driver Name:Data:100\",\n\t`tabBorder Clearance`.cargo_category AS \"Cargo Description:Data:100\",\n\t`tabBorder Clearance`.bond_ref_no AS \"Bond Reference:Data:100\",\n\t`tabBorder Clearance`.cargo_origin_country AS \"Cargo Origin:Data:100\",\n\t`tabBorder Clearance`.cargo_destination_exact AS \"Cargo Destination:Data:100\",\n\t`tabBorder Clearance`.border1_name AS \"Border 1 Name:Data:100\",\n\t`tabBorder Clearance`.border1_arrival AS \"Border 1 Arrival:Datetime:100\",\n\t`tabBorder Clearance`.border1_departure AS \"Border 1 Departure:Datetime:100\",\n\t`tabBorder Clearance`.border1_crossing AS \"Border 1 Crossing:Datetime:100\",\n\t`tabBorder Clearance`.border2_name AS \"Border 2 Name:Data:100\",\n\t`tabBorder Clearance`.border2_arrival AS \"Border 2 Arrival:Datetime:100\",\n\t`tabBorder Clearance`.border2_departure AS \"Border 2 Departure:Datetime:100\",\n\t`tabBorder Clearance`.border2_crossing AS \"Border 2 Crossing:Datetime:100\",\n\t`tabBorder Clearance`.offloading_point_arrival AS \"Arrival at Offloading Point:Datetime:100\",\n\t`tabBorder Clearance`.offloading_datetime AS \"Offloading Date and Time:Datetime:100\",\n\t(SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Border Clearance' AND `tabReporting Status Table`.parent = `tabBorder Clearance`.name ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS \"Remarks:Data:150\"\nFROM\n\t`tabBorder Clearance`", + "ref_doctype": "Border Clearance", + "report_name": "Border Clearance", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Import Key Account Manager" + }, + { + "role": "Declaration Officer - Border" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.py b/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.py new file mode 100644 index 0000000..fda6099 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/border_clearance/border_clearance.py @@ -0,0 +1,268 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe + +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "file_number", + "label": _("File No"), + "fieldtype": "Link", + "options": "Border Clearance", + "width": 100 + }, + { + "fieldname": "client", + "label": _("Client"), + "fieldtype": "Link", + "options": "Customer", + "width": 100 + }, + { + "fieldname": "consignee", + "label": _("Consignee"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "type", + "label": _("Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "crn_reference_number", + "label": _("CRN Reference No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "documents_received", + "label": _("Documents Received"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "transporter", + "label": _("Transporter"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "trip_number", + "label": _("Trip Number"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "vehicle_reg", + "label": _("Vehicle Reg"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "trailer_reg", + "label": _("Trailer Reg"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "driver_name", + "label": _("Driver Name"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "container_size", + "label": _("Container Size"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "weight", + "label": _("Weight (kg)"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "bond_reference", + "label": _("Bond Reference"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo_origin", + "label": _("Cargo Origin"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo_destination", + "label": _("Cargo Destination"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "border1_name", + "label": _("Border 1 Name"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "border1_arrival", + "label": _("Border 1 Arrival"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "border1_departure", + "label": _("Border 1 Departure"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "border1_crossing", + "label": _("Border 1 Crossing"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "border2_name", + "label": _("Border 2 Name"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "border2_arrival", + "label": _("Border 2 Arrival"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "border2_departure", + "label": _("Border 2 Departure"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "border2_crossing", + "label": _("Border 2 Crossing"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "arrival_offloading_point", + "label": _("Arrival Offloading Point"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "offloading_datetime", + "label": _("Offloading Date and Time"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "Data", + "width": 100 + } + ] + + where = '' + where_filter = {} + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + else: + where = " WHERE `tabBorder Clearance`.documents_received >= %(from_date)s AND `tabBorder Clearance`.documents_received <= %(to_date)s" + where_filter.update({"from_date": filters.from_date, "to_date": filters.to_date}) + + if filters.client: + where += 'AND `tabBorder Clearance`.client = %(client)s' + where_filter.update({"client": filters.client}) + + if filters.type and filters.type == 'Import': + where += "AND `tabBorder Clearance`.clearance_type = 'Exit'" + elif filters.type and filters.type == 'Export': + where += "AND `tabBorder Clearance`.clearance_type = 'Entry'" + + + data = frappe.db.sql(''' + SELECT + `tabBorder Clearance`.name AS file_number, + `tabBorder Clearance`.client AS client, + `tabBorder Clearance`.consignee, + CASE + WHEN `tabBorder Clearance`.clearance_type = 'Entry' THEN 'Export' + WHEN `tabBorder Clearance`.clearance_type = 'Exit' THEN 'Import' + WHEN `tabBorder Clearance`.clearance_type = 'Pass Through' THEN 'Pass Through' + END AS type, + `tabBorder Clearance`.crn_reference_number, + `tabBorder Clearance`.documents_received AS documents_received, + CASE + WHEN `tabBorder Clearance`.transporter_type = 'Bravo' THEN 'Bravo' + ELSE `tabBorder Clearance`.transporter_name + END AS transporter, + `tabBorder Clearance`.trip_reference_no AS trip_number, + `tabBorder Clearance`.vehicle_plate_number AS vehicle_reg, + `tabBorder Clearance`.trailer_plate_number AS trailer_reg, + `tabBorder Clearance`.driver_name AS driver_name, + `tabBorder Clearance`.cargo_category AS cargo, + CASE + WHEN `tabBorder Clearance`.cargo_type = 'Container' AND `tabCargo Details`.container_size IN ('40 FT GP', '40 OT', '40RF', '40 FT Heavy') THEN '40' + WHEN `tabBorder Clearance`.cargo_type = 'Container' AND `tabCargo Details`.container_size IN ('20 FT GP', '20 OT', '20RF') THEN '20' + WHEN `tabBorder Clearance`.cargo_type = 'Loose Cargo' THEN 'Loose Cargo' + END AS container_size, + CASE + WHEN `tabBorder Clearance`.cargo_type = 'Container' THEN `tabCargo Details`.net_weight + WHEN `tabBorder Clearance`.cargo_type = 'Loose Cargo' THEN `tabBorder Clearance`.loose_net_weight + END AS weight, + `tabBorder Clearance`.bond_ref_no AS bond_reference, + `tabBorder Clearance`.cargo_origin_country AS cargo_origin, + `tabBorder Clearance`.cargo_destination_exact AS cargo_destination, + `tabBorder Clearance`.border1_name AS border1_name, + `tabBorder Clearance`.border1_arrival AS border1_arrival, + `tabBorder Clearance`.border1_departure AS border1_departure, + `tabBorder Clearance`.border1_crossing AS border1_crossing, + `tabBorder Clearance`.border2_name AS border2_name, + `tabBorder Clearance`.border2_arrival AS border2_arrival, + `tabBorder Clearance`.border2_departure AS border2_departure, + `tabBorder Clearance`.border2_crossing AS border2_crossing, + `tabBorder Clearance`.offloading_point_arrival AS arrival_offloading_point, + `tabBorder Clearance`.offloading_datetime AS offloading_datetime, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Border Clearance' AND \ + `tabReporting Status Table`.parent = `tabBorder Clearance`.name ORDER BY \ + `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks \ + FROM \ + `tabBorder Clearance` + LEFT JOIN + `tabCargo Details` ON `tabCargo Details`.name = (SELECT name FROM `tabCargo Details` WHERE `tabCargo Details`.parent = `tabBorder Clearance`.name LIMIT 1)''' + where, where_filter, as_dict=True) + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/containers_report/__init__.py b/csf_tz/clearing_and_forwarding/report/containers_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.js b/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.js new file mode 100644 index 0000000..a7e65cd --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.js @@ -0,0 +1,36 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + + + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Containers Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"shipping_line", + "label": __("Shipping Line"), + "fieldtype": "Link", + "options": "Shipping Line", + + + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.json b/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.json new file mode 100644 index 0000000..cd1b169 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2019-11-08 16:24:29.308895", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "bravo", + "modified": "2019-12-11 16:31:25.528859", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Containers Report", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Container", + "report_name": "Containers Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Export Documentation Officer" + }, + { + "role": "Export Key Account Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.py b/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.py new file mode 100644 index 0000000..c451e3a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/containers_report/containers_report.py @@ -0,0 +1,81 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from datetime import datetime + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "creation_document_no", + "label": _("Creation Document No"), + "fieldtype": "Dynamic Link", + "width": 100 + }, + { + "fieldname": "shipping_line", + "label": _("Shipping Line"), + "fieldtype": "Link", + "options": "Shipping Line", + "width": 150 + }, + { + "fieldname": "export_reference", + "label": _("Export Reference"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "booking_number", + "label": _("Booking Number"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "container_no", + "label": _("Container No"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "container_type", + "label": _("Container Type"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "seal_number", + "label": _("Seal Number"), + "fieldtype": "Data", + "width": 100 + }, + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date, } + where = "" + if filters.shipping_line: + where += 'AND tc.shipping_line = %(shipping_line)s ' + where_filter.update({"shipping_line": filters.shipping_line}) + + data = frappe.db.sql('''SELECT + tc.creation_document_no AS creation_document_no, + tc.shipping_line AS shipping_line, + tc.export_reference AS export_reference, + tc.booking_number AS booking_number, + tc.container_no AS container_no, + tc.container_type AS container_type, + tc.seal_number AS seal_number + + FROM + (`tabContainer` tc) + WHERE + tc.container_no IS NOT NULL ''' + where + ''' + ''', + where_filter, as_dict=1, as_list=1); + + return columns, data \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/__init__.py b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.js b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.js new file mode 100644 index 0000000..201c206 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.js @@ -0,0 +1,14 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Daily Customer Report - Exports"] = { + "filters": [ + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.json b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.json new file mode 100644 index 0000000..18d1f26 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2017-12-20 19:47:19.793049", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:25:24.759220", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Daily Customer Report - Exports", + "owner": "Administrator", + "ref_doctype": "Export", + "report_name": "Daily Customer Report - Exports", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Export Documentation Officer" + }, + { + "role": "Export Key Account Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.py b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.py new file mode 100644 index 0000000..cb65673 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/daily_customer_report___exports/daily_customer_report___exports.py @@ -0,0 +1,221 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "file_number", + "label": _("File No"), + "fieldtype": "Link", + "options": "Export", + "width": 100 + }, + { + "fieldname": "client", + "label": _("Client"), + "fieldtype": "Link", + "options": "Customer", + "width": 150 + }, + { + "fieldname": "booking_received", + "label": _("Booking Received"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "booking_no", + "label": _("Booking No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "commodity", + "label": _("Commodity"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "no_of_containers", + "label": _("No of Containers"), + "fieldtype": "Int", + "width": 100 + }, + { + "fieldname": "weight", + "label": _("Weight"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "destination", + "label": _("Destination"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "vessel", + "label": _("Vessel"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "voyager_no", + "label": _("Voyager No"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "shipping_line", + "label": _("Shipping Line"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "eta", + "label": _("ETA"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "engagement_date", + "label": _("Engagement Date"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "payment_cutoff", + "label": _("Payment Cutoff"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "stuffing_date", + "label": _("Stuffing Date"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "tra_release_obtained", + "label": _("TRA Release Obtained"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "lodge_port_charges", + "label": _("Lodge Port Charges"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "port_charges_paid", + "label": _("Port Charges Paid"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "permit_obtained_date", + "label": _("Permit Obtained Date"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "delivery_date", + "label": _("Assigned Delivery Date"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "permit_submited_to_client", + "label": _("Permit Submited to Client"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "containers_arrived_port", + "label": _("Containers Delivered to Port"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "file_submitted_to_scanner", + "label": _("File Submitted to Scanner"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "scanner_report_collected", + "label": _("Scanner Report Collected"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "scanner_report_sent_to_client", + "label": _("Scanner Report Sent to Client"), + "fieldtype": "date", + "width": 100 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "data", + "width": 150 + } + ] + + today = datetime.date.today().strftime("%Y-%m-%d") + yesterday = datetime.date.today() - datetime.timedelta(1) + day_before = datetime.date.today() - datetime.timedelta(2) + yesterday = yesterday.strftime("%Y-%m-%d") + day_before = day_before.strftime("%Y-%m-%d") + + where = '' + where_filter = {'today': today, 'yesterday': yesterday, 'day_before': day_before} + if filters.customer: + where = 'AND tabExport.client = %(customer)s' + where_filter.update({'customer': filters.customer}) + + + data = frappe.db.sql('''SELECT + tabExport.name AS file_number, + tabExport.client, + tabExport.booking_received, + tabExport.booking_number AS booking_no, + tabExport.material AS commodity, + (SELECT count(`tabPacking List`.name) FROM `tabPacking List` WHERE `tabPacking List`.parenttype = 'Export' AND `tabPacking List`.parent = `tabExport`.name) AS no_of_containers, + (SELECT SUM(`tabPacking List`.net_weight) FROM `tabPacking List` WHERE `tabPacking List`.parenttype = 'Export' AND `tabPacking List`.parent = `tabExport`.name) AS weight, + tabExport.destination, + tabExport.vessel_name AS vessel, + tabExport.voyage_no AS voyager_no, + tabExport.shipping_line, + tabExport.eta, + tabExport.engagement_date, + tabExport.cut_off_date AS payment_cutoff, + tabExport.stuffing_date, + tabExport.release_received AS tra_release_obtained, + tabExport.lodge_port_charges, + tabExport.port_charges_paid, + tabExport.loading_permit_received AS permit_obtained_date, + tabExport.loading_date AS delivery_date, + tabExport.loading_permit_handover_transporter AS permit_submited_to_client, + tabExport.containers_arrived_at_port AS containers_arrived_port, + tabExport.file_submitted_to_scanner, + tabExport.scanner_report_collected, + tabExport.scanner_report_sent_to_client, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Export' \ + AND `tabReporting Status Table`.parent = `tabExport`.name ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks + FROM + `tabExport` + WHERE tabExport.status <> 'Closed' AND (`tabExport`.scanner_report_sent_to_client IS NULL OR `tabExport`.scanner_report_sent_to_client IN (%(today)s, %(yesterday)s, %(day_before)s)) + ''' + where, where_filter, as_dict=1) + + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/__init__.py b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.js b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.js new file mode 100644 index 0000000..072f69d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.js @@ -0,0 +1,15 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + + +frappe.query_reports["Daily Customer Report - Imports"] = { + "filters": [ + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.json b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.json new file mode 100644 index 0000000..c47fc84 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2017-12-20 12:50:40.219968", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:27:31.017062", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Daily Customer Report - Imports", + "owner": "Administrator", + "ref_doctype": "Import", + "report_name": "Daily Customer Report - Imports", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Import Key Account Manager" + }, + { + "role": "Declaration Officer" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.py b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.py new file mode 100644 index 0000000..830b434 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/daily_customer_report___imports/daily_customer_report___imports.py @@ -0,0 +1,514 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe + +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "file_number", + "label": _("File No"), + "fieldtype": "Link", + "options": "Import", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150 + }, + { + "fieldname": "customer_ref", + "label": _("Customer Ref"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "consignee", + "label": _("Consignee"), + "fieldtype": "Link", + "options": "Customer", + "width": 100 + }, + { + "fieldname": "destination", + "label": _("Destination"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "doc_rec_date", + "label": _("Docs Received Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "container_number", + "label": _("Container No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "container_size", + "label": _("Container Size"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "weight", + "label": _("Weight"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "eta", + "label": _("ETA"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "ata", + "label": _("ATA"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "discharge_date", + "label": _("Discharge Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "assigned_transport", + "label": _("Assigned Transport"), + "fieldtype": "Link", + "options": "Transport Assignment", + "width": 100 + }, + { + "fieldname": "trip_reference", + "label": _("Trip Ref"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "truck_trailer_no", + "label": _("Truck/Trailer No"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "driver_name", + "label": _("Driver Name"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "licence", + "label": _("Licence"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "contacts", + "label": _("Contacts"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "loading_date", + "label": _("Loading Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "dispatch_date", + "label": _("Dispatch Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "border1_name", + "label": _("1st Border"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "border1_arrival_date", + "label": _("1st Border Arrival Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "border1_dispatch_date", + "label": _("1st Border Dispatch Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "border2_name", + "label": _("2nd Border"), + "fieldtype": "data", + "width": 100 + }, + { + "fieldname": "border2_arrival_date", + "label": _("2nd Border Arrival Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "border2_dispatch_date", + "label": _("2nd Border Dispatch Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "arrival_destination", + "label": _("Arrival Destination"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "cargo_offloaded", + "label": _("Cargo Offloaded"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "vehicle_position", + "label": _("Vehicle Position"), + "fieldtype": "data", + "width": 150 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "data", + "width": 150 + } + ] + + today = datetime.date.today().strftime("%Y-%m-%d") + yesterday = datetime.date.today() - datetime.timedelta(1) + day_before = datetime.date.today() - datetime.timedelta(2) + yesterday = yesterday.strftime("%Y-%m-%d") + day_before = day_before.strftime("%Y-%m-%d") + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where = "" + where_filter = {'today': today, 'yesterday': yesterday, 'day_before': day_before} + if filters.customer: + where += 'AND tabImport.customer = %(customer)s' + where_filter.update({"customer": filters.customer}) + + + #where_filter.update({"where": where}) + + '''data = frappe.db.sql(SELECT * FROM + (SELECT + tabImport.name AS file_number, + tabImport.customer, + CASE + WHEN tabImport.house_bill_of_lading IS NULL OR tabImport.house_bill_of_lading = '' THEN tabImport.bl_number + ELSE tabImport.house_bill_of_lading + END AS customer_ref, + tabImport.consignee, + tabImport.cargo_destination_city AS destination, + tabImport.documents_received_date AS doc_rec_date, + tabImport.cargo_description AS cargo, + `tabCargo Details`.container_number, + CASE + WHEN `tabCargo Details`.container_size IN ('40 FT GP', '40 OT', '40RF', '40 FT Heavy') THEN '40' + WHEN `tabCargo Details`.container_size IN ('20 FT GP', '20 OT', '20RF') THEN '20' + END AS container_size, + `tabCargo Details`.gross_weight AS weight, + tabImport.eta, + tabImport.ata, + tabImport.discharge AS discharge_date, + CONCAT(`tabTransport Assignment`.vehicle_plate_number, "/", `tabTransport Assignment`.vehicle_plate_number) AS truck_trailer_no, + `tabTransport Assignment`.driver_name, + tabImport.loading_date, + loading_point.departure_date AS dispatch_date, + border1.arrival_date AS border_arrival_date, + border1.departure_date AS border_dispatch_date, + offloading_point.arrival_date AS arrival_destination, + offloading_point.offloading_date AS cargo_offloaded, + (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE parent = `tabVehicle Trip`.name + AND parenttype = 'Vehicle Trip' AND parentfield = 'main_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp DESC LIMIT 1) AS vehicle_position, + CASE + WHEN `tabVehicle Trip`.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = `tabVehicle Trip`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + ELSE (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Import' AND `tabReporting Status Table`.parent = `tabImport`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + END AS remarks + FROM + `tabCargo Details` + LEFT JOIN + tabImport ON tabImport.name = `tabCargo Details`.parent + LEFT JOIN + `tabTransport Assignment` ON `tabTransport Assignment`.container_number = `tabCargo Details`.container_number + LEFT JOIN + `tabVehicle Trip` ON `tabVehicle Trip`.reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabRoute Steps Table` AS loading_point \ + ON loading_point.name = (SELECT `tabRoute Steps Table`.name FROM `tabRoute Steps Table` WHERE \ + `tabRoute Steps Table`.parent = `tabVehicle Trip`.name AND UPPER(location_type) = 'LOADING POINT' and loading_point.parentfield = 'main_route_steps' LIMIT 1) + LEFT JOIN + `tabRoute Steps Table` AS border1 \ + ON border1.name = (SELECT `tabRoute Steps Table`.name FROM `tabRoute Steps Table` WHERE \ + `tabRoute Steps Table`.parent = `tabVehicle Trip`.name AND UPPER(location_type) = 'BORDER' and border1.parentfield = 'main_route_steps' LIMIT 1) + LEFT JOIN + `tabRoute Steps Table` AS offloading_point \ + ON offloading_point.name = (SELECT `tabRoute Steps Table`.name FROM `tabRoute Steps Table` WHERE \ + `tabRoute Steps Table`.parent = `tabVehicle Trip`.name AND UPPER(location_type) = 'OFFLOADING POINT' and `tabRoute Steps Table`.parentfield = 'main_route_steps' LIMIT 1) + WHERE + `tabCargo Details`.parenttype = 'Import' AND tabImport.status <> 'Closed' AND \ + `tabVehicle Trip`.name IS NULL OR `tabVehicle Trip`.status = 'En Route' OR offloading_point.offloading_date IN (%(today)s, %(yesterday)s, %(day_before)s) + + where + + UNION ALL + SELECT + tabImport.name AS file_number, + tabImport.customer, + CASE + WHEN tabImport.house_bill_of_lading IS NULL OR tabImport.house_bill_of_lading = '' THEN tabImport.bl_number + ELSE tabImport.house_bill_of_lading + END AS customer_ref, + tabImport.consignee, + tabImport.cargo_destination_city AS destination, + tabImport.documents_received_date AS doc_rec_date, + tabImport.cargo_description AS cargo, + `tabCargo Details`.container_number, + CASE + WHEN `tabCargo Details`.container_size IN ('40 FT GP', '40 OT', '40RF', '40 FT Heavy') THEN '40' + WHEN `tabCargo Details`.container_size IN ('20 FT GP', '20 OT', '20RF') THEN '20' + END AS container_size, + `tabCargo Details`.gross_weight AS weight, + tabImport.eta, + tabImport.ata, + tabImport.discharge AS discharge_date, + CONCAT(`tabTransport Assignment`.vehicle_plate_number, "/", `tabTransport Assignment`.vehicle_plate_number) AS truck_trailer_no, + `tabTransport Assignment`.driver_name, + tabImport.loading_date, + loading_point.departure_date AS dispatch_date, + border1.arrival_date AS border_arrival_date, + border1.departure_date AS border_dispatch_date, + offloading_point.arrival_date AS arrival_destination, + offloading_point.offloading_date AS cargo_offloaded, + (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE parent = `tabVehicle Trip`.name + AND parenttype = 'Vehicle Trip' AND parentfield = 'return_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp DESC LIMIT 1) AS vehicle_position, + CASE + WHEN `tabVehicle Trip`.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = `tabVehicle Trip`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + ELSE (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Import' AND `tabReporting Status Table`.parent = `tabImport`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + END AS remarks + FROM + `tabCargo Details` + LEFT JOIN + tabImport ON tabImport.name = `tabCargo Details`.parent + LEFT JOIN + `tabTransport Assignment` ON `tabTransport Assignment`.container_number = `tabCargo Details`.container_number + LEFT JOIN + `tabVehicle Trip` ON `tabVehicle Trip`.return_reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabRoute Steps Table` AS loading_point \ + ON loading_point.name = (SELECT `tabRoute Steps Table`.name FROM `tabRoute Steps Table` WHERE \ + `tabRoute Steps Table`.parent = `tabVehicle Trip`.name AND UPPER(location_type) = 'LOADING POINT' and loading_point.parentfield = 'return_route_steps' LIMIT 1) + LEFT JOIN + `tabRoute Steps Table` AS border1 \ + ON border1.name = (SELECT `tabRoute Steps Table`.name FROM `tabRoute Steps Table` WHERE \ + `tabRoute Steps Table`.parent = `tabVehicle Trip`.name AND UPPER(location_type) = 'BORDER' and border1.parentfield = 'return_route_steps' LIMIT 1) + LEFT JOIN + `tabRoute Steps Table` AS offloading_point \ + ON offloading_point.name = (SELECT `tabRoute Steps Table`.name FROM `tabRoute Steps Table` WHERE \ + `tabRoute Steps Table`.parent = `tabVehicle Trip`.name AND UPPER(location_type) = 'OFFLOADING POINT' and `tabRoute Steps Table`.parentfield = 'return_route_steps' LIMIT 1) + WHERE + `tabCargo Details`.parenttype = 'Import' AND tabImport.name IS NOT NULL AND tabImport.status <> 'Closed' AND \ + `tabVehicle Trip`.name IS NULL OR `tabVehicle Trip`.status = 'En Route - Returning' OR offloading_point.offloading_date IN (%(today)s, %(yesterday)s, %(day_before)s) + + where + + ) a, where_filter, as_dict=1)''' + + + data = frappe.db.sql('''SELECT + tabImport.name AS file_number, + tabImport.customer, + CASE + WHEN tabImport.house_bill_of_lading IS NULL OR tabImport.house_bill_of_lading = '' THEN tabImport.bl_number + ELSE tabImport.house_bill_of_lading + END AS customer_ref, + tabImport.consignee, + tabImport.cargo_destination_city AS destination, + tabImport.documents_received_date AS doc_rec_date, + tabImport.cargo_description AS cargo, + `tabCargo Details`.name as cargo_reference, + `tabCargo Details`.container_number, + CASE + WHEN `tabCargo Details`.container_size IN ('40 FT GP', '40 OT', '40RF', '40 FT Heavy') THEN '40' + WHEN `tabCargo Details`.container_size IN ('20 FT GP', '20 OT', '20RF') THEN '20' + END AS container_size, + `tabCargo Details`.gross_weight AS weight, + tabImport.eta, + tabImport.ata, + tabImport.discharge AS discharge_date, + tabImport.loading_date, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Import' AND `tabReporting Status Table`.parent = `tabImport`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + AS remarks + FROM + `tabCargo Details` + LEFT JOIN + tabImport ON tabImport.name = `tabCargo Details`.parent + WHERE + `tabCargo Details`.parenttype = 'Import' AND tabImport.status <> 'Closed' + ORDER BY file_number + ''' + where, where_filter, as_dict=1) + + if data: + for importd in data: + assigned_transport = frappe.db.get_value('Transport Assignment', {"cargo": importd.cargo_reference}) + if assigned_transport and assigned_transport != '': + assignment_details = frappe.get_doc('Transport Assignment', assigned_transport) + importd.update({ + "truck_trailer_no": str(assignment_details.vehicle_plate_number) + '/' + str(assignment_details.trailer_plate_number), + "driver_name": str(assignment_details.driver_name), + "licence": assignment_details.driver_licence, + "assigned_transport": assigned_transport + }) + is_main_trip = frappe.db.get_value("Vehicle Trip", + {"reference_doctype": "Transport Assignment", "reference_docname": importd.assigned_transport}) + is_return_trip = frappe.db.get_value("Vehicle Trip", + {"return_reference_doctype": "Transport Assignment", "return_reference_docname": importd.assigned_transport}) + + if is_main_trip: + main_trip = frappe.get_doc("Vehicle Trip", is_main_trip) + border1, border2 = False, False + importd.update({ + "trip_reference": main_trip.name, + "licence": main_trip.driving_licence_no, + "contacts": main_trip.phone_number + }) + for location in main_trip.main_route_steps: + #Vehicle location update + if main_trip.main_location_update: + importd.update({ + "vehicle_position": main_trip.main_location_update[-1].location + }) + + #Remarks update + if main_trip.main_reporting_status: + importd.update({ + "remarks": main_trip.main_reporting_status[-1].status + }) + + if location.location_type and location.location_type.upper() == 'LOADING POINT': + importd.update({ + 'loading_date': location.loading_date, + "dispatch_date": location.departure_date + }) + elif location.location_type and location.location_type.upper() == 'OFFLOADING POINT': + importd.update({ + "arrival_destination": location.arrival_date, + "cargo_offloaded": location.offloading_date + }) + elif location.location_type and location.location_type.upper() == 'BORDER' and not border1: + importd.update({ + "border1_name": location.location, + "border1_arrival_date": location.arrival_date, + "border1_dispatch_date": location.departure_date + }) + border1 = True + elif location.location_type and location.location_type.upper() == 'BORDER' and not border2: + importd.update({ + "border2_name": location.location, + "border2_arrival_date": location.arrival_date, + "border2_dispatch_date": location.departure_date + }) + border2 = True + elif is_return_trip: + return_trip = frappe.get_doc("Vehicle Trip", is_return_trip) + border1, border2 = False, False + importd.update({ + "trip_reference": return_trip.name, + "licence": return_trip.driving_licence_no, + "contacts": return_trip.phone_number + }) + for location in return_trip.return_route_steps: + #Vehicle location update + if return_trip.return_location_update: + importd.update({ + "vehicle_position": return_trip.return_location_update[-1].location + }) + + #Remarks update + if return_trip.return_reporting_status: + importd.update({ + "remarks": return_trip.return_reporting_status[-1].status + }) + + if location.location_type and location.location_type.upper() == 'LOADING POINT': + importd.update({ + 'loading_date': location.loading_date, + "dispatch_date": location.departure_date + }) + elif location.location_type and location.location_type.upper() == 'OFFLOADING POINT': + importd.update({ + "arrival_destination": location.arrival_date, + "cargo_offloaded": location.offloading_date + }) + elif location.location_type and location.location_type.upper() == 'BORDER' and not border1: + importd.update({ + "border1_name": location.location, + "border1_arrival_date": location.arrival_date, + "border1_dispatch_date": location.departure_date + }) + border1 = True + elif location.location_type and location.location_type.upper() == 'BORDER' and not border2: + importd.update({ + "border2_name": location.location, + "border2_arrival_date": location.arrival_date, + "border2_dispatch_date": location.departure_date + }) + border2 = True + + #Remove imports offloaded more than two days ago + for i in xrange(len(data) - 1, -1, -1): + if data[i].cargo_offloaded and data[i].cargo_offloaded not in [today, yesterday, day_before]: + del data[i] + + + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/empty_containers_report/__init__.py b/csf_tz/clearing_and_forwarding/report/empty_containers_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.js b/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.js new file mode 100644 index 0000000..150de0f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.js @@ -0,0 +1,35 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + + + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Empty Containers Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"shipping_line", + "label": __("Shipping Line"), + "fieldtype": "Link", + "options": "Shipping Line" + } + + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.json b/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.json new file mode 100644 index 0000000..a4b38f9 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2019-11-11 12:56:28.493972", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "bravo", + "modified": "2019-12-11 16:28:55.766102", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Empty Containers Report", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Container", + "report_name": "Empty Containers Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Export Documentation Officer" + }, + { + "role": "Export Key Account Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.py b/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.py new file mode 100644 index 0000000..7765c4b --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/empty_containers_report/empty_containers_report.py @@ -0,0 +1,82 @@ +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "creation_document_no", + "label": _("Creation Document No"), + "fieldtype": "Dynamic Link", + "width": 100 + }, + { + "fieldname": "shipping_line", + "label": _("Shipping Line"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "export_reference", + "label": _("Export Reference"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "booking_number", + "label": _("Booking Number"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "container_no", + "label": _("Container No"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "container_type", + "label": _("Container Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "seal_number", + "label": _("Seal Number"), + "fieldtype": "Data", + "width": 100 + }, + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date, } + where = "" + if filters.shipping_line: + where += 'AND tc.shipping_line = %(shipping_line)s ' + where_filter.update({"shipping_line":filters.shipping_line}) + + data = frappe.db.sql('''SELECT + tc.creation_document_no AS creation_document_no, + tc.shipping_line AS shipping_line, + tc.export_reference AS export_reference, + tc.booking_number AS booking_number, + tc.container_no AS container_no, + tc.container_type AS container_type, + tc.seal_number AS seal_number + + FROM + (`tabContainer` tc) + WHERE + tc.export_reference IS NULL ''' + where + ''' + ''', + where_filter, as_dict=1, as_list=1); + + + + return columns, data + diff --git a/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/__init__.py b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.js b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.js new file mode 100644 index 0000000..964e91f --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.js @@ -0,0 +1,9 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Export Vehicles En Route to Warehouse"] = { + "filters": [ + + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.json b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.json new file mode 100644 index 0000000..c628044 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.json @@ -0,0 +1,35 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-03-02 20:32:19.891342", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-03-02 20:32:44.771421", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Export Vehicles En Route to Warehouse", + "owner": "Administrator", + "ref_doctype": "Border Clearance", + "report_name": "Export Vehicles En Route to Warehouse", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Declaration Officer - Border" + }, + { + "role": "Assistant Declaration Officer - Tunduma" + }, + { + "role": "Export Documentation Officer" + }, + { + "role": "Export Key Account Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.py b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.py new file mode 100644 index 0000000..9a903aa --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/export_vehicles_en_route_to_warehouse/export_vehicles_en_route_to_warehouse.py @@ -0,0 +1,97 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +import ast +import datetime +import time + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label": _("Reference"), + "fieldtype": "Link", + "options": "Border Clearance", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "transporter", + "label": _("Transporter"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "truck", + "label": _("Truck\Trailer"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "border", + "label": _("Border"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "border_date_time", + "label": _("Border Crossing Date and Time"), + "fieldtype": "Datatime", + "width": 150 + } + ] + + + data = frappe.db.sql('''SELECT + `tabBorder Clearance`.name AS reference, + `tabBorder Clearance`.client AS customer, + `tabBorder Clearance`.cargo_destination_exact AS warehouse, + CASE + WHEN `tabBorder Clearance`.transporter_type = 'Other' THEN `tabBorder Clearance`.transporter_name + ELSE 'Bravo' + END AS transporter, + CONCAT(`tabBorder Clearance`.vehicle_plate_number, '/', `tabBorder Clearance`.trailer_plate_number) AS truck, + `tabBorder Clearance`.cargo_description AS cargo, + CASE + WHEN `tabBorder Clearance`.no_of_borders = 1 THEN `tabBorder Clearance`.border1_name + WHEN `tabBorder Clearance`.no_of_borders = 2 THEN `tabBorder Clearance`.border2_name + WHEN `tabBorder Clearance`.no_of_borders = 3 THEN `tabBorder Clearance`.border3_name + WHEN `tabBorder Clearance`.no_of_borders = 4 THEN `tabBorder Clearance`.border4_name + END AS border, + CASE + WHEN `tabBorder Clearance`.no_of_borders = 1 THEN `tabBorder Clearance`.border1_crossing + WHEN `tabBorder Clearance`.no_of_borders = 2 THEN `tabBorder Clearance`.border2_crossing + WHEN `tabBorder Clearance`.no_of_borders = 3 THEN `tabBorder Clearance`.border3_crossing + WHEN `tabBorder Clearance`.no_of_borders = 4 THEN `tabBorder Clearance`.border4_crossing + END AS border_date_time + FROM + `tabBorder Clearance` + WHERE + `tabBorder Clearance`.cargo_destination_country = 'Tanzania' AND `tabBorder Clearance`.offloading_datetime IS NULL + ''', as_dict=1) + + + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/exports_report/__init__.py b/csf_tz/clearing_and_forwarding/report/exports_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.js b/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.js new file mode 100644 index 0000000..10501cd --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.js @@ -0,0 +1,32 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Exports Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"status", + "label": __("Status"), + "fieldtype": "Select", + "options": "Open\nClosed", + "default": "Open" + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.json b/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.json new file mode 100644 index 0000000..213a09e --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.json @@ -0,0 +1,33 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2017-08-30 21:35:44.407987", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-23 17:51:05.110826", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Exports Report", + "owner": "Administrator", + "query": "SELECT\n\ttabExport.name AS \"Name:Link/Export:100\",\n\ttabExport.client AS \"Client:Data:150\",\n\ttabExport.file_number AS \"File Number:Link/Files:120\",\n\ttabExport.export_type AS \"Export Type:Data:100\",\n\ttabExport.eta AS \"ETA:Date:100\",\n\ttabExport.shipper AS \"Shipper:Data:120\",\n\ttabExport.material AS \"Cargo Information:Data:100\",\n\ttabExport.customs_processing_type AS \"Customs Processing Type:Data:100\",\n\ttabExport.received_repacking_manifest AS \"Received Repacking Manifest:Date:120\",\n\ttabExport.customs_assessment_submission AS \"Customs Assesment Submission:Date:120\",\n\ttabExport.bt_submission_date AS \"BT Submission Date:Date:120\",\n\ttabExport.bt_approval_date AS \"BT Approval Date:Date:120\",\n\t(SELECT SUM(expense_amount) FROM `tabExpenses`\n\t\t\tWHERE parenttype = 'Export' AND parent = `tabExport`.name AND expense_currency = 'USD'\n\t\t\t) AS \"Eport Expenses(USD):Float:200\",\n\t\t(SELECT SUM(expense_amount) FROM `tabExpenses`\n\t\t\tWHERE parenttype = 'Export' AND parent = `tabExport`.name AND expense_currency = 'TZS'\n\t\t\t) AS \"Export Expenses(TZS):Float:200\",\n\t(SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Export' AND `tabReporting Status Table`.parent = `tabExport`.name ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS \"Remarks:Data:200\"\nFROM\n\ttabExport", + "ref_doctype": "Export", + "report_name": "Exports Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Export Documentation Officer" + }, + { + "role": "Export Key Account Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.py b/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.py new file mode 100644 index 0000000..11c6900 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/exports_report/exports_report.py @@ -0,0 +1,179 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "name", + "label": _("Reference"), + "fieldtype": "Link", + "options": "Export", + "width": 100 + }, + { + "fieldname": "file_number", + "label": _("File Number"), + "fieldtype": "Link", + "options": "Files", + "width": 100 + }, + { + "fieldname": "booking_number", + "label": _("Booking Number"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "booking_received", + "label": _("Booking Received"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 100 + }, + { + "fieldname": "material", + "label": _("Commodity"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "no_of_containers", + "label": _("No of Containers"), + "fieldtype": "Int", + "width": 100 + }, + { + "fieldname": "weight", + "label": _("Weight (kg)"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "value", + "label": _("Cargo Value"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "export_type", + "label": _("Export Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "eta", + "label": _("ETA"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "shipper", + "label": _("Shipper"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "customs_processing_type", + "label": _("Customs Processing Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "received_repacking_manifest", + "label": _("Received Repacking Manifest"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "customs_assessment_submission", + "label": _("Customs Assessment Submission"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "bt_submission_date", + "label": _("BT Submission Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "bt_approval_date", + "label": _("BT Approval Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "expenses_usd", + "label": _("Expenses (USD)"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "expenses_tzs", + "label": _("Expenses (TZS)"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "Data", + "width": 200 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + data = frappe.db.sql(''' + SELECT + tabExport.name, + tabExport.client AS customer, + tabExport.file_number, + tabExport.booking_number, + tabExport.booking_received, + tabExport.export_type, + tabExport.material, + count(`tabPacking List`.name) AS no_of_containers, + SUM(`tabPacking List`.net_weight) AS weight, + SUM(`tabBond Reference Table`.bond_value) AS value, + tabExport.eta, + tabExport.shipper, + tabExport.customs_processing_type, + tabExport.received_repacking_manifest, + tabExport.customs_assessment_submission, + tabExport.bt_submission_date, + tabExport.bt_approval_date, + (SELECT SUM(expense_amount) FROM `tabExpenses` WHERE parenttype = 'Export' AND parent = `tabExport`.name AND expense_currency = 'USD') AS expenses_usd, + (SELECT SUM(expense_amount) FROM `tabExpenses` WHERE parenttype = 'Export' AND parent = `tabExport`.name AND expense_currency = 'TZS') AS expenses_tzs, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` \ + WHERE `tabReporting Status Table`.parenttype = 'Export' AND `tabReporting Status Table`.parent = `tabExport`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) \ + AS remarks + FROM + tabExport + LEFT JOIN + `tabPacking List` ON `tabPacking List`.parenttype = 'Export' AND `tabPacking List`.parent = `tabExport`.name + LEFT JOIN + `tabBond Reference Table` ON `tabBond Reference Table`.parenttype = 'Export' AND `tabBond Reference Table`.parent = `tabExport`.name + WHERE + tabExport.status = %(status)s AND tabExport.booking_received BETWEEN %(from_date)s AND %(to_date)s + GROUP BY `tabExport`.name + ''', + {"from_date": filters.from_date, "to_date": filters.to_date, "status": filters.status}, as_dict=1) + + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/files_report/__init__.py b/csf_tz/clearing_and_forwarding/report/files_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/files_report/files_report.js b/csf_tz/clearing_and_forwarding/report/files_report/files_report.js new file mode 100644 index 0000000..4904175 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/files_report/files_report.js @@ -0,0 +1,25 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Files Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/files_report/files_report.json b/csf_tz/clearing_and_forwarding/report/files_report/files_report.json new file mode 100644 index 0000000..ad43744 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/files_report/files_report.json @@ -0,0 +1,45 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2017-08-24 12:59:54.336815", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-12-05 12:38:35.062007", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Files Report", + "owner": "Administrator", + "query": "SELECT\n\ttabFiles.name as \"File No:Link/Files:100\",\n\tCASE\n\t\tWHEN tabFiles.import_transit = 1 THEN 'Importation - Transit'\n\t\tWHEN tabFiles.import_local = 1 THEN 'Importation - Local'\n\t\tWHEN tabFiles.export_transit = 1 THEN 'Export - Transit'\n\t\tWHEN tabFiles.export_local = 1 THEN 'Export Local'\n\t\tWHEN tabFiles.transport_transit = 1 THEN 'Transport - Transit'\n\t\tWHEN tabFiles.transport_local = 1 THEN 'Transport - Local'\n\t\tWHEN tabFiles.border_clearance = 1 THEN 'Border Clearance'\n\tEND AS \"Requested Services:Data/Requested Services:150\",\n\ttabFiles.documents_received_date as \"Document Received:Date:100\",\n\ttabFiles.customer as \"Customer:Link/Customer:150\",\n\ttabFiles.location as \"Opening Location:Link/Locations:200\",\n\t(SELECT SUM(expense_amount) FROM `tabExpenses` WHERE expense_currency = 'USD' AND (\n\t\t(parenttype = 'Import' AND parent IN (SELECT name FROM `tabImport` WHERE reference_file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Export' AND parent IN (SELECT name FROM `tabExport` WHERE file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE main_file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE return_file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Border Clearance' AND parent IN (SELECT name FROM `tabBorder Clearance` WHERE file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Files' AND parent = tabFiles.name))\n\t) AS \"Expenses(USD):Float:100\",\n\t(SELECT SUM(expense_amount) FROM `tabExpenses` WHERE expense_currency = 'TZS' AND (\n\t\t(parenttype = 'Import' AND parent IN (SELECT name FROM `tabImport` WHERE reference_file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Export' AND parent IN (SELECT name FROM `tabExport` WHERE file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE main_file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE return_file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Border Clearance' AND parent IN (SELECT name FROM `tabBorder Clearance` WHERE file_number = tabFiles.name )) OR\n\t\t(parenttype = 'Files' AND parent = tabFiles.name))\n\t) AS \"Expenses(TZS):Float:100\",\n\t(SELECT SUM(grand_total) FROM `tabSales Invoice` WHERE currency = 'USD' AND reference_doctype = 'Files' AND reference_docname = tabFiles.name) \n\t\tAS \"Invoiced Amount(USD):Float:150\",\n\t(SELECT SUM(grand_total) FROM `tabSales Invoice` WHERE currency = 'TZS' AND reference_doctype = 'Files' AND reference_docname = tabFiles.name) \n\t\tAS \"Invoiced Amount(TZS):Float:150\",\n\t(SELECT credit_in_account_currency FROM `tabGL Entry` WHERE credit_in_account_currency > 0 AND account_currency = 'USD' \n\t\tAND against_voucher_type = 'Sales Invoice' AND against_voucher \n\t\t\tIN (SELECT name FROM `tabSales Invoice` where reference_doctype = 'Files' AND reference_docname = tabFiles.name))\n\t\tAS \"Paid Amount(USD):Float:150\",\n\t(SELECT credit_in_account_currency FROM `tabGL Entry` WHERE credit_in_account_currency > 0 AND account_currency = 'TZS' \n\t\tAND against_voucher_type = 'Sales Invoice' AND against_voucher \n\t\t\tIN (SELECT name FROM `tabSales Invoice` where reference_doctype = 'Files' AND reference_docname = tabFiles.name))\n\t\tAS \"Paid Amount(TZS):Float:150\",\n\ttabFiles.status as \"Status:Data:100\"\n\t\nFROM tabFiles", + "ref_doctype": "Files", + "report_name": "Files Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Fleet Manager" + }, + { + "role": "Import Key Account Manager" + }, + { + "role": "Export Key Account Manager" + }, + { + "role": "Expense Approver" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Bravo Accounts User" + }, + { + "role": "Bravo Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/files_report/files_report.py b/csf_tz/clearing_and_forwarding/report/files_report/files_report.py new file mode 100644 index 0000000..5690ae1 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/files_report/files_report.py @@ -0,0 +1,134 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "file_no", + "label": _("File No"), + "fieldtype": "Link", + "options": "Files", + "width": 100 + }, + { + "fieldname": "file_type", + "label": _("File Type"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "documents_received_date", + "label": _("Document Received"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150 + }, + { + "fieldname": "location", + "label": _("Opening Location"), + "fieldtype": "Link", + "options": "Locations", + "width": 200 + }, + { + "fieldname": "expenses_usd", + "label": _("Expenses(USD)"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "expenses_tzs", + "label": _("Expenses(TZS)"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "invoiced_amount_usd", + "label": _("Invoiced Amount(USD)"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "invoiced_amount_tzs", + "label": _("Invoiced Amount(TZS)"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "paid_amount_usd", + "label": _("Paid Amount(USD)"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "paid_amount_tzs", + "label": _("Paid Amount(TZS)"), + "fieldtype": "Float", + "width": 150 + } + ] + + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + data = frappe.db.sql('''SELECT + tabFiles.name as file_no, + CASE + WHEN tabFiles.import_transit = 1 THEN 'Importation - Transit' + WHEN tabFiles.import_local = 1 THEN 'Importation - Local' + WHEN tabFiles.export_transit = 1 THEN 'Export - Transit' + WHEN tabFiles.export_local = 1 THEN 'Export Local' + WHEN tabFiles.transport_transit = 1 THEN 'Transport - Transit' + WHEN tabFiles.transport_local = 1 THEN 'Transport - Local' + WHEN tabFiles.border_clearance = 1 THEN 'Border Clearance' + END AS file_type, + tabFiles.documents_received_date, + tabFiles.customer, + tabFiles.location, + (SELECT SUM(expense_amount) FROM `tabExpenses` WHERE expense_currency = 'USD' AND ( + (parenttype = 'Import' AND parent IN (SELECT name FROM `tabImport` WHERE reference_file_number = tabFiles.name )) OR + (parenttype = 'Export' AND parent IN (SELECT name FROM `tabExport` WHERE file_number = tabFiles.name )) OR + (parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE main_file_number = tabFiles.name )) OR + (parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE return_file_number = tabFiles.name )) OR + (parenttype = 'Border Clearance' AND parent IN (SELECT name FROM `tabBorder Clearance` WHERE file_number = tabFiles.name )) OR + (parenttype = 'Files' AND parent = tabFiles.name)) + ) AS expenses_usd, + (SELECT SUM(expense_amount) FROM `tabExpenses` WHERE expense_currency = 'TZS' AND ( + (parenttype = 'Import' AND parent IN (SELECT name FROM `tabImport` WHERE reference_file_number = tabFiles.name )) OR + (parenttype = 'Export' AND parent IN (SELECT name FROM `tabExport` WHERE file_number = tabFiles.name )) OR + (parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE main_file_number = tabFiles.name )) OR + (parenttype = 'Vehicle Trip' AND parent IN (SELECT name FROM `tabVehicle Trip` WHERE return_file_number = tabFiles.name )) OR + (parenttype = 'Border Clearance' AND parent IN (SELECT name FROM `tabBorder Clearance` WHERE file_number = tabFiles.name )) OR + (parenttype = 'Files' AND parent = tabFiles.name)) + ) AS expenses_tzs, + (SELECT SUM(grand_total) FROM `tabSales Invoice` WHERE currency = 'USD' AND reference_doctype = 'Files' AND reference_docname = tabFiles.name) + AS invoiced_amount_usd, + (SELECT SUM(grand_total) FROM `tabSales Invoice` WHERE currency = 'TZS' AND reference_doctype = 'Files' AND reference_docname = tabFiles.name) + AS invoiced_amount_tzs, + (SELECT credit_in_account_currency FROM `tabGL Entry` WHERE credit_in_account_currency > 0 AND account_currency = 'USD' + AND against_voucher_type = 'Sales Invoice' AND against_voucher + IN (SELECT name FROM `tabSales Invoice` where reference_doctype = 'Files' AND reference_docname = tabFiles.name)) + AS paid_amount_usd, + (SELECT credit_in_account_currency FROM `tabGL Entry` WHERE credit_in_account_currency > 0 AND account_currency = 'TZS' + AND against_voucher_type = 'Sales Invoice' AND against_voucher + IN (SELECT name FROM `tabSales Invoice` where reference_doctype = 'Files' AND reference_docname = tabFiles.name)) + AS paid_amount_tzs + FROM tabFiles + WHERE + tabFiles.documents_received_date BETWEEN %(from_date)s AND %(to_date)s''', {"from_date": filters.from_date, "to_date": filters.to_date}, as_dict=1) + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/files_without_quotations/__init__.py b/csf_tz/clearing_and_forwarding/report/files_without_quotations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.js b/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.js new file mode 100644 index 0000000..96e6591 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.js @@ -0,0 +1,26 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Files Without Quotations"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.json b/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.json new file mode 100644 index 0000000..c1acdba --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.json @@ -0,0 +1,23 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-08-03 18:31:11.569249", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-08-03 18:31:11.569249", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Files Without Quotations", + "owner": "Administrator", + "ref_doctype": "Files", + "report_name": "Files Without Quotations", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.py b/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.py new file mode 100644 index 0000000..baa47a3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/files_without_quotations/files_without_quotations.py @@ -0,0 +1,59 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "reference", + "label": _("Reference"), + "fieldtype": "Link", + "options": "Files", + "width": 150 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 250 + }, + { + "fieldname": "documents_received_date", + "label": _("Date"), + "fieldtype": "Date", + "width": 150 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + data = frappe.db.sql('''SELECT + tabFiles.name AS reference, + tabFiles.customer, + tabFiles.documents_received_date + FROM + `tabFiles` + WHERE + tabFiles.quotation IS NULL AND tabFiles.documents_received_date BETWEEN %(from_date)s AND %(to_date)s''', + {"from_date": filters.from_date, "to_date": filters.to_date}, as_dict=1) + + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/import___expected_cargo/__init__.py b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.js b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.js new file mode 100644 index 0000000..50baea9 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.js @@ -0,0 +1,9 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Import - Expected Cargo"] = { + "filters": [ + + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.json b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.json new file mode 100644 index 0000000..db89f8e --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-05-07 12:26:19.449650", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-05-07 12:26:19.449650", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Import - Expected Cargo", + "owner": "Administrator", + "ref_doctype": "Import", + "report_name": "Import - Expected Cargo", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Fleet Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.py b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.py new file mode 100644 index 0000000..06a5c8b --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/import___expected_cargo/import___expected_cargo.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe + +def execute(filters=None): + columns, data = [], [] + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/imports_report/__init__.py b/csf_tz/clearing_and_forwarding/report/imports_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.js b/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.js new file mode 100644 index 0000000..c180ebc --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.js @@ -0,0 +1,42 @@ +// Copyright (c) 2016, Codes Consult and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Imports Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"loading_date_from", + "label": __("Loading From"), + "fieldtype": "Date" + }, + { + "fieldname":"loading_date_to", + "label": __("Loading To"), + "fieldtype": "Date" + }, + { + "fieldname":"status", + "label": __("Status"), + "fieldtype": "Select", + "options": "\nOpen\nClosed" + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.json b/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.json new file mode 100644 index 0000000..0b2f71a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.json @@ -0,0 +1,33 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2017-08-30 21:25:09.293100", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:28:03.399323", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Imports Report", + "owner": "Administrator", + "query": "", + "ref_doctype": "Import", + "report_name": "Imports Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Import Key Account Manager" + }, + { + "role": "Declaration Officer" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.py b/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.py new file mode 100644 index 0000000..9bfbe53 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/imports_report/imports_report.py @@ -0,0 +1,204 @@ +# Copyright (c) 2013, Codes Consult and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "reference", + "label": _("Reference"), + "fieldtype": "Link", + "options": "Import", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 100 + }, + { + "fieldname": "bl_number", + "label": _("BL Number"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "number_of_containers", + "label": _("No. of Containers"), + "fieldtype": "Int", + "width": 100 + }, + { + "fieldname": "total_weight", + "label": _("Total Weight"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "cargo_value", + "label": _("Cargo Value"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "shipper", + "label": _("Shipper"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "vessel_name", + "label": _("Vessel Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "import_type", + "label": _("Import Type"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "shipping_eta", + "label": _("Shipping ETA"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "shipping_ata", + "label": _("Shipping ATA"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "destination", + "label": _("Destination"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "manifest_date", + "label": _("Manifest Date"), + "fieldtype": "Date", + "width": 120 + }, + { + "fieldname": "tansad_date", + "label": _("Tansad Date"), + "fieldtype": "Date", + "width": 120 + }, + { + "fieldname": "manifest_comparison", + "label": _("Manifest Comparison"), + "fieldtype": "Date", + "width": 120 + }, + { + "fieldname": "loading_date", + "label": _("Loading Date"), + "fieldtype": "Date", + "width": 120 + }, + { + "fieldname": "import_expenses_usd", + "label": _("Import Expenses"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "import_expenses_tzs", + "label": _("Import Expenses (TZS)"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "Data", + "width": 200 + } + ] + + where = '' + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date, "status": filters.status} + + if filters.status: + where += " AND tabImport.status = %(status)s " + where_filter.update({'status': filters.status}) + + if filters.loading_date_from: + where += " AND tabImport.loading_date >= %(loading_date_from)s " + where_filter.update({'loading_date_from': filters.loading_date_from}) + + if filters.loading_date_to: + where += " AND tabImport.loading_date <= %(loading_date_to)s " + where_filter.update({'loading_date_to': filters.loading_date_to}) + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + data = frappe.db.sql('''SELECT + tabImport.name AS reference, + tabImport.customer, + tabImport.bl_number AS bl_number, + CONCAT(tabImport.cargo, " - ", tabImport.cargo_description) AS cargo, + count(`tabCargo Details`.name) AS number_of_containers, + SUM(`tabCargo Details`.net_weight) AS total_weight, + SUM(`tabCargo Details`.bond_value) AS cargo_value, + tabImport.shipping_line AS shipper, + tabImport.vessel_name AS vessel_name, + tabImport.import_type AS import_type, + tabImport.eta AS shipping_eta, + tabImport.ata AS shipping_ata, + CONCAT(tabImport.cargo_destination_country, " - ", tabImport.cargo_destination_city) AS destination, + tabImport.manifest_date, + tabImport.tansad_date, + tabImport.manifest_comparison_date AS manifest_comparison, + tabImport.loading_date, + (SELECT SUM(expense_amount) FROM `tabExpenses` + WHERE parenttype = 'Import' AND parent = `tabImport`.name AND expense_currency = 'USD' + ) AS import_expenses_usd, + (SELECT SUM(expense_amount) FROM `tabExpenses` + WHERE parenttype = 'Import' AND parent = `tabImport`.name AND expense_currency = 'TZS' + ) AS import_expenses_tzs, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Import' \ + AND `tabReporting Status Table`.parent = `tabImport`.name ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks + FROM + `tabImport` + LEFT OUTER JOIN + `tabCargo Details` ON `tabCargo Details`.parent = `tabImport`.name AND `tabCargo Details`.parenttype = 'Import' + WHERE + tabImport.documents_received_date BETWEEN %(from_date)s AND %(to_date)s ''' + where + + ''' GROUP BY + tabImport.name''', + where_filter, as_dict=1) + + return columns, data + + diff --git a/csf_tz/clearing_and_forwarding/report/operations_analysis/__init__.py b/csf_tz/clearing_and_forwarding/report/operations_analysis/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.js b/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.js new file mode 100644 index 0000000..428a5fe --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.js @@ -0,0 +1,12 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Operations Analysis"] = { + "filters": get_filters() +} + + +function get_filters(){ + +} diff --git a/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.json b/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.json new file mode 100644 index 0000000..80e77fa --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-04-28 12:02:58.022030", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-04-28 12:04:35.302464", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Operations Analysis", + "owner": "Administrator", + "ref_doctype": "Import", + "report_name": "Operations Analysis", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Fleet Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.py b/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.py new file mode 100644 index 0000000..06a5c8b --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/operations_analysis/operations_analysis.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe + +def execute(filters=None): + columns, data = [], [] + return columns, data diff --git a/csf_tz/clearing_and_forwarding/report/report_export_control.py b/csf_tz/clearing_and_forwarding/report/report_export_control.py new file mode 100644 index 0000000..db5d4d3 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/report_export_control.py @@ -0,0 +1,174 @@ +# Copyright (c) 2013, Codes Consult and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font, Alignment, Border, Side +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html +import re + +@frappe.whitelist() +def export_query(): + """export from query reports""" + + data = frappe._dict(frappe.local.form_dict) + + del data["cmd"] + if "csrf_token" in data: + del data["csrf_token"] + + if isinstance(data.get("filters"), string_types): + filters = json.loads(data["filters"]) + if isinstance(data.get("report_name"), string_types): + report_name = data["report_name"] + if isinstance(data.get("file_format_type"), string_types): + file_format_type = data["file_format_type"] + if isinstance(data.get("visible_idx"), string_types): + visible_idx = json.loads(data.get("visible_idx")) + else: + visible_idx = None + + if file_format_type == "Excel": + + data = run(report_name, filters) + data = frappe._dict(data) + columns = get_columns_dict(data.columns) + + result = [[]] + + # add column headings + for idx in range(len(data.columns)): + result[0].append(columns[idx]["label"]) + + # build table from dict + if isinstance(data.result[0], dict): + for i,row in enumerate(data.result): + # only rows which are visible in the report + if row and (i+1 in visible_idx): + row_list = [] + for idx in range(len(data.columns)): + row_list.append(row.get(columns[idx]["fieldname"],"")) + result.append(row_list) + elif not row: + result.append([]) + else: + result = result + [d for i,d in enumerate(data.result) if (i+1 in visible_idx)] + + #from frappe.utils.xlsxutils import make_xlsx + xlsx_file = make_xlsx(result, report_name) + + frappe.response['filename'] = report_name + '.xlsx' + frappe.response['filecontent'] = xlsx_file.getvalue() + frappe.response['type'] = 'binary' + +def make_xlsx(data, report_name): + wb = openpyxl.Workbook() + ws = wb.create_sheet('All', 0) + wb.guess_types = True + customers = [] + + ws.append(['']) + ws.append(['']) + ws.append(['']) + ws.append(['']) + ws.append(['']) + ws.append(['']) + ws.append(['']) + + for row in data: + clean_row = [] + if row[1] and row[1] not in customers and str(row[1]).upper() not in ['CUSTOMER', 'CLIENT']: + customers.append(row[1]) + for item in row: + if isinstance(item, string_types) and report_name != "Data Import Template": + value = item + else: + value = item + clean_row.append(value) + + ws.append(clean_row) + ws = style_export(ws, report_name) + + del data[0][1] #Remove the customer heading + #Create a sheet for each customer + if report_name not in ['Workshop Report', 'Workshop Daily Report']: + for customer in customers: + clean_title = customer.replace('\\', '') + clean_title = clean_title.replace('/', '') + wsc = wb.create_sheet(clean_title) + wsc.append(['']) + wsc.append(['']) + wsc.append(['']) + wsc.append(['']) + wsc.append(['']) + wsc.append(['']) + wsc.append(['']) + wsc.append(data[0]) + for row in data: + row = list(row) + if isinstance(row[1], string_types) and handle_html(row[1]) == customer: + clean_row = [] + del row[1] + for item in row: + if isinstance(item, string_types) and report_name != "Data Import Template": + value = item + else: + value = item + clean_row.append(value) + wsc.append(clean_row) + wsc = style_export(wsc, report_name) + + xlsx_file = StringIO() + wb.remove_sheet(wb.get_sheet_by_name('Sheet')) + wb.save(xlsx_file) + return xlsx_file + +def style_export(sheet, report_name): + logo = openpyxl.drawing.image.Image('assets/erpnext/images/logo.png', size=[110, 111]) + + if report_name in ['Daily Customer Report - Imports', 'Daily Customer Report - Exports', 'Daily Customer Report - Transport', 'Border Clearance', 'Workshop Report', 'Imports Report', + 'Exports Report', 'Workshop Daily Report', 'Vehicle Status Report', 'Transport Assignment Report', 'Vehicles En Route to Border', + 'Bond Report', 'Export Vehicles En Route to Warehouse']: + #Set heading style + alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + for i in alphabets: + cell1 = sheet[i + '8'] + cell2 = sheet['A'+i+'8'] + border_style = Border(left=Side(border_style='medium', color='FF000000'), right=Side(border_style='medium', color='FF000000'), top=Side(border_style='medium', color='FF000000'), bottom=Side(border_style='medium', color='FF000000')) + if cell1.value: + cell1.border = border_style + cell1.font = Font(name='Calibri',size=9,bold=True) + cell1.alignment = Alignment(horizontal='center',vertical='center',wrap_text=True,shrink_to_fit=False,indent=0) + + if cell2.value: + cell2.border = border_style + cell2.font = Font(name='Calibri',size=9,bold=True) + cell2.alignment = Alignment(horizontal='center',vertical='center',wrap_text=True,shrink_to_fit=False,indent=0) + + sheet.add_image(logo, 'B2') + sheet['I4'] = report_name + ' (' + datetime.now().strftime("%d-%m-%Y") + ')' + row1 = sheet.row_dimensions[8] + row1.height = 45 + + #Set font for each cell in document + for i in range(1, sheet.max_column+1): + for j in range(1, sheet.max_row+1): + sheet.cell(row = j, column = i).font = Font(name='Calibri',size=9) + + return sheet + + + + diff --git a/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/__init__.py b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.js b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.js new file mode 100644 index 0000000..c2a6ef0 --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.js @@ -0,0 +1,34 @@ +// Copyright (c) 2016, Bravo Logisitcs and contributors +// For license information, please see license.txt +/* eslint-disable */ + + + +var aday = new Date(); +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Unreturned Containers Report"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default":"" + }, + { + "fieldname": "container_owner", + "label": __("Container Owner"), + "fieldtype": "Select", + "options": "\nSOC (Shipper Owned Container)\nShipping Line Container\nBravo Container\nRental", + "default": "" + }, + { + "fieldname": "shipping_line", + "label": __("Shipping Line"), + "fieldtype": "Link", + "options": "Shipping Line", + } + ] +} diff --git a/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.json b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.json new file mode 100644 index 0000000..eae506d --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.json @@ -0,0 +1,24 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2019-11-11 17:07:06.232885", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "bravo", + "modified": "2019-11-11 17:07:08.128909", + "modified_by": "Administrator", + "module": "Clearing and Forwarding", + "name": "Unreturned Containers Report", + "owner": "Administrator", + "ref_doctype": "Import", + "report_name": "Unreturned Containers Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + } + ] +} \ No newline at end of file diff --git a/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.py b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.py new file mode 100644 index 0000000..469067a --- /dev/null +++ b/csf_tz/clearing_and_forwarding/report/unreturned_containers_report/unreturned_containers_report.py @@ -0,0 +1,109 @@ +# Copyright (c) 2013, Bravo Logisitcs and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from datetime import datetime + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "import_no", + "label": _("Import No"), + "fieldtype": "Link", + "options": "Import", + "width": 150 + + }, + { + "fieldname": "reference_file_number", + "label": _("Reference File Number"), + "fieldtype": "Link", + "options" :"Files", + "width": 200 + }, + { + "fieldname": "bl_number", + "label": _("B/L Number"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "shipping_line", + "label": _("Shipping Line"), + "fieldtype": "Link", + "options": "Shipping Line", + "width": 200 + }, + { + "fieldname": "container_owner", + "label": _("Container Owner"), + "fieldtype": "Select", + "options": "SOC (Shipper Owned Container)\nShipping Line Container\nBravo Container\nRental", + "width": 200 + }, + { + "fieldname": "container_no", + "label": _("Container No"), + "fieldtype": "Data", + "width": 150 + }, + + { + "fieldname": "container_return_date", + "label": _("Container Return Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "demurrage_start_date", + "label": _("Demurrage Start Date"), + "fieldtype": "Date", + "width": 150 + } + + ] + + where = "" + where_filter = {} + + if filters.from_date or filters.container_owner or filters.shipping_line: + where ="where " + + if filters.from_date: + where += ' imp.demurrage_start_date >= %(from_date)s' + where_filter.update({"from_date": filters.from_date}) + + if filters.container_owner: + if filters.from_date: + where += ' AND ' + where += ' imp.container_owner = %(container_owner)s' + where_filter.update({"container_owner": filters.container_owner}) + + if filters.shipping_line: + if filters.from_date or filters.container_owner: + where += ' AND ' + where += ' imp.shipping_line = %(shipping_line)s ' + where_filter.update({"shipping_line":filters.shipping_line}) + + data = frappe.db.sql('''SELECT + imp.name AS import_no, + imp.reference_file_number, + imp.bl_number, + imp.shipping_line , + imp.container_owner , + cfci.container_no, + cfci.container_return_date, + imp.demurrage_start_date + + + FROM + (`tabImport` imp) + LEFT JOIN `tabContainer File Closing Information` AS cfci + ON (imp.name=cfci.parent) + ''' + where + ''' + ''', + where_filter,as_dict=1,as_list=1); + return columns, data diff --git a/csf_tz/config/__init__.py b/csf_tz/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/config/accounts.py b/csf_tz/config/accounts.py new file mode 100644 index 0000000..ef7e790 --- /dev/null +++ b/csf_tz/config/accounts.py @@ -0,0 +1,23 @@ +from __future__ import unicode_literals +from frappe import _ + + +def get_data(): + return [ + + { + "label": _("General Ledger"), + "items": [ + + { + "type": "report", + "is_query_report": True, + "name": "Multi-Currency Ledger", + "doctype": "GL Entry", + "description": _("Accounting journal entries with Multi-Currency."), + }, + ] + }, + + + ] \ No newline at end of file diff --git a/csf_tz/config/after_sales_services.py b/csf_tz/config/after_sales_services.py new file mode 100644 index 0000000..b440405 --- /dev/null +++ b/csf_tz/config/after_sales_services.py @@ -0,0 +1,175 @@ +from frappe import _ + +def get_data(): + return [ + { + "label": _("After Sales"), + "icon": "fa fa-star", + "items": [ + { + "type": "doctype", + "name": "Delivery Note", + "description": _("Delivery Note"), + }, + { + "type": "doctype", + "name": "Installation Note", + "description": _("Items Installation Notes"), + }, + { + "type": "doctype", + "name": "Pre Delivery Inspection", + "description": _("Pre-delivery Inspection"), + }, + { + "type": "doctype", + "name": "Registration Card Management Module", + "label": "Registration Card Transfer Management", + "description": _("Registration Card Transfer Procedures."), + } + ] + }, + { + "label": _("Maintenance"), + "icon": "fa fa-star", + "items": [ + { + "type": "doctype", + "name": "Maintenance Request", + "description": _("Maintenance Request.") + }, + { + "type": "doctype", + "name": "Job Card", + "description": _("Job Card.") + }, + { + "type": "doctype", + "name": "Warranty Claim", + "description": _("Warranty Claim against Serial No."), + }, + { + "type": "doctype", + "name": "Requested Items", + "description": _("Requested Items") + }, + ] + }, + { + "label": _('Machine Stripping'), + "items": [ + { + "type": "doctype", + "name": "Machine Strip Request", + "description": "Machine Strip Request" + } + ] + }, + { + "label": _("After Sales Reports"), + "items": [ + { + "type": "report", + "name": "Delivery Note Report", + "doctype": "Delivery Note", + "is_query_report": True, + }, + { + "type": "report", + "name": "Pre Delivery Inspection Report", + "doctype": "Pre Delivery Inspection", + "is_query_report": True, + }, + { + "type": "report", + "name": "Installation Note Report", + "doctype": "Installation Note", + "is_query_report": True, + }, + { + "type": "report", + "name": "Technician Costing Report", + "doctype": "Job Card", + "is_query_report": True, + } + ] + }, + { + "label": _("Workshop Reports"), + "items": [ + { + "type": "report", + "name": "Maintenance Daily Report", + "doctype": "Job Card", + "is_query_report": True, + }, + { + "type": "report", + "name": "Maintenance Report", + "doctype": "Job Card", + "is_query_report": True, + }, + { + "type": "report", + "name": "Unprocessed Maintenance Requests", + "doctype": "Maintenance Request", + "is_query_report": True, + }, + { + "type": "report", + "name": "Used Items Report", + "doctype": "Job Card", + "is_query_report": True, + }, + { + "type": "report", + "name": "Maintenance Request Report", + "doctype": "Maintenance Request", + "is_query_report": True, + } + ] + }, + { + "label": _("Workshop Performance Analysis"), + "items": [ + { + "type": "report", + "name": "Technicians Performance Report", + "doctype": "Job Card", + "is_query_report": True, + }, + { + "type": "report", + "name": "Workshop Performance Report", + "doctype": "Job Card", + "is_query_report": True, + } + ] + }, + { + "label": _("Setup"), + "items": [ + { + "type": "doctype", + "name": "Maintenance Service Type", + "description": _("Maintenance Service Type") + }, + { + "type": "doctype", + "name": "Maintenance Service", + "description": _("Maintenance Service") + }, + { + "type": "doctype", + "name": "Item Installation Procedures", + "label": _("Installation Procedures"), + "description": _("Item Installation Procedures") + }, + { + "type": "doctype", + "name": "Pre Delivery Inspection Template", + "description": _("Pre-delivery Inspection Template"), + }, + ] + } + ] diff --git a/csf_tz/config/csf_tz.py b/csf_tz/config/csf_tz.py new file mode 100644 index 0000000..5ca8d6c --- /dev/null +++ b/csf_tz/config/csf_tz.py @@ -0,0 +1,216 @@ +from __future__ import unicode_literals +from frappe import _ + + +def get_data(): + return [ + { + "label": _("Tax Compliance"), + "items": [ + { + "type": "doctype", + "name": "EFD Z Report", + "description": _("Accounting journal entries with Multi-Currency."), + }, + { + "type": "doctype", + "name": "Electronic Fiscal Device", + "description": _("Electronic Fiscal Device setup."), + }, + ], + }, + { + "label": _("Corporate Compliance"), + "items": [ + { + "type": "doctype", + "name": "Visibility", + "description": _("Setup Visibity of records."), + }, + { + "type": "doctype", + "name": "Open Invoice Exchange Rate Revaluation", + "description": _("Open Invoice Exchange Rate Revaluation for period end P & L visibility."), + }, + ], + }, + { + "label": _("Petty Expense"), + "items": [ + { + "type": "doctype", + "name": "Expense Record", + "description": _("Petty expenses for Section. Intelligent expense transactions."), + }, + { + "type": "doctype", + "name": "Section", + "description": _("Sections for petty expense recording."), + }, + { + "type": "doctype", + "name": "Expense Type", + "description": _("Expense type to make petty expenses and linking to expense accounts."), + }, + ], + }, + { + "label": _("Tax Analytics"), + "items": [ + { + "type": "report", + "name": "TRA Input VAT Returns eFiling", + "doctype": "Purchase Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Withholding Tax Summary on Sales", + "doctype": "Sales Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Withholding Tax Summary on Sales", + "doctype": "Sales Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Withholding Tax Payment Summary", + "doctype": "Sales Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "ITX 230.01.E – Withholding Tax Statement", + "doctype": "Purchase Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Output VAT Reconciliation", + "doctype": "EFD Z Report", + "is_query_report": True + }, + { + "type": "report", + "name": "Credit Note List", + "doctype": "Sales Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Purchase Reports by Tax Category", + "doctype": "Purchase Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Purchases by Tax Category Summary", + "doctype": "Purchase Invoice", + "is_query_report": True + }, + ], + }, + { + "label": _("HR Analytics"), + "items": [ + { + "type": "report", + "name": "Employment History", + "doctype": "Employee", + "is_query_report": True + }, + ], + }, + { + "label": _("Business Analytics"), + "items": [ + { + "type": "report", + "name": "Multi-Currency Ledger", + "doctype": "GL Entry", + "is_query_report": True + }, + { + "type": "report", + "name": "Trial Balance Report in USD", + "doctype": "GL Entry", + "is_query_report": True + }, + { + "type": "report", + "name": "Itemwise Stock Movement", + "doctype": "Stock Ledger Entry", + "is_query_report": True + }, + { + "type": "report", + "name": "Warehouse wise Item Balance and Value", + "doctype": "Stock Ledger Entry", + "is_query_report": True + }, + { + "type": "report", + "name": "Accounts Receivable Multi Currency", + "doctype": "Sales Invoice", + "is_query_report": True + }, + { + "type": "report", + "name": "Stock Balance pivot warehouse", + "doctype": "Stock Ledger Entry", + "is_query_report": True + }, + { + "type": "report", + "name": "Accounts Receivable Summary Multi Currency", + "doctype": "Sales Invoice", + "is_query_report": True + }, + ] + }, + { + "label": _("System Analytics"), + "items": [ + { + "type": "report", + "name": "Master Data Statistics", + "doctype": "Electronic Fiscal Device", + "is_query_report": True + }, + { + "type": "report", + "name": "Transaction Statistics", + "doctype": "Electronic Fiscal Device", + "is_query_report": True + }, + ], + }, + { + "label": _("Other features"), + "items": [ + { + "type": "doctype", + "name": "Special Closing Balance", + "description": _("Special Closing Balance recording and generating Material Receipts for reverse calculated productions."), + }, + { + "type": "doctype", + "name": "Repack Template", + "description": _("Quick BOM feature for repacking. Making many items of one item"), + }, + ], + }, + { + "label": _("Settings"), + "items": [ + { + "type": "doctype", + "name": "CSF TZ Settings", + "description": _("Settings for CSF TZ."), + }, + ], + }, + ] \ No newline at end of file diff --git a/csf_tz/config/desktop.py b/csf_tz/config/desktop.py new file mode 100644 index 0000000..85bd52d --- /dev/null +++ b/csf_tz/config/desktop.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "module_name": "CSF TZ", + "category": "Modules", + "label": _("Country Specifics"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + "description": "Country specific customizations for compliance, taxation and statutory reports.", + }, + { + "module_name": "Clearing and Forwarding", + "category": "Modules", + "label": _("Clearing and Forwarding"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + "description": "Clearing and forwarding", + }, + { + "module_name": "After Sales Services", + "category": "Modules", + "label": _("After Sales Services"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + }, + { + "module_name": "Workshop", + "category": "Modules", + "label": _("Workshop"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + }, + { + "module_name": "Fleet Management", + "category": "Modules", + "label": _("Fleet Management"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + }, + { + "module_name": "Purchase and Stock Management", + "category": "Modules", + "label": _("Purchase and Stock Management"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + }, + { + "module_name": "Sales and Marketing", + "category": "Modules", + "label": _("Sales and Marketing"), + "color": "green", + "icon": "octicon octicon-bookmark", + "type": "module", + }, + ] diff --git a/csf_tz/config/docs.py b/csf_tz/config/docs.py new file mode 100644 index 0000000..281883c --- /dev/null +++ b/csf_tz/config/docs.py @@ -0,0 +1,11 @@ +""" +Configuration for docs +""" + +# source_link = "https://github.com/[org_name]/csf_tz" +# docs_base_url = "https://[org_name].github.io/csf_tz" +# headline = "App that does everything" +# sub_heading = "Yes, you got that right the first time, everything" + +def get_context(context): + context.brand_html = "CSF TZ" diff --git a/csf_tz/config/fleet_management.py b/csf_tz/config/fleet_management.py new file mode 100644 index 0000000..b7e5696 --- /dev/null +++ b/csf_tz/config/fleet_management.py @@ -0,0 +1,149 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Documents"), + "items": [ + { + "type": "doctype", + "name": "Files", + "description": _("Files.") + }, + { + "type": "doctype", + "name": "Fuel Request", + "description": _("Fuel Request.") + }, + { + "type": "doctype", + "name": "Transport Request", + "description": _("Transport Request.") + }, + { + "type": "doctype", + "name": "Transport Assignment", + "description": _("Transport Assignment.") + }, + { + "type": "doctype", + "name": "Vehicle Trip", + "description": _("Vehicle trips.") + }, + { + "type": "doctype", + "name": "Vehicle Inspection", + "description": _("Vehicle Inspection.") + }, + ] + }, + { + "label": _("Setup"), + "items": [ + { + "type": "doctype", + "name": "Vehicle", + "description": _("Registered Vehicles") + }, + { + "type": "doctype", + "name": "Trailer", + "description": _("Registered Trailers") + }, + { + "type": "doctype", + "name": "Trip Route", + "description": _("Trip Route") + }, + { + "type": "doctype", + "name": "Trip Location Type", + "description": _("Trip Location Type") + }, + { + "type": "doctype", + "name": "Trip Location", + "description": _("Trip Location") + }, + { + "type": "doctype", + "name": "Fixed Expense", + "description": _("Fixed Expense") + }, + { + "type": "doctype", + "name": "Unit of Measure", + "description": _("Unit of Measure") + }, + { + "type": "doctype", + "name": "Vehicle Documents Type", + "description": _("Vehicle Documents Type") + }, + { + "type": "doctype", + "name": "Vehicle Type", + "description": _("Vehicle Type") + }, + { + "type": "doctype", + "name": "Vehicle Inspection Template", + "description": _("Vehicle Inspection Template") + } + ] + }, + { + "label": _("Internal Reports"), + "items": [ + { + "type": "report", + "name": "Trip Report", + "doctype": "Vehicle Trip", + "is_query_report": True, + }, + { + "type": "report", + "name": "Fuel Report", + "doctype": "Vehicle Trip", + "is_query_report": True, + }, + { + "type": "report", + "name": "Vehicle Status Report", + "doctype": "Vehicle Trip", + "is_query_report": True, + }, + { + "type": "report", + "name": "Truck Document Expiration Report", + "doctype": "Vehicle", + "is_query_report": True, + }, + { + "type": "report", + "name": "Transport Assignment Report", + "doctype": "Transport Assignment", + "is_query_report": True, + }, + { + "type": "report", + "name": "Vehicles En Route to Border", + "doctype": "Vehicle Trip", + "is_query_report": True, + } + ] + }, + { + "label": _("Daily Customer Reports"), + "items": [ + { + "type": "report", + "name": "Daily Customer Report - Transport", + "doctype": "Vehicle Trip", + "is_query_report": True, + } + ] + } + ] diff --git a/csf_tz/config/hr.py b/csf_tz/config/hr.py new file mode 100644 index 0000000..6922e11 --- /dev/null +++ b/csf_tz/config/hr.py @@ -0,0 +1,21 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Piecework"), + "items": [ + { + "label": "Piecework Type", + "name": "Piecework Type", + "type": "doctype" + }, + { + "label": "Piecework", + "name": "Piecework", + "type": "doctype" + } + ] + } + ] \ No newline at end of file diff --git a/csf_tz/config/payroll.py b/csf_tz/config/payroll.py new file mode 100644 index 0000000..6922e11 --- /dev/null +++ b/csf_tz/config/payroll.py @@ -0,0 +1,21 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Piecework"), + "items": [ + { + "label": "Piecework Type", + "name": "Piecework Type", + "type": "doctype" + }, + { + "label": "Piecework", + "name": "Piecework", + "type": "doctype" + } + ] + } + ] \ No newline at end of file diff --git a/csf_tz/config/purchase_and_stock_management.py b/csf_tz/config/purchase_and_stock_management.py new file mode 100644 index 0000000..7df9ed3 --- /dev/null +++ b/csf_tz/config/purchase_and_stock_management.py @@ -0,0 +1,259 @@ +from frappe import _ + +def get_data(): + return [ + { + "label": _("Purchasing"), + "icon": "fa fa-star", + "items": [ + { + "type": "doctype", + "name": "Material Request", + "description": _("Request for purchase."), + }, + { + "type": "doctype", + "name": "Request for Quotation", + "description": _("Request for quotation."), + }, + { + "type": "doctype", + "name": "Supplier Quotation", + "description": _("Quotations received from Suppliers."), + }, + { + "type": "doctype", + "name": "Purchase Order", + "description": _("Purchase Orders given to Suppliers."), + }, + { + "type": "doctype", + "name": "Order Tracking", + "description": _("Track orders from Suppliers."), + }, + { + "type": "doctype", + "name": "Product Quality Inspection", + "label": _("Order Inspection") + }, + { + "type": "doctype", + "name": "Purchase Receipt", + }, + ] + }, + { + "label": _("Stock Management"), + "items": [ + { + "type": "doctype", + "name": "Stock Entry", + }, + { + "type": "doctype", + "name": "Stock Transport", + }, + { + "type": "report", + "is_query_report": True, + "name": "Stock Ledger", + "doctype": "Stock Ledger Entry", + }, + ] + }, + { + "label": _("Supplier"), + "items": [ + { + "type": "doctype", + "name": "Supplier", + "description": _("Supplier database."), + }, + { + "type": "doctype", + "name": "Supplier Type", + "description": _("Supplier Type master.") + }, + { + "type": "doctype", + "name": "Project", + "label": _("Projects"), + "description": _("Supplier Type master.") + }, + ] + }, + { + "label": _("Items and Pricing"), + "items": [ + { + "type": "doctype", + "name": "Item", + }, + { + "type": "doctype", + "name": "Product Bundle", + }, + { + "type": "doctype", + "name": "Item Price", + "route": "Report/Item Price", + }, + { + "type": "doctype", + "name": "Serial No", + }, + { + "type": "doctype", + "name": "Past Serial No", + "description": _("Past Serial No."), + } + ] + }, + { + "label": _("Purchase Reports"), + "icon": "fa fa-list", + "items": [ + { + "type": "report", + "is_query_report": True, + "name": "Items To Be Requested" + }, + { + "type": "report", + "is_query_report": True, + "name": "Reordering Items" + }, + { + "type": "report", + "is_query_report": True, + "name": "Pending Ordered Items" + }, + { + "type": "report", + "is_query_report": True, + "name": "Purchase History" + }, + { + "type": "report", + "is_query_report": True, + "name": "Pending Requests" + }, + { + "type": "report", + "is_query_report": True, + "name": "Shipment Tracking", + "doctype": "Order Tracking", + }, + { + "type": "report", + "is_query_report": True, + "name": "Costing Report", + "doctype": "Landed Cost Voucher", + }, + { + "type": "report", + "is_query_report": True, + "name": "Supplier Contacts", + "label": "Supplier Contacts", + "doctype": "Address", + "route_options": { + "party_type": "Supplier" + } + }, + ] + }, + { + "label": _("Stock Reports"), + "items": [ + { + "type": "report", + "is_query_report": True, + "name": "Stock Balance", + "doctype": "Stock Ledger Entry" + }, + { + "type": "report", + "is_query_report": True, + "name": "Stock Projected Qty", + "doctype": "Item", + }, + { + "type": "page", + "name": "stock-balance", + "label": _("Stock Summary") + }, + { + "type": "report", + "is_query_report": True, + "name": "Stock Ageing", + "doctype": "Item", + }, + { + "type": "report", + "is_query_report": True, + "name": "Ordered Items To Be Delivered", + "doctype": "Delivery Note" + }, + { + "type": "report", + "name": "Item Shortage Report", + "route": "Report/Bin/Item Shortage Report", + "doctype": "Purchase Receipt" + }, + { + "type": "report", + "is_query_report": True, + "name": "Requested Items To Be Transferred", + "doctype": "Material Request" + }, + { + "type": "report", + "is_query_report": True, + "name": "Itemwise Recommended Reorder Level", + "doctype": "Item" + }, + ] + }, + { + "label": _("Purchase Analytics"), + "icon": "fa fa-table", + "items": [ + { + "type": "page", + "name": "purchase-analytics", + "label": _("Purchase Analytics"), + "icon": "fa fa-bar-chart", + }, + { + "type": "report", + "is_query_report": True, + "name": "Purchase Order Trends", + "doctype": "Purchase Order" + }, + { + "type": "report", + "is_query_report": True, + "name": "Purchase Receipt Trends", + "doctype": "Purchase Receipt" + }, + ] + }, + { + "label": _("Stock Analytics"), + "icon": "fa fa-table", + "items": [ + { + "type": "page", + "name": "stock-analytics", + "label": _("Stock Analytics"), + "icon": "fa fa-bar-chart" + }, + { + "type": "doctype", + "name": "Bin Setup", + "description": _("Bin Setup for warehouse") + }, + + ] + }, + ] diff --git a/csf_tz/config/sales_and_marketing.py b/csf_tz/config/sales_and_marketing.py new file mode 100644 index 0000000..3c8a374 --- /dev/null +++ b/csf_tz/config/sales_and_marketing.py @@ -0,0 +1,315 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Marketing"), + "icon": "fa fa-star", + "items": [ + { + "type": "doctype", + "name": "Lead", + "description": _("Database of potential customers."), + }, + { + "type": "doctype", + "name": "Customer", + "description": _("Customer database."), + }, + { + "type": "doctype", + "name": "Customer Loan Assistance", + "description": _("Customer Loan Assistance."), + } + ] + }, + { + "label": _("Sales"), + "icon": "fa fa-star", + "items": [ + { + "type": "page", + "name": "pos", + "label": _("POS"), + "description": _("Point of Sale") + }, + { + "type": "doctype", + "name": "Quotation", + "description": _("Quotes to Leads or Customers."), + }, + { + "type": "doctype", + "name": "Sales Order", + "description": _("Confirmed orders from Customers."), + }, + { + "type": "doctype", + "name": "Sales Invoice", + "description": _("Sales Invoices."), + } + ] + }, + { + "label": _("Lead Follow Up"), + "icon": "fa fa-star", + "items": [ + { + "type": "report", + "is_query_report": True, + "label": _('Due Follow Up Communications'), + "name": "Due Communications", + "doctype": "Lead" + }, + { + "type": "report", + "is_query_report": True, + "name": "Due Demonstrations", + "doctype": "Lead" + }, + { + "type": "report", + "is_query_report": True, + "name": "Loan Assistance Report", + "doctype": "Customer Loan Assistance" + }, + { + "type": "report", + "is_query_report": True, + "name": "Item Wise Leads Report", + "doctype": "Quotation" + }, + ] + }, + { + "label": _("Stock and Pricing"), + "items": [ + { + "type": "doctype", + "name": "Item Price", + "description": _("Multiple Item prices."), + "route": "Report/Item Price" + }, + { + "type": "report", + "is_query_report": True, + "name": "Stock Balance", + "doctype": "Stock Ledger Entry" + }, + { + "type": "doctype", + "name": "Past Serial No", + "description": _("Past Serial No."), + } + ] + }, + { + "label": _("Marketing Reports"), + "icon": "fa fa-list", + "items": [ + { + "type": "doctype", + "name": "Lead", + "route": "List/Lead/Kanban/Sales Pipeline", + "label": _("Sales Pipeline"), + }, + { + "type": "report", + "is_query_report": True, + "name": "Lead Details", + "doctype": "Lead" + }, + { + "type": "page", + "name": "sales-funnel", + "label": _("Sales Funnel"), + "icon": "fa fa-bar-chart", + }, + { + "type": "report", + "is_query_report": True, + "name": "Customer Addresses And Contacts", + "doctype": "Contact" + }, + { + "type": "report", + "is_query_report": True, + "name": "Inactive Customers", + "doctype": "Sales Order" + }, + { + "type": "report", + "is_query_report": True, + "name": "Campaign Efficiency", + "doctype": "Lead" + }, + { + "type": "report", + "is_query_report": True, + "name": "Lead Owner Efficiency", + "doctype": "Lead" + }, + { + "type": "report", + "is_query_report": True, + "label": _("Follow Up Communications Report"), + "name": "Communications", + "doctype": "Lead" + }, + { + "type": "report", + "is_query_report": True, + "label": _("Demonstrations Report"), + "name": "Demonstrations", + "doctype": "Lead" + } + ] + }, + { + "label": _("Sales Reports"), + "icon": "fa fa-list", + "items": [ + { + "type": "report", + "is_query_report": True, + "name": "Items Marked For Delivery", + "doctype": "Sales Invoice" + }, + { + "type": "report", + "is_query_report": True, + "name": "Sales Person-wise Transaction Summary", + "doctype": "Sales Order" + }, + { + "type": "report", + "is_query_report": True, + "name": "Item-wise Sales History", + "doctype": "Item" + }, + { + "type": "report", + "is_query_report": True, + "name": "Sales Order Trends", + "doctype": "Sales Order" + }, + { + "type": "report", + "is_query_report": True, + "name": "Supplier-Wise Sales Analytics", + "doctype": "Stock Ledger Entry" + }, + { + "type": "report", + "is_query_report": True, + "name": "Payment Plan Report", + "doctype": "Sales Invoice" + }, + { + "type": "report", + "is_query_report": True, + "name": "Item Wise Sales Order", + "doctype": "Sales Order" + }, + { + "type": "report", + "is_query_report": True, + "name": "Payment Plan Summary", + "doctype": "Sales Invoice" + }, + { + "type": "report", + "is_query_report": True, + "name": "Sales Type Report", + "doctype": "Sales Invoice" + }, + { + "type": "report", + "is_query_report": True, + "name": "Spare Sales Report", + "doctype": "Sales Invoice" + }, + ] + }, + { + "label": _("Customer Reports"), + "icon": "fa fa-list", + "items": [ + { + "type": "report", + "is_query_report": True, + "name": "Brand Sales Report", + "label": "Brandwise Customer Details", + "doctype": "Sales Invoice" + }, + { + "type": "report", + "is_query_report": True, + "name": "Previous Ams Customer Report", + "label": "Old Customers Details", + "doctype": "Sales Invoice" + }, + ] + }, + { + "label": _("Setup"), + "items": [ + { + "type": "doctype", + "label": _("Customer Group"), + "name": "Customer Group", + "icon": "fa fa-sitemap", + "link": "Tree/Customer Group", + "description": _("Manage Customer Group Tree."), + }, + { + "type": "doctype", + "name": "Item Installation Procedures", + }, + { + "type": "doctype", + "name": "Campaign", + "description": _("Sales campaigns."), + }, + { + "type": "doctype", + "name": "Loan Procedures", + "label": "Supplier Loan Procedures", + "description": _("Loan Procedures.") + } + ] + }, + { + "label": _("Sales Analytics"), + "icon": "fa fa-table", + "items": [ + { + "type": "page", + "name": "sales-analytics", + "label": _("Sales Analytics"), + "icon": "fa fa-bar-chart", + }, + { + "type": "report", + "is_query_report": True, + "name": "Customer Acquisition and Loyalty", + "doctype": "Customer", + "icon": "fa fa-bar-chart", + }, + { + "type": "report", + "is_query_report": True, + "name": "Quotation Trends", + "doctype": "Quotation" + }, + { + "type": "report", + "is_query_report": True, + "name": "Sales Order Trends", + "doctype": "Sales Order" + }, + ] + } + + ] diff --git a/csf_tz/config/stock.py b/csf_tz/config/stock.py new file mode 100644 index 0000000..aa74c6f --- /dev/null +++ b/csf_tz/config/stock.py @@ -0,0 +1,21 @@ +from __future__ import unicode_literals +from frappe import _ + + +def get_data(): + return [ + + { + "label": _("Stock Transactions"), + "items": [ + + { + "type": "doctype", + "name": "Special Closing Balance", + "doctype": "Special Closing Balance", + "description": _("Enter closing balances and it will create Material Receipt type Stock Entry, to avoid manufacturing and remake entries."), + "dependencies": ["Item", "Warehouse"], + }, + ] + }, + ] \ No newline at end of file diff --git a/csf_tz/config/workshop.py b/csf_tz/config/workshop.py new file mode 100644 index 0000000..486b7df --- /dev/null +++ b/csf_tz/config/workshop.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Documents"), + "items": [ + { + "type": "doctype", + "name": "Job Card", + "description": _("Job Card.") + }, + { + "type": "doctype", + "name": "Requested Items", + "description": _("Requested Items.") + }, + { + "type": "doctype", + "name": "Workshop Request", + "description": _("Workshop Request.") + } + ] + }, + { + "label": _("Setup"), + "items": [ + { + "type": "doctype", + "name": "Workshop Service Type", + "description": _("Workshop Service Type") + }, + { + "type": "doctype", + "name": "Workshop Service", + "description": _("Workshop Service") + } + ] + }, + { + "label": _("Reports"), + "items": [ + { + "type": "report", + "name": "Workshop Daily Report", + "doctype": "Job Card", + "is_query_report": True, + }, + { + "type": "report", + "name": "Workshop Report", + "doctype": "Job Card", + "is_query_report": True, + }, + { + "type": "report", + "name": "Unprocessed Workshop Requests", + "doctype": "Workshop Request", + "is_query_report": True, + }, + { + "type": "report", + "name": "Used Items Report", + "doctype": "Job Card", + "is_query_report": True, + } + ] + } + ] diff --git a/csf_tz/csf_tz/__init__.py b/csf_tz/csf_tz/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/account.js b/csf_tz/csf_tz/account.js new file mode 100644 index 0000000..cdf9e88 --- /dev/null +++ b/csf_tz/csf_tz/account.js @@ -0,0 +1,40 @@ +frappe.ui.form.on("Account", { + onload_post_render: function(frm) { + frm.trigger("parent_account"); + frm.trigger("create_expenses_item_btn"); + frm.set_query("item", function() { + return { + "filters": { + "item_group": "Indirect Expenses" + } + }; + }); + }, + refresh:function(frm) { + frm.trigger("onload_post_render"); + }, + create_expenses_item_btn: function (frm) { + frm.add_custom_button(__("Create Expenses Item"), function() { + frappe.call({ + method: 'csf_tz.custom_api.add_indirect_expense_item', + args: { + account_name: frm.doc.name, + }, + callback: function(r) { + if (r.message) { + frm.set_value("item",r.message); + frm.refresh_field("item"); + frm.save(); + } + } + }); + }); + }, + parent_account: function(frm) { + frm.trigger("create_expenses_item_btn"); + frm.refresh_field("item"); + }, + item: function(frm) { + frm.trigger("create_expenses_item_btn"); + }, +}); diff --git a/csf_tz/csf_tz/bank_reconciliation.js b/csf_tz/csf_tz/bank_reconciliation.js new file mode 100644 index 0000000..fec5229 --- /dev/null +++ b/csf_tz/csf_tz/bank_reconciliation.js @@ -0,0 +1,21 @@ +frappe.ui.form.on('Bank Reconciliation', { + get_payment_entries: function (frm) { + frappe.call({ + method: 'erpnext.accounts.utils.get_balance_on', + args: { + account: frm.doc.account, + date: frappe.datetime.add_days(frm.doc.from_date, -1), + }, + async: false, + callback: function (r) { + if (r.message) { + frm.set_value("opening_balance", r.message || 0); + } + else { + frm.set_value("opening_balance", 0); + } + } + }); + frm.set_value("closing_balance", frm.doc.total_amount + frm.doc.opening_balance); + }, +}); diff --git a/csf_tz/csf_tz/company.js b/csf_tz/csf_tz/company.js new file mode 100644 index 0000000..b9af4d4 --- /dev/null +++ b/csf_tz/csf_tz/company.js @@ -0,0 +1,39 @@ +frappe.ui.form.on("Company", { + + setup: function(frm) { + frm.set_query("default_withholding_payable_account", function() { + return { + "filters": { + "company": frm.doc.name, + "account_type": "Payable", + } + }; + }); + frm.set_query("default_withholding_receivable_account", function() { + return { + "filters": { + "company": frm.doc.name, + "account_type": "Receivable", + } + }; + }); + frm.set_query("fee_bank_account", function() { + return { + "filters": { + "company": frm.doc.name, + "account_type": ["in",["Cash","Bank"]], + "account_currency": frm.doc.default_currency, + } + }; + }); + frm.set_query("student_applicant_fees_revenue_account", function() { + return { + "filters": { + "company": frm.doc.name, + "account_type": "Income Account", + "account_currency": frm.doc.default_currency, + } + }; + }); + }, +}); diff --git a/csf_tz/csf_tz/customer.js b/csf_tz/csf_tz/customer.js new file mode 100644 index 0000000..3cdeaa1 --- /dev/null +++ b/csf_tz/csf_tz/customer.js @@ -0,0 +1,21 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + + +frappe.ui.form.on("Customer", { + + + refresh: function(frm) { + + if(!frm.doc.__islocal) { + // custom buttons + frm.add_custom_button(__('Multi-Currency Ledger'), function() { + frappe.set_route('query-report', 'Multi-Currency Ledger', + {party_type:'Customer', party:frm.doc.name}); + }); + + } + }, + +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/delivery_note.js b/csf_tz/csf_tz/delivery_note.js new file mode 100644 index 0000000..986d5d3 --- /dev/null +++ b/csf_tz/csf_tz/delivery_note.js @@ -0,0 +1,148 @@ +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+q', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Delivery Note Item"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_info', + args: {item_code: item_row.item_code}, + callback: function(r) { + if (r.message.length > 0){ + const d = new frappe.ui.Dialog({ + title: __('Item Balance'), + width: 600 + }); + $(``).appendTo(d.body); + const thead = $(d.body).find('thead'); + if (r.message[0].batch_no){ + r.message.sort((a,b) => a.expiry_status-b.expiry_status); + $(` + Check + Warehouse + Qty + UOM + Batch No + Expires On + Expires in Days + `).appendTo(thead); + } else { + $(` + Check + Warehouse + Qty + UOM + `).appendTo(thead); + } + r.message.forEach(element => { + const tbody = $(d.body).find('tbody'); + const tr = $(` + + + ${element.warehouse} + ${element.actual_qty} + ${item_row.stock_uom } + + `).appendTo(tbody); + if (element.batch_no) { + $(` + ${element.batch_no} + ${element.expires_on} + ${element.expiry_status } + `).appendTo(tr); + tr.find('.check-warehouse').attr('data-batch',element.batch_no); + tr.find('.check-warehouse').attr('data-batchQty',element.actual_qty); + } + tbody.find('.check-warehouse').on('change', function() { + $('input.check-warehouse').not(this).prop('checked', false); + }); + }); + d.set_primary_action("Select", function() { + $(d.body).find('input:checked').each(function(i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 'warehouse', $(input).attr('data-warehouse')); + if ($(input).attr('data-batch')) { + frappe.model.set_value(item_row.doctype, item_row.name, 'batch_no', $(input).attr('data-batch')); + } + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = d; + d.show(); + } + else { + frappe.show_alert({message:__('There is No Records'), indicator:'red'}, 5); + } + } + }); + }, + page: this.page, + description: __('Select Item Warehouse'), + ignore_inputs: true, +}); + + + +frappe.ui.form.on("Delivery Note", { + refresh: function(frm, dt, dn) { + if ((!frm.is_return) && (frm.status!="Closed" || frm.is_new())) { + if (frm.doc.docstatus===0) { + let query_args = { + query:"csf_tz.custom_api.get_pending_sales_invoice", + filters: { + company: frm.doc.company, + set_warehouse: frm.doc.set_warehouse || "" + } + } + frm.add_custom_button(__('Sales Invoice'), + function() { + erpnext.utils.map_current_doc({ + method: "csf_tz.custom_api.make_delivery_note", + source_doctype: "Sales Invoice", + target: frm, + setters: { + customer: frm.doc.customer || undefined, + set_warehouse: frm.doc.set_warehouse || "", + }, + date_field: "posting_date", + get_query() { + return query_args; + }, + }) + }, __("Get items from")); + } + } + + }, + customer: function(frm) { + if (!frm.doc.customer) { + return + } + setTimeout(function() { + if (!frm.doc.tax_category){ + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function(r) { + console.log(r.message); + if(!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, +}); diff --git a/csf_tz/csf_tz/doctype/__init__.py b/csf_tz/csf_tz/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/attachment_type/__init__.py b/csf_tz/csf_tz/doctype/attachment_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.js b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.js new file mode 100644 index 0000000..8286b7e --- /dev/null +++ b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Attachment Type', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.json b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.json new file mode 100644 index 0000000..72c8efb --- /dev/null +++ b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.json @@ -0,0 +1,42 @@ +{ + "autoname": "field:description", + "creation": "2020-10-26 15:27:00.269115", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "description" + ], + "fields": [ + { + "fieldname": "description", + "fieldtype": "Data", + "label": "Description", + "unique": 1 + } + ], + "modified": "2020-10-28 09:24:26.104263", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Attachment Type", + "name_case": "Title Case", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.py b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.py new file mode 100644 index 0000000..d177101 --- /dev/null +++ b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class AttachmentType(Document): + pass diff --git a/csf_tz/csf_tz/doctype/attachment_type/test_attachment_type.py b/csf_tz/csf_tz/doctype/attachment_type/test_attachment_type.py new file mode 100644 index 0000000..d5becda --- /dev/null +++ b/csf_tz/csf_tz/doctype/attachment_type/test_attachment_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestAttachmentType(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/av_report_extension/__init__.py b/csf_tz/csf_tz/doctype/av_report_extension/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.js b/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.js new file mode 100644 index 0000000..d102fde --- /dev/null +++ b/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('AV Report Extension', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.json b/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.json new file mode 100644 index 0000000..e4da721 --- /dev/null +++ b/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.json @@ -0,0 +1,80 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:report", + "creation": "2021-07-03 19:47:10.912884", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "report", + "column_break_3", + "active", + "section_break_4", + "script", + "column_break_6", + "html_format" + ], + "fields": [ + { + "fieldname": "report", + "fieldtype": "Link", + "label": "Report", + "options": "Report", + "unique": 1 + }, + { + "fieldname": "script", + "fieldtype": "Code", + "label": "Script" + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "active", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Active" + }, + { + "fieldname": "html_format", + "fieldtype": "Code", + "label": "HTML Format" + }, + { + "fieldname": "section_break_4", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-07-03 21:06:38.708568", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "AV Report Extension", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.py b/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.py new file mode 100644 index 0000000..e57e006 --- /dev/null +++ b/csf_tz/csf_tz/doctype/av_report_extension/av_report_extension.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class AVReportExtension(Document): + pass diff --git a/csf_tz/csf_tz/doctype/av_report_extension/test_av_report_extension.py b/csf_tz/csf_tz/doctype/av_report_extension/test_av_report_extension.py new file mode 100644 index 0000000..89a2cf1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/av_report_extension/test_av_report_extension.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestAVReportExtension(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/background_document_posting/__init__.py b/csf_tz/csf_tz/doctype/background_document_posting/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.js b/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.js new file mode 100644 index 0000000..68b2439 --- /dev/null +++ b/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Background Document Posting', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.json b/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.json new file mode 100644 index 0000000..d6f97e6 --- /dev/null +++ b/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.json @@ -0,0 +1,78 @@ +{ + "actions": [], + "autoname": "CSFTZ-BDP.#####", + "creation": "2021-07-01 11:21:45.315015", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "document_type", + "document_name", + "posting_type", + "timeout", + "amended_from" + ], + "fields": [ + { + "fieldname": "document_type", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Document Type", + "options": "DocType", + "reqd": 1 + }, + { + "fieldname": "document_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Document Name", + "reqd": 1 + }, + { + "fieldname": "posting_type", + "fieldtype": "Select", + "label": "Posting Type", + "options": "submit\ncancel" + }, + { + "default": "600", + "fieldname": "timeout", + "fieldtype": "Int", + "label": "Timeout (Seconds)" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Background Document Posting", + "print_hide": 1, + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2021-07-01 11:48:56.301784", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Background Document Posting", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.py b/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.py new file mode 100644 index 0000000..79c09d0 --- /dev/null +++ b/csf_tz/csf_tz/doctype/background_document_posting/background_document_posting.py @@ -0,0 +1,10 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + +class BackgroundDocumentPosting(Document): + def on_submit(self): + post_doc = frappe.get_doc(self.document_type, self.document_name) + post_doc.queue_action(self.posting_type, timeout=self.timeout) diff --git a/csf_tz/csf_tz/doctype/background_document_posting/test_background_document_posting.py b/csf_tz/csf_tz/doctype/background_document_posting/test_background_document_posting.py new file mode 100644 index 0000000..6ae8b39 --- /dev/null +++ b/csf_tz/csf_tz/doctype/background_document_posting/test_background_document_posting.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestBackgroundDocumentPosting(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro/__init__.py b/csf_tz/csf_tz/doctype/bank_clearance_pro/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.js b/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.js new file mode 100644 index 0000000..f7d4160 --- /dev/null +++ b/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.js @@ -0,0 +1,111 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Bank Clearance Pro', { + setup: function (frm) { + frm.add_fetch("account", "account_currency", "account_currency"); + }, + + onload: function (frm) { + + let default_bank_account = frappe.defaults.get_user_default("Company") ? + locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"] : ""; + frm.set_value("account", default_bank_account); + + frm.set_query("account", function () { + return { + "filters": { + "account_type": ["in", ["Bank", "Cash"]], + "is_group": 0, + "disabled": 0 + } + }; + }); + + frm.set_query("bank_account", function () { + return { + "filters": { + "is_company_account": true + } + }; + }); + + frm.set_value("from_date", frappe.datetime.month_start()); + frm.set_value("to_date", frappe.datetime.month_end()); + }, + + refresh: function (frm) { + frm.disable_save(); + }, + + update_clearance_date: function (frm) { + return frappe.call({ + method: "update_clearance_date", + doc: frm.doc, + callback: function (r, rt) { + frm.refresh_field("payment_entries"); + frm.refresh_fields(); + } + }); + }, + @frappe.whitelist() + get_payment_entries: function (frm) { + if (!frm.doc.statement_opening_balance || !frm.doc.statement_closing_balance) { + frappe.throw("Statement Opening balance and Statement Closing Balance is Mandatory") + return + } + frappe.call({ + method: 'erpnext.accounts.utils.get_balance_on', + args: { + account: frm.doc.account, + date: frappe.datetime.add_days(frm.doc.from_date, -1), + }, + async: false, + callback: function (r) { + if (r.message) { + frm.set_value("opening_balance", r.message || 0); + } + else { + frm.set_value("opening_balance", 0); + } + } + }); + return frappe.call({ + method: "get_payment_entries", + doc: frm.doc, + callback: function (r, rt) { + frm.refresh_field("payment_entries"); + frm.refresh_fields(); + $(frm.fields_dict.payment_entries.wrapper).find("[data-fieldname=amount]").each(function (i, v) { + if (i != 0) { + $(v).addClass("text-right") + } + }) + frm.trigger('update_fields') + } + }); + }, + statement_opening_balance: function (frm) { + frm.trigger('update_fields') + }, + statement_closing_balance: function (frm) { + frm.trigger('update_fields') + }, + update_fields: function (frm) { + frm.set_value("closing_balance", frm.doc.total_amount + frm.doc.opening_balance); + frm.set_value("opening_difference", frm.doc.opening_balance - frm.doc.statement_opening_balance); + frm.set_value("closing_difference", frm.doc.closing_balance - frm.doc.statement_closing_balance); + }, +}); + +frappe.ui.form.on('Bank Clearance Pro Detail', { + clearance_date: function (frm) { + let reconciled_amount = 0; + frm.doc.payment_entries.forEach(element => { + if (element.clearance_date) { + reconciled_amount += element.flt_amount; + } + }); + frm.set_value("reconciled_amount", reconciled_amount); + } +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.json b/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.json new file mode 100644 index 0000000..63d2dc1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.json @@ -0,0 +1,195 @@ +{ + "allow_copy": 1, + "creation": "2020-11-14 17:39:32.055165", + "doctype": "DocType", + "document_type": "Document", + "engine": "InnoDB", + "field_order": [ + "account", + "account_currency", + "from_date", + "column_break_5", + "bank_account", + "to_date", + "section_break_7", + "statement_opening_balance", + "opening_balance", + "opening_difference", + "column_break_13", + "statement_closing_balance", + "closing_balance", + "closing_difference", + "total_amount", + "reconciled_amount", + "section_break_10", + "get_payment_entries", + "column_break_19", + "include_reconciled_entries", + "include_pos_transactions", + "section_break_22", + "payment_entries", + "update_clearance_date" + ], + "fields": [ + { + "fetch_from": "bank_account.account", + "fetch_if_empty": 1, + "fieldname": "account", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Account", + "options": "Account", + "reqd": 1 + }, + { + "fieldname": "account_currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Account Currency", + "options": "Currency", + "print_hide": 1 + }, + { + "fieldname": "from_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "From Date", + "reqd": 1 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "To Date", + "reqd": 1 + }, + { + "fieldname": "column_break_5", + "fieldtype": "Column Break" + }, + { + "fieldname": "bank_account", + "fieldtype": "Link", + "label": "Bank Account", + "options": "Bank Account" + }, + { + "default": "0", + "fieldname": "include_reconciled_entries", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Include Reconciled Entries" + }, + { + "default": "0", + "fieldname": "include_pos_transactions", + "fieldtype": "Check", + "label": "Include POS Transactions" + }, + { + "fieldname": "get_payment_entries", + "fieldtype": "Button", + "label": "Get Payment Entries" + }, + { + "fieldname": "section_break_10", + "fieldtype": "Section Break" + }, + { + "allow_bulk_edit": 1, + "fieldname": "payment_entries", + "fieldtype": "Table", + "label": "Payment Entries", + "options": "Bank Clearance Pro Detail" + }, + { + "fieldname": "update_clearance_date", + "fieldtype": "Button", + "label": "Update Clearance Date" + }, + { + "fieldname": "total_amount", + "fieldtype": "Currency", + "label": "Total Amount", + "options": "account_currency", + "read_only": 1 + }, + { + "fieldname": "opening_balance", + "fieldtype": "Float", + "label": "Opening Balance as per General Ledger", + "read_only": 1 + }, + { + "fieldname": "closing_balance", + "fieldtype": "Float", + "label": "Closing Balance as per General Ledger", + "read_only": 1 + }, + { + "fieldname": "statement_opening_balance", + "fieldtype": "Float", + "label": "Statement Opening balance" + }, + { + "fieldname": "opening_difference", + "fieldtype": "Float", + "label": "Opening Difference ", + "read_only": 1 + }, + { + "fieldname": "statement_closing_balance", + "fieldtype": "Float", + "label": "Statement Closing Balance" + }, + { + "fieldname": "closing_difference", + "fieldtype": "Float", + "label": "Closing Difference", + "read_only": 1 + }, + { + "fieldname": "reconciled_amount", + "fieldtype": "Float", + "label": "Reconciled Amount", + "read_only": 1 + }, + { + "fieldname": "section_break_7", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_13", + "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_19", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_22", + "fieldtype": "Section Break" + } + ], + "hide_toolbar": 1, + "icon": "fa fa-check", + "issingle": 1, + "modified": "2020-11-14 23:50:08.993553", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Bank Clearance Pro", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "read": 1, + "role": "Accounts User", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 1, + "sort_field": "modified", + "sort_order": "ASC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.py b/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.py new file mode 100644 index 0000000..50868d0 --- /dev/null +++ b/csf_tz/csf_tz/doctype/bank_clearance_pro/bank_clearance_pro.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, nowdate, fmt_money +from frappe import msgprint, _ +from frappe.model.document import Document + +form_grid_templates = { + "journal_entries": "templates/form_grid/bank_reconciliation_grid.html" +} + + +class BankClearancePro(Document): + @frappe.whitelist() + def get_payment_entries(self): + frappe.msgprint(_("Getting entries..."), alert=True) + if not (self.from_date and self.to_date): + frappe.throw(_("From Date and To Date are Mandatory")) + + if not self.account: + frappe.throw(_("Account is mandatory to get payment entries")) + + condition = "" + if not self.include_reconciled_entries: + condition = "and (clearance_date IS NULL or clearance_date='0000-00-00')" + + journal_entries = frappe.db.sql(""" + select + "Journal Entry" as payment_document, t1.name as payment_entry, + t1.cheque_no as cheque_number, t1.cheque_date, + sum(t2.debit_in_account_currency) as debit, sum(t2.credit_in_account_currency) as credit, + t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency + from + `tabJournal Entry` t1, `tabJournal Entry Account` t2 + where + t2.parent = t1.name and t2.account = %(account)s and t1.docstatus=1 + and t1.posting_date >= %(from)s and t1.posting_date <= %(to)s + and ifnull(t1.is_opening, 'No') = 'No' {condition} + group by t2.account, t1.name + order by t1.posting_date ASC, t1.name DESC + """.format(condition=condition), {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1) + + if self.bank_account: + condition += 'and bank_account = %(bank_account)s' + + payment_entries = frappe.db.sql(""" + select + "Payment Entry" as payment_document, name as payment_entry, + reference_no as cheque_number, reference_date as cheque_date, + if(paid_from=%(account)s, paid_amount, 0) as credit, + if(paid_from=%(account)s, 0, received_amount) as debit, + posting_date, ifnull(party_name,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date, + if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency + from `tabPayment Entry` + where + (paid_from=%(account)s or paid_to=%(account)s) and docstatus=1 + and posting_date >= %(from)s and posting_date <= %(to)s + {condition} + order by + posting_date ASC, name DESC + """.format(condition=condition), {"account": self.account, "from": self.from_date, + "to": self.to_date, "bank_account": self.bank_account}, as_dict=1) + + pos_sales_invoices, pos_purchase_invoices = [], [] + if self.include_pos_transactions: + pos_sales_invoices = frappe.db.sql(""" + select + "Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit, + si.posting_date, si.customer as against_account, sip.clearance_date, + account.account_currency, 0 as credit + from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account + where + sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name + and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s + order by + si.posting_date ASC, si.name DESC + """, {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1) + + pos_purchase_invoices = frappe.db.sql(""" + select + "Purchase Invoice" as payment_document, pi.name as payment_entry, pi.paid_amount as credit, + pi.posting_date, pi.supplier as against_account, pi.clearance_date, + account.account_currency, 0 as debit + from `tabPurchase Invoice` pi, `tabAccount` account + where + pi.cash_bank_account=%(account)s and pi.docstatus=1 and account.name = pi.cash_bank_account + and pi.posting_date >= %(from)s and pi.posting_date <= %(to)s + order by + pi.posting_date ASC, pi.name DESC + """, {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1) + + entries = sorted(list(payment_entries) + list(journal_entries + list(pos_sales_invoices) + list(pos_purchase_invoices)), + key=lambda k: k['posting_date'] or getdate(nowdate())) + frappe.msgprint(_("Got " + str(len(entries)) + " entries."), alert=True) + + self.set('payment_entries', []) + self.total_amount = 0.0 + + for d in entries: + row = self.append('payment_entries', {}) + + amount = flt(d.get('debit', 0)) - flt(d.get('credit', 0)) + d.flt_amount = amount + + formatted_amount = fmt_money(abs(amount), 2, d.account_currency) + d.amount = formatted_amount + " " + \ + (_("Dr") if amount > 0 else _("Cr")) + + d.pop("credit") + d.pop("debit") + d.pop("account_currency") + row.update(d) + self.total_amount += flt(amount) + + def update_clearance_date(self): + clearance_date_updated = False + for d in self.get('payment_entries'): + if d.clearance_date: + if not d.payment_document: + frappe.throw( + _("Row #{0}: Payment document is required to complete the transaction")) + + if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date): + frappe.msgprint(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}") + .format(d.idx, d.clearance_date, d.cheque_date), alert=True) + frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}") + .format(d.idx, d.clearance_date, d.cheque_date)) + + if d.clearance_date or self.include_reconciled_entries: + if not d.clearance_date: + d.clearance_date = None + + payment_entry = frappe.get_doc( + d.payment_document, d.payment_entry) + payment_entry.db_set('clearance_date', d.clearance_date) + + clearance_date_updated = True + + if clearance_date_updated: + self.get_payment_entries() + msgprint(_("Clearance Date updated")) + else: + msgprint(_("Clearance Date not mentioned")) diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro/test_bank_clearance_pro.py b/csf_tz/csf_tz/doctype/bank_clearance_pro/test_bank_clearance_pro.py new file mode 100644 index 0000000..c4f6087 --- /dev/null +++ b/csf_tz/csf_tz/doctype/bank_clearance_pro/test_bank_clearance_pro.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestBankClearancePro(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/__init__.py b/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/bank_clearance_pro_detail.json b/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/bank_clearance_pro_detail.json new file mode 100644 index 0000000..279f890 --- /dev/null +++ b/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/bank_clearance_pro_detail.json @@ -0,0 +1,118 @@ +{ + "actions": [], + "creation": "2020-11-14 17:40:11.317801", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "payment_document", + "payment_entry", + "against_account", + "amount", + "flt_amount", + "column_break_5", + "posting_date", + "cheque_number", + "cheque_date", + "clearance_date" + ], + "fields": [ + { + "fieldname": "payment_document", + "fieldtype": "Link", + "label": "Payment Document", + "options": "DocType" + }, + { + "columns": 2, + "fieldname": "payment_entry", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Payment Entry", + "oldfieldname": "voucher_id", + "oldfieldtype": "Link", + "options": "payment_document", + "width": "50" + }, + { + "columns": 2, + "fieldname": "against_account", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Against Account", + "oldfieldname": "against_account", + "oldfieldtype": "Data", + "read_only": 1, + "width": "15" + }, + { + "columns": 2, + "fieldname": "amount", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Amount", + "oldfieldname": "debit", + "oldfieldtype": "Currency", + "read_only": 1 + }, + { + "fieldname": "column_break_5", + "fieldtype": "Column Break", + "width": "50%" + }, + { + "columns": 2, + "fieldname": "posting_date", + "fieldtype": "Date", + "label": "Posting Date", + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "read_only": 1 + }, + { + "columns": 2, + "fieldname": "cheque_number", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Cheque Number", + "oldfieldname": "cheque_number", + "oldfieldtype": "Data", + "read_only": 1 + }, + { + "fieldname": "cheque_date", + "fieldtype": "Date", + "label": "Cheque Date", + "oldfieldname": "cheque_date", + "oldfieldtype": "Date", + "read_only": 1 + }, + { + "columns": 2, + "fieldname": "clearance_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Clearance Date", + "oldfieldname": "clearance_date", + "oldfieldtype": "Date" + }, + { + "fieldname": "flt_amount", + "fieldtype": "Float", + "label": "FLT Amount", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2020-11-14 20:08:46.366578", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Bank Clearance Pro Detail", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "ASC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/bank_clearance_pro_detail.py b/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/bank_clearance_pro_detail.py new file mode 100644 index 0000000..09378d3 --- /dev/null +++ b/csf_tz/csf_tz/doctype/bank_clearance_pro_detail/bank_clearance_pro_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class BankClearanceProDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/csf_api_response_log/__init__.py b/csf_tz/csf_tz/doctype/csf_api_response_log/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.js b/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.js new file mode 100644 index 0000000..7784ad4 --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('CSF API Response Log', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.json b/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.json new file mode 100644 index 0000000..548a575 --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.json @@ -0,0 +1,122 @@ +{ + "actions": [], + "autoname": "naming_series:", + "creation": "2021-08-11 22:03:36.967501", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "naming_series", + "timestamp", + "request_type", + "request_url", + "request_header", + "column_break_6", + "user_id", + "status_code", + "request_section", + "request_body", + "section_break_8", + "response_data" + ], + "fields": [ + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Naming Series", + "options": "CSFAPI-RES-.YY.-.########", + "read_only": 1 + }, + { + "default": "Now", + "fieldname": "timestamp", + "fieldtype": "Datetime", + "in_list_view": 1, + "label": "Timestamp", + "read_only": 1 + }, + { + "fieldname": "request_type", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Request Type", + "read_only": 1 + }, + { + "fieldname": "request_url", + "fieldtype": "Data", + "label": "Request URL", + "read_only": 1 + }, + { + "fieldname": "request_header", + "fieldtype": "Small Text", + "label": "Request Header", + "read_only": 1 + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + }, + { + "fieldname": "user_id", + "fieldtype": "Data", + "label": "User ID", + "read_only": 1 + }, + { + "fieldname": "status_code", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Response Status Code", + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "request_section", + "fieldtype": "Section Break", + "label": "Request Body" + }, + { + "fieldname": "request_body", + "fieldtype": "Long Text", + "label": "Request Body", + "read_only": 1 + }, + { + "fieldname": "section_break_8", + "fieldtype": "Section Break" + }, + { + "fieldname": "response_data", + "fieldtype": "Long Text", + "label": "Response Data", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-08-11 22:03:36.967501", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "CSF API Response Log", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.py b/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.py new file mode 100644 index 0000000..b2f0820 --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_api_response_log/csf_api_response_log.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + + +class CSFAPIResponseLog(Document): + pass + + +def add_log( + request_type, + request_url, + request_header=None, + request_body=None, + response_data=None, + status_code=None, +): + doc = frappe.new_doc("CSF API Response Log") + doc.request_type = str(request_type) + doc.request_url = str(request_url) + doc.request_header = str(request_header) or "" + doc.request_body = str(request_body) or "" + doc.response_data = str(response_data) or "" + doc.user_id = frappe.session.user + doc.status_code = status_code or "" + doc.save(ignore_permissions=True) + frappe.db.commit() + return doc.name diff --git a/csf_tz/csf_tz/doctype/csf_api_response_log/test_csf_api_response_log.py b/csf_tz/csf_tz/doctype/csf_api_response_log/test_csf_api_response_log.py new file mode 100644 index 0000000..f6384cc --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_api_response_log/test_csf_api_response_log.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestCSFAPIResponseLog(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/csf_tz_settings/__init__.py b/csf_tz/csf_tz/doctype/csf_tz_settings/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.js b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.js new file mode 100644 index 0000000..f5f23ca --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.js @@ -0,0 +1,13 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('CSF TZ Settings', { + start_sle_gle_reporting: function (frm) { + frappe.call({ + method: 'csf_tz.csftz_hooks.item_reposting.enqueue_reposting_sle_gle', + callback: function (data) { + console.log(data); + } + }) + }, +}); diff --git a/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json new file mode 100644 index 0000000..ddb5702 --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json @@ -0,0 +1,127 @@ +{ + "actions": [], + "creation": "2020-06-14 23:47:22.553281", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "unique_records", + "validate_net_rate", + "fetch_default_tax_category", + "enable_dependent_auto_permission", + "column_break_3", + "auto_pos_for_role", + "is_manufacture", + "allow_delete_in_sql_command", + "item_qty_poppup_message", + "section_break_8", + "sle_gle_reposting_start_date", + "column_break_10", + "start_sle_gle_reporting" + ], + "fields": [ + { + "default": "0", + "fieldname": "unique_records", + "fieldtype": "Check", + "label": "Unique Records" + }, + { + "fieldname": "auto_pos_for_role", + "fieldtype": "Link", + "label": "Auto Pos For Role", + "options": "Role" + }, + { + "default": "0", + "fieldname": "validate_net_rate", + "fieldtype": "Check", + "label": "Validate Net Rate in Sales Invoice" + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "default": "0", + "description": "Fetch Tax Category from Default Tax Templates", + "fieldname": "fetch_default_tax_category", + "fieldtype": "Check", + "label": "Fetch Default Tax Category" + }, + { + "default": "0", + "fieldname": "is_manufacture", + "fieldtype": "Check", + "label": "Make Manufacture Entry instead of Material Receipt" + }, + { + "default": "0", + "fieldname": "allow_delete_in_sql_command", + "fieldtype": "Check", + "label": "Allow Delete in SQL Command" + }, + { + "fieldname": "sle_gle_reposting_start_date", + "fieldtype": "Date", + "label": "SLE GLE Reposting Start Date" + }, + { + "fieldname": "section_break_8", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break" + }, + { + "fieldname": "start_sle_gle_reporting", + "fieldtype": "Button", + "label": "Start SLE GLE Reporting" + }, + { + "default": "1", + "fieldname": "enable_dependent_auto_permission", + "fieldtype": "Check", + "label": "Enable Dependent Auto Permission" + }, + { + "default": "0", + "description": "if ticked, a popup message showing description will appear on sales invoice when item qty remaining is less to 0", + "fieldname": "item_qty_poppup_message", + "fieldtype": "Check", + "label": "Item Qty Poppup Massage" + } + ], + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2022-09-13 16:56:02.482297", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "CSF TZ Settings", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, + { + "email": 1, + "print": 1, + "read": 1, + "role": "All", + "share": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.py b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.py new file mode 100644 index 0000000..c0f8fba --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class CSFTZSettings(Document): + pass diff --git a/csf_tz/csf_tz/doctype/csf_tz_settings/test_csf_tz_settings.py b/csf_tz/csf_tz/doctype/csf_tz_settings/test_csf_tz_settings.py new file mode 100644 index 0000000..42e29e1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/csf_tz_settings/test_csf_tz_settings.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestCSFTZSettings(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/document_attachment/__init__.py b/csf_tz/csf_tz/doctype/document_attachment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/document_attachment/document_attachment.json b/csf_tz/csf_tz/doctype/document_attachment/document_attachment.json new file mode 100644 index 0000000..4bf1037 --- /dev/null +++ b/csf_tz/csf_tz/doctype/document_attachment/document_attachment.json @@ -0,0 +1,61 @@ +{ + "creation": "2020-10-26 15:28:13.866148", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "document_name", + "document_number", + "issue_date", + "expiry_date", + "attachment" + ], + "fields": [ + { + "columns": 2, + "fieldname": "document_name", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Document Name", + "options": "Attachment Type" + }, + { + "columns": 2, + "fieldname": "document_number", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Document Number" + }, + { + "columns": 1, + "fieldname": "issue_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Issue Date" + }, + { + "columns": 1, + "fieldname": "expiry_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Expiry Date" + }, + { + "fieldname": "attachment", + "fieldtype": "Attach", + "in_list_view": 1, + "label": "Attachment" + } + ], + "istable": 1, + "modified": "2020-10-28 09:08:31.608278", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Document Attachment", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/document_attachment/document_attachment.py b/csf_tz/csf_tz/doctype/document_attachment/document_attachment.py new file mode 100644 index 0000000..b9ee29a --- /dev/null +++ b/csf_tz/csf_tz/doctype/document_attachment/document_attachment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class DocumentAttachment(Document): + pass diff --git a/csf_tz/csf_tz/doctype/efd_z_report/__init__.py b/csf_tz/csf_tz/doctype/efd_z_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.js b/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.js new file mode 100644 index 0000000..3b4fd3d --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.js @@ -0,0 +1,56 @@ +cur_frm.cscript.get_invoices = function (frm) { + cur_frm.clear_table("efd_z_report_invoices") + frappe.call({ + method: "get_sales_invoice", + doc: cur_frm.doc, + args: { + "electronic_fiscal_device": cur_frm.doc.electronic_fiscal_device, + "date_and_time": cur_frm.doc.z_report_date_time, + }, + freeze: true, + freeze_message: "Fetching Invoices...", + callback: function(r) { + cur_frm.refresh_field("efd_z_report_invoices") + } + }); +} + +frappe.ui.form.on('EFD Z Report Invoice', { + include: (frm) => { + let sum_excluding_vat_ticked = 0 + let sum_vat_ticked = 0 + let sum_turnover_exempted_sp_relief_ticked = 0 + let sum_turnover_ticked = 0 + frm.doc.efd_z_report_invoices.forEach(d => { + if (d.include){ + sum_excluding_vat_ticked += d.amt_excl_vat; + sum_vat_ticked += d.vat; + sum_turnover_exempted_sp_relief_ticked += d.amt_ex__sr; + sum_turnover_ticked += d.invoice_amount; + } + }); + frm.set_value("total_excluding_vat_ticked", sum_excluding_vat_ticked - sum_turnover_exempted_sp_relief_ticked); + frm.set_value("total_vat_ticked", sum_vat_ticked); + frm.set_value("total_turnover_exempted__sp_relief_ticked", sum_turnover_exempted_sp_relief_ticked); + frm.set_value("total_turnover_ticked", sum_turnover_ticked); + + } +}) + + +frappe.ui.form.on('EFD Z Report', { + net_amount: (frm) => { + calculate_total_turnover(frm); + }, + total_vat: (frm) => { + calculate_total_turnover(frm); + }, + total_turnover_ex_sr: (frm) => { + calculate_total_turnover(frm); + }, +}) + +const calculate_total_turnover = (frm) => { + frm.doc.total_turnover = frm.doc.net_amount + frm.doc.total_vat +frm.doc.total_turnover_ex_sr; + refresh_field("total_turnover"); +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.json b/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.json new file mode 100644 index 0000000..4946801 --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.json @@ -0,0 +1,364 @@ +{ + "actions": [], + "autoname": "format:{electronic_fiscal_device}-{z_no}", + "creation": "2019-08-14 11:15:03.370491", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "electronic_fiscal_device", + "z_no", + "money", + "column_break_5", + "z_report_date_time", + "receipts_issued", + "section_break_7", + "net_amount", + "total_vat", + "total_turnover_ex_sr", + "total_turnover", + "allowable_difference", + "column_break_13", + "total_excluding_vat_ticked", + "total_vat_ticked", + "total_turnover_exempted__sp_relief_ticked", + "total_turnover_ticked", + "vat_section", + "get_invoices", + "efd_z_report_invoices", + "section_break_10", + "vat_a_18", + "a_turnover", + "vat_b_10", + "b_turnover", + "html_11", + "c_turnover", + "html_13", + "d_turnover", + "html_15", + "e_turnover", + "column_break_12", + "html_18", + "a_net_sum", + "html_20", + "b_net_sum", + "html_22", + "c_net_sum", + "html_24", + "d_net_sum", + "column_break_17", + "html_27", + "a_vat", + "html_29", + "b_vat", + "html_31", + "c_vat", + "html_33", + "d_vat", + "amended_from" + ], + "fields": [ + { + "description": " ", + "fieldname": "electronic_fiscal_device", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Electronic Fiscal Device", + "options": "Electronic Fiscal Device", + "reqd": 1, + "set_only_once": 1 + }, + { + "depends_on": "eval: doc.electronic_fiscal_device", + "fieldname": "z_no", + "fieldtype": "Data", + "label": "Z No", + "reqd": 1, + "set_only_once": 1 + }, + { + "fieldname": "money", + "fieldtype": "Currency", + "hidden": 1, + "label": "Money" + }, + { + "depends_on": "eval: doc.electronic_fiscal_device", + "fieldname": "receipts_issued", + "fieldtype": "Int", + "label": "Receipts Issued", + "reqd": 1 + }, + { + "fieldname": "column_break_5", + "fieldtype": "Column Break" + }, + { + "fieldname": "total_turnover", + "fieldtype": "Currency", + "label": "Total Turnover", + "read_only": 1 + }, + { + "fieldname": "net_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Total Excluding VAT" + }, + { + "fieldname": "total_vat", + "fieldtype": "Currency", + "label": "Total VAT" + }, + { + "fieldname": "total_turnover_ex_sr", + "fieldtype": "Currency", + "label": "Total Turnover Exempted / Sp. Relief" + }, + { + "depends_on": "eval: doc.z_no", + "fieldname": "section_break_7", + "fieldtype": "Section Break" + }, + { + "default": "Today", + "depends_on": "eval: doc.electronic_fiscal_device", + "description": "From FM Summary section in the bottom part of the Z Report", + "fieldname": "z_report_date_time", + "fieldtype": "Datetime", + "in_list_view": 1, + "label": "Z Report Date Time", + "reqd": 1 + }, + { + "depends_on": "eval: doc.receipts_issued", + "fieldname": "vat_section", + "fieldtype": "Section Break" + }, + { + "fieldname": "get_invoices", + "fieldtype": "Button", + "label": "Get Invoices" + }, + { + "fieldname": "efd_z_report_invoices", + "fieldtype": "Table", + "label": "EFD Z Report Invoices", + "options": "EFD Z Report Invoice" + }, + { + "fieldname": "section_break_10", + "fieldtype": "Section Break", + "hidden": 1 + }, + { + "fieldname": "vat_a_18", + "fieldtype": "HTML", + "options": "VAT A (18.00%)" + }, + { + "fieldname": "a_turnover", + "fieldtype": "Currency", + "label": "Turnover" + }, + { + "fieldname": "vat_b_10", + "fieldtype": "HTML", + "options": "VAT B (10.00%)" + }, + { + "fieldname": "b_turnover", + "fieldtype": "Currency", + "label": "Turnover" + }, + { + "fieldname": "html_11", + "fieldtype": "HTML", + "options": "VAT C (0.00%)" + }, + { + "fieldname": "c_turnover", + "fieldtype": "Currency", + "label": "Turnover" + }, + { + "fieldname": "html_13", + "fieldtype": "HTML", + "options": "VAT D (SR)" + }, + { + "fieldname": "d_turnover", + "fieldtype": "Currency", + "label": "Turnover" + }, + { + "fieldname": "html_15", + "fieldtype": "HTML", + "options": "VAT (EX.)" + }, + { + "fieldname": "e_turnover", + "fieldtype": "Currency", + "label": "Turnover" + }, + { + "fieldname": "column_break_12", + "fieldtype": "Column Break" + }, + { + "fieldname": "html_18", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "a_net_sum", + "fieldtype": "Currency", + "label": "Net Sum" + }, + { + "fieldname": "html_20", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "b_net_sum", + "fieldtype": "Currency", + "label": "Net Sum" + }, + { + "fieldname": "html_22", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "c_net_sum", + "fieldtype": "Currency", + "label": "Net Sum" + }, + { + "fieldname": "html_24", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "d_net_sum", + "fieldtype": "Currency", + "label": "Net Sum" + }, + { + "fieldname": "column_break_17", + "fieldtype": "Column Break" + }, + { + "fieldname": "html_27", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "a_vat", + "fieldtype": "Currency", + "label": "VAT" + }, + { + "fieldname": "html_29", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "b_vat", + "fieldtype": "Currency", + "label": "VAT" + }, + { + "fieldname": "html_31", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "c_vat", + "fieldtype": "Currency", + "label": "VAT" + }, + { + "fieldname": "html_33", + "fieldtype": "HTML", + "options": " " + }, + { + "fieldname": "d_vat", + "fieldtype": "Currency", + "label": "VAT" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "EFD Z Report", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_13", + "fieldtype": "Column Break" + }, + { + "fieldname": "total_excluding_vat_ticked", + "fieldtype": "Currency", + "label": "Total Excluding VAT (Ticked)", + "precision": "2", + "read_only": 1 + }, + { + "fieldname": "total_vat_ticked", + "fieldtype": "Currency", + "label": "Total VAT (Ticked)", + "precision": "2", + "read_only": 1 + }, + { + "fieldname": "total_turnover_exempted__sp_relief_ticked", + "fieldtype": "Currency", + "label": "Total Turnover Exempted / Sp. Relief (Ticked)", + "precision": "2", + "read_only": 1 + }, + { + "fieldname": "total_turnover_ticked", + "fieldtype": "Currency", + "label": "Total Turnover (Ticked)", + "precision": "2", + "read_only": 1 + }, + { + "fieldname": "allowable_difference", + "fieldtype": "Currency", + "label": "Allowable difference" + } + ], + "is_submittable": 1, + "links": [], + "modified": "2022-05-19 11:50:02.474969", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "EFD Z Report", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.py b/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.py new file mode 100644 index 0000000..54e5a0f --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report/efd_z_report.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document +from datetime import datetime +from frappe.utils import flt + + +class EFDZReport(Document): + def validate(self): + if not self.efd_z_report_invoices: + frappe.throw(_("No Sales Invoie Found in the table")) + + def get_number_of_ticked(self): + total_checked = 0 + for i in self.efd_z_report_invoices: + if i.include: + total_checked += 1 + return total_checked + + @frappe.whitelist() + def get_sales_invoice(self): + + date = datetime.strptime( + str(self.z_report_date_time), "%Y-%m-%d %H:%M:%S" + ).date() + time = datetime.strptime( + str(self.z_report_date_time), "%Y-%m-%d %H:%M:%S" + ).time() + + condition = ( + "docstatus = 1 and (efd_z_report = '' OR efd_z_report is null) and status !='Return' and posting_date <= '" + + str(date) + + "' and IF(IF(posting_date = '" + + str(date) + + "', IF(posting_time < '" + + str(time) + + "',1,'PostingTime'),'PostingDate') = 1 or IF(posting_date = '" + + str(date) + + "',IF(posting_time < '" + + str(time) + + "',1,'PostingTime'),'PostingDate') = 'PostingDate',1,0)" + ) + + condition += ( + " and ( electronic_fiscal_device = '" + self.electronic_fiscal_device + "'" + "or electronic_fiscal_device is null or electronic_fiscal_device = '')" + ) + + query = """ select * + from `tabSales Invoice` + where {0}""".format( + condition + ) + + sales_invoices = frappe.db.sql(query, as_dict=True) + + if not sales_invoices: + frappe.throw("No Sales Invoice Fetch") + + for i in sales_invoices: + if i.base_total_taxes_and_charges == 0: + amt_ex__sr = i.base_total + else: + if i.base_net_total != i.base_total: + amt_ex__sr = i.base_grand_total - ( + i.base_net_total + i.base_total_taxes_and_charges + ) + else: + amt_ex__sr = i.base_grand_total - ( + (i.base_total_taxes_and_charges / 0.18) + + i.base_total_taxes_and_charges + ) + if amt_ex__sr < 0: + amt_ex__sr = 0 + self.append( + "efd_z_report_invoices", + { + "invoice_number": i.name, + "invoice_date": i.posting_date, + "amt_excl_vat": flt(i.base_net_total, 2), + "vat": flt(i.base_total_taxes_and_charges, 2), + "amt_ex__sr": amt_ex__sr, + "invoice_amount": flt(i.base_rounded_total, 2), + "invoice_currency": i.currency, + }, + ) + return True + + def before_submit(self): + if abs(flt(self.total_turnover, 2) - flt(self.total_turnover_ticked, 2)) > (self.allowable_difference or 0): + frappe.throw(_("Sales Invoice Amount {0} is not equal to Money Entered {1}".format(flt(self.total_turnover_ticked, 2), flt(self.total_turnover, 2)))) + if abs(flt(self.net_amount, 2) - flt(self.total_excluding_vat_ticked, 2)) > (self.allowable_difference or 0): + frappe.throw( + _("Total Excluding VAT {0} is not equal to Total Excluding VAT (Ticked) {1}".format(flt(self.net_amount, 2), flt(self.total_excluding_vat_ticked, 2))) + ) + if abs(flt(self.total_vat, 2) - flt(self.total_vat_ticked, 2)) > (self.allowable_difference or 0): + frappe.throw(_("Total VAT {0} is not equal to Total VAT (Ticked) {1}".format(flt(self.total_vat, 2), flt(self.total_vat_ticked, 2)))) + if abs(flt(self.total_turnover_ex_sr, 2) - flt(self.total_turnover_exempted__sp_relief_ticked, 2)) > (self.allowable_difference or 0): + frappe.throw( + _( + "Total Turnover Exempted / Sp. Relief {0} is not equal to Total Turnover Exempted / Sp. Relief (Ticked) {1}".format( + flt(self.total_turnover_ex_sr, 2), flt(self.total_turnover_exempted__sp_relief_ticked, 2) + ) + ) + ) + if self.get_number_of_ticked() != self.receipts_issued: + frappe.throw( + _( + "The Number of Sales Invoice (Include is checked) in the table is not equal to Receipts Issued" + ) + ) + to_remove = [] + for invoice in self.efd_z_report_invoices: + if not invoice.include: + to_remove.append(invoice) + else: + invoice_doc = frappe.get_doc("Sales Invoice", invoice.invoice_number) + if invoice_doc.efd_z_report: + frappe.throw( + _( + "The Sales Invoice {0} is linked to EFD Z Report {1}".format( + invoice.invoice_number, invoice_doc.efd_z_report + ) + ) + ) + else: + invoice_doc.efd_z_report = self.name + invoice_doc.flags.ignore_permissions = True + invoice_doc.save() + [self.remove(invoice) for invoice in to_remove] + + def on_cancel(self): + for invoice in self.efd_z_report_invoices: + if invoice.include: + invoice_doc = frappe.get_doc("Sales Invoice", invoice.invoice_number) + if invoice_doc.efd_z_report: + invoice_doc.efd_z_report = "" + invoice_doc.flags.ignore_permissions = True + invoice_doc.save() diff --git a/csf_tz/csf_tz/doctype/efd_z_report/test_efd_z_report.js b/csf_tz/csf_tz/doctype/efd_z_report/test_efd_z_report.js new file mode 100644 index 0000000..3777e84 --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report/test_efd_z_report.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: EFD Z Report", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new EFD Z Report + () => frappe.tests.make('EFD Z Report', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/csf_tz/doctype/efd_z_report/test_efd_z_report.py b/csf_tz/csf_tz/doctype/efd_z_report/test_efd_z_report.py new file mode 100644 index 0000000..292df86 --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report/test_efd_z_report.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals +import unittest + +class TestEFDZReport(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/efd_z_report_invoice/__init__.py b/csf_tz/csf_tz/doctype/efd_z_report_invoice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.js b/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.js new file mode 100644 index 0000000..d992d49 --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('EFD Z Report Invoice', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.json b/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.json new file mode 100644 index 0000000..b41de39 --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.json @@ -0,0 +1,97 @@ +{ + "creation": "2019-08-19 14:41:20.363473", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "invoice_number", + "invoice_date", + "amt_excl_vat", + "vat", + "amt_ex__sr", + "invoice_amount", + "include" + ], + "fields": [ + { + "columns": 1, + "fieldname": "invoice_number", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Invoice No.", + "options": "Sales Invoice", + "read_only": 1, + "reqd": 1 + }, + { + "columns": 1, + "fetch_from": "invoice_number.posting_date", + "fieldname": "invoice_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Invoice Date", + "read_only": 1, + "reqd": 1 + }, + { + "columns": 2, + "fieldname": "invoice_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Invoice Amt.", + "options": "invoice_currency", + "read_only": 1, + "reqd": 1, + "width": "200" + }, + { + "columns": 1, + "default": "0", + "fieldname": "include", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Include" + }, + { + "columns": 2, + "fieldname": "amt_excl_vat", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amt. Excl. VAT", + "read_only": 1, + "reqd": 1, + "width": "200" + }, + { + "columns": 1, + "fieldname": "vat", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "VAT", + "read_only": 1, + "reqd": 1, + "width": "200" + }, + { + "columns": 2, + "fieldname": "amt_ex__sr", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amt. EX / SR", + "read_only": 1, + "reqd": 1, + "width": "200" + } + ], + "istable": 1, + "modified": "2020-03-05 20:43:33.193085", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "EFD Z Report Invoice", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.py b/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.py new file mode 100644 index 0000000..2ff4e2a --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report_invoice/efd_z_report_invoice.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class EFDZReportInvoice(Document): + pass diff --git a/csf_tz/csf_tz/doctype/efd_z_report_invoice/test_efd_z_report_invoice.js b/csf_tz/csf_tz/doctype/efd_z_report_invoice/test_efd_z_report_invoice.js new file mode 100644 index 0000000..682b45b --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report_invoice/test_efd_z_report_invoice.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: EFD Z Report Invoice", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new EFD Z Report Invoice + () => frappe.tests.make('EFD Z Report Invoice', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/csf_tz/doctype/efd_z_report_invoice/test_efd_z_report_invoice.py b/csf_tz/csf_tz/doctype/efd_z_report_invoice/test_efd_z_report_invoice.py new file mode 100644 index 0000000..6cce1a9 --- /dev/null +++ b/csf_tz/csf_tz/doctype/efd_z_report_invoice/test_efd_z_report_invoice.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals +import unittest + +class TestEFDZReportInvoice(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/electronic_fiscal_device/__init__.py b/csf_tz/csf_tz/doctype/electronic_fiscal_device/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.js b/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.js new file mode 100644 index 0000000..2e9e311 --- /dev/null +++ b/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Electronic Fiscal Device', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.json b/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.json new file mode 100644 index 0000000..3f8c51d --- /dev/null +++ b/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.json @@ -0,0 +1,81 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{location}-{make}-{model}", + "creation": "2019-08-14 11:09:46.080727", + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "type", + "serial_no", + "location", + "supplier", + "make", + "model" + ], + "fields": [ + { + "fieldname": "type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Type", + "options": "Electronic Tax Register (ETR)\nElectronic Fiscal Printer (EFP)\nElectronic Signature Device (ESD)\nElectronic Fiscal Pump Printer (EFPP)", + "reqd": 1 + }, + { + "fieldname": "serial_no", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Serial No", + "reqd": 1 + }, + { + "fieldname": "location", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Location", + "reqd": 1 + }, + { + "fieldname": "supplier", + "fieldtype": "Link", + "label": "Supplier", + "options": "Supplier" + }, + { + "fieldname": "make", + "fieldtype": "Data", + "label": "Make" + }, + { + "fieldname": "model", + "fieldtype": "Data", + "label": "Model" + } + ], + "links": [], + "modified": "2022-02-01 15:57:35.183105", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Electronic Fiscal Device", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.py b/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.py new file mode 100644 index 0000000..bee6272 --- /dev/null +++ b/csf_tz/csf_tz/doctype/electronic_fiscal_device/electronic_fiscal_device.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class ElectronicFiscalDevice(Document): + pass diff --git a/csf_tz/csf_tz/doctype/electronic_fiscal_device/test_electronic_fiscal_device.js b/csf_tz/csf_tz/doctype/electronic_fiscal_device/test_electronic_fiscal_device.js new file mode 100644 index 0000000..1019e98 --- /dev/null +++ b/csf_tz/csf_tz/doctype/electronic_fiscal_device/test_electronic_fiscal_device.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Electronic Fiscal Device", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Electronic Fiscal Device + () => frappe.tests.make('Electronic Fiscal Device', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/csf_tz/doctype/electronic_fiscal_device/test_electronic_fiscal_device.py b/csf_tz/csf_tz/doctype/electronic_fiscal_device/test_electronic_fiscal_device.py new file mode 100644 index 0000000..706ba00 --- /dev/null +++ b/csf_tz/csf_tz/doctype/electronic_fiscal_device/test_electronic_fiscal_device.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals +import unittest + +class TestElectronicFiscalDevice(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/__init__.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.json b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.json new file mode 100644 index 0000000..29765b2 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.json @@ -0,0 +1,72 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-01-03 10:33:07.861488", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "employee", + "employee_name", + "column_break_3", + "department", + "designation", + "send_email" + ], + "fields": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Employee", + "options": "Employee" + }, + { + "fetch_from": "employee.employee_name", + "fieldname": "employee_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Employee Name", + "read_only": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fetch_from": "employee.department", + "fieldname": "department", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Department", + "options": "Department", + "read_only": 1 + }, + { + "fetch_from": "employee.designation", + "fieldname": "designation", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Designation", + "read_only": 1 + }, + { + "default": "0", + "fieldname": "send_email", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Send Email" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-01-03 14:49:29.028819", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Email Employee Salary Slip", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.py new file mode 100644 index 0000000..facf137 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class EmailEmployeeSalarySlip(Document): + pass diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/__init__.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.js b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.js new file mode 100644 index 0000000..ffc821d --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.js @@ -0,0 +1,22 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Email Salary Slips', { + // refresh: function(frm) { + + // } + + // onload: function(frm) { + // frm.get_field("employees").grid.cannot_add_rows = true; + // }, + + setup: function(frm) { + frm.set_query("payroll_entry", function() { + return { + filters: [ + ["Payroll Entry","docstatus", "=", "1"] + ] + } + }); + } +}); diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.json b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.json new file mode 100644 index 0000000..b862596 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.json @@ -0,0 +1,63 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-01-03 10:28:13.710129", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "payroll_entry_section", + "payroll_entry", + "employees_section", + "employees" + ], + "fields": [ + { + "fieldname": "payroll_entry_section", + "fieldtype": "Section Break", + "label": "Payroll Entry" + }, + { + "fieldname": "payroll_entry", + "fieldtype": "Link", + "label": "Payroll Entry", + "options": "Payroll Entry" + }, + { + "fieldname": "employees_section", + "fieldtype": "Section Break", + "label": "Employees" + }, + { + "fieldname": "employees", + "fieldtype": "Table", + "label": "Employee Details", + "options": "Email Employee Salary Slip" + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2022-01-03 10:34:53.384380", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Email Salary Slips", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.py new file mode 100644 index 0000000..a769d25 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class EmailSalarySlips(Document): + pass diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/test_email_salary_slips.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/test_email_salary_slips.py new file mode 100644 index 0000000..89be67d --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/test_email_salary_slips.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestEmailSalarySlips(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/__init__.py b/csf_tz/csf_tz/doctype/email_salary_slips/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.js b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.js new file mode 100644 index 0000000..a8b6421 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.js @@ -0,0 +1,70 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Email Salary Slips', { + // refresh: function(frm) { + + // } + + onload: function(frm) { + frm.get_field("employees").grid.cannot_add_rows = true; + }, + + setup: function(frm) { + frm.set_query("payroll_entry", function() { + return { + filters: [ + ["Payroll Entry","docstatus", "=", "1"] + ] + } + }); + }, + + "payroll_entry": function(frm) { + frm.doc.employees = [] + refresh_field("employees"); + let payroll_entry = frm.doc.payroll_entry; + if(payroll_entry){ + frappe.call({ + method: "csf_tz.custom_api.validate_payroll_entry_field", + args: {payroll_entry: payroll_entry} + }).done((r) => { + if(r.message == false){ + frm.fields_dict.payroll_entry.set_input(undefined); + frappe.msgprint({ + title: __('Invalid Payroll selection'), + indicator: 'red', + message: __('Please select the submitted Payroll Entry') + }); + } + }) + } + }, + + get_employees: function(frm) { + let payroll_entry = frm.doc.payroll_entry; + if(payroll_entry){ + frappe.call({ + method: "csf_tz.custom_api.get_payroll_employees", + args: {payroll_entry: payroll_entry} + }).done((r) => { + frm.doc.employees = [] + $.each(r.message, function(_i, e){ + let entry = frm.add_child("employees"); + entry.employee = e.employee; + }) + refresh_field("employees") + frm.dirty(); + frm.save(); + frm.refresh(); + }) + } + else{ + frappe.msgprint({ + title: __('Missing Fields'), + indicator: 'red', + message: __('Please select the Payroll Entry field') + }); + } + } +}); diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.json b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.json new file mode 100644 index 0000000..b994699 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.json @@ -0,0 +1,82 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-01-03 10:28:13.710129", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "payroll_entry_section", + "payroll_entry", + "get_employees", + "employees_section", + "employees", + "amended_from" + ], + "fields": [ + { + "fieldname": "payroll_entry_section", + "fieldtype": "Section Break", + "label": "Payroll Entry" + }, + { + "fieldname": "payroll_entry", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Payroll Entry", + "options": "Payroll Entry", + "reqd": 1 + }, + { + "fieldname": "employees_section", + "fieldtype": "Section Break", + "label": "Employees" + }, + { + "fieldname": "employees", + "fieldtype": "Table", + "label": "Employee Details", + "options": "Email Employee Salary Slip" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Email Salary Slips", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "eval: doc.docstatus !== 1", + "fieldname": "get_employees", + "fieldtype": "Button", + "label": "Get Employees" + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2022-01-03 18:05:49.812983", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Email Salary Slips", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.py b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.py new file mode 100644 index 0000000..ff1c895 --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.py @@ -0,0 +1,25 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + +class EmailSalarySlips(Document): + def on_submit(self): + self.send_salary_slip_email() + + def send_salary_slip_email(self): + # Employees selected to send mail + selected_employees = filter(lambda x: x.send_email == True, self.employees) + selected_employees = list(selected_employees) + employees = [] + for employee in selected_employees: + employees.append(employee.employee) + salary_slips = frappe.db.get_list('Salary Slip', filters=[ + ["employee", "in", employees], + ["payroll_entry", "=", self.payroll_entry] + ], pluck='name') + if frappe.db.get_single_value("Payroll Settings", "email_salary_slip_to_employee"): + for ss in salary_slips: + doc = frappe.get_doc('Salary Slip', ss) + doc.email_salary_slip() diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/test_email_salary_slips.py b/csf_tz/csf_tz/doctype/email_salary_slips/test_email_salary_slips.py new file mode 100644 index 0000000..89be67d --- /dev/null +++ b/csf_tz/csf_tz/doctype/email_salary_slips/test_email_salary_slips.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestEmailSalarySlips(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/__init__.py b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.json b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.json new file mode 100644 index 0000000..ca7633c --- /dev/null +++ b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.json @@ -0,0 +1,50 @@ +{ + "actions": [], + "creation": "2021-07-01 18:12:28.104243", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "employee", + "employee_name", + "amount", + "additional_salary" + ], + "fields": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "label": "Employee", + "options": "Employee" + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "label": "Amount" + }, + { + "fetch_from": "employee.employee_name", + "fieldname": "employee_name", + "fieldtype": "Data", + "label": "Employee Name" + }, + { + "fieldname": "additional_salary", + "fieldtype": "Link", + "label": "Additional Salary", + "options": "Additional Salary" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2021-07-01 18:13:45.444494", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Employee Piecework Additional Salary", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.py b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.py new file mode 100644 index 0000000..187b733 --- /dev/null +++ b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class EmployeePieceworkAdditionalSalary(Document): + pass diff --git a/csf_tz/csf_tz/doctype/employee_salary_component_limit/__init__.py b/csf_tz/csf_tz/doctype/employee_salary_component_limit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/employee_salary_component_limit/employee_salary_component_limit.json b/csf_tz/csf_tz/doctype/employee_salary_component_limit/employee_salary_component_limit.json new file mode 100644 index 0000000..4cbf5fc --- /dev/null +++ b/csf_tz/csf_tz/doctype/employee_salary_component_limit/employee_salary_component_limit.json @@ -0,0 +1,55 @@ +{ + "actions": [], + "creation": "2021-07-25 21:02:53.417249", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "salary_component", + "valid_from", + "limit_amount", + "limit_number" + ], + "fields": [ + { + "fieldname": "salary_component", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Salary Component", + "options": "Salary Component", + "reqd": 1 + }, + { + "fieldname": "valid_from", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Valid From", + "reqd": 1 + }, + { + "fieldname": "limit_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Limit Amount", + "reqd": 1 + }, + { + "fieldname": "limit_number", + "fieldtype": "Int", + "in_list_view": 1, + "label": "Limit Number" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2021-07-25 21:02:53.417249", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Employee Salary Component Limit", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/employee_salary_component_limit/employee_salary_component_limit.py b/csf_tz/csf_tz/doctype/employee_salary_component_limit/employee_salary_component_limit.py new file mode 100644 index 0000000..acc6afa --- /dev/null +++ b/csf_tz/csf_tz/doctype/employee_salary_component_limit/employee_salary_component_limit.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class EmployeeSalaryComponentLimit(Document): + pass diff --git a/csf_tz/csf_tz/doctype/expense_record/__init__.py b/csf_tz/csf_tz/doctype/expense_record/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/expense_record/expense_record.js b/csf_tz/csf_tz/doctype/expense_record/expense_record.js new file mode 100644 index 0000000..635ed84 --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_record/expense_record.js @@ -0,0 +1,18 @@ +// Copyright (c) 2019, Aakvatech Limited and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Expense Record', { + onload: function(frm,cdt,cdn) { + + }, + setup: function(frm) { + frm.set_query('expense_type', function() { + return { + filters: { + 'section': frm.doc.section + } + } + }); + } +}); + diff --git a/csf_tz/csf_tz/doctype/expense_record/expense_record.json b/csf_tz/csf_tz/doctype/expense_record/expense_record.json new file mode 100644 index 0000000..a9e948f --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_record/expense_record.json @@ -0,0 +1,202 @@ +{ + "autoname": "naming_series:", + "creation": "2020-06-17 02:37:43.275143", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "naming_series", + "main_info_section", + "date", + "column_break_3", + "section", + "purchase_invoice", + "section_break_5", + "supplier", + "expense_type", + "item", + "bill_no", + "column_break_8", + "amount", + "attach_receipt", + "section_break_11", + "journal_entry", + "column_break_15", + "section_break_15", + "section_manager", + "section_break_19", + "amended_from" + ], + "fields": [ + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "naming_series", + "options": "ER-.YYYY.-.#######" + }, + { + "collapsible": 1, + "fieldname": "main_info_section", + "fieldtype": "Section Break", + "label": "Main Info" + }, + { + "default": "Today", + "fetch_from": "shift.date", + "fieldname": "date", + "fieldtype": "Date", + "in_standard_filter": 1, + "label": "Date", + "reqd": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fetch_from": "shift.fuel_station", + "fieldname": "section", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Section", + "options": "Section", + "reqd": 1 + }, + { + "fieldname": "section_break_5", + "fieldtype": "Section Break" + }, + { + "fieldname": "supplier", + "fieldtype": "Link", + "label": "Supplier", + "options": "Supplier" + }, + { + "fieldname": "expense_type", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Expense Type", + "options": "Expense Type", + "reqd": 1 + }, + { + "fieldname": "bill_no", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "Bill No", + "reqd": 1 + }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break" + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Amount", + "reqd": 1 + }, + { + "fieldname": "attach_receipt", + "fieldtype": "Attach Image", + "in_preview": 1, + "label": "Attach Receipt" + }, + { + "fieldname": "section_break_11", + "fieldtype": "Section Break" + }, + { + "fieldname": "journal_entry", + "fieldtype": "Data", + "label": "Journal Entry", + "options": "Journal Entry", + "read_only": 1 + }, + { + "fieldname": "section_break_15", + "fieldtype": "Section Break" + }, + { + "fetch_from": "fuel_station.station_manager", + "fieldname": "section_manager", + "fieldtype": "Link", + "label": "Section Manager", + "options": "User", + "read_only": 1 + }, + { + "fieldname": "section_break_19", + "fieldtype": "Section Break" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Expense Record", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_15", + "fieldtype": "Column Break" + }, + { + "fetch_from": "expense_type.item", + "fieldname": "item", + "fieldtype": "Link", + "label": "Expense Item", + "options": "Item", + "read_only": 1, + "reqd": 1 + }, + { + "fieldname": "purchase_invoice", + "fieldtype": "Link", + "label": "Purchase Invoice", + "options": "Purchase Invoice", + "read_only": 1 + } + ], + "is_submittable": 1, + "modified": "2020-06-19 00:11:50.044255", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Expense Record", + "owner": "Administrator", + "permissions": [ + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "create": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Section Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/expense_record/expense_record.py b/csf_tz/csf_tz/doctype/expense_record/expense_record.py new file mode 100644 index 0000000..ccfbc38 --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_record/expense_record.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe ,erpnext +from frappe import _ +from frappe.model.document import Document +# from csf_tz.custom_api import get_linked_docs_info,cancle_linked_docs,cancel_doc,delete_doc,delete_linked_docs +from erpnext.controllers.accounts_controller import get_taxes_and_charges + +class ExpenseRecord(Document): + # def on_cancel(self): + # linked_doc_list = get_linked_docs_info(self.doctype,self.name) + # cancle_linked_docs(linked_doc_list) + # if self.journal_entry: + # cancel_doc("Journal Entry",self.journal_entry) + + + # def on_trash(self): + # linked_doc_list = get_linked_docs_info(self.doctype,self.name) + # delete_linked_docs(linked_doc_list) + # if self.journal_entry: + # delete_doc("Journal Entry",self.journal_entry) + + def validate(self): + pass + + + def on_submit(self): + if self.supplier: + self.create_purchase_invoice() + else: + self.create_journal_entry() + + + def create_purchase_invoice(self): + company = frappe.get_value("Expense Type",self.expense_type,"company") + items = [{ + "item_code": self.item, + "rate": self.amount, + "qty": 1, + "description": self.name +" - "+ self.expense_type + }] + pi = frappe.get_doc({ + "doctype": "Purchase Invoice", + "company": company, + "currency": erpnext.get_company_currency(company), + "cost_center": frappe.get_value("Section",self.section,"cost_center"), + "supplier": self.supplier, + "posting_date": self.date, + "set_posting_time": 1, + "bill_no": self.bill_no, + "bill_date": self.date, + "document_type": self.doctype, + "disable_rounded_total": 0, + "expense_record": self.name, + "items": items, + "is_paid": 1, + "cash_bank_account": frappe.get_value("Section",self.section,"default_cash_account"), + "taxes_and_charges": frappe.get_value("Section",self.section,"purchase_taxes_and_charges_template"), + }) + frappe.flags.ignore_account_permission = True + pi.set_missing_values() + getTax(pi) + pi.calculate_taxes_and_totals() + pi.insert(ignore_permissions=True) + pi.save() + self.purchase_invoice = pi.name + invoice_url = frappe.utils.get_url_to_form(pi.doctype, pi.name) + si_msgprint = "Purchase Invoice Created {1}".format(invoice_url,pi.name) + frappe.msgprint(_(si_msgprint)) + return pi.name + + + def create_journal_entry(self): + account_details = make_account_row( + debit_account = frappe.get_value("Expense Type",self.expense_type,"expense_account"), + credit_account = frappe.get_value("Section",self.section,"default_cash_account"), + amount = self.amount, + cost_center = frappe.get_value("Section",self.section,"cost_center") + ) + company = frappe.get_value("Section",self.section,"company") + user_remark = self.name + " " + self.doctype + " was created at " + self.section + " for " + self.expense_type + jv_doc = frappe.get_doc(dict( + doctype = "Journal Entry", + posting_date = self.date, + accounts = account_details, + bill_no = self.bill_no, + company = company, + expense_record = self.name, + user_remark = user_remark + )) + jv_doc.flags.ignore_permissions = True + frappe.flags.ignore_account_permission = True + jv_doc.save() + self.journal_entry = jv_doc.name + jv_url = frappe.utils.get_url_to_form(jv_doc.doctype, jv_doc.name) + si_msgprint = "Journal Entry Created {1}".format(jv_url,jv_doc.name) + frappe.msgprint(_(si_msgprint)) + return jv_doc.name + + + + +def getTax(purchase_invoice): + taxes = get_taxes_and_charges('Purchase Taxes and Charges Template',purchase_invoice.taxes_and_charges) + for tax in taxes: + purchase_invoice.append('taxes', tax) + + + +def make_account_row(debit_account,credit_account,amount,cost_center): + accounts = [] + debit_row = dict( + account = debit_account, + debit_in_account_currency = amount, + cost_center = cost_center + ) + accounts.append(debit_row) + credit_row = dict( + account = credit_account, + credit_in_account_currency = amount, + cost_center = cost_center + ) + accounts.append(credit_row) + return accounts \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/expense_record/test_expense_record.py b/csf_tz/csf_tz/doctype/expense_record/test_expense_record.py new file mode 100644 index 0000000..c8ef95c --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_record/test_expense_record.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestExpenseRecord(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/expense_type/__init__.py b/csf_tz/csf_tz/doctype/expense_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/expense_type/expense_type.js b/csf_tz/csf_tz/doctype/expense_type/expense_type.js new file mode 100644 index 0000000..cd86a80 --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_type/expense_type.js @@ -0,0 +1,17 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Expense Type', { + setup: function(frm) { + frm.set_query('expense_account', function() { + return { + filters: { + 'company': frm.doc.company, + "root_type": "Expense", + 'is_group': 0 + }, + order_by: "name" + } + }); + } +}); diff --git a/csf_tz/csf_tz/doctype/expense_type/expense_type.json b/csf_tz/csf_tz/doctype/expense_type/expense_type.json new file mode 100644 index 0000000..105a7dd --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_type/expense_type.json @@ -0,0 +1,96 @@ +{ + "allow_rename": 1, + "autoname": "format:{expense_type}-{section}", + "creation": "2020-06-17 02:35:34.988142", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "expense_type", + "section", + "column_break_3", + "company", + "expense_account", + "item" + ], + "fields": [ + { + "fieldname": "expense_type", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Expense Type", + "reqd": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fetch_from": "section.company", + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Company", + "options": "Company", + "read_only": 1 + }, + { + "fieldname": "expense_account", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Expense Account", + "options": "Account", + "reqd": 1 + }, + { + "fieldname": "section", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Section", + "options": "Section", + "reqd": 1 + }, + { + "fetch_from": "expense_account.item", + "fieldname": "item", + "fieldtype": "Link", + "label": "Expense Item", + "options": "Item", + "read_only": 1, + "reqd": 1 + } + ], + "modified": "2020-06-17 18:07:19.746952", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Expense Type", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Section Manager", + "share": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/expense_type/expense_type.py b/csf_tz/csf_tz/doctype/expense_type/expense_type.py new file mode 100644 index 0000000..fcdfb9f --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_type/expense_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class ExpenseType(Document): + pass diff --git a/csf_tz/csf_tz/doctype/expense_type/test_expense_type.py b/csf_tz/csf_tz/doctype/expense_type/test_expense_type.py new file mode 100644 index 0000000..ff5256d --- /dev/null +++ b/csf_tz/csf_tz/doctype/expense_type/test_expense_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestExpenseType(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/file_attachment/__init__.py b/csf_tz/csf_tz/doctype/file_attachment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.js b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.js new file mode 100644 index 0000000..6464d9e --- /dev/null +++ b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.js @@ -0,0 +1,8 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('File Attachment', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.json b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.json new file mode 100644 index 0000000..51c37d8 --- /dev/null +++ b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.json @@ -0,0 +1,39 @@ +{ + "creation": "2020-08-25 13:11:30.921286", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "file_attachment" + ], + "fields": [ + { + "fieldname": "file_attachment", + "fieldtype": "Data", + "label": "File Attachment" + } + ], + "modified": "2020-10-20 17:46:12.715024", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "File Attachment", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.py b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.py new file mode 100644 index 0000000..7b4dd3b --- /dev/null +++ b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class FileAttachment(Document): + pass diff --git a/csf_tz/csf_tz/doctype/file_attachment/test_file_attachment.py b/csf_tz/csf_tz/doctype/file_attachment/test_file_attachment.py new file mode 100644 index 0000000..c0d08a9 --- /dev/null +++ b/csf_tz/csf_tz/doctype/file_attachment/test_file_attachment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestFileAttachment(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/inv_err_detail/__init__.py b/csf_tz/csf_tz/doctype/inv_err_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.json b/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.json new file mode 100644 index 0000000..1d5c48a --- /dev/null +++ b/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.json @@ -0,0 +1,74 @@ +{ + "creation": "2019-02-18 23:25:41.743404", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "invoice_type", + "invoice_number", + "invoice_currency", + "column_break_4", + "invoice_amount", + "invoice_exchange_rate", + "invoice_gain_or_loss" + ], + "fields": [ + { + "fieldname": "invoice_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Invoice Type", + "options": "Sales Invoice\nPurchase Invoice" + }, + { + "description": "Should work like Party Type / Party Name", + "fieldname": "invoice_number", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Invoice Number", + "options": "invoice_type" + }, + { + "fieldname": "invoice_currency", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Invoice Currency", + "options": "Currency" + }, + { + "fieldname": "invoice_amount", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Invoice Amount", + "options": "invoice_currency" + }, + { + "fieldname": "invoice_exchange_rate", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Invoice Exchange Rate" + }, + { + "fieldname": "invoice_gain_or_loss", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Invoice Gain or Loss", + "options": "invoice_curency" + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + } + ], + "istable": 1, + "modified": "2020-10-11 22:47:10.437743", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Inv ERR Detail", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.py b/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.py new file mode 100644 index 0000000..d4cdf87 --- /dev/null +++ b/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class InvERRDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/item_barcode_update_tool/__init__.py b/csf_tz/csf_tz/doctype/item_barcode_update_tool/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.js b/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.js new file mode 100644 index 0000000..6d622ee --- /dev/null +++ b/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.js @@ -0,0 +1,44 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Item Barcode Update Tool', { + 'item_code': function (frm, cdt, cdn) { + var doc = locals[cdt][cdn]; + if (doc.item_code) { + frappe.call({ + method: "frappe.client.get", + args: { + name: doc.item_code, + doctype: "Item" + }, + callback(r) { + // console.log(r); + if (r.message) { + for (var row in r.message.barcodes) { + var child = frm.add_child("barcodes"); + frappe.model.set_value(child.doctype, child.name, "barcode", r.message.barcodes[row].barcode); + frappe.model.set_value(child.doctype, child.name, "barcode_type", r.message.barcodes[row].barcode_type); + frappe.model.set_value(child.doctype, child.name, "posa_uom", r.message.barcodes[row].posa_uom); + refresh_field("barcodes"); + } + } + } + }) + } + }, + refresh(frm) { + $(".btn-primary").hide() + }, + 'update_barcodes': function (frm) { + frappe.call({ + method: "csf_tz.csf_tz.doctype.item_barcode_update_tool.item_barcode_update_tool.update_barcodes", + args: { + doc: frm.doc + }, + callback: function (r) { + // frappe.msgprint(__("Barcodes updated successfully for Item " + frm.doc.item_name)) + return + } + }); + }, +}) \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.json b/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.json new file mode 100644 index 0000000..b62132d --- /dev/null +++ b/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.json @@ -0,0 +1,93 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-03-06 11:40:59.089686", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "item_code", + "item_name", + "column_break_4", + "item_group", + "item_brand", + "default_unit_of_measure", + "barcode_section", + "barcodes", + "update_barcodes" + ], + "fields": [ + { + "fetch_from": "item_code.item_name", + "fieldname": "item_name", + "fieldtype": "Data", + "label": "Item Name" + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, + { + "fetch_from": "item_code.item_group", + "fieldname": "item_group", + "fieldtype": "Data", + "label": "Item Group" + }, + { + "fetch_from": "item_code.brand", + "fieldname": "item_brand", + "fieldtype": "Data", + "label": "Item Brand" + }, + { + "fetch_from": "item_code.stock_uom", + "fieldname": "default_unit_of_measure", + "fieldtype": "Data", + "label": "Default Unit of Measure" + }, + { + "fieldname": "barcode_section", + "fieldtype": "Section Break", + "label": "Barcode" + }, + { + "fieldname": "barcodes", + "fieldtype": "Table", + "label": "Barcodes", + "options": "Item Barcode" + }, + { + "fieldname": "update_barcodes", + "fieldtype": "Button", + "label": "Update Barcodes" + }, + { + "fieldname": "item_code", + "fieldtype": "Link", + "label": "Item", + "options": "Item" + } + ], + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2022-03-06 12:31:28.344983", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Item Barcode Update Tool", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.py b/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.py new file mode 100644 index 0000000..3fd93ea --- /dev/null +++ b/csf_tz/csf_tz/doctype/item_barcode_update_tool/item_barcode_update_tool.py @@ -0,0 +1,42 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +from frappe import _ +import frappe +from frappe.model.document import Document + + +class ItemBarcodeUpdateTool(Document): + pass + + +@frappe.whitelist() +def update_barcodes(doc): + import json + + if isinstance(doc, str): + doc = frappe._dict(json.loads(doc)) + else: + return + if not doc.barcodes: + return + item = frappe.get_doc("Item", doc.item_code) + item.barcodes = [] + item.save(ignore_permissions=True) + item.reload() + for barcode in doc.barcodes: + item.append( + "barcodes", + { + "barcode": barcode["barcode"], + "barcode_type": barcode["barcode_type"], + "posa_uom": barcode["posa_uom"], + }, + ) + item.save(ignore_permissions=True) + frappe.db.commit() + frappe.msgprint( + _("Barcodes successfully updated for Item: " + item.item_name), alert=True + ) + + return item diff --git a/csf_tz/csf_tz/doctype/item_barcode_update_tool/test_item_barcode_update_tool.py b/csf_tz/csf_tz/doctype/item_barcode_update_tool/test_item_barcode_update_tool.py new file mode 100644 index 0000000..68e6478 --- /dev/null +++ b/csf_tz/csf_tz/doctype/item_barcode_update_tool/test_item_barcode_update_tool.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestItemBarcodeUpdateTool(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/maintenance_request/__init__.py b/csf_tz/csf_tz/doctype/maintenance_request/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.js b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.js new file mode 100644 index 0000000..17f3066 --- /dev/null +++ b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Maintenance Request', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.json b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.json new file mode 100644 index 0000000..41183a3 --- /dev/null +++ b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.json @@ -0,0 +1,41 @@ +{ + "actions": [], + "creation": "2021-06-23 11:50:54.836437", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "maintenance_request" + ], + "fields": [ + { + "fieldname": "maintenance_request", + "fieldtype": "Data", + "label": "Maintenance Request" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-06-23 11:50:54.836437", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Maintenance Request", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.py b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.py new file mode 100644 index 0000000..fc480a3 --- /dev/null +++ b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class MaintenanceRequest(Document): + pass diff --git a/csf_tz/csf_tz/doctype/maintenance_request/test_maintenance_request.py b/csf_tz/csf_tz/doctype/maintenance_request/test_maintenance_request.py new file mode 100644 index 0000000..3b1d31e --- /dev/null +++ b/csf_tz/csf_tz/doctype/maintenance_request/test_maintenance_request.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestMaintenanceRequest(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/nmb_callback/__init__.py b/csf_tz/csf_tz/doctype/nmb_callback/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.js b/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.js new file mode 100644 index 0000000..cd13c81 --- /dev/null +++ b/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.js @@ -0,0 +1,17 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('NMB Callback', { + refresh: function(frm) { + frm.add_custom_button(__('Make Payment Entry'), + function () { + frappe.call({ + method: "csf_tz.bank_api.make_payment_entry_from_call", + args: { + docname: frm.doc.name, + }, + }); + } + ); + } +}); diff --git a/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.json b/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.json new file mode 100644 index 0000000..266b194 --- /dev/null +++ b/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.json @@ -0,0 +1,165 @@ +{ + "actions": [], + "allow_copy": 1, + "autoname": "NMBC-.YY.-.######", + "creation": "2020-07-21 21:19:58.817941", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "timestamp", + "reference", + "column_break_3", + "receipt", + "amount", + "section_break_6", + "customer_name", + "column_break_8", + "account_number", + "section_break_10", + "token", + "column_break_12", + "fees_token", + "channel", + "section_break_13", + "payment_entry", + "section_break_16", + "api_key", + "api_secret" + ], + "fields": [ + { + "fieldname": "reference", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Reference", + "read_only": 1 + }, + { + "fieldname": "timestamp", + "fieldtype": "Datetime", + "label": "Timestamp", + "read_only": 1 + }, + { + "fieldname": "receipt", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Receipt", + "read_only": 1 + }, + { + "fieldname": "customer_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Customer Name", + "read_only": 1 + }, + { + "fieldname": "account_number", + "fieldtype": "Data", + "label": "Account Number", + "read_only": 1 + }, + { + "fieldname": "token", + "fieldtype": "Data", + "label": "Token", + "read_only": 1 + }, + { + "fieldname": "amount", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Amount", + "read_only": 1 + }, + { + "fieldname": "api_key", + "fieldtype": "Data", + "hidden": 1, + "label": "Api Key", + "read_only": 1 + }, + { + "fieldname": "api_secret", + "fieldtype": "Data", + "hidden": 1, + "label": "Api Secret", + "read_only": 1 + }, + { + "fieldname": "fees_token", + "fieldtype": "Data", + "label": "Fees Token", + "read_only": 1 + }, + { + "fieldname": "payment_entry", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Payment Entry", + "options": "Payment Entry", + "read_only": 1 + }, + { + "fieldname": "channel", + "fieldtype": "Data", + "label": "Channel", + "read_only": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_10", + "fieldtype": "Section Break" + }, + { + "fieldname": "section_break_13", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_12", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_16", + "fieldtype": "Section Break" + } + ], + "links": [], + "modified": "2020-07-29 18:09:06.415004", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "NMB Callback", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "reference", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.py b/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.py new file mode 100644 index 0000000..6b225b5 --- /dev/null +++ b/csf_tz/csf_tz/doctype/nmb_callback/nmb_callback.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class NMBCallback(Document): + pass diff --git a/csf_tz/csf_tz/doctype/nmb_callback/test_nmb_callback.py b/csf_tz/csf_tz/doctype/nmb_callback/test_nmb_callback.py new file mode 100644 index 0000000..8a6e55b --- /dev/null +++ b/csf_tz/csf_tz/doctype/nmb_callback/test_nmb_callback.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestNMBCallback(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/__init__.py b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.js b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.js new file mode 100644 index 0000000..347bcac --- /dev/null +++ b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.js @@ -0,0 +1,52 @@ +// Copyright (c) 2019, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Open Invoice Exchange Rate Revaluation', { + refresh: function(frm) { + + }, + currency:function(frm,cdt,cdn){ + var doc=locals[cdt][cdn] + if(frm.doc.currency && frm.doc.revaluation_date){ + frappe.call({ + method:"csf_tz.custom_api.getInvoiceExchangeRate", + args:{'currency':frm.doc.currency,'date':frm.doc.revaluation_date}, + callback:function(r){ + console.log(r.message) + cur_frm.set_value("exchange_rate_to_company_currency",r.message) + + } + + }) + } + + }, + get_invoices:function(frm,cdt,cdn){ + if(frm.doc.__islocal) { + frappe.throw("Save Document Before Get Invoice") + } + if(frm.doc.currency && frm.doc.name){ + frappe.call({ + method:"csf_tz.custom_api.getInvoice", + args:{'currency':frm.doc.currency,'name':frm.doc.name}, + freeze: true, + freeze_message: "Please Wait...", + callback:function(data){ + if(data.message){ + frm.clear_table("inv_err_detail"); + frm.refresh_fields("inv_err_detail"); + frm.reload_doc(); + } + + } + + + }) + } + else{ + + frappe.msgprint("Currency Mandatory And Document Saved Before Get Invoice") + } + + } +}); diff --git a/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.json b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.json new file mode 100644 index 0000000..9cbe363 --- /dev/null +++ b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.json @@ -0,0 +1,120 @@ +{ + "autoname": "OIERR.#####", + "creation": "2019-02-19 09:52:40.787084", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "company", + "revaluation_date", + "column_break_3", + "currency", + "exchange_rate_to_company_currency", + "get_invoices", + "section_break_7", + "inv_err_detail", + "amended_from", + "refrences_section", + "journal_entry", + "reverse_journal_entry" + ], + "fields": [ + { + "fieldname": "revaluation_date", + "fieldtype": "Date", + "label": "Revaluation Date" + }, + { + "default": "USD", + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "options": "Currency" + }, + { + "fieldname": "exchange_rate_to_company_currency", + "fieldtype": "Currency", + "label": "Exchange rate to company currency", + "precision": "5" + }, + { + "fieldname": "get_invoices", + "fieldtype": "Button", + "label": "Get Invoices" + }, + { + "fieldname": "inv_err_detail", + "fieldtype": "Table", + "label": "Inv ERR Detail", + "options": "Inv ERR Detail" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Open Invoice Exchange Rate Revaluation", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "refrences_section", + "fieldtype": "Section Break", + "label": "Refrences" + }, + { + "fieldname": "journal_entry", + "fieldtype": "Link", + "label": "Journal Entry", + "options": "Journal Entry", + "read_only": 1 + }, + { + "fieldname": "reverse_journal_entry", + "fieldtype": "Link", + "label": "Reverse Journal Entry", + "options": "Journal Entry", + "read_only": 1 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_7", + "fieldtype": "Section Break" + } + ], + "is_submittable": 1, + "modified": "2020-10-11 22:46:03.797861", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Open Invoice Exchange Rate Revaluation", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.py b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.py new file mode 100644 index 0000000..5c0f86d --- /dev/null +++ b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/open_invoice_exchange_rate_revaluation.py @@ -0,0 +1,120 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe.utils import flt + +class OpenInvoiceExchangeRateRevaluation(Document): + def on_submit(self): + last_doc_details=getLastCreatedDocument(self.name,self.currency) + if last_doc_details: + reverse_je = makeReverseJE(self.revaluation_date,last_doc_details[0].journal_entry) + frappe.db.set_value(self.doctype,last_doc_details[0].name,"reverse_journal_entry",reverse_je) + frappe.msgprint("Reverse Journal Entry Created: "+str(reverse_je)) + je_item = makeJEItem(self) + res = makeJournalEntry(self.revaluation_date,je_item) + frappe.db.set_value(self.doctype,self.name,"journal_entry",res) + url = frappe.utils.get_url_to_form("Journal Entry", res) + frappe.msgprint("Journal Entry for Exchange Rate Revaluation Created at {1}".format(url,res)) + + + +def getLastDocument(_self): + doc=frappe.get_all('Open Invoice Exchange Rate Revaluation', filters={}, fields=['name'], limit_page_length = 1) + return doc[0].name + + + +def makeJEItem(self): + item_dict = [] + for row in self.inv_err_detail: + first_row_je = getFirstRow(abs(row.invoice_gain_or_loss),row.invoice_type) + item_dict.append(first_row_je) + second_row_je=getSecondRow(abs(row.invoice_gain_or_loss),row.invoice_type,row.invoice_number) + item_dict.append(second_row_je) + return item_dict + + +def getFirstRow(invoice_gain_or_loss,invoice_type): + item_json={} + item_json["account"] = frappe.db.get_value("Company",frappe.defaults.get_global_default("company"),"unrealized_exchange_gain_loss_account") + if flt(invoice_gain_or_loss) > 0: + if invoice_type == "Sales Invoice": + item_json["credit_in_account_currency"] = invoice_gain_or_loss + else: + item_json["debit_in_account_currency"] = invoice_gain_or_loss + else: + if invoice_type == "Sales Invoice": + item_json["debit_in_account_currency"] = invoice_gain_or_loss + else: + item_json["credit_in_account_currency"] = invoice_gain_or_loss + return item_json + + +def getSecondRow(invoice_gain_or_loss,invoice_type,invoice_number): + item_json={} + item_json["reference_type"] = invoice_type + item_json["reference_name"] = invoice_number + item_json["user_remark"] = str(frappe.db.get_value(str(invoice_type),invoice_number,"currency"))+'@'+str(frappe.db.get_value(str(invoice_type),invoice_number,"conversion_rate")) + if invoice_type == "Sales Invoice": + item_json["account"] = frappe.db.get_value(invoice_type,invoice_number,"debit_to") + item_json["party_type"] = 'Customer' + item_json["party"] = frappe.db.get_value(invoice_type,invoice_number,"customer") + if flt(invoice_gain_or_loss) > 0: + item_json["debit_in_account_currency"] = invoice_gain_or_loss + else: + item_json["credit_in_account_currency"] = invoice_gain_or_loss + + else: + item_json["account"] = frappe.db.get_value(invoice_type,invoice_number,"credit_to") + item_json["party_type"] = 'Supplier' + item_json["party"] = frappe.db.get_value(invoice_type,invoice_number,"supplier") + if flt(invoice_gain_or_loss) > 0: + item_json["credit_in_account_currency"] = invoice_gain_or_loss + else: + item_json["debit_in_account_currency"] = invoice_gain_or_loss + return item_json + + +@frappe.whitelist() +def makeJournalEntry(date,je_item): + j_entry=frappe.get_doc(dict( + doctype="Journal Entry", + posting_date=date, + company=frappe.db.get_single_value('Global Defaults', 'default_company'), + accounts=je_item, + voucher_type='Exchange Rate Revaluation', + multi_currency=1 + )) + j_entry.save() + j_entry.submit() + return j_entry.name + +@frappe.whitelist() +def makeReverseJE(date,name): + je_doc = frappe.get_doc("Journal Entry",name) + je_dict = [] + for entry in je_doc.accounts: + je_json = {} + je_json["account"] = entry.account + je_json["credit_in_account_currency"] = entry.debit_in_account_currency + je_json["debit_in_account_currency"] = entry.credit_in_account_currency + je_json["party_type"] = entry.party_type if not entry.party_type is None else '' + je_json["party"] = entry.party if not entry.party is None else '' + je_json["reference_type"] = entry.reference_type if not entry.reference_type is None else '' + je_json["reference_name"] = entry.reference_name if not entry.reference_name is None else '' + je_dict.append(je_json) + return makeJournalEntry(date,je_dict) + + +@frappe.whitelist() +def getLastCreatedDocument(name,currency): + return frappe.get_all("Open Invoice Exchange Rate Revaluation",filters = [["Open Invoice Exchange Rate Revaluation","name","!=",name],["Open Invoice Exchange Rate Revaluation","docstatus","=","1"],["Open Invoice Exchange Rate Revaluation","currency","=",str(currency)]],fields = ["name","journal_entry"],order_by = "revaluation_date desc",limit_start = 0,limit_page_length = 1) + + + + + diff --git a/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/test_open_invoice_exchange_rate_revaluation.js b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/test_open_invoice_exchange_rate_revaluation.js new file mode 100644 index 0000000..892a100 --- /dev/null +++ b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/test_open_invoice_exchange_rate_revaluation.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Open Invoice Exchange Rate Revaluation", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Open Invoice Exchange Rate Revaluation + () => frappe.tests.make('Open Invoice Exchange Rate Revaluation', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/test_open_invoice_exchange_rate_revaluation.py b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/test_open_invoice_exchange_rate_revaluation.py new file mode 100644 index 0000000..6c573d1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/open_invoice_exchange_rate_revaluation/test_open_invoice_exchange_rate_revaluation.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals +import unittest + +class TestOpenInvoiceExchangeRateRevaluation(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/parking_bill/__init__.py b/csf_tz/csf_tz/doctype/parking_bill/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.js b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.js new file mode 100644 index 0000000..553fb37 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Parking Bill', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.json b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.json new file mode 100644 index 0000000..6b827f5 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.json @@ -0,0 +1,278 @@ +{ + "actions": [], + "autoname": "field:billreference", + "creation": "2021-09-18 23:15:04.291031", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "vehicle", + "billstatus", + "billid", + "approvedby", + "billdescription", + "billpayed", + "billreference", + "billedamount", + "billcontrolnumber", + "billequivalentamount", + "expirydate", + "generateddate", + "miscellaneousamount", + "column_break_16", + "payeremail", + "remarks", + "payerphone", + "payername", + "reminderflag", + "spsystemid", + "billpaytype", + "receivedtime", + "billcurrency", + "applicationid", + "collectioncode", + "type", + "createdby", + "itemid", + "parkingdetailsid", + "section_break_29", + "bilitems", + "parkingdetails" + ], + "fields": [ + { + "fieldname": "billstatus", + "fieldtype": "Data", + "label": "billStatus", + "read_only": 1 + }, + { + "fieldname": "billid", + "fieldtype": "Data", + "label": "billId", + "read_only": 1 + }, + { + "fieldname": "approvedby", + "fieldtype": "Data", + "label": "approvedBy", + "read_only": 1 + }, + { + "fieldname": "billdescription", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "billDescription", + "read_only": 1 + }, + { + "default": "0", + "fieldname": "billpayed", + "fieldtype": "Check", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "billPayed", + "read_only": 1 + }, + { + "fieldname": "billreference", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "billReference", + "read_only": 1, + "unique": 1 + }, + { + "fieldname": "billedamount", + "fieldtype": "Float", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "billedAmount", + "read_only": 1 + }, + { + "fieldname": "billcontrolnumber", + "fieldtype": "Data", + "label": "billControlNumber", + "read_only": 1 + }, + { + "fieldname": "billequivalentamount", + "fieldtype": "Float", + "label": "billEquivalentAmount", + "read_only": 1 + }, + { + "fieldname": "expirydate", + "fieldtype": "Date", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "expiryDate", + "read_only": 1 + }, + { + "fieldname": "generateddate", + "fieldtype": "Date", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "generatedDate", + "read_only": 1 + }, + { + "fieldname": "miscellaneousamount", + "fieldtype": "Float", + "label": "miscellaneousAmount", + "read_only": 1 + }, + { + "fieldname": "payeremail", + "fieldtype": "Data", + "label": "payerEmail", + "read_only": 1 + }, + { + "fieldname": "remarks", + "fieldtype": "Data", + "in_list_view": 1, + "label": "remarks", + "read_only": 1 + }, + { + "fieldname": "payerphone", + "fieldtype": "Data", + "label": "payerPhone", + "read_only": 1 + }, + { + "fieldname": "payername", + "fieldtype": "Data", + "label": "payerName", + "read_only": 1 + }, + { + "fieldname": "reminderflag", + "fieldtype": "Data", + "label": "reminderFlag", + "read_only": 1 + }, + { + "fieldname": "spsystemid", + "fieldtype": "Data", + "label": "spSystemId", + "read_only": 1 + }, + { + "fieldname": "billpaytype", + "fieldtype": "Data", + "label": "billPayType", + "read_only": 1 + }, + { + "fieldname": "receivedtime", + "fieldtype": "Data", + "label": "receivedTime", + "read_only": 1 + }, + { + "fieldname": "applicationid", + "fieldtype": "Data", + "label": "applicationId", + "read_only": 1 + }, + { + "fieldname": "collectioncode", + "fieldtype": "Data", + "label": "collectionCode", + "read_only": 1 + }, + { + "fieldname": "type", + "fieldtype": "Data", + "label": "type", + "read_only": 1 + }, + { + "fieldname": "createdby", + "fieldtype": "Data", + "label": "createdBy", + "read_only": 1 + }, + { + "fieldname": "itemid", + "fieldtype": "Data", + "label": "itemId", + "read_only": 1 + }, + { + "fieldname": "parkingdetailsid", + "fieldtype": "Data", + "label": "parkingDetailsId", + "read_only": 1 + }, + { + "fieldname": "bilitems", + "fieldtype": "Table", + "label": "BilItems", + "options": "Parking Bill Items", + "read_only": 1 + }, + { + "fieldname": "column_break_16", + "fieldtype": "Column Break", + "read_only": 1 + }, + { + "fieldname": "section_break_29", + "fieldtype": "Section Break", + "read_only": 1 + }, + { + "fieldname": "vehicle", + "fieldtype": "Link", + "label": "Vehicle", + "options": "Vehicle", + "read_only": 1 + }, + { + "fieldname": "parkingdetails", + "fieldtype": "Table", + "label": "parkingDetails", + "options": "Parking Bill Details", + "read_only": 1 + }, + { + "fieldname": "billcurrency", + "fieldtype": "Data", + "label": "currency", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-09-20 01:04:22.385365", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Parking Bill", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "vehicle", + "track_changes": 1, + "track_seen": 1, + "track_views": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.py b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.py new file mode 100644 index 0000000..68d0d63 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.py @@ -0,0 +1,127 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +import json +import re +import frappe +from frappe import _ +from frappe.utils import getdate +import requests +from requests.exceptions import Timeout +from frappe.model.document import Document + + +class ParkingBill(Document): + pass + + +def check_bills_all_vehicles(): + plate_list = frappe.get_all("Vehicle") + for vehicle in plate_list: + try: + bill = get_bills(vehicle["name"]) + if ( + bill and bill.code == 6000 + ): + update_bill(vehicle["name"], bill) + except Exception as e: + frappe.log_error(frappe.get_traceback(), str(e)) + frappe.db.commit() + + +def get_bills(number_plate): + headers = { + 'x-transfer-key': 'e9f3e572-db87-4eff-9ed6-66922f1f7f24', + } + + url = ( + "https://termis.tarura.go.tz:6003/termis-parking-service/api/v1/parkingDetails/debts/plateNumber/" + + number_plate + ) + try: + response = requests.get(url=url, headers=headers, timeout=5) + if response.status_code == 200: + return frappe._dict(json.loads(response.text)) + else: + res = None + try: + res = json.loads(response.text) + except: + res = response.text + frappe.log_error(res) + return + + except Timeout: + frappe.log_error(_("Timeout error for plate {0}").format(number_plate)) + except Exception as e: + frappe.log_error(e) + + +def update_bill(number_plate, bills): + if not bills.get("data"): + return + for row in bills.data: + row = frappe._dict(row) + data = frappe._dict(row.bill) + + if frappe.db.exists("Parking Bill", data.billReference): + doc = frappe.get_doc("Parking Bill", data.billReference) + else: + doc = frappe.new_doc("Parking Bill") + doc.billreference = data.billReference + doc.vehicle = number_plate + doc.billstatus = row.billStatus + doc.billid = data.billId + doc.approvedby = data.approvedBy + doc.billdescription = data.billDescription + doc.billpayed = 1 if data.billPayed else 0 + doc.billedamount = data.billedAmount + doc.billcontrolnumber = data.billControlNumber + doc.billequivalentamount = data.billEquivalentAmount + doc.expirydate = getdate(data.expiryDate) + doc.generateddate = getdate(data.generatedDate) + doc.miscellaneousamount = data.miscellaneousAmount + doc.payeremail = data.payerEmail + doc.remarks = data.remarks + doc.payerphone = data.payerPhone + doc.payername = data.payerName + doc.reminderflag = data.reminderFlag + doc.spsystemid = data.spSystemId + doc.billpaytype = data.billPayType + doc.receivedtime = data.receivedTime + doc.billcurrency = data.currency + doc.applicationid = data.applicationId + doc.collectioncode = data.collectionCode + doc.type = data.type + doc.createdby = data.createdBy + doc.itemid = data.itemId + doc.parkingdetailsid = data.parkingDetailsId + + doc.bilitems = [] + for item in data.billItems: + item = frappe._dict(item) + bill_item = doc.append("bilitems",{}) + bill_item.billitemrefid = item.billItemRefId + bill_item.billitemref = item.billItemRef + bill_item.billitemamount = item.billItemAmount + bill_item.billitemmiscamount = item.billItemMiscAmount + bill_item.billitemeqvamount = item.billItemEqvAmount + bill_item.billitemdescription = item.billItemDescription + bill_item.date = item.date + bill_item.sourcename = item.isourceName + bill_item.gsfcode = item.gsfCode + bill_item.parkingdetailsid = item.parkingDetailsId + + doc.parkingdetails = [] + for det in row.parkingDetails: + det = frappe._dict(det) + detail = doc.append("parkingdetails",{}) + detail.id = det.id + detail.collectorid = det.icollectorIdd + detail.councilcode = det.councilCode + detail.intime = det.inTime + detail.outtime = det.outTime + detail.detailinsertionstatus = det.detailInsertionStatus.get("description") + detail.coordinates = det.coordinates + + doc.save(ignore_permissions=True) diff --git a/csf_tz/csf_tz/doctype/parking_bill/test_parking_bill.py b/csf_tz/csf_tz/doctype/parking_bill/test_parking_bill.py new file mode 100644 index 0000000..9e125d1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill/test_parking_bill.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestParkingBill(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/parking_bill_details/__init__.py b/csf_tz/csf_tz/doctype/parking_bill_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.json b/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.json new file mode 100644 index 0000000..b75677c --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.json @@ -0,0 +1,76 @@ +{ + "actions": [], + "creation": "2021-09-18 23:39:04.042497", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "id", + "collectorid", + "councilcode", + "intime", + "outtime", + "detailinsertionstatus", + "coordinates" + ], + "fields": [ + { + "fieldname": "id", + "fieldtype": "Data", + "label": "id", + "read_only": 1 + }, + { + "fieldname": "collectorid", + "fieldtype": "Data", + "label": "collectorId", + "read_only": 1 + }, + { + "fieldname": "councilcode", + "fieldtype": "Data", + "label": "councilCode", + "read_only": 1 + }, + { + "fieldname": "intime", + "fieldtype": "Datetime", + "in_list_view": 1, + "label": "inTime", + "read_only": 1 + }, + { + "fieldname": "outtime", + "fieldtype": "Datetime", + "in_list_view": 1, + "label": "outTime", + "read_only": 1 + }, + { + "fieldname": "detailinsertionstatus", + "fieldtype": "Data", + "in_list_view": 1, + "label": "detailInsertionStatus", + "read_only": 1 + }, + { + "fieldname": "coordinates", + "fieldtype": "Data", + "in_list_view": 1, + "label": "coordinates", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2021-09-18 23:45:04.557419", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Parking Bill Details", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.py b/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.py new file mode 100644 index 0000000..07f4d23 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ParkingBillDetails(Document): + pass diff --git a/csf_tz/csf_tz/doctype/parking_bill_items/__init__.py b/csf_tz/csf_tz/doctype/parking_bill_items/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.json b/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.json new file mode 100644 index 0000000..29cc082 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.json @@ -0,0 +1,100 @@ +{ + "actions": [], + "creation": "2021-09-18 23:17:43.420193", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "billitemrefid", + "billitemref", + "billitemamount", + "billitemmiscamount", + "billitemeqvamount", + "billitemdescription", + "date", + "sourcename", + "gsfcode", + "parkingdetailsid" + ], + "fields": [ + { + "fieldname": "billitemrefid", + "fieldtype": "Data", + "in_list_view": 1, + "label": "billItemRefId", + "read_only": 1 + }, + { + "fieldname": "billitemref", + "fieldtype": "Data", + "in_list_view": 1, + "label": "billItemRef", + "read_only": 1 + }, + { + "fieldname": "billitemamount", + "fieldtype": "Float", + "in_list_view": 1, + "label": "billItemAmount", + "read_only": 1 + }, + { + "fieldname": "billitemmiscamount", + "fieldtype": "Float", + "label": "billItemMiscAmount", + "read_only": 1 + }, + { + "fieldname": "billitemeqvamount", + "fieldtype": "Float", + "label": "billItemEqvAmount", + "read_only": 1 + }, + { + "fieldname": "billitemdescription", + "fieldtype": "Data", + "in_list_view": 1, + "label": "billItemDescription", + "read_only": 1 + }, + { + "fieldname": "date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "date", + "read_only": 1 + }, + { + "fieldname": "sourcename", + "fieldtype": "Data", + "in_list_view": 1, + "label": "sourceName", + "read_only": 1 + }, + { + "fieldname": "gsfcode", + "fieldtype": "Data", + "in_list_view": 1, + "label": "gsfCode", + "read_only": 1 + }, + { + "fieldname": "parkingdetailsid", + "fieldtype": "Data", + "label": "parkingDetailsId", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2021-09-18 23:19:27.317425", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Parking Bill Items", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.py b/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.py new file mode 100644 index 0000000..5f58448 --- /dev/null +++ b/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ParkingBillItems(Document): + pass diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro/__init__.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.js b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.js new file mode 100644 index 0000000..a5e9781 --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.js @@ -0,0 +1,264 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.provide("erpnext.accounts"); + +frappe.ui.form.on("Payment Reconciliation Pro Payment", { + invoice_number: function(frm, cdt, cdn) { + var row = locals[cdt][cdn]; + if(row.invoice_number) { + var parts = row.invoice_number.split(' | '); + var invoice_type = parts[0]; + var invoice_number = parts[1]; + + var invoice_amount = frm.doc.invoices.filter(function(d) { + return d.invoice_type === invoice_type && d.invoice_number === invoice_number; + })[0].outstanding_amount; + + frappe.model.set_value(cdt, cdn, "allocated_amount", Math.min(invoice_amount, row.amount)); + + frm.call({ + doc: frm.doc, + method: 'get_difference_amount', + args: { + child_row: row + }, + callback: function(r, rt) { + if(r.message) { + frappe.model.set_value(cdt, cdn, + "difference_amount", r.message); + } + } + }); + } + } +}); + +erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({ + onload: function() { + var me = this; + + this.frm.set_query("party", function() { + check_mandatory(me.frm); + }); + + this.frm.set_query("party_type", function() { + return { + "filters": { + "name": ["in", Object.keys(frappe.boot.party_account_types)], + } + } + }); + + this.frm.set_query('receivable_payable_account', function() { + check_mandatory(me.frm); + return { + filters: { + "company": me.frm.doc.company, + "is_group": 0, + "account_type": frappe.boot.party_account_types[me.frm.doc.party_type] + } + }; + }); + + this.frm.set_query('bank_cash_account', function() { + check_mandatory(me.frm, true); + return { + filters:[ + ['Account', 'company', '=', me.frm.doc.company], + ['Account', 'is_group', '=', 0], + ['Account', 'account_type', 'in', ['Bank', 'Cash']] + ] + }; + }); + + this.frm.set_value('party_type', ''); + this.frm.set_value('party', ''); + this.frm.set_value('receivable_payable_account', ''); + + var check_mandatory = (frm, only_company=false) => { + var title = __("Mandatory"); + if (only_company && !frm.doc.company) { + frappe.throw({message: __("Please Select a Company First"), title: title}); + } else if (!frm.doc.company || !frm.doc.party_type) { + frappe.throw({message: __("Please Select Both Company and Party Type First"), title: title}); + } + }; + }, + + refresh: function() { + this.frm.disable_save(); + this.toggle_primary_action(); + }, + + onload_post_render: function() { + this.toggle_primary_action(); + }, + + party: function() { + var me = this + if (!me.frm.doc.receivable_payable_account && me.frm.doc.party_type && me.frm.doc.party) { + return frappe.call({ + method: "erpnext.accounts.party.get_party_account", + args: { + company: me.frm.doc.company, + party_type: me.frm.doc.party_type, + party: me.frm.doc.party + }, + callback: function(r) { + if (!r.exc && r.message) { + me.frm.set_value("receivable_payable_account", r.message); + } + } + }); + } + }, + + get_unreconciled_entries: function() { + var me = this; + return this.frm.call({ + doc: me.frm.doc, + method: 'get_unreconciled_entries', + callback: function(r, rt) { + me.set_invoice_options(); + me.toggle_primary_action(); + } + }); + + }, + + reconcile: function() { + var me = this; + var show_dialog = me.frm.doc.payments.filter(d => d.difference_amount && !d.difference_account); + + if (show_dialog && show_dialog.length) { + + this.data = []; + const dialog = new frappe.ui.Dialog({ + title: __("Select Difference Account"), + fields: [ + { + fieldname: "payments", fieldtype: "Table", label: __("Payments"), + data: this.data, in_place_edit: true, + get_data: () => { + return this.data; + }, + fields: [{ + fieldtype:'Data', + fieldname:"docname", + in_list_view: 1, + hidden: 1 + }, { + fieldtype:'Data', + fieldname:"reference_name", + label: __("Voucher No"), + in_list_view: 1, + read_only: 1 + }, { + fieldtype:'Link', + options: 'Account', + in_list_view: 1, + label: __("Difference Account"), + fieldname: 'difference_account', + reqd: 1, + get_query: function() { + return { + filters: { + company: me.frm.doc.company, + is_group: 0 + } + } + } + }, { + fieldtype:'Currency', + in_list_view: 1, + label: __("Difference Amount"), + fieldname: 'difference_amount', + read_only: 1 + }] + }, + ], + primary_action: function() { + const args = dialog.get_values()["payments"]; + + args.forEach(d => { + frappe.model.set_value("Payment Reconciliation Pro Payment", d.docname, + "difference_account", d.difference_account); + }); + + me.reconcile_payment_entries(); + dialog.hide(); + }, + primary_action_label: __('Reconcile Entries') + }); + + this.frm.doc.payments.forEach(d => { + if (d.difference_amount && !d.difference_account) { + dialog.fields_dict.payments.df.data.push({ + 'docname': d.name, + 'reference_name': d.reference_name, + 'difference_amount': d.difference_amount, + 'difference_account': d.difference_account, + }); + } + }); + + this.data = dialog.fields_dict.payments.df.data; + dialog.fields_dict.payments.grid.refresh(); + dialog.show(); + } else { + this.reconcile_payment_entries(); + } + }, + + reconcile_payment_entries: function() { + var me = this; + + return this.frm.call({ + doc: me.frm.doc, + method: 'reconcile', + callback: function(r, rt) { + me.set_invoice_options(); + me.toggle_primary_action(); + } + }); + }, + + set_invoice_options: function() { + var me = this; + var invoices = []; + + $.each(me.frm.doc.invoices || [], function(i, row) { + if (row.invoice_number && !in_list(invoices, row.invoice_number)) + invoices.push(row.invoice_type + " | " + row.invoice_number); + }); + + if (invoices) { + frappe.meta.get_docfield("Payment Reconciliation Pro Payment", "invoice_number", + me.frm.doc.name).options = "\n" + invoices.join("\n"); + + $.each(me.frm.doc.payments || [], function(i, p) { + if(!in_list(invoices, cstr(p.invoice_number))) p.invoice_number = null; + }); + } + + refresh_field("payments"); + }, + + toggle_primary_action: function() { + if ((this.frm.doc.payments || []).length) { + this.frm.fields_dict.reconcile.$input + && this.frm.fields_dict.reconcile.$input.addClass("btn-primary"); + this.frm.fields_dict.get_unreconciled_entries.$input + && this.frm.fields_dict.get_unreconciled_entries.$input.removeClass("btn-primary"); + } else { + this.frm.fields_dict.reconcile.$input + && this.frm.fields_dict.reconcile.$input.removeClass("btn-primary"); + this.frm.fields_dict.get_unreconciled_entries.$input + && this.frm.fields_dict.get_unreconciled_entries.$input.addClass("btn-primary"); + } + } + +}); + +$.extend(cur_frm.cscript, new erpnext.accounts.PaymentReconciliationController({frm: cur_frm})); diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.json b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.json new file mode 100644 index 0000000..7764570 --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.json @@ -0,0 +1,167 @@ +{ + "actions": [], + "allow_copy": 1, + "creation": "2020-11-29 19:29:04.760248", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "company", + "party_type", + "party", + "receivable_payable_account", + "bank_cash_account", + "account_currency", + "col_break1", + "from_date", + "to_date", + "minimum_amount", + "maximum_amount", + "limit", + "get_unreconciled_entries", + "sec_break1", + "payments", + "reconcile", + "sec_break2", + "invoices" + ], + "fields": [ + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "party_type", + "fieldtype": "Link", + "label": "Party Type", + "options": "DocType", + "reqd": 1 + }, + { + "fieldname": "party", + "fieldtype": "Dynamic Link", + "label": "Party", + "options": "party_type", + "reqd": 1 + }, + { + "fieldname": "receivable_payable_account", + "fieldtype": "Link", + "label": "Receivable / Payable Account", + "options": "Account", + "reqd": 1 + }, + { + "fieldname": "bank_cash_account", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Bank / Cash Account", + "options": "Account" + }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break" + }, + { + "fieldname": "from_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "From Invoice Date" + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "To Invoice Date" + }, + { + "fieldname": "minimum_amount", + "fieldtype": "Currency", + "label": "Minimum Invoice Amount" + }, + { + "fieldname": "maximum_amount", + "fieldtype": "Currency", + "label": "Maximum Invoice Amount" + }, + { + "description": "System will fetch all the entries if limit value is zero.", + "fieldname": "limit", + "fieldtype": "Int", + "label": "Limit" + }, + { + "fieldname": "get_unreconciled_entries", + "fieldtype": "Button", + "label": "Get Unreconciled Entries" + }, + { + "fieldname": "sec_break1", + "fieldtype": "Section Break", + "label": "Unreconciled Payment Details" + }, + { + "fieldname": "payments", + "fieldtype": "Table", + "label": "Payments", + "options": "Payment Reconciliation Pro Payment" + }, + { + "fieldname": "reconcile", + "fieldtype": "Button", + "label": "Reconcile" + }, + { + "fieldname": "sec_break2", + "fieldtype": "Section Break", + "label": "Invoice/Journal Entry Details" + }, + { + "fieldname": "invoices", + "fieldtype": "Table", + "label": "Invoices", + "options": "Payment Reconciliation Pro Invoice", + "read_only": 1 + }, + { + "fetch_from": "receivable_payable_account.account_currency", + "fieldname": "account_currency", + "fieldtype": "Data", + "label": "Account Currency", + "read_only": 1 + } + ], + "hide_toolbar": 1, + "icon": "icon-resize-horizontal", + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2021-07-01 07:42:19.523253", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Payment Reconciliation Pro", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "read": 1, + "role": "Accounts Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "read": 1, + "role": "Accounts User", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.py new file mode 100644 index 0000000..c57ddcc --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/payment_reconciliation_pro.py @@ -0,0 +1,357 @@ +# Copyright (c) 2015, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe, erpnext +from frappe.utils import flt, today +from frappe import msgprint, _ +from frappe.model.document import Document +from erpnext.accounts.utils import (get_outstanding_invoices, + update_reference_in_payment_entry, reconcile_against_document) + +class PaymentReconciliationPro(Document): + @frappe.whitelist() + def get_unreconciled_entries(self): + self.get_nonreconciled_payment_entries() + self.get_invoice_entries() + + def get_nonreconciled_payment_entries(self): + self.check_mandatory_to_fetch() + + payment_entries = self.get_payment_entries() + journal_entries = self.get_jv_entries() + + if self.party_type in ["Customer", "Supplier"]: + dr_or_cr_notes = self.get_dr_or_cr_notes() + else: + dr_or_cr_notes = [] + + self.add_payment_entries(payment_entries + journal_entries + dr_or_cr_notes) + + def get_payment_entries(self): + order_doctype = "Sales Order" if self.party_type=="Customer" else "Purchase Order" + payment_entries = get_advance_payment_entries(self.party_type, self.party, + self.receivable_payable_account, order_doctype, against_all_orders=True, limit=self.limit) + + return payment_entries + + def get_jv_entries(self): + dr_or_cr = ("credit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == 'Receivable' + else "debit_in_account_currency") + + bank_account_condition = "t2.against_account like %(bank_cash_account)s" \ + if self.bank_cash_account else "1=1" + + limit_cond = "limit %s" % self.limit if self.limit else "" + + journal_entries = frappe.db.sql(""" + select + "Journal Entry" as reference_type, t1.name as reference_name, + t1.posting_date, t1.remark as remarks, t2.name as reference_row, + {dr_or_cr} as amount, t2.is_advance, + t2.account_currency as currency + from + `tabJournal Entry` t1, `tabJournal Entry Account` t2 + where + t1.name = t2.parent and t1.docstatus = 1 and t2.docstatus = 1 + and t2.party_type = %(party_type)s and t2.party = %(party)s + and t2.account = %(account)s and {dr_or_cr} > 0 + and (t2.reference_type is null or t2.reference_type = '' or + (t2.reference_type in ('Sales Order', 'Purchase Order') + and t2.reference_name is not null and t2.reference_name != '')) + and (CASE + WHEN t1.voucher_type in ('Debit Note', 'Credit Note') + THEN 1=1 + ELSE {bank_account_condition} + END) + order by t1.posting_date {limit_cond} + """.format(**{ + "dr_or_cr": dr_or_cr, + "bank_account_condition": bank_account_condition, + "limit_cond": limit_cond + }), { + "party_type": self.party_type, + "party": self.party, + "account": self.receivable_payable_account, + "bank_cash_account": "%%%s%%" % self.bank_cash_account + }, as_dict=1) + + return list(journal_entries) + + def get_dr_or_cr_notes(self): + dr_or_cr = ("credit_in_account_currency" + if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit_in_account_currency") + + reconciled_dr_or_cr = ("debit_in_account_currency" + if dr_or_cr == "credit_in_account_currency" else "credit_in_account_currency") + + voucher_type = ('Sales Invoice' + if self.party_type == 'Customer' else "Purchase Invoice") + + return frappe.db.sql(""" SELECT doc.name as reference_name, %(voucher_type)s as reference_type, + (sum(gl.{dr_or_cr}) - sum(gl.{reconciled_dr_or_cr})) as amount, + account_currency as currency + FROM `tab{doc}` doc, `tabGL Entry` gl + WHERE + (doc.name = gl.against_voucher or doc.name = gl.voucher_no) + and doc.{party_type_field} = %(party)s + and doc.is_return = 1 and ifnull(doc.return_against, "") = "" + and gl.against_voucher_type = %(voucher_type)s + and doc.docstatus = 1 and gl.party = %(party)s + and gl.party_type = %(party_type)s and gl.account = %(account)s + and gl.is_cancelled = 0 + GROUP BY doc.name + Having + amount > 0 + """.format( + doc=voucher_type, + dr_or_cr=dr_or_cr, + reconciled_dr_or_cr=reconciled_dr_or_cr, + party_type_field=frappe.scrub(self.party_type)), + { + 'party': self.party, + 'party_type': self.party_type, + 'voucher_type': voucher_type, + 'account': self.receivable_payable_account + }, as_dict=1) + + def add_payment_entries(self, entries): + self.set('payments', []) + for e in entries: + row = self.append('payments', {}) + row.update(e) + + def get_invoice_entries(self): + #Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against + + condition = self.check_condition() + + non_reconciled_invoices = get_outstanding_invoices(self.party_type, self.party, + self.receivable_payable_account, condition=condition) + + if self.limit: + non_reconciled_invoices = non_reconciled_invoices[:self.limit] + + self.add_invoice_entries(non_reconciled_invoices) + + def add_invoice_entries(self, non_reconciled_invoices): + #Populate 'invoices' with JVs and Invoices to reconcile against + self.set('invoices', []) + + for e in non_reconciled_invoices: + ent = self.append('invoices', {}) + ent.invoice_type = e.get('voucher_type') + ent.invoice_number = e.get('voucher_no') + ent.invoice_date = e.get('posting_date') + ent.amount = flt(e.get('invoice_amount')) + ent.currency = e.get('currency') + ent.outstanding_amount = e.get('outstanding_amount') + + @frappe.whitelist() + def reconcile(self, args): + for e in self.get('payments'): + e.invoice_type = None + if e.invoice_number and " | " in e.invoice_number: + e.invoice_type, e.invoice_number = e.invoice_number.split(" | ") + + self.get_invoice_entries() + self.validate_invoice() + dr_or_cr = ("credit_in_account_currency" + if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit_in_account_currency") + + lst = [] + dr_or_cr_notes = [] + for e in self.get('payments'): + reconciled_entry = [] + if e.invoice_number and e.allocated_amount: + if e.reference_type in ['Sales Invoice', 'Purchase Invoice']: + reconciled_entry = dr_or_cr_notes + else: + reconciled_entry = lst + + reconciled_entry.append(self.get_payment_details(e, dr_or_cr)) + + if lst: + reconcile_against_document(lst) + + if dr_or_cr_notes: + reconcile_dr_cr_note(dr_or_cr_notes, self.company) + + msgprint(_("Successfully Reconciled")) + self.get_unreconciled_entries() + + def get_payment_details(self, row, dr_or_cr): + return frappe._dict({ + 'voucher_type': row.reference_type, + 'voucher_no' : row.reference_name, + 'voucher_detail_no' : row.reference_row, + 'against_voucher_type' : row.invoice_type, + 'against_voucher' : row.invoice_number, + 'account' : self.receivable_payable_account, + 'party_type': self.party_type, + 'party': self.party, + 'is_advance' : row.is_advance, + 'dr_or_cr' : dr_or_cr, + 'unadjusted_amount' : flt(row.amount), + 'allocated_amount' : flt(row.allocated_amount), + 'difference_amount': row.difference_amount, + 'difference_account': row.difference_account + }) + + @frappe.whitelist() + def get_difference_amount(self, child_row): + if child_row.get("reference_type") != 'Payment Entry': return + + child_row = frappe._dict(child_row) + + if child_row.invoice_number and " | " in child_row.invoice_number: + child_row.invoice_type, child_row.invoice_number = child_row.invoice_number.split(" | ") + + dr_or_cr = ("credit_in_account_currency" + if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit_in_account_currency") + + row = self.get_payment_details(child_row, dr_or_cr) + + doc = frappe.get_doc(row.voucher_type, row.voucher_no) + update_reference_in_payment_entry(row, doc, do_not_save=True) + + return doc.difference_amount + + def check_mandatory_to_fetch(self): + for fieldname in ["company", "party_type", "party", "receivable_payable_account"]: + if not self.get(fieldname): + frappe.throw(_("Please select {0} first").format(self.meta.get_label(fieldname))) + + def validate_invoice(self): + if not self.get("invoices"): + frappe.throw(_("No records found in the Invoice table")) + + if not self.get("payments"): + frappe.throw(_("No records found in the Payment table")) + + unreconciled_invoices = frappe._dict() + for d in self.get("invoices"): + unreconciled_invoices.setdefault(d.invoice_type, {}).setdefault(d.invoice_number, d.outstanding_amount) + + invoices_to_reconcile = [] + for p in self.get("payments"): + if p.invoice_type and p.invoice_number and p.allocated_amount: + invoices_to_reconcile.append(p.invoice_number) + + if p.invoice_number not in unreconciled_invoices.get(p.invoice_type, {}): + frappe.throw(_("{0}: {1} not found in Invoice Details table") + .format(p.invoice_type, p.invoice_number)) + + if flt(p.allocated_amount) > flt(p.amount): + frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equals to Payment Entry amount {2}") + .format(p.idx, p.allocated_amount, p.amount)) + + invoice_outstanding = unreconciled_invoices.get(p.invoice_type, {}).get(p.invoice_number) + if flt(p.allocated_amount) - invoice_outstanding > 0.009: + frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equals to invoice outstanding amount {2}") + .format(p.idx, p.allocated_amount, invoice_outstanding)) + + if not invoices_to_reconcile: + frappe.throw(_("Please select Allocated Amount, Invoice Type and Invoice Number in atleast one row")) + + def check_condition(self): + cond = " and posting_date >= {0}".format(frappe.db.escape(self.from_date)) if self.from_date else "" + cond += " and posting_date <= {0}".format(frappe.db.escape(self.to_date)) if self.to_date else "" + dr_or_cr = ("debit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == 'Receivable' + else "credit_in_account_currency") + + if self.minimum_amount: + cond += " and `{0}` >= {1}".format(dr_or_cr, flt(self.minimum_amount)) + if self.maximum_amount: + cond += " and `{0}` <= {1}".format(dr_or_cr, flt(self.maximum_amount)) + + return cond + +def reconcile_dr_cr_note(dr_cr_notes, company): + for d in dr_cr_notes: + voucher_type = ('Credit Note' + if d.voucher_type == 'Sales Invoice' else 'Debit Note') + + reconcile_dr_or_cr = ('debit_in_account_currency' + if d.dr_or_cr == 'credit_in_account_currency' else 'credit_in_account_currency') + + company_currency = erpnext.get_company_currency(company) + + jv = frappe.get_doc({ + "doctype": "Journal Entry", + "voucher_type": voucher_type, + "posting_date": today(), + "company": company, + "multi_currency": 1 if d.currency != company_currency else 0, + "accounts": [ + { + 'account': d.account, + 'party': d.party, + 'party_type': d.party_type, + d.dr_or_cr: abs(d.allocated_amount), + 'reference_type': d.against_voucher_type, + 'reference_name': d.against_voucher, + 'cost_center': erpnext.get_default_cost_center(company) + }, + { + 'account': d.account, + 'party': d.party, + 'party_type': d.party_type, + reconcile_dr_or_cr: (abs(d.allocated_amount) + if abs(d.unadjusted_amount) > abs(d.allocated_amount) else abs(d.unadjusted_amount)), + 'reference_type': d.voucher_type, + 'reference_name': d.voucher_no, + 'cost_center': erpnext.get_default_cost_center(company) + } + ] + }) + + jv.submit() + +def get_advance_payment_entries(party_type, party, party_account, order_doctype, + order_list=None, include_unallocated=True, against_all_orders=False, limit=None): + party_account_field = "paid_from" if party_type in ["Customer", "Student"] else "paid_to" + currency_field = "paid_from_account_currency" if party_type in ["Customer", "Student"] else "paid_to_account_currency" + payment_type = "Receive" if party_type in ["Customer", "Student"] else "Pay" + exchange_rate_field = "source_exchange_rate" if payment_type == "Receive" else "target_exchange_rate" + + payment_entries_against_order, unallocated_payment_entries = [], [] + limit_cond = "limit %s" % limit if limit else "" + + if order_list or against_all_orders: + if order_list: + reference_condition = " and t2.reference_name in ({0})" \ + .format(', '.join(['%s'] * len(order_list))) + else: + reference_condition = "" + order_list = [] + + payment_entries_against_order = frappe.db.sql(""" + select + "Payment Entry" as reference_type, t1.name as reference_name, + t1.remarks, t2.allocated_amount as amount, t2.name as reference_row, + t2.reference_name as against_order, t1.posting_date, + t1.{0} as currency, t1.{4} as exchange_rate + from `tabPayment Entry` t1, `tabPayment Entry Reference` t2 + where + t1.name = t2.parent and t1.{1} = %s and t1.payment_type = %s + and t1.party_type = %s and t1.party = %s and t1.docstatus = 1 + and t2.reference_doctype = %s {2} + order by t1.posting_date {3} + """.format(currency_field, party_account_field, reference_condition, limit_cond, exchange_rate_field), + [party_account, payment_type, party_type, party, + order_doctype] + order_list, as_dict=1) + + if include_unallocated: + unallocated_payment_entries = frappe.db.sql(""" + select "Payment Entry" as reference_type, name as reference_name, + remarks, unallocated_amount as amount, {2} as exchange_rate + from `tabPayment Entry` + where + {0} = %s and party_type = %s and party = %s and payment_type = %s + and docstatus = 1 and unallocated_amount > 0 + order by posting_date {1} + """.format(party_account_field, limit_cond, exchange_rate_field), + (party_account, party_type, party, payment_type), as_dict=1) + + return list(payment_entries_against_order) + list(unallocated_payment_entries) diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro/test_payment_reconciliation_pro.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/test_payment_reconciliation_pro.py new file mode 100644 index 0000000..b27b86d --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro/test_payment_reconciliation_pro.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestPaymentReconciliationPro(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/__init__.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/payment_reconciliation_pro_invoice.json b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/payment_reconciliation_pro_invoice.json new file mode 100644 index 0000000..5599cae --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/payment_reconciliation_pro_invoice.json @@ -0,0 +1,81 @@ +{ + "actions": [], + "creation": "2020-11-29 19:28:48.456126", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "invoice_type", + "invoice_number", + "invoice_date", + "col_break1", + "amount", + "outstanding_amount", + "currency" + ], + "fields": [ + { + "fieldname": "invoice_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Invoice Type", + "options": "Sales Invoice\nPurchase Invoice\nJournal Entry", + "read_only": 1 + }, + { + "fieldname": "invoice_number", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Invoice Number", + "options": "invoice_type", + "read_only": 1 + }, + { + "fieldname": "invoice_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Invoice Date", + "read_only": 1 + }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break" + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Outstanding Amount", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Currency", + "options": "Currency" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2020-11-29 19:28:48.456126", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Payment Reconciliation Pro Invoice", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/payment_reconciliation_pro_invoice.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/payment_reconciliation_pro_invoice.py new file mode 100644 index 0000000..57c489b --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_invoice/payment_reconciliation_pro_invoice.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class PaymentReconciliationProInvoice(Document): + pass diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/__init__.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/payment_reconciliation_pro_payment.json b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/payment_reconciliation_pro_payment.json new file mode 100644 index 0000000..1ffa8c8 --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/payment_reconciliation_pro_payment.json @@ -0,0 +1,142 @@ +{ + "actions": [], + "creation": "2020-11-29 19:28:24.126126", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "reference_type", + "reference_name", + "posting_date", + "is_advance", + "reference_row", + "col_break1", + "invoice_number", + "amount", + "allocated_amount", + "section_break_10", + "difference_account", + "difference_amount", + "sec_break1", + "remark", + "currency" + ], + "fields": [ + { + "fieldname": "reference_type", + "fieldtype": "Link", + "label": "Reference Type", + "options": "DocType", + "read_only": 1 + }, + { + "columns": 2, + "fieldname": "reference_name", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Reference Name", + "options": "reference_type", + "read_only": 1 + }, + { + "fieldname": "posting_date", + "fieldtype": "Date", + "label": "Posting Date", + "read_only": 1 + }, + { + "fieldname": "is_advance", + "fieldtype": "Data", + "hidden": 1, + "label": "Is Advance", + "read_only": 1 + }, + { + "fieldname": "reference_row", + "fieldtype": "Data", + "hidden": 1, + "label": "Reference Row", + "read_only": 1 + }, + { + "fieldname": "col_break1", + "fieldtype": "Column Break" + }, + { + "columns": 2, + "fieldname": "invoice_number", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Invoice Number", + "reqd": 1 + }, + { + "columns": 2, + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "options": "currency", + "read_only": 1 + }, + { + "columns": 2, + "fieldname": "allocated_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Allocated amount", + "options": "currency", + "reqd": 1 + }, + { + "fieldname": "section_break_10", + "fieldtype": "Section Break" + }, + { + "columns": 2, + "fieldname": "difference_account", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Difference Account", + "options": "Account" + }, + { + "fieldname": "difference_amount", + "fieldtype": "Currency", + "label": "Difference Amount", + "options": "currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "sec_break1", + "fieldtype": "Section Break" + }, + { + "fieldname": "remark", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Remark", + "read_only": 1 + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Currency", + "options": "Currency" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2020-11-29 19:29:19.319027", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Payment Reconciliation Pro Payment", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/payment_reconciliation_pro_payment.py b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/payment_reconciliation_pro_payment.py new file mode 100644 index 0000000..00ef37c --- /dev/null +++ b/csf_tz/csf_tz/doctype/payment_reconciliation_pro_payment/payment_reconciliation_pro_payment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class PaymentReconciliationProPayment(Document): + pass diff --git a/csf_tz/csf_tz/doctype/piecework/__init__.py b/csf_tz/csf_tz/doctype/piecework/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/piecework/piecework.js b/csf_tz/csf_tz/doctype/piecework/piecework.js new file mode 100644 index 0000000..7395474 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework/piecework.js @@ -0,0 +1,27 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on("Piecework", { + task: (frm) => setTotal(frm), + quantity: (frm) => setTotal(frm), + task_rate: (frm) => setTotal(frm), + + setup: (frm) => { + frm.set_query("task", () => { + return { + filters: { + disabled: 0, + }, + }; + }); + }, +}); + +const setTotal = (frm) => { + const total = frm.doc.task_rate * frm.doc.quantity || 0; + frm.set_value("total", total); + const count = frm.doc.employees.length; + frm.doc.employees.forEach((row) => { + frappe.model.set_value(row.doctype, row.name, "amount", total / count); + }); +}; diff --git a/csf_tz/csf_tz/doctype/piecework/piecework.json b/csf_tz/csf_tz/doctype/piecework/piecework.json new file mode 100644 index 0000000..ad1b55c --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework/piecework.json @@ -0,0 +1,157 @@ +{ + "autoname": "format:{date}-{task}-{######}", + "creation": "2021-01-17 00:13:39.930551", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "date", + "column_break_2", + "company", + "section_break_3", + "task", + "quantity", + "column_break_6", + "task_name", + "task_rate", + "total", + "section_break_9", + "employees", + "amended_from" + ], + "fields": [ + { + "fieldname": "date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Date", + "reqd": 1 + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_3", + "fieldtype": "Section Break" + }, + { + "fieldname": "task", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Task", + "options": "Piecework Type", + "reqd": 1 + }, + { + "fieldname": "quantity", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Quantity", + "reqd": 1 + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + }, + { + "fetch_from": "task.rate", + "fieldname": "task_rate", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Task Rate", + "precision": "2", + "read_only": 1 + }, + { + "fieldname": "total", + "fieldtype": "Currency", + "label": "Total", + "read_only": 1 + }, + { + "fieldname": "section_break_9", + "fieldtype": "Section Break" + }, + { + "fieldname": "employees", + "fieldtype": "Table", + "label": "Employees", + "options": "Piecework Payment Allocation", + "reqd": 1 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Piecework", + "print_hide": 1, + "read_only": 1 + }, + { + "fetch_from": "task.task_name", + "fieldname": "task_name", + "fieldtype": "Data", + "label": "Task Name", + "read_only": 1 + } + ], + "is_submittable": 1, + "modified": "2021-04-23 23:42:01.650310", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Piecework", + "owner": "Administrator", + "permissions": [ + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR User", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework/piecework.py b/csf_tz/csf_tz/doctype/piecework/piecework.py new file mode 100644 index 0000000..816509c --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework/piecework.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document + + +class Piecework(Document): + def before_submit(self): + create_additional_salaries(self) + + def validate(self): + self.total = self.quantity * frappe.db.get_value('Piecework Type', self.task, 'rate') + employees = [] + amount = self.total / len(self.employees) + for row in self.employees: + if row.employee not in employees: + employees.append(row.employee) + row.amount = amount + else: + frappe.throw( + "The employee '{0}' is this duplicate in the table in row {1}".format(row.employee, row.idx)) + + +def create_additional_salaries(doc): + for row in doc.employees: + if row.employee and row.amount: + as_doc = frappe.new_doc("Additional Salary") + as_doc.employee = row.employee + as_doc.salary_component = 'Piecework' + as_doc.amount = row.amount + as_doc.payroll_date = doc.date + as_doc.company = doc.company + as_doc.overwrite_salary_structure_amount = 0 + as_doc.insert(ignore_permissions=True) + row.additional_salary = as_doc.name + as_doc.submit() + frappe.msgprint(_("Additional Salary {0} created for employee {1}").format( + as_doc.name, row.employee), alert=True) diff --git a/csf_tz/csf_tz/doctype/piecework/test_piecework.py b/csf_tz/csf_tz/doctype/piecework/test_piecework.py new file mode 100644 index 0000000..76d80cd --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework/test_piecework.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestPiecework(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/__init__.py b/csf_tz/csf_tz/doctype/piecework_payment_allocation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.js b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.js new file mode 100644 index 0000000..f9c867e --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Piecework Payment Allocation', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.json b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.json new file mode 100644 index 0000000..3e90ccd --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.json @@ -0,0 +1,55 @@ +{ + "creation": "2021-01-17 00:05:31.021900", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "employee", + "employee_name", + "amount", + "additional_salary" + ], + "fields": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Employee", + "options": "Employee", + "reqd": 1 + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "precision": "2", + "read_only": 1 + }, + { + "fieldname": "additional_salary", + "fieldtype": "Link", + "label": "Additional Salary", + "options": "Additional Salary", + "read_only": 1 + }, + { + "fetch_from": "employee.employee_name", + "fieldname": "employee_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Employee Name" + } + ], + "istable": 1, + "modified": "2021-02-12 12:15:58.721685", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Piecework Payment Allocation", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.py b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.py new file mode 100644 index 0000000..0ac6caa --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class PieceworkPaymentAllocation(Document): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/test_piecework_payment_allocation.py b/csf_tz/csf_tz/doctype/piecework_payment_allocation/test_piecework_payment_allocation.py new file mode 100644 index 0000000..9d219fb --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_payment_allocation/test_piecework_payment_allocation.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestPieceworkPaymentAllocation(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/__init__.py b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.js b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.js new file mode 100644 index 0000000..9cd1b1a --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Piecework Salary Disbursement', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.json b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.json new file mode 100644 index 0000000..9b61011 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.json @@ -0,0 +1,85 @@ +{ + "actions": [], + "autoname": "format:start_date-end_date-######", + "creation": "2021-07-01 18:11:07.506913", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "start_date", + "end_date", + "payroll_date", + "column_break_3", + "earning_salary_component", + "deduction_salary_component", + "section_break_6", + "employee" + ], + "fields": [ + { + "fieldname": "start_date", + "fieldtype": "Date", + "label": "Start Date" + }, + { + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date" + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "payroll_date", + "fieldtype": "Date", + "label": "Payroll Date" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, + { + "fieldname": "employee", + "fieldtype": "Table", + "label": "Employee", + "options": "Employee Piecework Additional Salary" + }, + { + "fieldname": "earning_salary_component", + "fieldtype": "Link", + "label": "Earning Salary Component ", + "options": "Salary Component" + }, + { + "fieldname": "deduction_salary_component", + "fieldtype": "Link", + "label": "Deduction Salary Component", + "options": "Salary Component" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-07-03 12:37:00.405085", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Piecework Salary Disbursement", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.py b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.py new file mode 100644 index 0000000..aa5d091 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class PieceworkSalaryDisbursement(Document): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/test_piecework_salary_disbursement.py b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/test_piecework_salary_disbursement.py new file mode 100644 index 0000000..c9805c0 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/test_piecework_salary_disbursement.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestPieceworkSalaryDisbursement(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_single/__init__.py b/csf_tz/csf_tz/doctype/piecework_single/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.js b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.js new file mode 100644 index 0000000..e90676d --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.js @@ -0,0 +1,28 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Piecework Single', { + // refresh: function(frm) { + + // } +}); + +frappe.ui.form.on('Single Piecework Employees', { + task: (frm, cdt, cdn) => { + const row = locals[cdt][cdn]; + setTotal(frm, row); + }, + task_rate: (frm, cdt, cdn) => { + const row = locals[cdt][cdn]; + setTotal(frm, row); + }, + quantity: (frm, cdt, cdn) => { + const row = locals[cdt][cdn]; + setTotal(frm, row); + }, +}); + +const setTotal = (frm, row) => { + const total = row.task_rate * row.quantity || 0; + frappe.model.set_value(row.doctype, row.name, "amount", total); +}; \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.json b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.json new file mode 100644 index 0000000..e7f1728 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.json @@ -0,0 +1,107 @@ +{ + "autoname": "format:{date}-{task}-{######}", + "creation": "2021-04-23 23:12:51.189256", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "date", + "column_break_2", + "company", + "section_break_4", + "employees", + "amended_from" + ], + "fields": [ + { + "default": "Today", + "fieldname": "date", + "fieldtype": "Date", + "label": "Date", + "reqd": 1 + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "section_break_4", + "fieldtype": "Section Break" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Piecework Single", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "employees", + "fieldtype": "Table", + "label": "Employees", + "options": "Single Piecework Employees", + "reqd": 1 + } + ], + "is_submittable": 1, + "modified": "2021-04-27 00:07:03.606305", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Piecework Single", + "owner": "Administrator", + "permissions": [ + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR User", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.py b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.py new file mode 100644 index 0000000..538f8a6 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document + + +class PieceworkSingle(Document): + def before_submit(self): + create_additional_salaries(self) + + +def create_additional_salaries(doc): + for row in doc.employees: + if row.employee and row.amount: + as_doc = frappe.new_doc("Additional Salary") + as_doc.employee = row.employee + as_doc.salary_component = "Piecework" + as_doc.amount = row.amount + as_doc.payroll_date = doc.date + as_doc.company = doc.company + as_doc.overwrite_salary_structure_amount = 0 + as_doc.insert(ignore_permissions=True) + row.additional_salary = as_doc.name + as_doc.submit() + frappe.msgprint( + _("Additional Salary {0} created for employee {1}").format( + as_doc.name, row.employee + ), + alert=True, + ) diff --git a/csf_tz/csf_tz/doctype/piecework_single/test_piecework_single.py b/csf_tz/csf_tz/doctype/piecework_single/test_piecework_single.py new file mode 100644 index 0000000..d0f6a26 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_single/test_piecework_single.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestPieceworkSingle(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_type/__init__.py b/csf_tz/csf_tz/doctype/piecework_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.js b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.js new file mode 100644 index 0000000..b7ec93a --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Piecework Type', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.json b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.json new file mode 100644 index 0000000..7047988 --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.json @@ -0,0 +1,91 @@ +{ + "autoname": "format:{task_code}", + "creation": "2021-01-17 00:02:10.540373", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "task_code", + "task_name", + "column_break_3", + "rate", + "uom", + "disabled", + "section_break_6", + "description" + ], + "fields": [ + { + "fieldname": "task_code", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Task Code", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "task_name", + "fieldtype": "Data", + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Task Name", + "reqd": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "rate", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Rate", + "reqd": 1 + }, + { + "fieldname": "uom", + "fieldtype": "Link", + "label": "UOM", + "options": "UOM" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, + { + "fieldname": "description", + "fieldtype": "Text", + "label": "Description" + }, + { + "default": "0", + "fieldname": "disabled", + "fieldtype": "Check", + "label": "Disabled" + } + ], + "modified": "2021-02-12 12:58:32.138100", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Piecework Type", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.py b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.py new file mode 100644 index 0000000..ec0e71f --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class PieceworkType(Document): + pass diff --git a/csf_tz/csf_tz/doctype/piecework_type/test_piecework_type.py b/csf_tz/csf_tz/doctype/piecework_type/test_piecework_type.py new file mode 100644 index 0000000..aa7491b --- /dev/null +++ b/csf_tz/csf_tz/doctype/piecework_type/test_piecework_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestPieceworkType(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/__init__.py b/csf_tz/csf_tz/doctype/possible_root_cause/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.js b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.js new file mode 100644 index 0000000..750e427 --- /dev/null +++ b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Possible Root Cause', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.json b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.json new file mode 100644 index 0000000..9946c8a --- /dev/null +++ b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.json @@ -0,0 +1,165 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-28 12:55:52.861403", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "root_cause_of_the_issue", + "rate_probability", + "description", + "category_column_break", + "categorize_root_cause", + "please_specify", + "investigation_section_break", + "investigation", + "investigation_area", + "interview_conducted", + "interview_summary", + "interview_column_break", + "number_of_people_interviewed", + "name_of_interviewer", + "findings_and_evidences_section_break", + "findings_of_investigation", + "evidence_available", + "list_evidence_column_break", + "list_documented_evidence", + "attach_evidence" + ], + "fields": [ + { + "fieldname": "root_cause_of_the_issue", + "fieldtype": "Data", + "in_list_view": 1, + "label": "What is the root cause of the issue?", + "reqd": 1 + }, + { + "fieldname": "rate_probability", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Rate probability as the root cause", + "options": "\nLow\nMedium\nHigh" + }, + { + "fieldname": "category_column_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "categorize_root_cause", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Categorize the root cause", + "options": "\nProcess\nEquipment\nLack of Communication\nLack of Knowledge\nIncorrect Information\n3rd Party Software\nNetwork\nOther", + "reqd": 1 + }, + { + "depends_on": "eval: doc.categorize_root_cause == \"Other\"", + "fieldname": "please_specify", + "fieldtype": "Small Text", + "label": "Please specify", + "mandatory_depends_on": "eval: doc.categorize_root_cause == \"Other\"" + }, + { + "description": "Brief describle the root cause depending on the category of the rout cause", + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Description" + }, + { + "fieldname": "investigation", + "fieldtype": "Select", + "label": "Were any Investigation done?", + "options": "\nNo\nYes" + }, + { + "depends_on": "eval: doc.investigation == \"Yes\"\r\n", + "fieldname": "investigation_area", + "fieldtype": "Data", + "label": "In which area/department did the investigation begin?", + "mandatory_depends_on": "eval: doc.investigation == \"Yes\"\r\n" + }, + { + "depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n", + "fieldname": "number_of_people_interviewed", + "fieldtype": "Data", + "label": "How Many People Interviewed", + "mandatory_depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n" + }, + { + "depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n", + "fieldname": "name_of_interviewer", + "fieldtype": "Small Text", + "label": "Name(s) of Interviewers", + "mandatory_depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n" + }, + { + "depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n", + "fieldname": "interview_summary", + "fieldtype": "Small Text", + "label": "Give a brief summary of the interview.", + "mandatory_depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n" + }, + { + "fieldname": "findings_of_investigation", + "fieldtype": "Small Text", + "label": "List any findings pertinent to the investigation." + }, + { + "fieldname": "evidence_available", + "fieldtype": "Select", + "label": "Was any evidence available that helped determine the root cause?", + "options": "\nNo\nYes" + }, + { + "depends_on": "eval: doc.evidence_available == \"Yes\"\r\n", + "fieldname": "list_documented_evidence", + "fieldtype": "Small Text", + "label": "List the items documented as evidence of the root cause.", + "mandatory_depends_on": "eval: doc.evidence_available == \"Yes\"\r\n" + }, + { + "depends_on": "eval: doc.evidence_available == \"Yes\"\r\n", + "fieldname": "attach_evidence", + "fieldtype": "Attach", + "label": "Attach Evidence", + "mandatory_depends_on": "eval: doc.evidence_available == \"Yes\"\r\n" + }, + { + "fieldname": "investigation_section_break", + "fieldtype": "Section Break", + "label": "Investigation" + }, + { + "fieldname": "interview_conducted", + "fieldtype": "Select", + "label": "Were any interviews conducted?", + "options": "\nNo\nYes" + }, + { + "fieldname": "findings_and_evidences_section_break", + "fieldtype": "Section Break", + "label": "Findings and Evidences" + }, + { + "fieldname": "list_evidence_column_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "interview_column_break", + "fieldtype": "Column Break" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-06-01 18:05:58.567278", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Possible Root Cause", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.py b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.py new file mode 100644 index 0000000..d2aba91 --- /dev/null +++ b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class PossibleRootCause(Document): + pass diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/test_possible_root_cause.py b/csf_tz/csf_tz/doctype/possible_root_cause/test_possible_root_cause.py new file mode 100644 index 0000000..16ecef4 --- /dev/null +++ b/csf_tz/csf_tz/doctype/possible_root_cause/test_possible_root_cause.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestPossibleRootCause(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/repack_template/__init__.py b/csf_tz/csf_tz/doctype/repack_template/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/repack_template/repack_template.js b/csf_tz/csf_tz/doctype/repack_template/repack_template.js new file mode 100644 index 0000000..79aa5b3 --- /dev/null +++ b/csf_tz/csf_tz/doctype/repack_template/repack_template.js @@ -0,0 +1,34 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Repack Template', { + onload: function(frm) { + frm.set_query("item_code", function() { + return { + "filters": { + "is_stock_item": 1 + } + }; + + }); + frm.set_query("item_code","repack_template_details", function() { + return { + "filters": { + "is_stock_item": 1 + } + }; + + }); + }, + validate: function(frm) { + const item_list = []; + const items = frm.doc.repack_template_details; + items.forEach(element => { + if (!item_list.includes(element.item_code)) { + item_list.push(element.item_code); + } else { + frappe.throw(__("The items cannot be duplicated! Please remove the duplicate item")); + } + }); + }, +}); diff --git a/csf_tz/csf_tz/doctype/repack_template/repack_template.json b/csf_tz/csf_tz/doctype/repack_template/repack_template.json new file mode 100644 index 0000000..d39e3e0 --- /dev/null +++ b/csf_tz/csf_tz/doctype/repack_template/repack_template.json @@ -0,0 +1,110 @@ +{ + "allow_rename": 1, + "autoname": "format:{item_code}-{#####} ", + "creation": "2020-05-29 11:18:36.828527", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "item_code", + "item_name", + "column_break_3", + "item_uom", + "qty", + "section_break_5", + "default_warehouse", + "section_break_8", + "repack_template_details", + "amended_from" + ], + "fields": [ + { + "fieldname": "item_code", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Item Code", + "options": "Item", + "reqd": 1 + }, + { + "fetch_from": "item_code.item_name", + "fieldname": "item_name", + "fieldtype": "Data", + "label": "Item Name", + "read_only": 1 + }, + { + "fetch_from": "item_code.stock_uom", + "fieldname": "item_uom", + "fieldtype": "Data", + "label": "Item UOM", + "read_only": 1 + }, + { + "fieldname": "qty", + "fieldtype": "Float", + "label": "Qty", + "reqd": 1 + }, + { + "fieldname": "section_break_5", + "fieldtype": "Section Break" + }, + { + "fieldname": "repack_template_details", + "fieldtype": "Table", + "label": "Repack Template Details", + "options": "Repack Template Detail", + "reqd": 1 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Repack Template", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "default_warehouse", + "fieldtype": "Link", + "label": "Default Warehouse", + "options": "Warehouse", + "reqd": 1 + }, + { + "fieldname": "section_break_8", + "fieldtype": "Section Break" + } + ], + "is_submittable": 1, + "modified": "2020-06-15 22:14:22.077798", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Repack Template", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "search_fields": "item_code, default_warehouse", + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "item_name", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/repack_template/repack_template.py b/csf_tz/csf_tz/doctype/repack_template/repack_template.py new file mode 100644 index 0000000..52e5073 --- /dev/null +++ b/csf_tz/csf_tz/doctype/repack_template/repack_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class RepackTemplate(Document): + pass diff --git a/csf_tz/csf_tz/doctype/repack_template/test_repack_template.py b/csf_tz/csf_tz/doctype/repack_template/test_repack_template.py new file mode 100644 index 0000000..f57b459 --- /dev/null +++ b/csf_tz/csf_tz/doctype/repack_template/test_repack_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestRepackTemplate(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/repack_template_detail/__init__.py b/csf_tz/csf_tz/doctype/repack_template_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/repack_template_detail/repack_template_detail.json b/csf_tz/csf_tz/doctype/repack_template_detail/repack_template_detail.json new file mode 100644 index 0000000..4aaf72d --- /dev/null +++ b/csf_tz/csf_tz/doctype/repack_template_detail/repack_template_detail.json @@ -0,0 +1,68 @@ +{ + "creation": "2020-05-29 11:15:08.636913", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "default_target_warehouse", + "item_code", + "item_name", + "item_uom", + "qty" + ], + "fields": [ + { + "columns": 4, + "fieldname": "item_code", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Item Code", + "options": "Item", + "reqd": 1 + }, + { + "columns": 4, + "fetch_from": "item_code.item_name", + "fieldname": "item_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Item Name", + "read_only": 1 + }, + { + "columns": 1, + "fetch_from": "item_code.stock_uom", + "fieldname": "item_uom", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Item UOM", + "read_only": 1 + }, + { + "columns": 1, + "fieldname": "qty", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Qty", + "reqd": 1 + }, + { + "fieldname": "default_target_warehouse", + "fieldtype": "Link", + "label": "Default Target Warehouse", + "options": "Warehouse", + "reqd": 1 + } + ], + "istable": 1, + "modified": "2020-06-23 16:15:54.357189", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Repack Template Detail", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/repack_template_detail/repack_template_detail.py b/csf_tz/csf_tz/doctype/repack_template_detail/repack_template_detail.py new file mode 100644 index 0000000..5782f29 --- /dev/null +++ b/csf_tz/csf_tz/doctype/repack_template_detail/repack_template_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class RepackTemplateDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings/__init__.py b/csf_tz/csf_tz/doctype/reporting_currency_settings/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.js b/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.js new file mode 100644 index 0000000..bac89b7 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Reporting Currency Settings', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.json b/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.json new file mode 100644 index 0000000..97caaba --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.json @@ -0,0 +1,140 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:company", + "creation": "2022-05-28 12:52:15.249347", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "enable_reporting_currency", + "section_break_2", + "reporting_currency", + "column_break_5", + "company", + "section_break_6", + "recalculation_start_date", + "reset_reporting_currency_records", + "column_break_9", + "recalculation_end_date", + "section_break_12", + "recalculation_schedule_frequency", + "column_break_13", + "recalculation_schedule_time", + "rate_definition_section", + "table_11" + ], + "fields": [ + { + "default": "0", + "fieldname": "enable_reporting_currency", + "fieldtype": "Check", + "label": "Enable Reporting Currency" + }, + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "mandatory_depends_on": "eval:doc.enable_reporting_currency", + "options": "Company", + "unique": 1 + }, + { + "fieldname": "reporting_currency", + "fieldtype": "Link", + "label": "Reporting Currency", + "mandatory_depends_on": "eval:doc.enable_reporting_currency", + "options": "Currency" + }, + { + "fieldname": "recalculation_start_date", + "fieldtype": "Date", + "label": "Recalculation Start Date" + }, + { + "fieldname": "recalculation_end_date", + "fieldtype": "Date", + "label": "Recalculation End Date", + "mandatory_depends_on": "eval:doc.recalculation_start_date" + }, + { + "fieldname": "column_break_5", + "fieldtype": "Column Break" + }, + { + "fieldname": "reset_reporting_currency_records", + "fieldtype": "Button", + "label": "Reset Reporting Currency Records" + }, + { + "fieldname": "recalculation_schedule_frequency", + "fieldtype": "Select", + "label": "Recalculation Schedule Frequency", + "options": "Daily\nWeekly\nMonthly" + }, + { + "fieldname": "recalculation_schedule_time", + "fieldtype": "Time", + "label": "Recalculation Schedule Time" + }, + { + "fieldname": "rate_definition_section", + "fieldtype": "Section Break", + "hidden": 1, + "label": "Rate Definition" + }, + { + "fieldname": "table_11", + "fieldtype": "Table", + "options": "Reporting Currency Settings Rate" + }, + { + "depends_on": "eval:doc.enable_reporting_currency", + "fieldname": "section_break_2", + "fieldtype": "Section Break", + "label": "Company Settings" + }, + { + "depends_on": "eval:doc.enable_reporting_currency", + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "label": "Manual Calculation Settings" + }, + { + "fieldname": "column_break_9", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:doc.enable_reporting_currency", + "fieldname": "section_break_12", + "fieldtype": "Section Break", + "label": "Auto Calculation Settings" + }, + { + "fieldname": "column_break_13", + "fieldtype": "Column Break" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2022-05-28 13:25:26.934074", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Reporting Currency Settings", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.py b/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.py new file mode 100644 index 0000000..c201f83 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_currency_settings/reporting_currency_settings.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ReportingCurrencySettings(Document): + pass diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings/test_reporting_currency_settings.py b/csf_tz/csf_tz/doctype/reporting_currency_settings/test_reporting_currency_settings.py new file mode 100644 index 0000000..2c37070 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_currency_settings/test_reporting_currency_settings.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestReportingCurrencySettings(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/__init__.py b/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/reporting_currency_settings_rate.json b/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/reporting_currency_settings_rate.json new file mode 100644 index 0000000..f7fdb47 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/reporting_currency_settings_rate.json @@ -0,0 +1,47 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-28 12:54:10.089147", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "reference_doctype", + "rate_doctype", + "rate_docfield" + ], + "fields": [ + { + "fieldname": "reference_doctype", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Reference DocType", + "options": "DocType", + "reqd": 1 + }, + { + "fieldname": "rate_doctype", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Rate DocType", + "options": "DocType" + }, + { + "fieldname": "rate_docfield", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Rate DocField" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-05-28 12:54:20.796537", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Reporting Currency Settings Rate", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/reporting_currency_settings_rate.py b/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/reporting_currency_settings_rate.py new file mode 100644 index 0000000..d141f3f --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_currency_settings_rate/reporting_currency_settings_rate.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ReportingCurrencySettingsRate(Document): + pass diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/__init__.py b/csf_tz/csf_tz/doctype/reporting_gl_entry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.js b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.js new file mode 100644 index 0000000..4660e8c --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Reporting GL Entry', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.json b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.json new file mode 100644 index 0000000..710d4a4 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.json @@ -0,0 +1,83 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-28 13:06:59.877801", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "gl_entry", + "posting_date", + "reporting_currency", + "exchange_rate", + "debit_amount", + "credit_amount", + "day_exchange_rate" + ], + "fields": [ + { + "fieldname": "gl_entry", + "fieldtype": "Link", + "label": "GL Entry", + "options": "GL Entry" + }, + { + "fieldname": "reporting_currency", + "fieldtype": "Link", + "label": "Reporting Currency", + "options": "Currency" + }, + { + "fieldname": "exchange_rate", + "fieldtype": "Float", + "label": "Exchange Rate" + }, + { + "fieldname": "debit_amount", + "fieldtype": "Currency", + "label": "Debit Amount", + "options": "reporting_currency" + }, + { + "fieldname": "credit_amount", + "fieldtype": "Currency", + "label": "Credit Amount", + "options": "reporting_currency" + }, + { + "default": "0", + "fieldname": "day_exchange_rate", + "fieldtype": "Check", + "label": "Day Exchange Rate" + }, + { + "fieldname": "posting_date", + "fieldtype": "Date", + "label": "Posting Date" + } + ], + "in_create": 1, + "index_web_pages_for_search": 1, + "links": [], + "modified": "2022-05-28 13:22:09.512246", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Reporting GL Entry", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.py b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.py new file mode 100644 index 0000000..1485d10 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ReportingGLEntry(Document): + pass diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/test_reporting_gl_entry.py b/csf_tz/csf_tz/doctype/reporting_gl_entry/test_reporting_gl_entry.py new file mode 100644 index 0000000..70d1e37 --- /dev/null +++ b/csf_tz/csf_tz/doctype/reporting_gl_entry/test_reporting_gl_entry.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestReportingGLEntry(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/__init__.py b/csf_tz/csf_tz/doctype/root_cause_analysis/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.js b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.js new file mode 100644 index 0000000..6f69fdf --- /dev/null +++ b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Root Cause Analysis', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.json b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.json new file mode 100644 index 0000000..dd51628 --- /dev/null +++ b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.json @@ -0,0 +1,213 @@ +{ + "actions": [], + "allow_import": 1, + "allow_rename": 1, + "autoname": "naming_series:", + "creation": "2022-05-28 11:53:20.931555", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "issue_detail", + "title", + "date_issue_happened", + "department_issue_identified", + "impact_to_productivity", + "rate_colum_break", + "is_recurring_issue", + "frequency_of_the_issue", + "department_affected", + "description_section_break", + "description_of_the_issue", + "report_section_break", + "reported_by", + "phone_no", + "status_column_break", + "status", + "reported_date", + "root_cause_section_break", + "possible_root_cause", + "prevention_section_break", + "prevention_strategy", + "solved_by", + "naming_series" + ], + "fields": [ + { + "fieldname": "issue_detail", + "fieldtype": "Section Break", + "label": "Issue Detail" + }, + { + "fieldname": "rate_colum_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "impact_to_productivity", + "fieldtype": "Select", + "label": "Rate the impact to productivity", + "options": "\nLow\nMedium\nHigh", + "reqd": 1 + }, + { + "fieldname": "description_section_break", + "fieldtype": "Section Break", + "label": "Description" + }, + { + "fieldname": "description_of_the_issue", + "fieldtype": "Small Text", + "label": "Brief description of the issue" + }, + { + "description": "List potential reasons why the issue happened\n", + "fieldname": "possible_root_cause", + "fieldtype": "Table", + "options": "Possible Root Cause" + }, + { + "columns": 1, + "fieldname": "status", + "fieldtype": "Select", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Status", + "options": "\nPending\nSolved", + "reqd": 1 + }, + { + "fieldname": "root_cause_section_break", + "fieldtype": "Section Break", + "label": "Possible Root Cause" + }, + { + "description": "Please keep full name", + "fieldname": "reported_by", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Reported By", + "reqd": 1 + }, + { + "fieldname": "prevention_section_break", + "fieldtype": "Section Break", + "label": "Root Cause Prevention " + }, + { + "description": "List solution(s) to be applied or implemented", + "fieldname": "prevention_strategy", + "fieldtype": "Table", + "options": "Root Cause Prevention Strategy" + }, + { + "description": "List Name(s) and Phone number of Member(s) participated to solve the Issue", + "fieldname": "solved_by", + "fieldtype": "Small Text", + "in_standard_filter": 1, + "label": "Solved By" + }, + { + "fieldname": "report_section_break", + "fieldtype": "Section Break" + }, + { + "fieldname": "phone_no", + "fieldtype": "Data", + "label": "Reporter Phone No:" + }, + { + "columns": 1, + "fieldname": "is_recurring_issue", + "fieldtype": "Select", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Is this a recurring issue?", + "options": "\nNo\nYes", + "reqd": 1 + }, + { + "fieldname": "frequency_of_the_issue", + "fieldtype": "Select", + "label": "What is the frequency of the issue?", + "options": "\nAt Randomly\nDaily\nWeekly\nMonthly\nYearly" + }, + { + "description": "List department(s) that affected by the incident ", + "fieldname": "department_affected", + "fieldtype": "Small Text", + "in_standard_filter": 1, + "label": "Department(s) affected by an Issue", + "reqd": 1 + }, + { + "columns": 1, + "fieldname": "date_issue_happened", + "fieldtype": "Date", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "When did it start", + "reqd": 1 + }, + { + "columns": 2, + "fieldname": "title", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "Title of the Issue/Incident", + "reqd": 1 + }, + { + "fieldname": "status_column_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "reported_date", + "fieldtype": "Date", + "in_standard_filter": 1, + "label": "Reported Date", + "reqd": 1 + }, + { + "fieldname": "department_issue_identified", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "In which Area/department was the issue identified?", + "reqd": 1 + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 1, + "label": "Series", + "options": "RCA-.YYYY.-" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2022-06-02 11:38:02.185887", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Root Cause Analysis", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "title", + "track_changes": 1, + "track_seen": 1, + "track_views": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.py b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.py new file mode 100644 index 0000000..288fa50 --- /dev/null +++ b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class RootCauseAnalysis(Document): + pass diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/test_root_cause_analysis.py b/csf_tz/csf_tz/doctype/root_cause_analysis/test_root_cause_analysis.py new file mode 100644 index 0000000..59a567a --- /dev/null +++ b/csf_tz/csf_tz/doctype/root_cause_analysis/test_root_cause_analysis.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestRootCauseAnalysis(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/__init__.py b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.json b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.json new file mode 100644 index 0000000..2eb08f9 --- /dev/null +++ b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.json @@ -0,0 +1,92 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-28 13:35:44.821933", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "solution_to_be_implemented", + "consideration", + "specify_considerations", + "is_solution_implemented", + "cost_column_break", + "estimated_cost", + "incidental_findings", + "specify_findings", + "date_of_completion" + ], + "fields": [ + { + "fieldname": "solution_to_be_implemented", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Solution to be implemented", + "length": 1000, + "reqd": 1 + }, + { + "fieldname": "cost_column_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "estimated_cost", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Estimated cost" + }, + { + "fieldname": "consideration", + "fieldtype": "Select", + "label": "Are there special considerations?", + "options": "\nNo\nYes" + }, + { + "depends_on": "eval: doc.consideration == \"Yes\"", + "fieldname": "specify_considerations", + "fieldtype": "Small Text", + "label": "Please specify", + "mandatory_depends_on": "eval: doc.consideration == \"Yes\"" + }, + { + "fieldname": "incidental_findings", + "fieldtype": "Select", + "label": "Are there incidental findings to be reviewed for corrective action?", + "options": "\nNo\nYes" + }, + { + "depends_on": "eval: doc.incidental_findings == \"Yes\"", + "fieldname": "specify_findings", + "fieldtype": "Small Text", + "label": "Please specify", + "mandatory_depends_on": "eval: doc.incidental_findings == \"Yes\"" + }, + { + "depends_on": "eval: doc.is_solution_implemented == \"Yes\"", + "fieldname": "date_of_completion", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Date of Implementation", + "mandatory_depends_on": "eval: doc.is_solution_implemented == \"Yes\"" + }, + { + "fieldname": "is_solution_implemented", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Is the solution implemented", + "options": "\nNo\nYes", + "reqd": 1 + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-06-01 16:20:38.015263", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Root Cause Prevention Strategy", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.py b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.py new file mode 100644 index 0000000..1460575 --- /dev/null +++ b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class RootCausePreventionStrategy(Document): + pass diff --git a/csf_tz/csf_tz/doctype/section/__init__.py b/csf_tz/csf_tz/doctype/section/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/section/section.js b/csf_tz/csf_tz/doctype/section/section.js new file mode 100644 index 0000000..aaadab0 --- /dev/null +++ b/csf_tz/csf_tz/doctype/section/section.js @@ -0,0 +1,58 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Section', { + setup: function(frm) { + frm.set_query('default_cash_account', function() { + return { + filters: { + 'company': frm.doc.company, + "account_type": "Cash", + "is_group": 0, + } + } + }); + frm.set_query('cash_customer_pos_profile', function() { + return { + filters: { + 'company': frm.doc.company, + } + } + }); + frm.set_query('purchase_taxes_and_charges_template', function() { + return { + filters: { + 'company': frm.doc.company, + } + } + }); + frm.set_query('stock_adjustment', function() { + return { + filters: { + 'company': frm.doc.company, + "account_type": "Stock Adjustment", + "is_group": 0, + } + } + }); + frm.set_query('default_warehouse', function() { + return { + filters: { + 'company': frm.doc.company, + "is_group": 0, + } + } + }); + frm.set_query('cost_center', function() { + return { + filters: { + 'company': frm.doc.company, + } + } + }); + }, + company: function(frm) { + frm.set_value("cost_center", "") + frm.set_value("default_cash_account", "") + } +}); diff --git a/csf_tz/csf_tz/doctype/section/section.json b/csf_tz/csf_tz/doctype/section/section.json new file mode 100644 index 0000000..cb616d1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/section/section.json @@ -0,0 +1,237 @@ +{ + "allow_rename": 1, + "autoname": "field:section_name", + "creation": "2020-06-17 01:49:57.503552", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "section_name", + "company", + "column_break_3", + "section_full_name", + "section_manager", + "section_break_6", + "business_license_due_date", + "column_break_8", + "workplace_license_expiry", + "section_break_18", + "cost_center", + "section_break_12", + "stock_adjustment", + "purchase_taxes_and_charges_template", + "column_break_20", + "default_cash_account", + "default_warehouse", + "section_break_21", + "cash_customer", + "monthly_target", + "column_break_25", + "cash_customer_pos_profile" + ], + "fields": [ + { + "fieldname": "company", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Company", + "options": "Company", + "permlevel": 1, + "reqd": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, + { + "fieldname": "business_license_due_date", + "fieldtype": "Date", + "label": "Business License Due Date", + "reqd": 1 + }, + { + "fieldname": "workplace_license_expiry", + "fieldtype": "Date", + "label": "Workplace License Expiry", + "reqd": 1 + }, + { + "fieldname": "section_break_18", + "fieldtype": "Section Break", + "label": "Accounting Dimensions" + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center", + "permlevel": 1, + "reqd": 1 + }, + { + "fieldname": "stock_adjustment", + "fieldtype": "Link", + "label": "Stock Adjustment Account", + "options": "Account", + "reqd": 1 + }, + { + "fieldname": "column_break_20", + "fieldtype": "Column Break" + }, + { + "fieldname": "default_cash_account", + "fieldtype": "Link", + "label": "Default Cash Account", + "options": "Account", + "permlevel": 1, + "reqd": 1 + }, + { + "fieldname": "default_warehouse", + "fieldtype": "Link", + "label": "Default Warehouse", + "options": "Warehouse", + "reqd": 1 + }, + { + "fieldname": "section_break_21", + "fieldtype": "Section Break" + }, + { + "fieldname": "cash_customer", + "fieldtype": "Link", + "label": "Cash Customer", + "options": "Customer", + "reqd": 1 + }, + { + "fieldname": "column_break_25", + "fieldtype": "Column Break" + }, + { + "fieldname": "cash_customer_pos_profile", + "fieldtype": "Link", + "label": "Cash Customer POS Profile", + "options": "POS Profile", + "reqd": 1 + }, + { + "fieldname": "monthly_target", + "fieldtype": "Float", + "label": "Monthly Target", + "precision": "2" + }, + { + "fieldname": "section_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Section Name", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "section_full_name", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "Section Full Name" + }, + { + "fieldname": "section_manager", + "fieldtype": "Link", + "label": "Section Manager", + "options": "User" + }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_12", + "fieldtype": "Section Break" + }, + { + "fieldname": "purchase_taxes_and_charges_template", + "fieldtype": "Link", + "label": "Purchase Taxes and Charges Template", + "options": "Purchase Taxes and Charges Template", + "reqd": 1 + } + ], + "modified": "2020-08-19 15:24:35.943812", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Section", + "owner": "Administrator", + "permissions": [ + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Station Manager", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Cluster Manager", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "write": 1 + }, + { + "delete": 1, + "email": 1, + "export": 1, + "permlevel": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Customer", + "share": 1 + } + ], + "search_fields": "company,section_full_name", + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/section/section.py b/csf_tz/csf_tz/doctype/section/section.py new file mode 100644 index 0000000..8871c6a --- /dev/null +++ b/csf_tz/csf_tz/doctype/section/section.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class Section(Document): + pass diff --git a/csf_tz/csf_tz/doctype/section/test_section.py b/csf_tz/csf_tz/doctype/section/test_section.py new file mode 100644 index 0000000..51f594f --- /dev/null +++ b/csf_tz/csf_tz/doctype/section/test_section.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestSection(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/single_piecework_employees/__init__.py b/csf_tz/csf_tz/doctype/single_piecework_employees/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.json b/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.json new file mode 100644 index 0000000..744e872 --- /dev/null +++ b/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.json @@ -0,0 +1,114 @@ +{ + "creation": "2021-04-23 23:21:59.054525", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "employee", + "column_break_2", + "employee_name", + "section_break_4", + "task", + "column_break_6", + "task_name", + "task_rate", + "section_break_9", + "quantity", + "column_break_10", + "amount", + "section_break_11", + "additional_salary" + ], + "fields": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Employee", + "options": "Employee" + }, + { + "fetch_from": "employee.employee_name", + "fieldname": "employee_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Employee Name", + "read_only": 1 + }, + { + "fieldname": "quantity", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Quantity" + }, + { + "default": "0", + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "read_only": 1 + }, + { + "fieldname": "additional_salary", + "fieldtype": "Link", + "label": "Additional Salary", + "options": "Additional Salary", + "read_only": 1 + }, + { + "fieldname": "task", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Task", + "options": "Piecework Type" + }, + { + "fetch_from": "task.task_name", + "fieldname": "task_name", + "fieldtype": "Data", + "label": "Task Name" + }, + { + "fetch_from": "task.rate", + "fieldname": "task_rate", + "fieldtype": "Currency", + "label": "Task Rate" + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_4", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_11", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_9", + "fieldtype": "Section Break" + } + ], + "istable": 1, + "modified": "2021-04-27 00:01:55.824888", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Single Piecework Employees", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.py b/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.py new file mode 100644 index 0000000..2f8f04b --- /dev/null +++ b/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class SinglePieceworkEmployees(Document): + pass diff --git a/csf_tz/csf_tz/doctype/special_closing_balance/__init__.py b/csf_tz/csf_tz/doctype/special_closing_balance/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.js b/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.js new file mode 100644 index 0000000..19e9fcd --- /dev/null +++ b/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.js @@ -0,0 +1,69 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Special Closing Balance', { + onload: function(frm) { + + frm.set_query("item_code", "closing_balance_details", function(doc, cdt, cdn) { + return { + query: "erpnext.controllers.queries.item_query", + filters:{ + "is_stock_item": 1 + } + } + }); + + if (frm.doc.company) { + erpnext.queries.setup_queries(frm, "Warehouse", function() { + return erpnext.queries.warehouse(frm.doc); + }); + } + }, + refresh: function(frm) { + if(frm.doc.docstatus < 1) { + frm.add_custom_button(__("Fetch Items from Warehouse"), function() { + frm.events.get_items(frm); + }); + } + }, + get_items: function(frm) { + if (!frm.doc.warehouse) { + frappe.prompt({label:"Warehouse", fieldname: "warehouse", fieldtype:"Link", options:"Warehouse", reqd: 1, + "get_query": function() { + return { + "filters": { + "company": frm.doc.company, + } + } + }}, + function(data) { + frm.set_value('warehouse',data.warehouse); + frm.trigger("_get_items"); + } + ); + } + else {frm.trigger("_get_items");} + }, + _get_items: function(frm) { + if (!frm.doc.warehouse) {return} + frappe.call({ + method:"csf_tz.csf_tz.doctype.special_closing_balance.special_closing_balance.get_items", + args: { + warehouse: frm.doc.warehouse, + posting_date: frm.doc.posting_date, + posting_time: frm.doc.posting_time, + company:frm.doc.company + }, + callback: function(r) { + var items = []; + frm.clear_table("closing_balance_details"); + for(var i=0; i< r.message.length; i++) { + var d = frm.add_child("closing_balance_details"); + $.extend(d, r.message[i]); + if(!d.quantity) d.quantity = 0; + } + frm.refresh_field("closing_balance_details"); + } + }); + } +}); diff --git a/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.json b/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.json new file mode 100644 index 0000000..e2d096c --- /dev/null +++ b/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.json @@ -0,0 +1,149 @@ +{ + "actions": [], + "autoname": "naming_series:", + "creation": "2020-04-25 21:09:42.927253", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "naming_series", + "company", + "posting_date", + "posting_time", + "warehouse", + "column_break_2", + "shift", + "stock_entry", + "section_break_4", + "closing_balance_details", + "amended_from" + ], + "fields": [ + { + "fieldname": "naming_series", + "fieldtype": "Data", + "hidden": 1, + "label": "naming_series" + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "label": "Posting Date", + "reqd": 1 + }, + { + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "options": "Warehouse", + "reqd": 1 + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "shift", + "fieldtype": "Select", + "label": "Shift", + "options": "Shift 1\nShift 2\nShift 3" + }, + { + "fieldname": "section_break_4", + "fieldtype": "Section Break" + }, + { + "fieldname": "closing_balance_details", + "fieldtype": "Table", + "label": "Closing Balance Details", + "options": "Special Closing Balance Detail", + "reqd": 1 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Special Closing Balance", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "stock_entry", + "fieldtype": "Link", + "label": "Stock Entry", + "no_copy": 1, + "options": "Stock Entry", + "read_only": 1 + }, + { + "fieldname": "posting_time", + "fieldtype": "Time", + "label": "Posting Time", + "reqd": 1 + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2021-05-28 21:59:44.027863", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Special Closing Balance", + "owner": "Administrator", + "permissions": [ + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "create": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock Manager", + "share": 1, + "submit": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.py b/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.py new file mode 100644 index 0000000..a41d51a --- /dev/null +++ b/csf_tz/csf_tz/doctype/special_closing_balance/special_closing_balance.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document +from erpnext.stock.utils import get_latest_stock_qty, get_stock_balance + + +class SpecialClosingBalance(Document): + def validate(self): + items = [] + user_remarks = "Special Closing Balance - {0}".format(self.name) + for item_row in self.closing_balance_details: + if not item_row.quantity: + item_row.quantity = 0 + if item_row.item : + item_balance = get_latest_stock_qty(item_row.item, self.warehouse) or 0 + item_row.item_balance = item_balance + # item_row.db_update() + + + def on_submit(self): + user_remarks = "Special Closing Balance - {0}".format(self.name) + csf_tz_settings = frappe.get_doc("CSF TZ Settings", "CSF TZ Settings") + if csf_tz_settings.is_manufacture: + for item_row in self.closing_balance_details: + if item_row.item : + item_bom_list = frappe.get_all("BOM", {"is_active": 1, "is_default": 1, "item": item_row.item, "docstatus": 1}) + if len(item_bom_list) > 0: + item_bom = item_bom_list[0].name + frappe.msgprint(_("BOM no {0} for item {1} selected").format(item_bom, item_row.item), alert=True) + else: + frappe.throw(_("Default active BOM not found for item {0}").format(item_row.item)) + item_balance = get_latest_stock_qty(item_row.item, self.warehouse) or 0 + item_row.item_balance = item_balance + item_row.db_update() + if item_row.quantity != item_balance: + stock_entry_doc = frappe.get_doc(dict( + doctype="Stock Entry", + from_bom = 1, + bom_no = item_bom, + fg_completed_qty = item_row.quantity - item_balance, + posting_date=self.posting_date, + posting_time=self.posting_time, + set_posting_time = 1, + items = [], + stock_entry_type='Manufacture', + purpose='Manufacture', + to_warehouse=self.warehouse, + company=self.company, + remarks=user_remarks, + special_closing_balance=self.name + )) + stock_entry_doc.get_items() + stock_entry_doc.insert(ignore_permissions=True) + if stock_entry_doc: + frappe.flags.ignore_account_permission = True + stock_entry_doc.submit() + # return stock_entry_doc.name + # self.stock_entry = stock_entry_doc.name + url = frappe.utils.get_url_to_form(stock_entry_doc.doctype, stock_entry_doc.name) + frappe.msgprint("Stock Entry Created {1}".format(url,stock_entry_doc.name)) + + else: + items = [] + for item_row in self.closing_balance_details: + if item_row.item : + item_balance = get_latest_stock_qty(item_row.item, self.warehouse) or 0 + item_row.item_balance = item_balance + item_row.db_update() + if item_row.quantity != item_balance: + item_dict = dict( + item_code=item_row.item, + qty=item_row.quantity - item_balance, + uom=item_row.uom, + s_warehouse=self.warehouse + ) + items.append(item_dict) + if len(items) < 1: + return + stock_entry_doc = frappe.get_doc(dict( + doctype="Stock Entry", + posting_date=self.posting_date, + posting_time=self.posting_time, + set_posting_time = 1, + items=items, + stock_entry_type='Material Receipt', + purpose='Material Receipt', + to_warehouse=self.warehouse, + company=self.company, + remarks=user_remarks, + special_closing_balance=self.name + )).insert(ignore_permissions=True) + if stock_entry_doc: + frappe.flags.ignore_account_permission = True + stock_entry_doc.submit() + # return stock_entry_doc.name + self.stock_entry = stock_entry_doc.name + url = frappe.utils.get_url_to_form(stock_entry_doc.doctype, stock_entry_doc.name) + frappe.msgprint("Stock Entry Created {1}".format(url,stock_entry_doc.name)) + +@frappe.whitelist() +def get_items(warehouse, posting_date, posting_time, company): + lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"]) + + items = frappe.db.sql(""" + select i.name, i.item_name, i.stock_uom, id.default_warehouse + from tabItem i, `tabItem Default` id + where i.name = id.parent + and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=id.default_warehouse) + and i.is_stock_item = 1 and i.has_serial_no = 0 and i.has_batch_no = 0 + and i.has_variants = 0 and i.disabled = 0 and id.company=%s + group by i.name + order by i.name + """, (lft, rgt, company), as_list=True) + + res = [] + for d in items: + stock_bal = get_stock_balance(d[0], d[3], posting_date, posting_time, + with_valuation_rate=True) + + if frappe.db.get_value("Item", d[0], "disabled") == 0: + res.append({ + "item": d[0], + "uom": d[2], + "warehouse": d[3], + "quantity": stock_bal[0], + "item_name": d[1], + "valuation_rate": stock_bal[1], + "item_balance": stock_bal[0], + "current_valuation_rate": stock_bal[1] + }) + + return res \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/special_closing_balance/test_special_closing_balance.py b/csf_tz/csf_tz/doctype/special_closing_balance/test_special_closing_balance.py new file mode 100644 index 0000000..0068d68 --- /dev/null +++ b/csf_tz/csf_tz/doctype/special_closing_balance/test_special_closing_balance.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + + +class TestSpecialClosingBalance(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/special_closing_balance_detail/__init__.py b/csf_tz/csf_tz/doctype/special_closing_balance_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/special_closing_balance_detail/special_closing_balance_detail.json b/csf_tz/csf_tz/doctype/special_closing_balance_detail/special_closing_balance_detail.json new file mode 100644 index 0000000..cdd42dc --- /dev/null +++ b/csf_tz/csf_tz/doctype/special_closing_balance_detail/special_closing_balance_detail.json @@ -0,0 +1,58 @@ +{ + "_comments": "[{\"by\": \"Administrator\", \"comment\": \"
Formula for Stock Entry Material Receipt quantity for each item based on this table + Stock ...\", \"name\": \"384b079634\"}]", + "creation": "2020-04-25 21:10:34.876714", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "item", + "uom", + "quantity", + "item_balance" + ], + "fields": [ + { + "fieldname": "item", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Item", + "options": "Item", + "reqd": 1 + }, + { + "fetch_from": "item.stock_uom", + "fetch_if_empty": 1, + "fieldname": "uom", + "fieldtype": "Link", + "in_list_view": 1, + "label": "UOM", + "options": "UOM", + "reqd": 1 + }, + { + "fieldname": "quantity", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Quantity", + "reqd": 1 + }, + { + "fieldname": "item_balance", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Stock Balance On Submit", + "read_only": 1 + } + ], + "istable": 1, + "modified": "2020-07-04 05:17:15.968749", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Special Closing Balance Detail", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/special_closing_balance_detail/special_closing_balance_detail.py b/csf_tz/csf_tz/doctype/special_closing_balance_detail/special_closing_balance_detail.py new file mode 100644 index 0000000..242b518 --- /dev/null +++ b/csf_tz/csf_tz/doctype/special_closing_balance_detail/special_closing_balance_detail.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + + +class SpecialClosingBalanceDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/sql_command/__init__.py b/csf_tz/csf_tz/doctype/sql_command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/sql_command/sql_command.js b/csf_tz/csf_tz/doctype/sql_command/sql_command.js new file mode 100644 index 0000000..754dacf --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_command/sql_command.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('SQL Command', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/sql_command/sql_command.json b/csf_tz/csf_tz/doctype/sql_command/sql_command.json new file mode 100644 index 0000000..a1d8375 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_command/sql_command.json @@ -0,0 +1,78 @@ +{ + "actions": [], + "autoname": "SQLCMD-.######", + "creation": "2021-06-04 15:04:17.236157", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "doctype_name", + "column_break_2", + "names", + "section_break_4", + "sql_text", + "amended_from" + ], + "fields": [ + { + "fieldname": "sql_text", + "fieldtype": "Code", + "label": "SQL Text" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "SQL Command", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "doctype_name", + "fieldtype": "Link", + "label": "DocType Name", + "options": "DocType", + "read_only": 1 + }, + { + "fieldname": "names", + "fieldtype": "Small Text", + "label": "Names", + "read_only": 1 + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_4", + "fieldtype": "Section Break" + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2021-06-04 16:19:00.205575", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "SQL Command", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/sql_command/sql_command.py b/csf_tz/csf_tz/doctype/sql_command/sql_command.py new file mode 100644 index 0000000..9f18428 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_command/sql_command.py @@ -0,0 +1,20 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document +from csf_tz import console + +class SQLCommand(Document): + def on_submit(self): + if "DELETE" in self.sql_text: + return + + delete_allowed = frappe.get_value("CSF TZ Settings", "CSF TZ Settings", "allow_delete_in_sql_command") + if self.doctype_name: + if delete_allowed and not self.sql_text and self.doctype_name and self.names: + frappe.db.sql("DELETE FROM `tab" + self.doctype_name + "` WHERE NAME IN (" + self.names + ")") + # frappe.db.sql("select * from `tabBin` where warehouse = %s", self.name, as_dict=1) + else: + frappe.db.sql(self.sql_text) + frappe.db.commit() diff --git a/csf_tz/csf_tz/doctype/sql_command/test_sql_command.py b/csf_tz/csf_tz/doctype/sql_command/test_sql_command.py new file mode 100644 index 0000000..dcb1898 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_command/test_sql_command.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestSQLCommand(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/sql_process/__init__.py b/csf_tz/csf_tz/doctype/sql_process/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/sql_process/sql_process.js b/csf_tz/csf_tz/doctype/sql_process/sql_process.js new file mode 100644 index 0000000..04f5096 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_process/sql_process.js @@ -0,0 +1,49 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('SQL Process', { + refresh: function (frm) { + frm.set_value('process', []); + }, + refresh_q: function (frm) { + frappe.call({ + method: "get_process", + doc: frm.doc, + callback: function (r) { + update_table(frm, r.message); + + } + }); + } +}); + +frappe.ui.form.on('SQL Process Detail', { + kill: function (frm, cdt, cdn) { + const row = locals[cdt][cdn]; + frappe.call({ + method: "kill_process", + doc: frm.doc, + args: { + pid: row.id + }, + callback: function (r) { + frm.trigger('refresh_q'); + + } + }); + } +}); + +const update_table = (frm, data) => { + frm.doc.process = []; + data.forEach(element => { + let row = frm.add_child('process', { + id: element.id, + time: element.time, + query: element.info, + + }); + frm.refresh_field('process'); + + }); +}; \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/sql_process/sql_process.json b/csf_tz/csf_tz/doctype/sql_process/sql_process.json new file mode 100644 index 0000000..3234533 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_process/sql_process.json @@ -0,0 +1,48 @@ +{ + "actions": [], + "allow_copy": 1, + "creation": "2022-08-08 16:10:11.510104", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "refresh_q", + "process" + ], + "fields": [ + { + "fieldname": "process", + "fieldtype": "Table", + "label": "Process", + "options": "SQL Process Detail" + }, + { + "fieldname": "refresh_q", + "fieldtype": "Button", + "label": "Refresh" + } + ], + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2022-08-08 17:10:36.271964", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "SQL Process", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/sql_process/sql_process.py b/csf_tz/csf_tz/doctype/sql_process/sql_process.py new file mode 100644 index 0000000..786747c --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_process/sql_process.py @@ -0,0 +1,35 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + + +class SQLProcess(Document): + def validate(self): + self.process = [] + + @frappe.whitelist() + def get_process(self): + process = frappe.db.sql( + """ + select id, time, info + from information_schema.processlist + WHERE info IS NOT NULL + """, + as_dict=True, + ) + return process + + @frappe.whitelist() + def kill_process(self, pid): + frappe.msgprint( + "Killing process {}".format(pid), alert=True, indicator="orange" + ) + try: + frappe.db.sql("""Kill {0}""".format(pid)) + except Exception: + frappe.msgprint("Process not found", alert=True, indicator="red") + return False + frappe.msgprint("Process killed", alert=True, indicator="green") + return True diff --git a/csf_tz/csf_tz/doctype/sql_process/test_sql_process.py b/csf_tz/csf_tz/doctype/sql_process/test_sql_process.py new file mode 100644 index 0000000..01d5e00 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_process/test_sql_process.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestSQLProcess(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/sql_process_detail/__init__.py b/csf_tz/csf_tz/doctype/sql_process_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/sql_process_detail/sql_process_detail.json b/csf_tz/csf_tz/doctype/sql_process_detail/sql_process_detail.json new file mode 100644 index 0000000..98a5868 --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_process_detail/sql_process_detail.json @@ -0,0 +1,55 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-08-08 16:14:30.755327", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "id", + "time", + "query", + "kill" + ], + "fields": [ + { + "columns": 1, + "fieldname": "id", + "fieldtype": "Data", + "in_list_view": 1, + "label": "ID" + }, + { + "columns": 1, + "fieldname": "time", + "fieldtype": "Int", + "in_list_view": 1, + "label": "Time Running" + }, + { + "columns": 7, + "fieldname": "query", + "fieldtype": "Long Text", + "in_list_view": 1, + "label": "SQL Query" + }, + { + "columns": 1, + "fieldname": "kill", + "fieldtype": "Button", + "in_list_view": 1, + "label": "Kill" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-08-08 17:57:18.789687", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "SQL Process Detail", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/sql_process_detail/sql_process_detail.py b/csf_tz/csf_tz/doctype/sql_process_detail/sql_process_detail.py new file mode 100644 index 0000000..ce97d4b --- /dev/null +++ b/csf_tz/csf_tz/doctype/sql_process_detail/sql_process_detail.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class SQLProcessDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/station_members/__init__.py b/csf_tz/csf_tz/doctype/station_members/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/station_members/station_members.json b/csf_tz/csf_tz/doctype/station_members/station_members.json new file mode 100644 index 0000000..35277fa --- /dev/null +++ b/csf_tz/csf_tz/doctype/station_members/station_members.json @@ -0,0 +1,39 @@ +{ + "creation": "2021-04-23 23:17:17.897554", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "employee", + "employee_name" + ], + "fields": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Employee", + "options": "Employee", + "reqd": 1 + }, + { + "fetch_from": "Employee.employee_name", + "fieldname": "employee_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Employee Name", + "read_only": 1 + } + ], + "istable": 1, + "modified": "2021-04-23 23:17:26.631969", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Station Members", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/station_members/station_members.py b/csf_tz/csf_tz/doctype/station_members/station_members.py new file mode 100644 index 0000000..39ad5cb --- /dev/null +++ b/csf_tz/csf_tz/doctype/station_members/station_members.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class StationMembers(Document): + pass diff --git a/csf_tz/csf_tz/doctype/student_applicant_fees/__init__.py b/csf_tz/csf_tz/doctype/student_applicant_fees/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.js b/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.js new file mode 100644 index 0000000..c6026d9 --- /dev/null +++ b/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.js @@ -0,0 +1,85 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Student Applicant Fees', { + setup: function(frm) { + frm.add_fetch("fee_structure", "receivable_account", "receivable_account"); + frm.add_fetch("fee_structure", "income_account", "income_account"); + frm.add_fetch("fee_structure", "cost_center", "cost_center"); + }, + + onload: function(frm){ + frm.set_query("academic_term",function(){ + return{ + "filters":{ + "academic_year": (frm.doc.academic_year) + } + }; + }); + frm.set_query("fee_structure",function(){ + return{ + "filters":{ + "academic_year": (frm.doc.academic_year) + } + }; + }); + frm.set_query("receivable_account", function(doc) { + return { + filters: { + 'account_type': 'Receivable', + 'is_group': 0, + 'company': doc.company + } + }; + }); + frm.set_query("income_account", function(doc) { + return { + filters: { + 'account_type': 'Income Account', + 'is_group': 0, + 'company': doc.company + } + }; + }); + if (!frm.doc.posting_date) { + frm.doc.posting_date = frappe.datetime.get_today(); + } + }, + + refresh: function(frm) { + if(frm.doc.docstatus == 0 && frm.doc.set_posting_time) { + frm.set_df_property('posting_date', 'read_only', 0); + frm.set_df_property('posting_time', 'read_only', 0); + } else { + frm.set_df_property('posting_date', 'read_only', 1); + frm.set_df_property('posting_time', 'read_only', 1); + } + }, + + student: function(frm) { + if (frm.doc.student) { + frappe.call({ + method:"erpnext.education.api.get_current_enrollment", + args: { + "student": frm.doc.student, + "academic_year": frm.doc.academic_year + }, + callback: function(r) { + if(r){ + $.each(r.message, function(i, d) { + frm.set_value(i,d); + }); + } + } + }); + } + }, + + set_posting_time: function(frm) { + frm.refresh(); + }, + + academic_term: function() { + frappe.ui.form.trigger("Fees", "program"); + }, +}); diff --git a/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.json b/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.json new file mode 100644 index 0000000..b860273 --- /dev/null +++ b/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.json @@ -0,0 +1,420 @@ +{ + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2020-08-22 23:55:57.796292", + "doctype": "DocType", + "document_type": "Document", + "engine": "InnoDB", + "field_order": [ + "naming_series", + "student", + "student_name", + "fee_schedule", + "include_payment", + "send_payment_request", + "bank_reference", + "column_break_4", + "company", + "abbr", + "posting_date", + "posting_time", + "set_posting_time", + "due_date", + "student_details", + "program_enrollment", + "program", + "student_batch", + "student_email", + "column_break_16", + "student_category", + "academic_term", + "academic_year", + "section_break_7", + "currency", + "fee_structure", + "section_break_10", + "grand_total", + "grand_total_in_words", + "column_break_11", + "outstanding_amount", + "edit_printing_settings", + "letter_head", + "column_break_32", + "select_print_heading", + "account", + "receivable_account", + "column_break_39", + "income_account", + "accounting_dimensions_section", + "callback_token", + "cost_center", + "dimension_col_break", + "amended_from" + ], + "fields": [ + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Naming Series", + "options": "RFEE-.abbr.-.YY.-", + "print_hide": 1, + "set_only_once": 1 + }, + { + "fieldname": "student", + "fieldtype": "Link", + "in_global_search": 1, + "label": "Student Applicant", + "options": "Student Applicant", + "reqd": 1 + }, + { + "fetch_from": "student.title", + "fieldname": "student_name", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Student Applicant Name", + "read_only": 1 + }, + { + "fieldname": "fee_schedule", + "fieldtype": "Link", + "in_global_search": 1, + "label": "Fee Schedule", + "options": "Fee Schedule", + "print_hide": 1, + "read_only": 1 + }, + { + "default": "0", + "fieldname": "include_payment", + "fieldtype": "Check", + "hidden": 1, + "label": "Include Payment", + "print_hide": 1 + }, + { + "default": "0", + "fieldname": "send_payment_request", + "fieldtype": "Check", + "label": "Send Payment Request", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, + { + "fieldname": "company", + "fieldtype": "Link", + "label": "Institution", + "options": "Company", + "remember_last_selected_value": 1, + "reqd": 1 + }, + { + "bold": 1, + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "label": "Date", + "no_copy": 1, + "reqd": 1, + "search_index": 1 + }, + { + "fieldname": "posting_time", + "fieldtype": "Time", + "label": "Posting Time", + "no_copy": 1 + }, + { + "default": "0", + "depends_on": "eval:doc.docstatus==0", + "fieldname": "set_posting_time", + "fieldtype": "Check", + "label": "Edit Posting Date and Time", + "print_hide": 1 + }, + { + "fieldname": "due_date", + "fieldtype": "Date", + "label": "Due Date", + "reqd": 1 + }, + { + "collapsible": 1, + "fieldname": "student_details", + "fieldtype": "Section Break", + "label": "Student Details" + }, + { + "fieldname": "program_enrollment", + "fieldtype": "Link", + "label": "Program Enrollment", + "options": "Program Enrollment" + }, + { + "fieldname": "program", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Program", + "options": "Program" + }, + { + "fieldname": "student_batch", + "fieldtype": "Link", + "label": "Student Batch", + "options": "Student Batch Name", + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "student_email", + "fieldtype": "Data", + "label": "Student Email", + "options": "Email", + "print_hide": 1 + }, + { + "fieldname": "column_break_16", + "fieldtype": "Column Break" + }, + { + "fieldname": "student_category", + "fieldtype": "Link", + "label": "Student Category", + "options": "Student Category" + }, + { + "fieldname": "academic_term", + "fieldtype": "Link", + "label": "Academic Term", + "options": "Academic Term" + }, + { + "fieldname": "academic_year", + "fieldtype": "Link", + "label": "Academic Year", + "options": "Academic Year" + }, + { + "fieldname": "section_break_7", + "fieldtype": "Section Break" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Currency", + "options": "Currency", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "fee_structure", + "fieldtype": "Link", + "label": "Fee Structure", + "options": "Fee Structure", + "print_hide": 1 + }, + { + "fieldname": "section_break_10", + "fieldtype": "Section Break" + }, + { + "default": "0", + "fieldname": "grand_total", + "fieldtype": "Currency", + "label": "Grand Total" + }, + { + "fieldname": "grand_total_in_words", + "fieldtype": "Data", + "label": "In Words", + "read_only": 1 + }, + { + "fieldname": "column_break_11", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "outstanding_amount", + "fieldtype": "Currency", + "label": "Outstanding Amount", + "no_copy": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "edit_printing_settings", + "fieldtype": "Section Break", + "label": "Printing Settings", + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "options": "Letter Head", + "print_hide": 1 + }, + { + "fieldname": "column_break_32", + "fieldtype": "Column Break" + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "options": "Print Heading", + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "account", + "fieldtype": "Section Break", + "label": "Accounting", + "print_hide": 1 + }, + { + "fieldname": "receivable_account", + "fieldtype": "Link", + "label": "Receivable Account", + "options": "Account", + "print_hide": 1, + "reqd": 1 + }, + { + "fieldname": "column_break_39", + "fieldtype": "Column Break", + "print_hide": 1 + }, + { + "fieldname": "income_account", + "fieldtype": "Link", + "label": "Income Account", + "options": "Account", + "print_hide": 1 + }, + { + "fieldname": "accounting_dimensions_section", + "fieldtype": "Section Break", + "label": "Accounting Dimensions" + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center", + "print_hide": 1 + }, + { + "fieldname": "dimension_col_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Student Applicant Fees", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "bank_reference", + "fieldtype": "Data", + "label": "Bank Reference", + "no_copy": 1, + "read_only": 1 + }, + { + "fetch_from": "company.abbr", + "fieldname": "abbr", + "fieldtype": "Data", + "label": "Abbr", + "read_only": 1 + }, + { + "fieldname": "callback_token", + "fieldtype": "Data", + "label": "Callback Token", + "no_copy": 1, + "read_only": 1 + } + ], + "is_submittable": 1, + "modified": "2020-08-24 16:45:12.635352", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Student Applicant Fees", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, + "write": 1 + } + ], + "restrict_to_domain": "Education", + "search_fields": "student, student_name", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "student_name" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.py b/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.py new file mode 100644 index 0000000..90a8767 --- /dev/null +++ b/csf_tz/csf_tz/doctype/student_applicant_fees/student_applicant_fees.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ +import binascii +import os +from csf_tz.bank_api import invoice_submission, cancel_invoice + +class StudentApplicantFees(Document): + def after_insert(self): + if not check_send_fee_details_to_bank(self.company): + return + self.callback_token = binascii.hexlify(os.urandom(14)).decode() + series = frappe.get_value("Company", self.company, "nmb_series") or "" + if not series: + frappe.throw(_("Please set NMB User Series in Company {0}".format(self.company))) + reference = str(series) + 'R' + str(self.name) + if not self.abbr: + self.abbr = frappe.get_value("Company", self.company, "abbr") or "" + self.bank_reference = reference.replace('-', '').replace('RFEE'+self.abbr,'') + + + def on_submit(self): + if not check_send_fee_details_to_bank(self.company): + return + invoice_submission(self) + + + def on_cancel(self): + if check_send_fee_details_to_bank(self.company): + cancel_invoice(self, "on_cancel") + doc = frappe.get_doc("Student Applicant", self.student) + doc.bank_reference = None + doc.student_applicant_fee = None + doc.application_status = "Applied" + doc.db_update() + + +def check_send_fee_details_to_bank(company): + send_fee_details_to_bank = frappe.get_value("Company", company, "send_fee_details_to_bank") or 0 + if not send_fee_details_to_bank: + return False + else: + return True \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/student_applicant_fees/test_student_applicant_fees.py b/csf_tz/csf_tz/doctype/student_applicant_fees/test_student_applicant_fees.py new file mode 100644 index 0000000..98bb30f --- /dev/null +++ b/csf_tz/csf_tz/doctype/student_applicant_fees/test_student_applicant_fees.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestStudentApplicantFees(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/theme/__init__.py b/csf_tz/csf_tz/doctype/theme/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/theme/test_theme.py b/csf_tz/csf_tz/doctype/theme/test_theme.py new file mode 100644 index 0000000..1ac670f --- /dev/null +++ b/csf_tz/csf_tz/doctype/theme/test_theme.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestTheme(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/theme/theme.js b/csf_tz/csf_tz/doctype/theme/theme.js new file mode 100644 index 0000000..56c6710 --- /dev/null +++ b/csf_tz/csf_tz/doctype/theme/theme.js @@ -0,0 +1,8 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Theme', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/theme/theme.json b/csf_tz/csf_tz/doctype/theme/theme.json new file mode 100644 index 0000000..0195c8a --- /dev/null +++ b/csf_tz/csf_tz/doctype/theme/theme.json @@ -0,0 +1,38 @@ +{ + "creation": "2020-09-16 18:58:21.003962", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "theme" + ], + "fields": [ + { + "fieldname": "theme", + "fieldtype": "Code", + "label": "Theme" + } + ], + "issingle": 1, + "modified": "2020-09-16 18:58:21.003962", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Theme", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/theme/theme.py b/csf_tz/csf_tz/doctype/theme/theme.py new file mode 100644 index 0000000..b8f579f --- /dev/null +++ b/csf_tz/csf_tz/doctype/theme/theme.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class Theme(Document): + def validate(self): + csf_theme = open("../apps/csf_tz/csf_tz/public/css/theme.css" ,"w+") + csf_theme.write(self.theme) + csf_theme.close() diff --git a/csf_tz/csf_tz/doctype/tz_district/__init__.py b/csf_tz/csf_tz/doctype/tz_district/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_district/test_tz_district.py b/csf_tz/csf_tz/doctype/tz_district/test_tz_district.py new file mode 100644 index 0000000..9f30068 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_district/test_tz_district.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestTZDistrict(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/tz_district/tz_district.js b/csf_tz/csf_tz/doctype/tz_district/tz_district.js new file mode 100644 index 0000000..c4d7fe2 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_district/tz_district.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('TZ District', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/tz_district/tz_district.json b/csf_tz/csf_tz/doctype/tz_district/tz_district.json new file mode 100644 index 0000000..7e46a63 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_district/tz_district.json @@ -0,0 +1,54 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:district", + "creation": "2021-12-27 15:50:17.401363", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "district", + "region" + ], + "fields": [ + { + "fieldname": "district", + "fieldtype": "Data", + "in_list_view": 1, + "label": "District", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "region", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Region", + "options": "TZ Region", + "reqd": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-12-27 15:50:25.791120", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ District", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_district/tz_district.py b/csf_tz/csf_tz/doctype/tz_district/tz_district.py new file mode 100644 index 0000000..f69f3b2 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_district/tz_district.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZDistrict(Document): + pass diff --git a/csf_tz/csf_tz/doctype/tz_insurance_company_detail/__init__.py b/csf_tz/csf_tz/doctype/tz_insurance_company_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_insurance_company_detail/tz_insurance_company_detail.json b/csf_tz/csf_tz/doctype/tz_insurance_company_detail/tz_insurance_company_detail.json new file mode 100644 index 0000000..67411b6 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_company_detail/tz_insurance_company_detail.json @@ -0,0 +1,226 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-11 10:11:22.494704", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "createddate", + "updateddate", + "createdby", + "updatedby", + "id", + "companycode", + "companynumber", + "companytypeid", + "companyname", + "businesstypeid", + "incorporationcertificatenumber", + "numberlocalstaff", + "numberforeignstaff", + "totalshareowned", + "totalsharealloted", + "column_break_16", + "incorporationdate", + "initialregistrationdate", + "businesscommencementdate", + "countryid", + "regionid", + "districtid", + "locationstreet", + "companyphone1", + "companyphone2", + "companyphone3", + "companyfax", + "postaladdress", + "emailaddress", + "statusid", + "smsnotification", + "emailnotification", + "shareholders" + ], + "fields": [ + { + "fieldname": "createddate", + "fieldtype": "Data", + "label": "createdDate" + }, + { + "fieldname": "updateddate", + "fieldtype": "Data", + "label": "updatedDate" + }, + { + "fieldname": "createdby", + "fieldtype": "Data", + "label": "createdBy" + }, + { + "fieldname": "updatedby", + "fieldtype": "Data", + "label": "updatedBy" + }, + { + "fieldname": "id", + "fieldtype": "Data", + "label": "ID" + }, + { + "fieldname": "companycode", + "fieldtype": "Data", + "in_list_view": 1, + "label": "companyCode" + }, + { + "fieldname": "companynumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "companyNumber" + }, + { + "fieldname": "companytypeid", + "fieldtype": "Data", + "label": "companyTypeId" + }, + { + "fieldname": "businesstypeid", + "fieldtype": "Data", + "label": "businessTypeId" + }, + { + "fieldname": "companyname", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "companyName" + }, + { + "fieldname": "incorporationcertificatenumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "incorporationCertificateNumber" + }, + { + "fieldname": "numberlocalstaff", + "fieldtype": "Data", + "label": "numberLocalStaff" + }, + { + "fieldname": "numberforeignstaff", + "fieldtype": "Data", + "label": "numberForeignStaff" + }, + { + "fieldname": "totalshareowned", + "fieldtype": "Data", + "label": "totalShareOwned" + }, + { + "fieldname": "totalsharealloted", + "fieldtype": "Data", + "label": "totalShareAlloted" + }, + { + "fieldname": "column_break_16", + "fieldtype": "Column Break" + }, + { + "fieldname": "incorporationdate", + "fieldtype": "Data", + "label": "incorporationDate" + }, + { + "fieldname": "initialregistrationdate", + "fieldtype": "Data", + "label": "initialRegistrationDate" + }, + { + "fieldname": "businesscommencementdate", + "fieldtype": "Data", + "label": "businessCommencementDate" + }, + { + "fieldname": "countryid", + "fieldtype": "Data", + "label": "countryId" + }, + { + "fieldname": "regionid", + "fieldtype": "Data", + "label": "regionId" + }, + { + "fieldname": "districtid", + "fieldtype": "Data", + "label": "districtId" + }, + { + "fieldname": "locationstreet", + "fieldtype": "Data", + "label": "locationStreet" + }, + { + "fieldname": "companyphone1", + "fieldtype": "Data", + "label": "companyPhone1" + }, + { + "fieldname": "companyphone2", + "fieldtype": "Data", + "label": "companyPhone2" + }, + { + "fieldname": "companyphone3", + "fieldtype": "Data", + "label": "companyPhone3" + }, + { + "fieldname": "companyfax", + "fieldtype": "Data", + "label": "companyFax" + }, + { + "fieldname": "postaladdress", + "fieldtype": "Data", + "label": "postalAddress" + }, + { + "fieldname": "emailaddress", + "fieldtype": "Data", + "label": "emailAddress" + }, + { + "fieldname": "statusid", + "fieldtype": "Data", + "label": "statusId" + }, + { + "fieldname": "smsnotification", + "fieldtype": "Data", + "label": "smsNotification" + }, + { + "fieldname": "emailnotification", + "fieldtype": "Data", + "label": "emailNotification" + }, + { + "fieldname": "shareholders", + "fieldtype": "Data", + "label": "shareholders", + "length": 1000 + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-05-11 22:30:32.415238", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Insurance Company Detail", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_insurance_company_detail/tz_insurance_company_detail.py b/csf_tz/csf_tz/doctype/tz_insurance_company_detail/tz_insurance_company_detail.py new file mode 100644 index 0000000..1edb376 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_company_detail/tz_insurance_company_detail.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZInsuranceCompanyDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/tz_insurance_cover_note/__init__.py b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_insurance_cover_note/test_tz_insurance_cover_note.py b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/test_tz_insurance_cover_note.py new file mode 100644 index 0000000..8c7f40e --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/test_tz_insurance_cover_note.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestTZInsuranceCoverNote(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.js b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.js new file mode 100644 index 0000000..52e9a22 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('TZ Insurance Cover Note', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.json b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.json new file mode 100644 index 0000000..e198668 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.json @@ -0,0 +1,284 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:covernotenumber", + "creation": "2022-05-10 23:24:14.394684", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "vehicle", + "covernotenumber", + "covernotestartdate", + "covernoteenddate", + "stickernumber", + "covernotereferencenumber", + "productname", + "classofbusiness", + "transactingcompany", + "transactingcompanytype", + "covernotedescription", + "officername", + "column_break_5", + "ismotor", + "isfleet", + "statustitle", + "currencycode", + "totalpremiumamountexcludingtax", + "totalpremiumamountincludingtax", + "commisionrate", + "exchangerate", + "commisionpaid", + "vat", + "operativeclause", + "officertitle", + "fleetidentificationnumber", + "fleetsize", + "premiumlevy", + "section_break_28", + "insurance_motors", + "section_break_30", + "insurance_provider", + "section_break_31", + "policy_holders" + ], + "fields": [ + { + "fieldname": "vehicle", + "fieldtype": "Data", + "label": "Vehicle", + "read_only": 1 + }, + { + "fieldname": "covernotenumber", + "fieldtype": "Data", + "label": "coverNoteNumber", + "read_only": 1, + "unique": 1 + }, + { + "fieldname": "covernotestartdate", + "fieldtype": "Data", + "label": "coverNoteStartDate", + "read_only": 1 + }, + { + "fieldname": "covernoteenddate", + "fieldtype": "Data", + "label": "coverNoteEndDate", + "read_only": 1 + }, + { + "fieldname": "column_break_5", + "fieldtype": "Column Break" + }, + { + "fieldname": "statustitle", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "statusTitle", + "read_only": 1 + }, + { + "fieldname": "stickernumber", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "stickerNumber", + "read_only": 1 + }, + { + "fieldname": "covernotereferencenumber", + "fieldtype": "Data", + "label": "coverNoteReferenceNumber", + "read_only": 1 + }, + { + "fieldname": "operativeclause", + "fieldtype": "Data", + "label": "operativeClause", + "read_only": 1 + }, + { + "fieldname": "covernotedescription", + "fieldtype": "Data", + "label": "coverNoteDescription", + "length": 1000, + "read_only": 1 + }, + { + "fieldname": "officername", + "fieldtype": "Data", + "label": "officerName", + "read_only": 1 + }, + { + "fieldname": "officertitle", + "fieldtype": "Data", + "label": "officerTitle", + "read_only": 1 + }, + { + "fieldname": "fleetidentificationnumber", + "fieldtype": "Data", + "label": "fleetIdentificationNumber", + "read_only": 1 + }, + { + "fieldname": "currencycode", + "fieldtype": "Data", + "label": "currencyCode", + "read_only": 1 + }, + { + "fieldname": "totalpremiumamountexcludingtax", + "fieldtype": "Currency", + "label": "totalPremiumAmountExcludingTax", + "read_only": 1 + }, + { + "fieldname": "commisionpaid", + "fieldtype": "Currency", + "label": "commisionPaid", + "read_only": 1 + }, + { + "fieldname": "vat", + "fieldtype": "Data", + "label": "Vat", + "read_only": 1 + }, + { + "default": "0", + "fieldname": "ismotor", + "fieldtype": "Check", + "in_standard_filter": 1, + "label": "isMotor", + "read_only": 1 + }, + { + "default": "0", + "fieldname": "isfleet", + "fieldtype": "Check", + "label": "isFleet", + "read_only": 1 + }, + { + "fieldname": "fleetsize", + "fieldtype": "Data", + "label": "fleetSize", + "read_only": 1 + }, + { + "fieldname": "exchangerate", + "fieldtype": "Currency", + "label": "exchangeRate", + "read_only": 1 + }, + { + "fieldname": "totalpremiumamountincludingtax", + "fieldtype": "Currency", + "label": "totalPremiumAmountIncludingTax", + "read_only": 1 + }, + { + "fieldname": "commisionrate", + "fieldtype": "Currency", + "label": "commisionRate", + "read_only": 1 + }, + { + "fieldname": "premiumlevy", + "fieldtype": "Data", + "label": "premiumLevy", + "read_only": 1 + }, + { + "fieldname": "section_break_28", + "fieldtype": "Section Break", + "label": "Vehicle Details" + }, + { + "fieldname": "productname", + "fieldtype": "Data", + "label": "productName", + "read_only": 1 + }, + { + "fieldname": "transactingcompany", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "transactingCompany", + "read_only": 1 + }, + { + "fieldname": "classofbusiness", + "fieldtype": "Data", + "label": "classOfBusiness", + "read_only": 1 + }, + { + "fieldname": "transactingcompanytype", + "fieldtype": "Data", + "label": "transactingCompanyType", + "read_only": 1 + }, + { + "fieldname": "insurance_motors", + "fieldtype": "Table", + "options": "TZ Insurance Vehicle Detail", + "read_only": 1 + }, + { + "fieldname": "section_break_30", + "fieldtype": "Section Break", + "label": "Insurance Provider Details" + }, + { + "fieldname": "section_break_31", + "fieldtype": "Section Break", + "label": "Policy Holder Details" + }, + { + "fieldname": "insurance_provider", + "fieldtype": "Table", + "options": "TZ Insurance Company Detail", + "read_only": 1 + }, + { + "fieldname": "policy_holders", + "fieldtype": "Table", + "options": "TZ Insurance Policy Holder Detail", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2022-05-12 10:49:58.898715", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Insurance Cover Note", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "vehicle", + "track_changes": 1, + "track_seen": 1, + "track_views": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.py b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.py new file mode 100644 index 0000000..b912aec --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_cover_note/tz_insurance_cover_note.py @@ -0,0 +1,130 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +import requests +import json +from datetime import datetime +from frappe.utils import cint +from frappe.model.document import Document + +class TZInsuranceCoverNote(Document): + pass + +@frappe.whitelist() +def update_covernote_docs(): + """Create or Update covernote document after getting necessary details from tira + + The routine to create or update covernote document runs on 00:00 am, 1st date of every month + Forexample: + for June: a routine will run on 00:00 am, June 1, 2022 + """ + + motor_vehicles = frappe.get_all('Vehicle', 'name') + + for vehicle in motor_vehicles: + req = get_covernote_details(vehicle.name) + try: + for record in req.get('data'): + if not frappe.db.exists('TZ Insurance Cover Note', record['coverNoteNumber']): + doc = frappe.new_doc('TZ Insurance Cover Note') + else: + doc = frappe.get_doc('TZ Insurance Cover Note', record['coverNoteNumber']) + + for key, value in record.items(): + + if key.lower() == 'motor': + row = {} + doc.insurance_motors = [] + for motor_child_key, motor_child_value in value.items(): + motor_new_value = None + if motor_child_value and motor_child_key.lower() in ['createddate', 'updateddate']: + unix_timestamp_int = cint(motor_child_value) + motor_new_value = datetime.utcfromtimestamp((unix_timestamp_int/1000)).strftime('%Y-%m-%d %H:%M:%S') + else: + motor_new_value = motor_child_value + + row[motor_child_key.lower()] = motor_new_value + + doc.append('insurance_motors', row) + + if key.lower() == 'company': + row = {} + doc.insurance_provider = [] + for company_child_key, company_child_value in value.items(): + company_new_value = None + if company_child_value and company_child_key.lower() in ['createddate', 'updateddate', 'incorporationdate', 'initialregistrationdate', 'businesscommencementdate']: + unix_timestamp_int = cint(company_child_value) + company_new_value = datetime.utcfromtimestamp((unix_timestamp_int/1000)).strftime('%Y-%m-%d %H:%M:%S') + + elif company_child_key.lower() == 'shareholders': + company_new_value = json.dumps(company_child_value) + + else: + company_new_value = company_child_value + + row[company_child_key.lower()] = company_new_value + + doc.append('insurance_provider', row) + + if key.lower() == 'policyholders': + doc.policy_holders = [] + for i, row in enumerate(value): + new_row = {} + for policy_child_key, policy_child_value in row.items(): + policy_new_value = None + if policy_child_value and policy_child_key.lower() in ['createddate', 'updateddate', 'policyholderbirthdate']: + unix_timestamp_int = cint(policy_child_value) + policy_new_value = datetime.utcfromtimestamp((unix_timestamp_int/1000)).strftime('%Y-%m-%d %H:%M:%S') + + else: + policy_new_value = policy_child_value + + new_row[policy_child_key.lower()] = policy_new_value + + doc.append('policy_holders', new_row) + + if key.lower() not in ['covernotestartdate', 'covernoteenddate', 'company', 'motor', 'policyholders']: + doc.update({key.lower(): value}) + + if key.lower() in ['covernotestartdate', 'covernoteenddate']: + unix_timestamp_int = cint(value) + date_value = datetime.utcfromtimestamp((unix_timestamp_int/1000.0)).strftime('%Y-%m-%d %H:%M:%S') + doc.update({key.lower(): date_value}) + + doc.vehicle = vehicle.name + doc.save(ignore_permissions=True) + + except Exception as e: + frappe.log_error(frappe.get_traceback(), str(e)) + + frappe.db.commit() + return True + +def get_covernote_details(regnumber): + """Fetch motor insurance details from tira + + :param regnumber: car registration number + """ + url = "https://tiramis.tira.go.tz/covernote/api/public/portal/verify" + + payload = json.dumps({ + "paramType": 2, + "searchParam": regnumber + }) + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + } + + try: + response = requests.post(url, headers=headers, data=payload, timeout=3000, verify=False) + if response.status_code == 200: + return json.loads(response.text) + else: + frappe.log_error(response.text, str(response.status_code)) + + except Exception as e: + frappe.log_error(frappe.get_traceback(), str(e)) + + diff --git a/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/__init__.py b/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/tz_insurance_policy_holder_detail.json b/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/tz_insurance_policy_holder_detail.json new file mode 100644 index 0000000..39e11d3 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/tz_insurance_policy_holder_detail.json @@ -0,0 +1,189 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-11 10:19:41.462744", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "createddate", + "updateddate", + "createdby", + "updatedby", + "id", + "policyholdertypeid", + "policyholderfullname", + "policyholderbirthdate", + "policyholderidentitynumber", + "policyholderidentitytypeid", + "genderid", + "countryid", + "countrycode", + "column_break_14", + "districtid", + "districtname", + "regionname", + "locationstreet", + "policyholderphone1", + "policyholderphone2", + "policyholderphone3", + "policyholderfax", + "postaladdress", + "emailaddress", + "companyid", + "statusid", + "systemid" + ], + "fields": [ + { + "fieldname": "createddate", + "fieldtype": "Data", + "label": "createdDate" + }, + { + "fieldname": "updateddate", + "fieldtype": "Data", + "label": "updatedDate" + }, + { + "fieldname": "createdby", + "fieldtype": "Data", + "label": "createdBy" + }, + { + "fieldname": "updatedby", + "fieldtype": "Data", + "label": "updatedBy" + }, + { + "fieldname": "id", + "fieldtype": "Data", + "label": "id" + }, + { + "fieldname": "policyholdertypeid", + "fieldtype": "Data", + "label": "policyHolderTypeId" + }, + { + "fieldname": "policyholderfullname", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "policyHolderFullName" + }, + { + "fieldname": "policyholderbirthdate", + "fieldtype": "Data", + "label": "policyHolderBirthDate" + }, + { + "fieldname": "policyholderidentitynumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "policyHolderIdentityNumber" + }, + { + "fieldname": "policyholderidentitytypeid", + "fieldtype": "Data", + "label": "policyHolderIdentityTypeId" + }, + { + "fieldname": "genderid", + "fieldtype": "Data", + "label": "genderId" + }, + { + "fieldname": "countryid", + "fieldtype": "Data", + "label": "countryId" + }, + { + "fieldname": "countrycode", + "fieldtype": "Data", + "label": "countryCode" + }, + { + "fieldname": "column_break_14", + "fieldtype": "Column Break" + }, + { + "fieldname": "districtid", + "fieldtype": "Data", + "label": "districtId" + }, + { + "fieldname": "districtname", + "fieldtype": "Data", + "in_list_view": 1, + "label": "districtName" + }, + { + "fieldname": "regionname", + "fieldtype": "Data", + "in_list_view": 1, + "label": "regionName" + }, + { + "fieldname": "locationstreet", + "fieldtype": "Data", + "label": "locationStreet" + }, + { + "fieldname": "policyholderphone1", + "fieldtype": "Data", + "label": "policyHolderPhone1" + }, + { + "fieldname": "policyholderphone2", + "fieldtype": "Data", + "label": "policyHolderPhone2" + }, + { + "fieldname": "policyholderphone3", + "fieldtype": "Data", + "label": "policyHolderPhone3" + }, + { + "fieldname": "policyholderfax", + "fieldtype": "Data", + "label": "policyHolderFax" + }, + { + "fieldname": "postaladdress", + "fieldtype": "Data", + "label": "postalAddress" + }, + { + "fieldname": "emailaddress", + "fieldtype": "Data", + "label": "emailAddress" + }, + { + "fieldname": "companyid", + "fieldtype": "Data", + "label": "companyId" + }, + { + "fieldname": "statusid", + "fieldtype": "Data", + "label": "statusId" + }, + { + "fieldname": "systemid", + "fieldtype": "Data", + "label": "systemId" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-05-11 22:23:19.812728", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Insurance Policy Holder Detail", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/tz_insurance_policy_holder_detail.py b/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/tz_insurance_policy_holder_detail.py new file mode 100644 index 0000000..b6f0d5c --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_policy_holder_detail/tz_insurance_policy_holder_detail.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZInsurancePolicyHolderDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/__init__.py b/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/tz_insurance_vehicle_detail.json b/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/tz_insurance_vehicle_detail.json new file mode 100644 index 0000000..dfccd4d --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/tz_insurance_vehicle_detail.json @@ -0,0 +1,198 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-05-11 09:55:44.171655", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "registrationnumber", + "make", + "model", + "enginenumber", + "enginecapacity", + "numberofaxles", + "sittingcapacity", + "createddate", + "createdby", + "column_break_10", + "chassisnumber", + "bodytype", + "modelnumber", + "color", + "fuelused", + "axledistance", + "id", + "updateddate", + "updatedby", + "tareweight", + "grossweight", + "motorusageid", + "ownername", + "owneraddress", + "ownercategoryid", + "motorcategoryid", + "covernoteid", + "yearofmanufacture" + ], + "fields": [ + { + "fieldname": "registrationnumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "registrationNumber" + }, + { + "fieldname": "make", + "fieldtype": "Data", + "in_list_view": 1, + "label": "make" + }, + { + "fieldname": "model", + "fieldtype": "Data", + "in_list_view": 1, + "label": "model" + }, + { + "fieldname": "enginenumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "engineNumber" + }, + { + "fieldname": "enginecapacity", + "fieldtype": "Data", + "label": "engineCapacity" + }, + { + "fieldname": "numberofaxles", + "fieldtype": "Data", + "label": "numberOfAxles" + }, + { + "fieldname": "sittingcapacity", + "fieldtype": "Data", + "label": "sittingCapacity" + }, + { + "fieldname": "createddate", + "fieldtype": "Data", + "label": "createdDate" + }, + { + "fieldname": "createdby", + "fieldtype": "Data", + "label": "createdBy" + }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break" + }, + { + "fieldname": "chassisnumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "chassisNumber" + }, + { + "fieldname": "bodytype", + "fieldtype": "Data", + "in_list_view": 1, + "label": "bodyType" + }, + { + "fieldname": "modelnumber", + "fieldtype": "Data", + "in_list_view": 1, + "label": "modelNumber" + }, + { + "fieldname": "color", + "fieldtype": "Data", + "label": "color" + }, + { + "fieldname": "fuelused", + "fieldtype": "Data", + "label": "fuelUsed" + }, + { + "fieldname": "axledistance", + "fieldtype": "Data", + "label": "axleDistance" + }, + { + "fieldname": "id", + "fieldtype": "Data", + "label": "id" + }, + { + "fieldname": "updateddate", + "fieldtype": "Data", + "label": "updatedDate" + }, + { + "fieldname": "updatedby", + "fieldtype": "Data", + "label": "updatedBy" + }, + { + "fieldname": "tareweight", + "fieldtype": "Data", + "label": "tareWeight" + }, + { + "fieldname": "grossweight", + "fieldtype": "Data", + "label": "grossWeight" + }, + { + "fieldname": "motorusageid", + "fieldtype": "Data", + "label": "motorUsageId" + }, + { + "fieldname": "ownername", + "fieldtype": "Data", + "in_list_view": 1, + "label": "ownerName" + }, + { + "fieldname": "owneraddress", + "fieldtype": "Data", + "label": "ownerAddress" + }, + { + "fieldname": "ownercategoryid", + "fieldtype": "Data", + "label": "ownerCategoryId" + }, + { + "fieldname": "motorcategoryid", + "fieldtype": "Data", + "label": "motorCategoryId" + }, + { + "fieldname": "covernoteid", + "fieldtype": "Data", + "label": "coverNoteId" + }, + { + "fieldname": "yearofmanufacture", + "fieldtype": "Data", + "label": "yearOfManufacture" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-05-11 22:48:18.492753", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Insurance Vehicle Detail", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/tz_insurance_vehicle_detail.py b/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/tz_insurance_vehicle_detail.py new file mode 100644 index 0000000..b4d83cb --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_insurance_vehicle_detail/tz_insurance_vehicle_detail.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZInsuranceVehicleDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/tz_region/__init__.py b/csf_tz/csf_tz/doctype/tz_region/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_region/test_tz_region.py b/csf_tz/csf_tz/doctype/tz_region/test_tz_region.py new file mode 100644 index 0000000..141eef1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_region/test_tz_region.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestTZRegion(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/tz_region/tz_region.js b/csf_tz/csf_tz/doctype/tz_region/tz_region.js new file mode 100644 index 0000000..c4d40ab --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_region/tz_region.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('TZ Region', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/tz_region/tz_region.json b/csf_tz/csf_tz/doctype/tz_region/tz_region.json new file mode 100644 index 0000000..384b9a5 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_region/tz_region.json @@ -0,0 +1,43 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:region", + "creation": "2021-12-27 15:50:11.043448", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "region" + ], + "fields": [ + { + "fieldname": "region", + "fieldtype": "Data", + "label": "Region", + "unique": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-12-27 15:50:11.043448", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Region", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_region/tz_region.py b/csf_tz/csf_tz/doctype/tz_region/tz_region.py new file mode 100644 index 0000000..9c11a91 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_region/tz_region.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZRegion(Document): + pass diff --git a/csf_tz/csf_tz/doctype/tz_village/__init__.py b/csf_tz/csf_tz/doctype/tz_village/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_village/test_tz_village.py b/csf_tz/csf_tz/doctype/tz_village/test_tz_village.py new file mode 100644 index 0000000..db2f18c --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_village/test_tz_village.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestTZVillage(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/tz_village/tz_village.js b/csf_tz/csf_tz/doctype/tz_village/tz_village.js new file mode 100644 index 0000000..7e9e31c --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_village/tz_village.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('TZ Village', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/tz_village/tz_village.json b/csf_tz/csf_tz/doctype/tz_village/tz_village.json new file mode 100644 index 0000000..a6fed8c --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_village/tz_village.json @@ -0,0 +1,52 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:village", + "creation": "2021-12-27 15:44:43.576565", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "village", + "ward" + ], + "fields": [ + { + "fieldname": "village", + "fieldtype": "Data", + "label": "Village", + "unique": 1 + }, + { + "fieldname": "ward", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Ward", + "options": "TZ Ward", + "reqd": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-12-27 15:50:33.584381", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Village", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_village/tz_village.py b/csf_tz/csf_tz/doctype/tz_village/tz_village.py new file mode 100644 index 0000000..c5f4c45 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_village/tz_village.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZVillage(Document): + pass diff --git a/csf_tz/csf_tz/doctype/tz_ward/__init__.py b/csf_tz/csf_tz/doctype/tz_ward/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/tz_ward/test_tz_ward.py b/csf_tz/csf_tz/doctype/tz_ward/test_tz_ward.py new file mode 100644 index 0000000..5a7f004 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_ward/test_tz_ward.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt + +# import frappe +import unittest + +class TestTZWard(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/tz_ward/tz_ward.js b/csf_tz/csf_tz/doctype/tz_ward/tz_ward.js new file mode 100644 index 0000000..515bc99 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_ward/tz_ward.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('TZ Ward', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/tz_ward/tz_ward.json b/csf_tz/csf_tz/doctype/tz_ward/tz_ward.json new file mode 100644 index 0000000..258e9dc --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_ward/tz_ward.json @@ -0,0 +1,54 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "field:ward", + "creation": "2021-12-27 15:50:30.018270", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "ward", + "district" + ], + "fields": [ + { + "fieldname": "ward", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Ward", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "district", + "fieldtype": "Link", + "in_list_view": 1, + "label": "District", + "options": "TZ District", + "reqd": 1 + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-12-27 15:50:30.018270", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TZ Ward", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/tz_ward/tz_ward.py b/csf_tz/csf_tz/doctype/tz_ward/tz_ward.py new file mode 100644 index 0000000..d6d10e5 --- /dev/null +++ b/csf_tz/csf_tz/doctype/tz_ward/tz_ward.py @@ -0,0 +1,8 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class TZWard(Document): + pass diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/__init__.py b/csf_tz/csf_tz/doctype/vehicle_consignment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/test_vehicle_consignment.py b/csf_tz/csf_tz/doctype/vehicle_consignment/test_vehicle_consignment.py new file mode 100644 index 0000000..8fc1d42 --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_consignment/test_vehicle_consignment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestVehicleConsignment(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.js b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.js new file mode 100644 index 0000000..2302512 --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Consignment', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.json b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.json new file mode 100644 index 0000000..72d0f88 --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.json @@ -0,0 +1,77 @@ +{ + "actions": [], + "autoname": "VCONS-.YYYY.-.###", + "creation": "2021-01-19 11:24:49.205307", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "parent_item", + "column_break_2", + "quantity", + "section_break_5", + "vehicle_consignment_detail", + "amended_from" + ], + "fields": [ + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "parent_item", + "fieldtype": "Link", + "label": "Parent Item", + "options": "Item" + }, + { + "fieldname": "quantity", + "fieldtype": "Int", + "label": "Quantity" + }, + { + "fieldname": "section_break_5", + "fieldtype": "Section Break" + }, + { + "fieldname": "vehicle_consignment_detail", + "fieldtype": "Table", + "label": "Vehicle Consignment Detail", + "options": "Vehicle Consignment Detail" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Vehicle Consignment", + "print_hide": 1, + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2021-01-19 11:34:41.517181", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Vehicle Consignment", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.py b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.py new file mode 100644 index 0000000..4957bfc --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class VehicleConsignment(Document): + pass diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/__init__.py b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.json b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.json new file mode 100644 index 0000000..fbcb6aa --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.json @@ -0,0 +1,32 @@ +{ + "actions": [], + "creation": "2021-01-19 11:24:20.882509", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "bom" + ], + "fields": [ + { + "fieldname": "bom", + "fieldtype": "Link", + "in_list_view": 1, + "label": "BOM", + "options": "BOM" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2021-01-19 11:24:20.882509", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Vehicle Consignment Detail", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.py b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.py new file mode 100644 index 0000000..25d88e4 --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class VehicleConsignmentDetail(Document): + pass diff --git a/csf_tz/csf_tz/doctype/vehicle_fine_record/__init__.py b/csf_tz/csf_tz/doctype/vehicle_fine_record/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/vehicle_fine_record/test_vehicle_fine_record.py b/csf_tz/csf_tz/doctype/vehicle_fine_record/test_vehicle_fine_record.py new file mode 100644 index 0000000..cf306b1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_fine_record/test_vehicle_fine_record.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestVehicleFineRecord(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.js b/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.js new file mode 100644 index 0000000..2f13cec --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.js @@ -0,0 +1,8 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Fine Record', { + // refresh: function(frm) { + + // } +}); diff --git a/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.json b/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.json new file mode 100644 index 0000000..c52f06b --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.json @@ -0,0 +1,129 @@ +{ + "autoname": "field:reference", + "creation": "2020-07-12 16:43:35.877811", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "reference", + "issued_date", + "officer", + "vehicle", + "licence", + "status", + "offence", + "charge", + "penalty", + "total", + "location" + ], + "fields": [ + { + "fieldname": "reference", + "fieldtype": "Data", + "label": "REFERENCE", + "read_only": 1, + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "issued_date", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "ISSUED DATE", + "read_only": 1 + }, + { + "fieldname": "officer", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "OFFICER", + "read_only": 1 + }, + { + "fieldname": "vehicle", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "VEHICLE", + "options": "Vehicle", + "read_only": 1 + }, + { + "fieldname": "licence", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "LICENCE", + "read_only": 1 + }, + { + "fieldname": "location", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "LOCATION", + "read_only": 1 + }, + { + "fieldname": "offence", + "fieldtype": "Text", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "OFFENCE", + "read_only": 1 + }, + { + "fieldname": "charge", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "CHARGE", + "read_only": 1 + }, + { + "fieldname": "penalty", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "PENALTY", + "read_only": 1 + }, + { + "fieldname": "total", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "TOTAL", + "read_only": 1 + }, + { + "fieldname": "status", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "STATUS", + "read_only": 1 + } + ], + "modified": "2021-02-04 08:41:39.513542", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Vehicle Fine Record", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "vehicle", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.py b/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.py new file mode 100644 index 0000000..e7018aa --- /dev/null +++ b/csf_tz/csf_tz/doctype/vehicle_fine_record/vehicle_fine_record.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document +import frappe +from frappe import _ +import requests +from requests.exceptions import Timeout +from bs4 import BeautifulSoup +from csf_tz.custom_api import print_out + + +class VehicleFineRecord(Document): + pass + + +def check_fine_all_vehicles(): + plate_list = frappe.get_all("Vehicle") + for vehicle in plate_list: + get_fine(vehicle["name"]) + reference_list = frappe.get_all( + "Vehicle Fine Record", filters={"status": ["!=", "PAID"]}) + for reference in reference_list: + update_fine(reference["name"]) + + +def get_fine(number_plate=None): + field_list = ["reference", "issued_date", "officer", "vehicle", "licence", + "location", "offence", "charge", "penalty", "total", "status", "qr_code"] + formSig = "plcwb4um7FCh8BxsRRTBZ%2FXzw84N5SUnMv6ctKWPaiM%3D" + url = "https://tms.tpf.go.tz/" + + try: + response = requests.post(url=url, timeout=5) + except Timeout: + frappe.msgprint(_("Error")) + else: + if response.status_code == 200: + soup = BeautifulSoup(response.text, 'html.parser') + formSig = soup.find(attrs={"type": "hidden"})['value'] + payload = { + 'service': 'VEHICLE', + 'vehicle': number_plate, + 'formSig': formSig + } + response2 = requests.post(url=url, data=payload, timeout=5) + soup = BeautifulSoup(response2.text, 'html.parser') + trs = soup.find_all('tr') + for tr in trs: + fields_dict = {'doctype': 'Vehicle Fine Record'} + soup_tr = BeautifulSoup(str(tr), 'html.parser') + tds = soup_tr.find_all('td') + if len(tds) > 1: + i = 0 + for td in tds: + soup_td = BeautifulSoup(str(td), 'html.parser') + td = soup_td.find('td').getText() + fields_dict[field_list[i]] = td + i += 1 + if len(tds) > 1: + if frappe.db.exists("Vehicle Fine Record", fields_dict["reference"]): + doc = frappe.get_doc( + "Vehicle Fine Record", fields_dict["reference"]) + for key, value in fields_dict.items(): + if key != "qr_code": + doc[key] = value + doc.save() + else: + fine_doc = frappe.get_doc(fields_dict) + fine_doc.insert() + + else: + # res = json.loads(response.text) + print_out(response) + + +def update_fine(reference=None): + field_list = ["reference", "issued_date", "officer", "vehicle", "licence", + "location", "offence", "charge", "penalty", "total", "status", "qr_code"] + formSig = "plcwb4um7FCh8BxsRRTBZ%2FXzw84N5SUnMv6ctKWPaiM%3D" + url = "https://tms.tpf.go.tz/" + + try: + response = requests.post(url=url, timeout=5) + except Timeout: + frappe.msgprint(_("Error")) + else: + if response.status_code == 200: + soup = BeautifulSoup(response.text, 'html.parser') + formSig = soup.find(attrs={"type": "hidden"})['value'] + payload = { + 'service': 'REFERENCE', + 'vehicle': reference, + 'formSig': formSig + } + response2 = requests.post(url=url, data=payload, timeout=5) + soup = BeautifulSoup(response2.text, 'html.parser') + trs = soup.find_all('tr') + for tr in trs: + fields_dict = {'doctype': 'Vehicle Fine Record'} + soup_tr = BeautifulSoup(str(tr), 'html.parser') + tds = soup_tr.find_all('td') + if len(tds) > 1: + i = 0 + for td in tds: + soup_td = BeautifulSoup(str(td), 'html.parser') + td = soup_td.find('td').getText() + fields_dict[field_list[i]] = td + i += 1 + if len(tds) > 1: + if frappe.db.exists("Vehicle Fine Record", fields_dict["reference"]): + doc = frappe.get_doc( + "Vehicle Fine Record", fields_dict["reference"]) + doc.update(fields_dict) + print(fields_dict) + doc.save() + frappe.db.commit() + + else: + print_out(response) diff --git a/csf_tz/csf_tz/doctype/visibility/__init__.py b/csf_tz/csf_tz/doctype/visibility/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/visibility/test_visibility.py b/csf_tz/csf_tz/doctype/visibility/test_visibility.py new file mode 100644 index 0000000..33cd9d1 --- /dev/null +++ b/csf_tz/csf_tz/doctype/visibility/test_visibility.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestVisibility(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/visibility/visibility.js b/csf_tz/csf_tz/doctype/visibility/visibility.js new file mode 100644 index 0000000..4b9b401 --- /dev/null +++ b/csf_tz/csf_tz/doctype/visibility/visibility.js @@ -0,0 +1,75 @@ +// Copyright (c) 2020, Aakvatech and contributors +// For license information, please see license.txt + +frappe.notification = { + setup_fieldname_select: function(frm) { + // get the doctype to update fields + if(!frm.doc.document_type) { + return; + } + + frappe.model.with_doctype(frm.doc.document_type, function() { + let get_select_options = function(df) { + return {value: df.fieldname, label: df.fieldname + " (" + __(df.label) + ")"}; + } + + let get_date_change_options = function() { + let date_options = $.map(fields, function(d) { + return (d.fieldtype=="Date" || d.fieldtype=="Datetime")? + get_select_options(d) : null; + }); + // append creation and modified date to Date Change field + return date_options.concat([ + { value: "creation", label: `creation (${__('Created On')})` }, + { value: "modified", label: `modified (${__('Last Modified Date')})` } + ]); + } + + let fields = frappe.get_doc("DocType", frm.doc.document_type).fields; + let options = $.map(fields, + function(d) { return in_list(frappe.model.no_value_type, d.fieldtype) ? + null : get_select_options(d); }); + + // set value changed options + frm.set_df_property("value_changed", "options", [""].concat(options)); + frm.set_df_property("set_property_after_alert", "options", [""].concat(options)); + + // set date changed options + frm.set_df_property("date_changed", "options", get_date_change_options()); + + }); + } +} + + +frappe.ui.form.on('Visibility', { + onload: function(frm) { + frm.set_query("document_type", function() { + return { + "filters": { + "istable": 0 + } + } + }); + frm.set_query("print_format", function() { + return { + "filters": { + "doc_type": frm.doc.document_type + } + } + }); + }, + refresh: function(frm) { + frappe.notification.setup_fieldname_select(frm); + frm.get_field("is_standard").toggle(frappe.boot.developer_mode); + }, + + document_type: function(frm) { + frappe.notification.setup_fieldname_select(frm); + }, + view_properties: function(frm) { + frappe.route_options = {doc_type:frm.doc.document_type}; + frappe.set_route("Form", "Customize Form"); + }, + +}); diff --git a/csf_tz/csf_tz/doctype/visibility/visibility.json b/csf_tz/csf_tz/doctype/visibility/visibility.json new file mode 100644 index 0000000..d86cdac --- /dev/null +++ b/csf_tz/csf_tz/doctype/visibility/visibility.json @@ -0,0 +1,217 @@ +{ + "allow_rename": 1, + "autoname": "Prompt", + "creation": "2020-06-27 01:32:37.795899", + "doctype": "DocType", + "document_type": "System", + "engine": "InnoDB", + "field_order": [ + "enabled", + "column_break_2", + "filters", + "subject", + "document_type", + "is_standard", + "module", + "col_break_1", + "event", + "method", + "date_changed", + "days_in_advance", + "value_changed", + "property_section", + "set_property_after_alert", + "property_value", + "section_break_9", + "condition", + "column_break_6", + "html_7" + ], + "fields": [ + { + "default": "1", + "fieldname": "enabled", + "fieldtype": "Check", + "label": "Enabled" + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "filters", + "fieldtype": "Section Break", + "label": "Filters" + }, + { + "fieldname": "subject", + "fieldtype": "Data", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Subject", + "reqd": 1 + }, + { + "fieldname": "document_type", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Document Type", + "options": "DocType", + "reqd": 1, + "search_index": 1 + }, + { + "default": "0", + "fieldname": "is_standard", + "fieldtype": "Check", + "label": "Is Standard" + }, + { + "depends_on": "is_standard", + "fieldname": "module", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Module", + "options": "Module Def" + }, + { + "fieldname": "col_break_1", + "fieldtype": "Column Break" + }, + { + "fieldname": "event", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Trigger On", + "options": "\nNew\nSave\nSubmit\nCancel\nDays After\nDays Before\nValue Change\nMethod\nCustom", + "reqd": 1, + "search_index": 1 + }, + { + "depends_on": "eval:doc.event=='Method'", + "description": "Trigger on valid methods like \"before_insert\", \"after_update\", etc (will depend on the DocType selected)", + "fieldname": "method", + "fieldtype": "Data", + "label": "Trigger Method" + }, + { + "depends_on": "eval:doc.event==\"Days After\" || doc.event==\"Days Before\"", + "description": "Send alert if date matches this field's value", + "fieldname": "date_changed", + "fieldtype": "Select", + "label": "Reference Date" + }, + { + "default": "0", + "depends_on": "eval:doc.event==\"Days After\" || doc.event==\"Days Before\"", + "description": "Send days before or after the reference date", + "fieldname": "days_in_advance", + "fieldtype": "Int", + "label": "Days Before or After" + }, + { + "depends_on": "eval:doc.event==\"Value Change\"", + "description": "Send alert if this field's value changes", + "fieldname": "value_changed", + "fieldtype": "Select", + "label": "Value Changed" + }, + { + "fieldname": "section_break_9", + "fieldtype": "Section Break" + }, + { + "description": "Optional: The alert will be sent if this expression is true", + "fieldname": "condition", + "fieldtype": "Code", + "ignore_xss_filter": 1, + "in_list_view": 1, + "label": "Condition" + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + }, + { + "fieldname": "html_7", + "fieldtype": "HTML", + "options": "

Condition Examples:

\n
doc.status==\"Open\"
doc.due_date==nowdate()
doc.total > 40000\n
\n" + }, + { + "fieldname": "property_section", + "fieldtype": "Section Break", + "label": "Set Property After Trigger" + }, + { + "fieldname": "set_property_after_alert", + "fieldtype": "Select", + "label": "Set Property After Trigger", + "reqd": 1 + }, + { + "fieldname": "property_value", + "fieldtype": "Data", + "label": "Value To Be Set", + "reqd": 1 + } + ], + "icon": "fa fa-envelope", + "modified": "2020-06-27 02:58:09.623162", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Visibility", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "export": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "subject", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/visibility/visibility.py b/csf_tz/csf_tz/doctype/visibility/visibility.py new file mode 100644 index 0000000..7571ba4 --- /dev/null +++ b/csf_tz/csf_tz/doctype/visibility/visibility.py @@ -0,0 +1,269 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Youssef Restom and contributors +# For license information, please see license.txt +from __future__ import unicode_literals +import frappe +import os +from frappe import _ +from frappe.model.document import Document +from frappe.utils import nowdate, parse_val, add_to_date +from frappe.modules.utils import export_module_json, get_doc_module +from six import string_types + +class Visibility(Document): + def onload(self): + '''load message''' + if self.is_standard: + self.message = self.get_template() + + def autoname(self): + if not self.name: + self.name = self.subject + + def validate(self): + if self.event in ("Days Before", "Days After") and not self.date_changed: + frappe.throw(_("Please specify which date field must be checked")) + + if self.event=="Value Change" and not self.value_changed: + frappe.throw(_("Please specify which value field must be checked")) + + self.validate_forbidden_types() + self.validate_condition() + self.validate_standard() + frappe.cache().hdel('vis_notifications', self.document_type) + + def on_update(self): + path = export_module_json(self, self.is_standard, self.module) + if path: + # js + if not os.path.exists(path + '.md') and not os.path.exists(path + '.html'): + with open(path + '.md', 'w') as f: + f.write(self.message) + + # py + if not os.path.exists(path + '.py'): + with open(path + '.py', 'w') as f: + f.write("""from __future__ import unicode_literals + +import frappe + +def get_context(context): + # do your magic here + pass +""") + + def validate_standard(self): + if self.is_standard and not frappe.conf.developer_mode: + frappe.throw(_('Cannot edit Standard Notification. To edit, please disable this and duplicate it')) + + def validate_condition(self): + temp_doc = frappe.new_doc(self.document_type) + if self.condition: + try: + frappe.safe_eval(self.condition, None, get_context(temp_doc)) + except Exception: + frappe.throw(_("The Condition '{0}' is invalid").format(self.condition)) + + def validate_forbidden_types(self): + forbidden_document_types = ("Email Queue",) + if (self.document_type in forbidden_document_types + or frappe.get_meta(self.document_type).istable): + # currently notifications don't work on child tables as events are not fired for each record of child table + + frappe.throw(_("Cannot set Notification on Document Type {0}").format(self.document_type)) + + def get_documents_for_today(self): + '''get list of documents that will be triggered today''' + docs = [] + + diff_days = self.days_in_advance + if self.event=="Days After": + diff_days = -diff_days + + reference_date = add_to_date(nowdate(), days=diff_days) + reference_date_start = reference_date + ' 00:00:00.000000' + reference_date_end = reference_date + ' 23:59:59.000000' + + doc_list = frappe.get_all(self.document_type, + fields='name', + filters=[ + { self.date_changed: ('>=', reference_date_start) }, + { self.date_changed: ('<=', reference_date_end) } + ]) + + for d in doc_list: + doc = frappe.get_doc(self.document_type, d.name) + + if self.condition and not frappe.safe_eval(self.condition, None, get_context(doc)): + continue + + docs.append(doc) + + return docs + + def send(self, doc): + '''Build recipients and send Notification''' + + context = get_context(doc) + context = {"doc": doc, "alert": self, "comments": None} + + if self.is_standard: + self.load_standard_properties(context) + + + if self.set_property_after_alert: + allow_update = True + if doc.docstatus == 1 and not doc.meta.get_field(self.set_property_after_alert).allow_on_submit: + allow_update = False + + if allow_update: + frappe.db.set_value(doc.doctype, doc.name, self.set_property_after_alert, + self.property_value, update_modified = False) + doc.db_set(self.set_property_after_alert, self.property_value) + frappe.db.commit() + + + + def load_standard_properties(self, context): + '''load templates and run get_context''' + module = get_doc_module(self.module, self.doctype, self.name) + if module: + if hasattr(module, 'get_context'): + out = module.get_context(context) + if out: context.update(out) + + +@frappe.whitelist() +def run_visibility(doc, method): + '''Run notifications for this method''' + if frappe.flags.in_import or frappe.flags.in_patch or frappe.flags.in_install: + return + + if doc.flags.vis_notifications_executed==None: + doc.flags.vis_notifications_executed = [] + + if doc.flags.vis_notifications == None: + alerts = frappe.cache().hget('vis_notifications', doc.doctype) + if alerts==None: + alerts = frappe.get_all('Visibility', fields=['name', 'event', 'method'], + filters={'enabled': 1, 'document_type': doc.doctype}) + frappe.cache().hset('vis_notifications', doc.doctype, alerts) + doc.flags.vis_notifications = alerts + + if not doc.flags.vis_notifications: + return + + def _evaluate_alert(alert): + if not alert.name in doc.flags.vis_notifications_executed: + evaluate_alert(doc, alert.name, alert.event) + doc.flags.vis_notifications_executed.append(alert.name) + + event_map = { + "on_update": "Save", + "after_insert": "New", + "on_submit": "Submit", + "before_submit": "Submit", + "before_update_after_submit": "Submit", + "on_cancel": "Cancel" + } + + if not doc.flags.in_insert: + # value change is not applicable in insert + event_map['validate'] = 'Value Change' + event_map['before_change'] = 'Value Change' + event_map['before_update_after_submit'] = 'Value Change' + + + for alert in doc.flags.vis_notifications: + event = event_map.get(method, None) + if event and alert.event == event: + _evaluate_alert(alert) + elif alert.event=='Method' and method == alert.method: + _evaluate_alert(alert) + + + +@frappe.whitelist() +def get_documents_for_today(notification): + notification = frappe.get_doc('Visibility', notification) + notification.check_permission('read') + return [d.name for d in notification.get_documents_for_today()] + +def trigger_daily_alerts(): + trigger_notifications(None, "daily") + +def trigger_notifications(doc, method=None): + if frappe.flags.in_import or frappe.flags.in_patch: + # don't send notifications while syncing or patching + return + + if method == "daily": + doc_list = frappe.get_all('Visibility', + filters={ + 'event': ('in', ('Days Before', 'Days After')), + 'enabled': 1 + }) + for d in doc_list: + alert = frappe.get_doc("Visibility", d.name) + + for doc in alert.get_documents_for_today(): + evaluate_alert(doc, alert, alert.event) + frappe.db.commit() + +def evaluate_alert(doc, alert, event): + from jinja2 import TemplateError + try: + if isinstance(alert, string_types): + alert = frappe.get_doc("Visibility", alert) + + context = get_context(doc) + + if alert.condition: + if not frappe.safe_eval(alert.condition, None, context): + return + + if event=="Value Change" and not doc.is_new(): + try: + db_value = frappe.db.get_value(doc.doctype, doc.name, alert.value_changed) + except Exception as e: + if frappe.db.is_missing_column(e): + alert.db_set('enabled', 0) + frappe.log_error('Notification {0} has been disabled due to missing field'.format(alert.name)) + return + else: + raise + db_value = parse_val(db_value) + if (doc.get(alert.value_changed) == db_value) or (not db_value and not doc.get(alert.value_changed)): + return # value not changed + + if event != "Value Change" and not doc.is_new(): + # reload the doc for the latest values & comments, + # except for validate type event. + doc = frappe.get_doc(doc.doctype, doc.name) + alert.send(doc) + except TemplateError: + frappe.throw(_("Error while evaluating Notification {0}. Please fix your template.").format(alert)) + except Exception as e: + error_log = frappe.log_error(message=frappe.get_traceback(), title=str(e)) + frappe.throw(_("Error in Notification: {}".format( + frappe.utils.get_link_to_form('Error Log', error_log.name)))) + +def get_context(doc): + return {"doc": doc, "nowdate": nowdate, "frappe.utils": frappe.utils} + + +def get_doc_fields(doctype_name): + fields = frappe.get_meta(doctype_name).fields + filed_list = [] + field_names =["Customer","Supplier","Student","Employee"] + for d in fields: + if d.fieldtype == "Link" and d.options in field_names: + field = { + "label":d.label, + "fieldname": d.fieldname, + "fieldtype" : d.fieldtype, + "field_options" : d.options, + "doctype_name": doctype_name, + } + filed_list.append(field) + return filed_list diff --git a/csf_tz/csf_tz/doctype/work_order_consignment/__init__.py b/csf_tz/csf_tz/doctype/work_order_consignment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/work_order_consignment/test_work_order_consignment.py b/csf_tz/csf_tz/doctype/work_order_consignment/test_work_order_consignment.py new file mode 100644 index 0000000..cdaad47 --- /dev/null +++ b/csf_tz/csf_tz/doctype/work_order_consignment/test_work_order_consignment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestWorkOrderConsignment(unittest.TestCase): + pass diff --git a/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.js b/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.js new file mode 100644 index 0000000..370bfd6 --- /dev/null +++ b/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.js @@ -0,0 +1,31 @@ +// Copyright (c) 2021, Aakvatech and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Work Order Consignment', { + onload: function (frm) { + frm.set_query("default_source_warehouse", function () { + return { filters: [["name", "like", "%Parts Store%"]] }; + }); + }, + parent_item: function (frm) { + if (frm.doc.parent_item) { + frappe.call({ + method: "csf_tz.csf_tz.doctype.work_order_consignment.work_order_consignment.get_boms", + args: { + "item": frm.doc.parent_item, + }, + callback: function (data) { + frm.clear_table("work_order_consignment_detail"); + if (data.message) { + data.message.forEach(element => { + var child = frm.add_child("work_order_consignment_detail"); + frappe.model.set_value(child.doctype, child.name, "bom", element.name); + + }); + } + frm.refresh_field("work_order_consignment_detail"); + } + }); + } + } +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.json b/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.json new file mode 100644 index 0000000..26a037a --- /dev/null +++ b/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.json @@ -0,0 +1,105 @@ +{ + "actions": [], + "autoname": "naming_series:", + "creation": "2021-01-23 16:18:34.877288", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "naming_series", + "parent_item", + "company", + "column_break_2", + "quantity", + "default_source_warehouse", + "section_break_5", + "work_order_consignment_detail", + "amended_from" + ], + "fields": [ + { + "fieldname": "parent_item", + "fieldtype": "Link", + "label": "Parent Item", + "options": "Item", + "reqd": 1 + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "quantity", + "fieldtype": "Int", + "label": "Quantity", + "reqd": 1 + }, + { + "fieldname": "section_break_5", + "fieldtype": "Section Break" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Work Order Consignment", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "work_order_consignment_detail", + "fieldtype": "Table", + "label": "Work Order Consignment Detail", + "options": "Work Order Consignment Detail", + "reqd": 1 + }, + { + "fieldname": "default_source_warehouse", + "fieldtype": "Link", + "label": "Default Source Warehouse", + "options": "Warehouse", + "reqd": 1 + }, + { + "default": "WOCO-.YYYY.-.######", + "fieldname": "naming_series", + "fieldtype": "Data", + "hidden": 1, + "label": "naming_series" + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2021-03-25 16:11:24.667891", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Work Order Consignment", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.py b/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.py new file mode 100644 index 0000000..3a584f3 --- /dev/null +++ b/csf_tz/csf_tz/doctype/work_order_consignment/work_order_consignment.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document +from frappe.utils import now + + +class WorkOrderConsignment(Document): + def before_submit(self): + create_orders(self) + + +@frappe.whitelist() +def get_boms(item): + boms = frappe.get_all("BOM", filters={ + "docstatus": 1, + "is_active": 1, + "transfer_material_against": "Work Order", + "parent_item": item, + }) + return boms + + +def create_orders(doc): + for row in doc.work_order_consignment_detail: + if row.bom: + crate_work_order(row.bom, doc) + + +def crate_work_order(bom_name, doc): + bom = frappe.get_doc("BOM", bom_name) + wo_order = frappe.new_doc("Work Order") + wo_order.production_item = bom.item + wo_order.bom_no = bom_name + wo_order.qty = doc.quantity + wo_order.source_warehouse = doc.default_source_warehouse + wo_order.wip_warehouse = bom.wip_warehouse + wo_order.fg_warehouse = bom.fg_warehouse + wo_order.scrap_warehouse = bom.fg_warehouse + wo_order.company = doc.company + wo_order.stock_uom = bom.uom + wo_order.use_multi_level_bom = 0 + wo_order.skip_transfer = 0 + wo_order.get_items_and_operations_from_bom() + wo_order.planned_start_date = now() + wo_order.parent_item = doc.parent_item + wo_order.work_order_consignment = doc.name + + if bom.source_warehouse: + for item in wo_order.get("required_items"): + item.source_warehouse = bom.source_warehouse + + wo_order.insert(ignore_permissions=True) + # wo_order.submit() + + frappe.msgprint(_("Work Order created: {0}").format( + wo_order.name), alert=True) + + return wo_order.name diff --git a/csf_tz/csf_tz/doctype/work_order_consignment_detail/__init__.py b/csf_tz/csf_tz/doctype/work_order_consignment_detail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/doctype/work_order_consignment_detail/work_order_consignment_detail.json b/csf_tz/csf_tz/doctype/work_order_consignment_detail/work_order_consignment_detail.json new file mode 100644 index 0000000..da4fe17 --- /dev/null +++ b/csf_tz/csf_tz/doctype/work_order_consignment_detail/work_order_consignment_detail.json @@ -0,0 +1,29 @@ +{ + "creation": "2021-01-23 16:15:30.977454", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "bom" + ], + "fields": [ + { + "fieldname": "bom", + "fieldtype": "Link", + "in_list_view": 1, + "label": "BOM", + "options": "BOM" + } + ], + "istable": 1, + "modified": "2021-01-23 16:15:30.977454", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Work Order Consignment Detail", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/work_order_consignment_detail/work_order_consignment_detail.py b/csf_tz/csf_tz/doctype/work_order_consignment_detail/work_order_consignment_detail.py new file mode 100644 index 0000000..a3b7be5 --- /dev/null +++ b/csf_tz/csf_tz/doctype/work_order_consignment_detail/work_order_consignment_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class WorkOrderConsignmentDetail(Document): + pass diff --git a/csf_tz/csf_tz/fees.js b/csf_tz/csf_tz/fees.js new file mode 100644 index 0000000..96e5a84 --- /dev/null +++ b/csf_tz/csf_tz/fees.js @@ -0,0 +1,26 @@ +frappe.ui.form.on('Fees', { + refresh: function (frm) { + if (frm.doc.docstatus == 1 && frm.doc.outstanding_amount > 0) { + frm.add_custom_button(__("Invoice Submission"), function () { + frappe.call({ + method: 'csf_tz.bank_api.invoice_submission', + args: { + fees_name: frm.doc.name, + }, + callback: function (r) { + if (r.message) { + console.log(r.message); + } + } + }); + }); + }; + frm.set_query("sales_invoice_income_account", function () { + return { + filters: [ + ["Account", "company", "=", frm.doc.company] + ] + }; + }); + }, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/landed_cost_voucher.js b/csf_tz/csf_tz/landed_cost_voucher.js new file mode 100644 index 0000000..0747fd5 --- /dev/null +++ b/csf_tz/csf_tz/landed_cost_voucher.js @@ -0,0 +1,26 @@ +frappe.ui.form.on("Landed Cost Voucher", { + import_file: function (frm) { + frm.clear_table("taxes"); + if (frm.doc.import_file) { + frappe.call({ + method: 'csf_tz.csftz_hooks.landed_cost_voucher.get_landed_cost_expenses', + args: { + import_file: frm.doc.import_file, + }, + async: false, + callback: function (r) { + if (r.message) { + r.message.forEach(element => { + var child = frm.add_child("taxes"); + frappe.model.set_value(child.doctype, child.name, "expense_account", element.expense_account); + frappe.model.set_value(child.doctype, child.name, "description", element.description); + frappe.model.set_value(child.doctype, child.name, "amount", element.amount); + }) + } + } + }); + } + frm.refresh_field("taxes"); + }, +}); + diff --git a/csf_tz/csf_tz/page/__init__.py b/csf_tz/csf_tz/page/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/page/jobcards/__init__.py b/csf_tz/csf_tz/page/jobcards/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/page/jobcards/jobcards.js b/csf_tz/csf_tz/page/jobcards/jobcards.js new file mode 100644 index 0000000..4f1c572 --- /dev/null +++ b/csf_tz/csf_tz/page/jobcards/jobcards.js @@ -0,0 +1,14 @@ +frappe.pages['jobcards'].on_page_load = function (wrapper) { + var page = frappe.ui.make_app_page({ + parent: wrapper, + title: 'Job Cards', + single_column: true + }); + + this.page.$JobCards = new frappe.JobCards.job_cards(this.page); + + + $("head").append(""); + $("head").append(""); + $("head").append(""); +} \ No newline at end of file diff --git a/csf_tz/csf_tz/page/jobcards/jobcards.json b/csf_tz/csf_tz/page/jobcards/jobcards.json new file mode 100644 index 0000000..3421be9 --- /dev/null +++ b/csf_tz/csf_tz/page/jobcards/jobcards.json @@ -0,0 +1,45 @@ +{ + "content": null, + "creation": "2020-10-10 02:21:11.479103", + "docstatus": 0, + "doctype": "Page", + "idx": 0, + "modified": "2021-05-06 12:02:03.838474", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "jobcards", + "owner": "Administrator", + "page_name": "Job Cards", + "restrict_to_domain": "Manufacturing", + "roles": [ + { + "role": "Manufacturing User" + }, + { + "role": "Manufacturing Manager" + }, + { + "role": "System Manager" + }, + { + "role": "Cab Line Team Leader" + }, + { + "role": "Body Shop Team Leader" + }, + { + "role": "Production Team Leader" + }, + { + "role": "Production Manager" + }, + { + "role": "KD Engineer" + } + ], + "script": null, + "standard": "Yes", + "style": null, + "system_page": 1, + "title": "Job Cards" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/page/jobcards/jobcards.py b/csf_tz/csf_tz/page/jobcards/jobcards.py new file mode 100644 index 0000000..0fab358 --- /dev/null +++ b/csf_tz/csf_tz/page/jobcards/jobcards.py @@ -0,0 +1,53 @@ +from __future__ import unicode_literals +import frappe +from frappe import _ +import json +from csf_tz import console + + +@frappe.whitelist() +def get_job_cards(): + data = frappe.get_list( + "Job Card", + filters={ + "status": ["in", ["Open", "Work In Progress", "Material Transferred", "On Hold", "Submitted"]], + "docstatus": 0, + }, + fields=["*"], + limit_page_length=0, + order_by='name' + ) + for card in data: + card["operation"] = frappe.get_doc("Operation", card.operation) + card["work_order_image"] = frappe.get_value( + "Work Order", card.work_order, "image") + card["time_logs"] = frappe.get_all("Job Card Time Log", filters={ + "parent": card.name}, fields=["*"]) + return data + + +@frappe.whitelist() +def get_employees(company): + data = frappe.get_list( + "Employee", + filters={ + "status": "Active", + "company": company + }, + fields=["name", "employee_name"], + limit_page_length=0, + order_by='name' + ) + + return data + + +@frappe.whitelist() +def save_doc(doc, action="Save"): + doc = json.loads(doc) + cur_doc = frappe.get_doc("Job Card", doc.get("name")) + cur_doc.update(doc) + cur_doc.save() + if action == "Submit": + cur_doc.submit() + return cur_doc diff --git a/csf_tz/csf_tz/payment_entry.js b/csf_tz/csf_tz/payment_entry.js new file mode 100644 index 0000000..adc2755 --- /dev/null +++ b/csf_tz/csf_tz/payment_entry.js @@ -0,0 +1,139 @@ +frappe.ui.form.on("Payment Entry", { + onload: function (frm) { + if (frm.is_new()) { + frm.trigger("payment_type"); + } + }, + payment_type: function (frm) { + if (frm.is_new()) { + if (frm.doc.payment_type == "Receive") { + frm.set_value("naming_series", "RE-.YYYY.-"); + if (!["Student", "Donor"].includes(frm.doc.party_type)) { + frm.set_value("party_type", "Customer"); + } + } + else if (frm.doc.payment_type == "Pay") { + frm.set_value("naming_series", "PE-.YYYY.-"); + if (frm.doc.party_type != "Employee") { + frm.set_value("party_type", "Supplier"); + } + } + else if (frm.doc.payment_type == "Internal Transfer") { + frm.set_value("naming_series", "IT-.YYYY.-"); + } + } + frm.refresh_fields() + }, + + party: function (frm) { + if (frm.is_new()) { + const today = frappe.datetime.get_today(); + const filters = { + from_posting_date: frappe.datetime.add_days(today, -3650), + to_posting_date: today, + allocate_payment_amount: 1 + } + if (["Customer", "Supplier"].includes(frm.doc.party_type)) { + frm.events.get_outstanding_documents(frm, filters); + } + } + }, + + get_outstanding_documents: function (frm, filters) { + if (typeof frappe.route_history[frappe.route_history.length - 2] != "undefined") { + if (frappe.route_history[frappe.route_history.length - 2][1] in ["Sales Invoice", "Employee Advance", "Purchase Invoice"]) { + return; + } + } + + frm.clear_table("references"); + + if (!frm.doc.party) { + return; + } + + frm.events.check_mandatory_to_fetch(frm); + var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; + + var args = { + "posting_date": frm.doc.posting_date, + "company": frm.doc.company, + "party_type": frm.doc.party_type, + "payment_type": frm.doc.payment_type, + "party": frm.doc.party, + "party_account": frm.doc.payment_type == "Receive" ? frm.doc.paid_from : frm.doc.paid_to, + "cost_center": frm.doc.cost_center + } + + for (let key in filters) { + args[key] = filters[key]; + } + + frappe.flags.allocate_payment_amount = filters['allocate_payment_amount']; + + return frappe.call({ + method: 'csf_tz.csftz_hooks.payment_entry.get_outstanding_reference_documents', + args: { + args: args + }, + callback: function (r, rt) { + if (r.message) { + var total_positive_outstanding = 0; + var total_negative_outstanding = 0; + + $.each(r.message, function (i, d) { + var c = frm.add_child("references"); + c.reference_doctype = d.voucher_type; + c.reference_name = d.voucher_no; + c.due_date = d.due_date + c.total_amount = d.invoice_amount; + c.outstanding_amount = d.outstanding_amount; + c.bill_no = d.bill_no; + + if (!in_list(["Sales Order", "Purchase Order", "Expense Claim", "Fees"], d.voucher_type)) { + if (flt(d.outstanding_amount) > 0) + total_positive_outstanding += flt(d.outstanding_amount); + else + total_negative_outstanding += Math.abs(flt(d.outstanding_amount)); + } + + var party_account_currency = frm.doc.payment_type == "Receive" ? + frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency; + + if (party_account_currency != company_currency) { + c.exchange_rate = d.exchange_rate; + } else { + c.exchange_rate = 1; + } + if (in_list(['Sales Invoice', 'Purchase Invoice', "Expense Claim", "Fees"], d.reference_doctype)) { + c.due_date = d.due_date; + } + }); + + if ( + (frm.doc.payment_type == "Receive" && frm.doc.party_type == "Customer") || + (frm.doc.payment_type == "Pay" && frm.doc.party_type == "Supplier") || + (frm.doc.payment_type == "Pay" && frm.doc.party_type == "Employee") || + (frm.doc.payment_type == "Receive" && frm.doc.party_type == "Student") + ) { + if (total_positive_outstanding > total_negative_outstanding) + if (!frm.doc.paid_amount) + frm.set_value("paid_amount", + total_positive_outstanding - total_negative_outstanding); + } else if ( + total_negative_outstanding && + total_positive_outstanding < total_negative_outstanding + ) { + if (!frm.doc.received_amount) + frm.set_value("received_amount", + total_negative_outstanding - total_positive_outstanding); + } + } + + frm.events.allocate_party_amount_against_ref_docs(frm, + (frm.doc.payment_type == "Receive" ? frm.doc.paid_amount : frm.doc.received_amount)); + + } + }); + }, +}); diff --git a/csf_tz/csf_tz/payroll_entry.js b/csf_tz/csf_tz/payroll_entry.js new file mode 100644 index 0000000..722347a --- /dev/null +++ b/csf_tz/csf_tz/payroll_entry.js @@ -0,0 +1,67 @@ +frappe.ui.form.on("Payroll Entry", { + setup: function(frm) { + frm.trigger("create_update_slips_btn"); + frm.trigger("create_print_btn"); + frm.trigger("create_journal_entry_btn"); + + }, + refresh:function(frm) { + frm.trigger("create_update_slips_btn"); + frm.trigger("create_print_btn"); + frm.trigger("create_journal_entry_btn"); + }, + create_update_slips_btn: function (frm) { + if (frm.doc.docstatus != 1) { + return + } + frm.add_custom_button(__("Update Salary Slips"), function() { + frappe.call({ + method: 'csf_tz.csftz_hooks.payroll.update_slips', + args: { + payroll_entry: frm.doc.name, + }, + callback: function(r) { + if (r.message) { + console.log(r.message); + } + } + }); + }); + }, + create_print_btn: function (frm) { + if (frm.doc.docstatus != 1) { + return + } + frm.add_custom_button(__("Print Salary Slips"), function() { + frappe.call({ + method: 'csf_tz.csftz_hooks.payroll.print_slips', + args: { + payroll_entry: frm.doc.name, + }, + // callback: function(r) { + // if (r.message) { + // frm.reload_doc(); + // } + // } + }); + }); + }, + create_journal_entry_btn: function (frm) { + if (frm.doc.docstatus != 1 || frm.doc.salary_slips_submitted == 1) { + return; + } + frm.add_custom_button(__("Create Journal Entry"), function () { + frappe.call({ + method: 'csf_tz.csftz_hooks.payroll.create_journal_entry', + args: { + payroll_entry: frm.doc.name, + }, + // callback: function(r) { + // if (r.message) { + // frm.reload_doc(); + // } + // } + }); + }); + }, +}); diff --git a/csf_tz/csf_tz/print_format/__init__.py b/csf_tz/csf_tz/print_format/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/av_jounrnal_entry/__init__.py b/csf_tz/csf_tz/print_format/av_jounrnal_entry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/av_jounrnal_entry/av_jounrnal_entry.json b/csf_tz/csf_tz/print_format/av_jounrnal_entry/av_jounrnal_entry.json new file mode 100644 index 0000000..e27188d --- /dev/null +++ b/csf_tz/csf_tz/print_format/av_jounrnal_entry/av_jounrnal_entry.json @@ -0,0 +1,26 @@ +{ + "align_labels_right": 1, + "creation": "2020-03-04 10:07:22.836521", + "css": "@media screen {\n .print-format {\n padding-left: 10mm;\n padding-right: 10mm;\n padding-top: 5mm;\n padding-bottom: 2mm;\n width: 5.8in;\n min-height: 8.3in;\n font-size: 7pt;\n }\n .print-format td, .print-format th {\n vertical-align: top !important;\n padding: 2px !important;\n }\n\n .print-format h1 { font-size: 19pt;}\n .print-format h2 { font-size: 17pt;}\n .print-format h3 { font-size: 15pt;}\n .print-format h4 { font-size: 13pt;}\n .print-format h5 { font-size: 9pt;}\n .print-format h6 { font-size: 8px;}\n}\n.hr_class {\n margin-top: 6px;\n margin-bottom: 6px;\n}", + "custom_format": 0, + "disabled": 0, + "doc_type": "Journal Entry", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"\\n \\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

JOURNAL ENTRY

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"voucher_type\", \"label\": \"Entry Type\", \"print_hide\": 0}, {\"fieldname\": \"finance_book\", \"label\": \"Finance Book\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"posting_date\", \"label\": \"Posting Date\", \"print_hide\": 0}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"label\": \"Custom HTML\", \"print_hide\": 0, \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_width\": \"250px\", \"fieldname\": \"account\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"party_type\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"party\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"debit_in_account_currency\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"credit_in_account_currency\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"reference_type\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"reference_name\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"reference_due_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"project\", \"print_hide\": 0}], \"fieldname\": \"accounts\", \"label\": \"Accounting Entries\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"remark\", \"label\": \"Remark\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}]", + "html": "", + "idx": 0, + "line_breaks": 1, + "modified": "2020-03-09 17:15:20.186043", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "AV Jounrnal Entry", + "owner": "Administrator", + "parent": "Journal Entry", + "print_format_builder": 1, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/av_payment_entry_voucher/__init__.py b/csf_tz/csf_tz/print_format/av_payment_entry_voucher/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/av_payment_entry_voucher/av_payment_entry_voucher.json b/csf_tz/csf_tz/print_format/av_payment_entry_voucher/av_payment_entry_voucher.json new file mode 100644 index 0000000..3b2010c --- /dev/null +++ b/csf_tz/csf_tz/print_format/av_payment_entry_voucher/av_payment_entry_voucher.json @@ -0,0 +1,29 @@ +{ + "absolute_value": 0, + "align_labels_right": 1, + "creation": "2020-03-04 10:07:22.784499", + "css": ".print-format td, .print-format th \n{\n \tvertical-align: top !important;\n \tpadding: 5px !important;\n\tvertical-align: bottom !important;\n}\n.print-format {\n padding-left: 10mm;\n padding-right: 5mm;\n padding-top: 5mm;\n\tfont-size: 10pt;\t\n}\n\n .print-format h1 { font-size: 19pt;}\n .print-format h2 { font-size: 17pt;}\n .print-format h3 { font-size: 15pt;}\n .print-format h4 { font-size: 13pt;}\n .print-format h5 { font-size: 9pt;}\n .print-format h6 { font-size: 8px;}\n}\n.hr_class {\n margin-top: 6px;\n margin-bottom: 6px;\n}\n\n.clearfix:after {\n /* clear: both; */\n}", + "custom_format": 0, + "disabled": 0, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"\\n \\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

\\n\\t{% if doc.payment_type == \\\"Receive\\\" %}\\n\\t RECEIPT\\n\\t{% elif doc.payment_type == \\\"Pay\\\" %}\\n PAYMENT VOUCHER\\n\\t{% else %}\\n INTERNAL TRANSFER VOUCHER\\n {% endif %}\\n

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.party_name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ doc.mode_of_payment}}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ doc.posting_date}}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.paid_from }}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.paid_to }}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n {{ frappe.utils.fmt_money(doc.received_amount, currency=doc.paid_to_account_currency) }}
\\r\\n
\\r\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ frappe.utils.money_in_words(doc.received_amount, doc.paid_to_account_currency) }}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Transaction\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.reference_no }}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.reference_date }}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Reference\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"{% if doc.payment_type != \\\"Internal Transfer\\\" %}\\n\\n{% endif %}\"}, {\"fieldname\": \"references\", \"print_hide\": 0, \"label\": \"Payment References\", \"visible_columns\": [{\"fieldname\": \"reference_doctype\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"reference_name\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"due_date\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"bill_no\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"outstanding_amount\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"allocated_amount\", \"print_width\": \"\", \"print_hide\": 0}]}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \" \\n \\n \\n \\n \\n
\\n {{ doc.remarks }}\\n \\n for {{ doc.company }}\\n
\\n
\\n Authorised Signatory\\n
\\n
\\n
\"}]", + "html": "\n ", + "idx": 0, + "line_breaks": 0, + "modified": "2021-02-16 09:01:40.643509", + "modified_by": "info@aakvatech.com", + "module": "CSF TZ", + "name": "AV Payment Entry Voucher", + "owner": "Administrator", + "parent": "", + "parentfield": "", + "parenttype": "", + "print_format_builder": 1, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/av_proforma_invoice/__init__.py b/csf_tz/csf_tz/print_format/av_proforma_invoice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/av_proforma_invoice/av_proforma_invoice.json b/csf_tz/csf_tz/print_format/av_proforma_invoice/av_proforma_invoice.json new file mode 100644 index 0000000..9a671d8 --- /dev/null +++ b/csf_tz/csf_tz/print_format/av_proforma_invoice/av_proforma_invoice.json @@ -0,0 +1,25 @@ +{ + "align_labels_right": 1, + "creation": "2020-03-04 10:07:22.675296", + "css": ".print-format {\npadding-left: 10mm;\npadding-right: 10mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}", + "custom_format": 0, + "disabled": 0, + "doc_type": "Quotation", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"\\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n

PROFORMA INVOICE

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"customer_name\", \"label\": \"Customer Name\", \"print_hide\": 0}, {\"fieldname\": \"address_display\", \"label\": \"Address\", \"print_hide\": 0}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.party_name, \\\"vrn\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.party_name, \\\"tax_id\\\") }}\\n
\\n
\\n\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldname\": \"cost_center\", \"label\": \"Cost Center\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldname\": \"transaction_date\", \"label\": \"Date\", \"print_hide\": 0}, {\"fieldname\": \"valid_till\", \"label\": \"Valid Till\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"\\n\\n \\n \\n \\n \\n \\n \\n\\n\\n\\n\\t\\n\\n{% for item in doc.items %}\\n\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\n{% endfor %}\\n\\n \\n\\t\\n \\n\\t\\n\\n\\n\\t\\n \\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\n\\n\\t\\n\\n\\n
SI\\n\\tParticulars\\n\\tQTY\\n\\tVAT\\n\\tRate\\n\\tAmount\\n
{{ loop.index }}{{ item.item_name }}\\n {{ item.get_formatted(\\\"qty\\\", 0) }}\\n {{ item.get_formatted(\\\"uom\\\", 0) }}\\n \\n\\t\\t{% set mydict = json.loads(item.item_tax_rate) %}\\n\\t\\t{% if item.item_tax_rate == \\\"{}\\\" %}\\n\\t\\t\\t{% for row in doc.taxes %}\\n\\t\\t\\t\\t{{ row.get_formatted(\\\"rate\\\",0) }}\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% else %}\\n\\t\\t\\t{% for key, value in mydict.items() %}\\n\\t\\t\\t\\t{{ value }}%\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% endif %}\\n\\t{{ item.get_formatted(\\\"rate\\\", doc) }}{{ item.get_formatted(\\\"amount\\\", doc) }}
\\n Amount in Words
\\n {{ doc.in_words }}

\\n \\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.base_in_words }}\\n {% endif %} \\n \\n
SUB. TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_total\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"total\\\", doc) }}
V.A.T.\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_total_taxes_and_charges\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"total_taxes_and_charges\\\", doc) }}
TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_grand_total\\\", doc) }}\\n {% endif %} \\n {{ doc.get_formatted(\\\"grand_total\\\", doc) }}
\\n\\t {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"company_bank_details\\\") }}\\n\\t\\n for {{ doc.company }}\\n
\\n
\\n Authorised Signatory\\n
\\n
\\n
\\n Terms and Conditions
\\n\\t {{ doc.terms }}\\n\\t
\\n
\\n
\\n 1mm\\n 1mm\\n 1mm\\n 0mm\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}]", + "html": "", + "idx": 0, + "line_breaks": 1, + "modified": "2020-03-09 17:13:49.279900", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "AV Proforma Invoice", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/av_purchase_invoice/__init__.py b/csf_tz/csf_tz/print_format/av_purchase_invoice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/av_purchase_invoice/av_purchase_invoice.json b/csf_tz/csf_tz/print_format/av_purchase_invoice/av_purchase_invoice.json new file mode 100644 index 0000000..739ce54 --- /dev/null +++ b/csf_tz/csf_tz/print_format/av_purchase_invoice/av_purchase_invoice.json @@ -0,0 +1,24 @@ +{ + "align_labels_right": 0, + "creation": "2020-03-04 10:07:23.062648", + "css": ".print-format {\npadding-left: 10mm;\npadding-right: 10mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}", + "custom_format": 0, + "disabled": 0, + "doc_type": "Purchase Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"\\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n

PURCHASE INVOICE

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"supplier_name\", \"label\": \"Supplier Name\", \"print_hide\": 0}, {\"fieldname\": \"address_display\", \"label\": \"Address\", \"print_hide\": 0}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Supplier\\\", doc.supplier, \\\"vrn\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Supplier\\\", doc.supplier, \\\"tax_id\\\") }}\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldname\": \"posting_date\", \"label\": \"Date\", \"print_hide\": 0}, {\"fieldname\": \"cost_center\", \"label\": \"Cost Center\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"\\n\\n \\n \\n \\n \\n \\n \\n\\n\\n\\n\\t\\n\\n{% for item in doc.items %}\\n\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\n{% endfor %}\\n\\n \\n\\t\\n \\n\\t\\n\\n\\n\\t\\n \\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\n\\n
SI\\n\\tParticulars\\n\\tQTY\\n\\tVAT\\n\\tRate\\n\\tAmount\\n
{{ loop.index }}{{ item.item_name }}\\n {{ item.get_formatted(\\\"qty\\\", 0) }}\\n {{ item.get_formatted(\\\"uom\\\", 0) }}\\n \\n\\t\\t{% set mydict = json.loads(item.item_tax_rate) %}\\n\\t\\t{% if item.item_tax_rate == \\\"{}\\\" %}\\n\\t\\t\\t{% for row in doc.taxes %}\\n\\t\\t\\t\\t{{ row.get_formatted(\\\"rate\\\",0) }}\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% else %}\\n\\t\\t\\t{% for key, value in mydict.items() %}\\n\\t\\t\\t\\t{{ value }}%\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% endif %}\\n\\t{{ item.get_formatted(\\\"rate\\\", doc) }}{{ item.get_formatted(\\\"amount\\\", doc) }}
\\n Amount in Words
\\n {{ doc.in_words }}

\\n \\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.base_in_words }}\\n {% endif %} \\n \\n
SUB. TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_net_total\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"net_total\\\", doc) }}
V.A.T.\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_total_taxes_and_charges\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"total_taxes_and_charges\\\", doc) }}
TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_grand_total\\\", doc) }}\\n {% endif %} \\n {{ doc.get_formatted(\\\"grand_total\\\", doc) }}
{{ doc.remarks }}\\n for {{ doc.company }}\\n
\\n
\\n Authorised Signatory\\n
\\n
\\n
\\n
\\n
\\n 1mm\\n 1mm\\n 1mm\\n 0mm\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}]", + "html": "", + "idx": 0, + "line_breaks": 0, + "modified": "2020-03-09 17:13:24.244958", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "AV Purchase Invoice", + "owner": "Administrator", + "print_format_builder": 1, + "raw_printing": 0, + "show_section_headings": 0, + "standard": "Yes" +} diff --git a/csf_tz/csf_tz/print_format/av_tax_invoice/__init__.py b/csf_tz/csf_tz/print_format/av_tax_invoice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/av_tax_invoice/av_tax_invoice.json b/csf_tz/csf_tz/print_format/av_tax_invoice/av_tax_invoice.json new file mode 100644 index 0000000..176df3a --- /dev/null +++ b/csf_tz/csf_tz/print_format/av_tax_invoice/av_tax_invoice.json @@ -0,0 +1,27 @@ +{ + "absolute_value": 0, + "align_labels_right": 1, + "creation": "2020-03-04 10:07:23.010409", + "css": ".print-format td, .print-format th \n{\n \tvertical-align: top !important;\n \tpadding: 5px !important;\n\tvertical-align: bottom !important;\n}\n.print-format {\n padding-left: 10mm;\n padding-right: 5mm;\n padding-top: 5mm;\n\tfont-size: 10pt;\t\n}\n\ntd.tight {\n padding: 0px !important;\n}", + "custom_format": 0, + "disabled": 1, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"\\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n{% if doc.select_print_heading is not none %}\\n

{{ doc.select_print_heading }}

\\n{% else %}\\n

TAX INVOICE

\\n{% endif %}\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.customer_name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ doc.address_display}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"vrn\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"tax_id\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n\\t{{ doc.cost_center}}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n {% if (doc.is_return == 0) %}\\n \\n {% else %}\\n \\n {% endif %}\\n
\\n
\\n {{ doc.name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.utils.formatdate(doc.posting_date, 'dd-MMM-YYYY') }}\\n
\\n
\\n{% if (doc.is_return == 0) %} \\n
\\n
\\n
{{ doc.po_no}}
\\n
\\n
\\n
\\n
{{ frappe.utils.formatdate(doc.po_date, 'dd-MMM-YYYY') }}
\\n
\\n
\\n
\\n
{{ frappe.utils.formatdate(doc.due_date, 'dd-MMM-YYYY') }}
\\n
\\n{% else %}\\n
\\n
\\n
{{ doc.return_against}}
\\n
\\n{% endif %}\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t{% for item in doc.items %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t{% endfor %}\\r\\n\\t\\r\\n \\r\\n \\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% else %}\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n
SI\\r\\n\\t\\tParticulars\\r\\n\\t\\tQTY\\r\\n\\t\\tVAT\\r\\n\\t\\tRate\\r\\n\\t\\tAmount\\r\\n\\t
{{ loop.index }}\\r\\n\\t\\t\\t{{ item.item_name }}\\r\\n\\t\\t\\t{% if (item.description != item.item_name) %}\\r\\n\\t\\t\\t\\t
{{ item.description }}\\r\\n\\t\\t\\t{% endif %}\\r\\n\\t\\t
\\r\\n\\t\\t {% if item.qty|int != 0 %} \\r\\n\\t\\t {{ item.get_formatted(\\\"qty\\\", 0).replace(\\\"-\\\",\\\"\\\") }}\\r\\n {% else %}\\t\\t \\r\\n\\t\\t {{ item.get_formatted(\\\"qty\\\", 2).replace(\\\"-\\\",\\\"\\\") }}\\r\\n\\t\\t {% endif %}\\r\\n\\t\\t\\t{{ item.get_formatted(\\\"uom\\\", 0) }}\\r\\n\\t\\t\\r\\n\\t\\t\\t{% set mydict = json.loads(item.item_tax_rate) %}\\r\\n\\t\\t\\t{% if item.item_tax_rate == \\\"{}\\\" %}\\r\\n\\t\\t\\t\\t{% for row in doc.taxes %}\\r\\n\\t\\t\\t\\t\\t{{ row.get_formatted(\\\"rate\\\",0) }}%\\r\\n\\t\\t\\t\\t{% endfor %}\\r\\n\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t{% set ns = namespace(vat=none) %}\\r\\n\\t\\t\\t\\t{% for key, value in mydict.items() %}\\t\\r\\n\\t\\t\\t\\t\\t{% set ns.vat = value %}\\r\\n\\t\\t\\t\\t\\t{% endfor %}\\r\\n\\t\\t\\t\\t{{ ns.vat }}%\\r\\n\\t\\t\\t{% endif %}\\t\\t\\t\\t\\t\\t\\t\\t\\r\\n\\t\\t{{ item.get_formatted(\\\"net_rate\\\", doc) }}{{ frappe.utils.fmt_money('%0.2f'|format(item.net_amount|float|abs), currency=doc.currency) }}
\\r\\n Amount in Words
\\r\\n {{ doc.in_words }}

\\r\\n \\r\\n {% if doc.currency != \\\"TZS\\\" %}\\r\\n {{ doc.base_in_words }}\\r\\n {% endif %} \\r\\n \\r\\n
SUB. TOTAL{{ frappe.utils.fmt_money('%0.2f'|format(doc.net_total|float|abs), currency=doc.currency) }}
V.A.T.{{ frappe.utils.fmt_money('%0.2f'|format(doc.total_taxes_and_charges|float|abs), currency=doc.currency) }}
TOTAL{{ frappe.utils.fmt_money('%0.2f'|format(doc.grand_total|float|abs), currency=doc.currency) }}
E&OE
Assessable Value:\\r\\n\\t\\t\\t\\t{% if (doc.base_total_taxes_and_charges == 0) %}\\r\\n\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(0, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t{% if (doc.base_net_total != doc.base_total) %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_net_total, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_total_taxes_and_charges / 0.18, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t 
\\r\\n\\t\\t\\t\\t{% if (doc.from_date != None) %}\\r\\n\\t\\t\\t\\t\\tPERIOD: FROM {{ frappe.utils.formatdate(doc.from_date, 'dd-MMM-YYYY') }} TO {{ frappe.utils.formatdate(doc.to_date, 'dd-MMM-YYYY') }}
\\r\\n\\t\\t\\t\\t{% endif %}\\t\\r\\n\\t\\t\\t\\t{% if (doc.remarks != \\\"No Remarks\\\") %}{{ doc.remarks }}{% endif %}\\r\\n\\t\\t\\t
VAT Amount:{{ frappe.utils.fmt_money(doc.base_total_taxes_and_charges, currency=\\\"\\\") }}
Exempt:\\r\\n\\t\\t\\t\\t{% if (doc.base_total_taxes_and_charges == 0) %}\\r\\n\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_total, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t{% if (doc.base_net_total != doc.base_total) %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_grand_total - (doc.base_net_total + doc.base_total_taxes_and_charges), currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_grand_total - ((doc.base_total_taxes_and_charges / 0.18) + doc.base_total_taxes_and_charges), currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t
Special Relief: 
Zero Rated: 
Total:\\r\\n\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_grand_total, currency=\\\"\\\") }}\\r\\n\\t\\t\\t
\\r\\n
\\r\\n
\\r\\n 1mm\\r\\n 1mm\\r\\n 1mm\\r\\n 0mm\\r\\n
\\r\\n
\\r\\n\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\n\\t\\n\\t\\t\\n\\t\\t\\t{% if (doc.is_return == 0) %}\\n\\t\\t\\t\\t\\n\\t\\t\\t{% else %}\\n\\t\\t\\t\\t\\n\\t\\t\\t{% endif %}\\n\\t\\t\\t\\n\\t\\t\\n\\t\\n
\\n\\t\\t\\t\\t\\t{{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"company_bank_details\\\") }}\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t{{ doc.remarks }}\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t
\\n\\t\\t\\t\\t\\t
for {{ doc.company }}
\\n\\t\\t\\t\\t\\t
Authorised Signatory
\\n\\t\\t\\t\\t
\\n\\t\\t\\t
\"}]", + "html": "", + "idx": 0, + "line_breaks": 1, + "modified": "2021-02-15 09:07:02.443364", + "modified_by": "info@aakvatech.com", + "module": "CSF TZ", + "name": "AV Tax Invoice", + "owner": "Administrator", + "parent": "Sales Invoice", + "print_format_builder": 1, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 1, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/tally_format/__init__.py b/csf_tz/csf_tz/print_format/tally_format/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/tally_format/tally_format.json b/csf_tz/csf_tz/print_format/tally_format/tally_format.json new file mode 100644 index 0000000..19e3100 --- /dev/null +++ b/csf_tz/csf_tz/print_format/tally_format/tally_format.json @@ -0,0 +1,25 @@ +{ + "align_labels_right": 0, + "creation": "2020-03-04 10:07:22.936567", + "css": ".print-format {\npadding-left: 5mm;\npadding-right: 5mm;\npadding-top: 10mm;\npadding-bottom: 5mm;\n}\n", + "custom_format": 1, + "disabled": 1, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"
\\t\\t\\t\\t\\n
Tax Invoice
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Address\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"address_display\", \"label\": \"Address\", \"print_hide\": 0}, {\"fieldname\": \"contact_display\", \"label\": \"Contact\", \"print_hide\": 0}, {\"fieldname\": \"contact_mobile\", \"label\": \"Mobile No\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Currency\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"conversion_rate\", \"label\": \"Exchange Rate\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"scan_barcode\", \"label\": \"Scan Barcode\", \"print_hide\": 0}, {\"visible_columns\": [{\"print_width\": \"\", \"fieldname\": \"item_code\", \"print_hide\": 0}, {\"print_width\": \"200px\", \"fieldname\": \"description\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"image\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"qty\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"stock_uom\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"uom\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"discount_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"rate\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"pricing_rule\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"deferred_revenue_account\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"service_stop_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"enable_deferred_revenue\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"service_start_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"service_end_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"quality_inspection\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"serial_no\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"asset\", \"print_hide\": 0}], \"fieldname\": \"items\", \"label\": \"Items\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"total_qty\", \"label\": \"Total Quantity\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"total\", \"label\": \"Total\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_width\": \"\", \"fieldname\": \"charge_type\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"row_id\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"account_head\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"cost_center\", \"print_hide\": 0}, {\"print_width\": \"300px\", \"fieldname\": \"description\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"rate\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"tax_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"total\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"tax_amount_after_discount_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"base_tax_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"base_total\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"base_tax_amount_after_discount_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"item_wise_tax_detail\", \"print_hide\": 0}], \"fieldname\": \"taxes\", \"label\": \"Sales Taxes and Charges\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"Loyalty\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"loyalty_redemption_account\", \"label\": \"Redemption Account\", \"print_hide\": 0}, {\"fieldname\": \"loyalty_redemption_cost_center\", \"label\": \"Redemption Cost Center\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"base_grand_total\", \"align\": \"left\", \"print_hide\": 0, \"label\": \"Grand Total (TZS)\"}, {\"fieldname\": \"base_rounded_total\", \"align\": \"left\", \"print_hide\": 0, \"label\": \"Rounded Total (TZS)\"}, {\"fieldname\": \"base_in_words\", \"align\": \"left\", \"print_hide\": 0, \"label\": \"In Words (TZS)\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"grand_total\", \"label\": \"Grand Total\", \"print_hide\": 0}, {\"fieldname\": \"rounded_total\", \"label\": \"Rounded Total\", \"print_hide\": 0}, {\"fieldname\": \"in_words\", \"label\": \"In Words\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"Advance\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"allocate_advances_automatically\", \"label\": \"Allocate Advances Automatically (FIFO)\", \"print_hide\": 0}, {\"fieldname\": \"get_advances\", \"label\": \"Get Advances Received\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"terms\", \"label\": \"Terms and Conditions Details\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"More\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"inter_company_invoice_reference\", \"label\": \"Inter Company Invoice Reference\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Subscription\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"update_auto_repeat_reference\", \"label\": \"Update Auto Repeat Reference\", \"print_hide\": 0}]", + "html": "

Tax Invoice

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n {{ doc.company or \"\" }}
\n {{ frappe.db.get_value(\"Company\", doc.company, \"registration_details\") or \"\" }}\n
\n Invoice No.
\n {{ doc.name }}\n
\n Dated
\n\t {{ frappe.utils.formatdate(doc.posting_date) }}\n
\n Delivery Note
\n\t  \n
\n Mode/Terms of Payment
\n\t  \n
\n Supplier's Ref.
\n\t  \n
\n Other Reference(s)
\n\t  \n
\n Customer
\n {{ doc.customer_name or \"\" }}
\n\t {{ doc.address_display or \"\" }}\n
\n Buyer's Order No.
\n\t  \n
\n Dated
\n\t  \n
\n Despatch Document No.
\n\t  \n
\n Dated
\n\t  \n
\n Despatched through
\n\t  \n
\n Destination
\n\t  \n
\n Terms of Delivery
\n\t  \n
\n\n\n\t\n\n{% for item in doc.items %}\n{% set remrows = 10 - loop.revindex %}\n\n\t\n\t\n\t\n\t\n\t\n\t\n\n{% set trate = \"\" %}\n{% endfor %}\n\n\n
Sl\n\tParticulars\n\tQTY\n\tRate\n\tVAT\n\tAmount\n
{{ loop.index }}{{ item.item_name }}{{ item.get_formatted(\"qty\", 0) }}{{ item.get_formatted(\"rate\", doc) }}\n\t\t{% set mydict = json.loads(item.item_tax_rate) %}\n\t\t{% if item.item_tax_rate == \"{}\" %}\n\t\t\t{% for row in doc.taxes %}\n\t\t\t\t{{ row.rate }}.0%\n\t\t\t{% endfor %}\n\t\t{% else %}\n\t\t\t{% for key, value in mydict.items() %}\n\t\t\t\t{{ value }}%\n\t\t\t{% endfor %}\n\t\t{% endif %}\n\n\n {{ item.get_formatted(\"amount\", doc) }}
\n\n\n\n \n\t\n \n\t\n\n\n\t\n \n\t\n\t\n\n\n\t\n\t\n\t\n\n\n\t\n\t\n\n
\n Amount in Words
\n {{ doc.in_words }}

\n {{ doc.base_in_words }}\n
SUB TOTAL{{ doc.get_formatted(\"base_total\", doc) }}{{ doc.get_formatted(\"total\", doc) }}
VAT{{ doc.get_formatted(\"base_total_taxes_and_charges\", doc) }}{{ doc.get_formatted(\"total_taxes_and_charges\", doc) }}
TOTAL{{ doc.get_formatted(\"base_grand_total\", doc) }}{{ doc.get_formatted(\"grand_total\", doc) }}
{{ doc.remarks }}\n for {{ doc.company }}\n
\n
\n Authorised Signatory\n
\n
\n
\n", + "idx": 0, + "line_breaks": 0, + "modified": "2020-03-09 17:10:05.059954", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Tally Format", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/withholding_certificate/__init__.py b/csf_tz/csf_tz/print_format/withholding_certificate/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/withholding_certificate/withholding_certificate.json b/csf_tz/csf_tz/print_format/withholding_certificate/withholding_certificate.json new file mode 100644 index 0000000..6037c07 --- /dev/null +++ b/csf_tz/csf_tz/print_format/withholding_certificate/withholding_certificate.json @@ -0,0 +1,27 @@ +{ + "absolute_value": 0, + "align_labels_right": 0, + "creation": "2020-03-04 10:07:23.114505", + "css": ".print-format {\npadding-left: 25mm;\npadding-right: 25mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}\n\n[document-status] {\n display: none;\n}", + "custom_format": 0, + "disabled": 1, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"options\": \"
\", \"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"label\": \"Custom HTML\", \"options\": \"


\\n
\\n
\\nNo:  {{ doc.tra_control_number }}  \\n
\\n

\\n
\\n\\tCERTIFICATE/REMITTANCE SLIP IN RESPECT OF
\\n\\tWITHHOLDING TAX ON RENT FEES\\n
\\n
\\nName of TAXPAYER/WITHHOLDER:   {{doc.customer}}   

\\n\\n{% set cust_tin = frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"tax_id\\\")| replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\n\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
TIN:{{ cust_tin[0] }}{{ cust_tin[1] }}{{ cust_tin[2] }} {{ cust_tin[3] }}{{ cust_tin[4] }}{{ cust_tin[5] }} {{ cust_tin[6] }}{{ cust_tin[7] }}{{ cust_tin[8] }}
\\n
\\nName of WITHHOLDEE.   {{doc.company}}   

\\n{% set cmp_tin = frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\")| replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\n\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
TIN:{{ cmp_tin[0] }}{{ cmp_tin[1] }}{{ cmp_tin[2] }} {{ cmp_tin[3] }}{{ cmp_tin[4] }}{{ cmp_tin[5] }} {{ cmp_tin[6] }}{{ cmp_tin[7] }}{{ cmp_tin[8] }}
\\n
\\nI hereby certify that, I have this date of  {{ frappe.utils.formatdate(doc.posting_date, \\\"dd\\\")}}  Month of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}}  deducted prior to payment of Rent Fees in favour of the Commissioner of Domestic Revenue Department/Large Taxpayers Department withheld from the above named person as follows:
\\nGross Amount in \\n {{ doc.get_formatted(\\\"base_total\\\", doc) }}  
\\nTax withheld at  10  %\\n\\n{% set wth_amount = doc.base_total * 0.1 %}\\n\\n TZS \\n{{ frappe.format_value(wth_amount, {'fieldtype': 'Currency', 'options': 'TZS'})}}\\n  
\\n
\\nThis payment is for the period covered from  {{ frappe.utils.formatdate(doc.from_date) }} to {{ frappe.utils.formatdate(doc.to_date) }}  

\\nI further certify that the above withholding Tax has been/shall be REMITTED to the Regional Manager  ILALA/   Large Taxpayers Department in the monthly schedule of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}} .

\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\nTo be completed in triplicate:
\\n(1) Original to Customer
\\n(2)\\tDuplicate to TRA Office
\\n(3)\\tTriplicate \\u2013 Retained by withholder
\\n\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\"}]", + "idx": 0, + "line_breaks": 0, + "modified": "2021-02-15 09:06:33.980767", + "modified_by": "info@aakvatech.com", + "module": "CSF TZ", + "name": "Withholding Certificate", + "owner": "Administrator", + "parent": "", + "parentfield": "", + "parenttype": "", + "print_format_builder": 1, + "raw_printing": 0, + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/__init__.py b/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/withholding_certificate_multi_items.json b/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/withholding_certificate_multi_items.json new file mode 100644 index 0000000..c7d828d --- /dev/null +++ b/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/withholding_certificate_multi_items.json @@ -0,0 +1,27 @@ +{ + "absolute_value": 0, + "align_labels_right": 0, + "creation": "2020-03-04 10:07:23.165260", + "css": ".print-format {\npadding-left: 25mm;\npadding-right: 25mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}\n\n[document-status] {\n display: none;\n}", + "custom_format": 0, + "default_print_language": "en", + "disabled": 1, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"options\": \"\", \"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"label\": \"Custom HTML\", \"options\": \"{% for item in doc.items %}\\r\\n\\t{% if item.item_name == \\\"Residential Rent\\\" or item.item_name == \\\"Commercial Rent\\\" %}\\r\\n\\t\\t{% set wth_rate = 10 %}\\r\\n\\t{% else %}\\r\\n\\t\\t{% set wth_rate = 5 %}\\r\\n\\t{% endif %}\\t\\r\\n\\t\\r\\n\\t{% if item.item_name == \\\"Residential Rent\\\" or item.item_name == \\\"Commercial Rent\\\" or item.item_name == \\\"Customization\\\" %}\\r\\n\\t\\t
\\r\\n\\t\\t


\\r\\n\\t\\t
\\r\\n\\t\\t
\\r\\n\\t\\t\\tNo:  {{ doc.tra_control_number | default('    ', true)}}  \\r\\n\\t\\t
\\r\\n\\t\\t

\\r\\n\\t\\t
\\r\\n\\t\\t\\tCERTIFICATE/REMITTANCE SLIP IN RESPECT OF
\\r\\n\\t\\t\\tWITHHOLDING TAX ON RENT FEES\\r\\n\\t\\t
\\r\\n\\t\\t
\\r\\n\\t\\tName of TAXPAYER/WITHHOLDER:   {{doc.customer}}   

\\r\\n\\t\\t\\r\\n\\t\\t{% set cust_tin = frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"tax_id\\\") | default('000-000-000', true) | replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\r\\n\\t\\t\\r\\n\\t\\t

Name: ___________________

Designation: ___________________

___________________

___________________
SignatureDate

Name: ___________________

Designation: ___________________

___________________

___________________
Countersignature (withholdee)Date
Official Stamp
\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t
TIN:{{ cust_tin[0] }}{{ cust_tin[1] }}{{ cust_tin[2] }} {{ cust_tin[3] }}{{ cust_tin[4] }}{{ cust_tin[5] }} {{ cust_tin[6] }}{{ cust_tin[7] }}{{ cust_tin[8] }}
\\r\\n\\t\\t
\\r\\n\\t\\tName of WITHHOLDEE.   {{doc.company}}   

\\r\\n\\t\\t{% set cmp_tin = frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") | default('000-000-000', true) | replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t
TIN:{{ cmp_tin[0] }}{{ cmp_tin[1] }}{{ cmp_tin[2] }} {{ cmp_tin[3] }}{{ cmp_tin[4] }}{{ cmp_tin[5] }} {{ cmp_tin[6] }}{{ cmp_tin[7] }}{{ cmp_tin[8] }}
\\r\\n\\t\\t
\\r\\n\\t\\tI hereby certify that, I have this date of  {{ frappe.utils.formatdate(doc.posting_date, \\\"dd\\\")}}  Month of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}}  deducted prior to payment of Rent Fees in favour of the Commissioner of Domestic Revenue Department/Large Taxpayers Department withheld from the above named person as follows:
\\r\\n\\t\\tGross Amount in \\r\\n\\t\\t {{ item.get_formatted(\\\"base_net_amount\\\", doc) }}  
\\r\\n\\t\\tTax withheld at  {{ wth_rate }}  %\\r\\n\\t\\t\\r\\n\\t\\t{% set wth_amount = item.base_net_amount * (wth_rate / 100) %}\\r\\n\\t\\t\\r\\n\\t\\t TZS \\r\\n\\t\\t{{ frappe.format_value(wth_amount, {'fieldtype': 'Currency', 'options': 'TZS'})}}\\r\\n\\t\\t  
\\r\\n\\t\\t
\\r\\n\\t\\tThis payment is for the period covered from  {{ frappe.utils.formatdate(doc.from_date) }} to {{ frappe.utils.formatdate(doc.to_date) }}  

\\r\\n\\t\\tI further certify that the above withholding Tax has been/shall be REMITTED to the Regional Manager  ILALA/   Large Taxpayers Department in the monthly schedule of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}} .

\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\tTo be completed in triplicate:
\\r\\n\\t\\t(1) Original to Customer
\\r\\n\\t\\t(2)\\tDuplicate to TRA Office
\\r\\n\\t\\t(3)\\tTriplicate \\u2013 Retained by withholder
\\r\\n\\t\\t\\r\\n\\t\\t

\\t\\t\\r\\n\\t{% endif %}\\r\\n{% endfor %}\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\"}]", + "html": "", + "idx": 0, + "line_breaks": 0, + "modified": "2021-02-15 09:06:34.047210", + "modified_by": "info@aakvatech.com", + "module": "CSF TZ", + "name": "Withholding Certificate Multi Items", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/csf_tz/program_enrollment.js b/csf_tz/csf_tz/program_enrollment.js new file mode 100644 index 0000000..a9fc565 --- /dev/null +++ b/csf_tz/csf_tz/program_enrollment.js @@ -0,0 +1,34 @@ +frappe.ui.form.on("Program Enrollment", { + program: function (frm) { + frm.set_value("fees", ""); + frm.events.get_courses(frm); + if (frm.doc.program) { + frappe.call({ + method: "csf_tz.csftz_hooks.program_enrollment.get_fee_schedule", + args: { + "program": frm.doc.program, + "student_category": frm.doc.student_category, + "academic_year": frm.doc.academic_year, + "academic_term": frm.doc.academic_term + }, + async: false, + callback: function (r) { + if (r.message) { + frm.set_value("fees", r.message); + frm.events.get_courses(frm); + } + } + }); + } + }, + + student_category: function () { + frappe.ui.form.trigger("program"); + }, + + validate: function (frm) { + if (( !frm.doc.fees || !frm.doc.fees.length) && frm.doc.student_category) { + frm.trigger("program"); + } + } +}); diff --git a/csf_tz/csf_tz/program_enrollment_tool.js b/csf_tz/csf_tz/program_enrollment_tool.js new file mode 100644 index 0000000..7fffcb7 --- /dev/null +++ b/csf_tz/csf_tz/program_enrollment_tool.js @@ -0,0 +1,38 @@ +frappe.ui.form.on("Program Enrollment Tool", { + refresh: function (frm) { + frm.toggle_display(['enroll_students']); + }, + academic_year: function (frm) { + frm.toggle_display("enroll_students", is_viewable); + }, + get_students: function (frm) { + if (frm.doc.students.length > 0) { + frm.add_custom_button(__("Enroll All Students"), function () { + if (frm.doc.students.length > 0) { + frappe.call({ + method: "csf_tz.custom_api.enroll_all_students", + args: { + "self": frm.doc + }, + callback: function (r) { + if (r.message === 'queued') { + frappe.show_alert({ + message: __("Students enrollment has been queued."), + indicator: 'orange' + }); + } else { + frappe.show_alert({ + message: __("{0} students enrolled.", [r.message]), + indicator: 'green' + }); + } + } + }); + } else { + frappe.msgprint("No students to enroll") + } + }) + } + }, + +}) \ No newline at end of file diff --git a/csf_tz/csf_tz/purchase_invoice.js b/csf_tz/csf_tz/purchase_invoice.js new file mode 100644 index 0000000..b7c579e --- /dev/null +++ b/csf_tz/csf_tz/purchase_invoice.js @@ -0,0 +1,77 @@ +frappe.ui.form.on("Purchase Invoice", { + supplier: function(frm) { + if (!frm.doc.supplier) { + return + } + setTimeout(function() { + if (!frm.doc.tax_category){ + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function(r) { + if(!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, + setup: function(frm) { + frm.set_query("taxes_and_charges", function() { + return { + "filters": { + "company": frm.doc.company, + } + }; + }); + frappe.call({ + method: "erpnext.accounts.doctype.accounting_dimension.accounting_dimension.get_dimensions", + callback: function(r) { + if(!r.exc) { + const dimensions = []; + r.message[0].forEach(element => { + dimensions.push(element.fieldname); + }); + frm.dimensions = dimensions; + // console.log(frm.dimensions); + + } + } + }); + // const dimensions_fields = $("div.frappe-control[data-fieldname='expense_type']") + // console.log(dimensions_fields); + }, + onload: function(frm){ + frm.dimensions.forEach(i => { + let dimension_field = $(`div.frappe-control[data-fieldname='${i}']`).find("input"); + dimension_field.on("focusout",function() { + frm.doc.items.forEach(row => { + row[i]=frm.doc[i]; + }); + frm.refresh_field("items"); + }); + }); + }, + +}); +frappe.ui.form.on("Purchase Invoice Item", { + items_add: function(frm, cdt, cdn) { + var row = frappe.get_doc(cdt, cdn); + frm.dimensions.forEach(i => { + row[i]=frm.doc[i]; + }); + frm.refresh_field("items"); + }, + csf_tz_create_wtax_entry: (frm, cdt, cdn) => { + frappe.call('csf_tz.custom_api.make_withholding_tax_gl_entries_for_purchase', { + doc: frm.doc, method: 'From Front End' + }).then(r => { + frm.refresh(); + }); + } +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/purchase_order.js b/csf_tz/csf_tz/purchase_order.js new file mode 100644 index 0000000..18219ed --- /dev/null +++ b/csf_tz/csf_tz/purchase_order.js @@ -0,0 +1,30 @@ +frappe.ui.form.on("Purchase Order", { + supplier: function(frm) { + setTimeout(function() { + if (!frm.doc.tax_category){ + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function(r) { + if(!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, + setup: function(frm) { + frm.set_query("taxes_and_charges", function() { + return { + "filters": { + "company": frm.doc.company, + } + }; + }); + }, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/purchase_receipt.js b/csf_tz/csf_tz/purchase_receipt.js new file mode 100644 index 0000000..7320a13 --- /dev/null +++ b/csf_tz/csf_tz/purchase_receipt.js @@ -0,0 +1,21 @@ +frappe.ui.form.on("Purchase Receipt", { + supplier: function(frm) { + setTimeout(function() { + if (!frm.doc.tax_category){ + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function(r) { + if(!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/quotation.js b/csf_tz/csf_tz/quotation.js new file mode 100644 index 0000000..6225bb7 --- /dev/null +++ b/csf_tz/csf_tz/quotation.js @@ -0,0 +1,21 @@ +frappe.ui.form.on("Quotation", { + party_name: function(frm) { + setTimeout(function() { + if (!frm.doc.tax_category){ + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function(r) { + if(!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/report/__init__.py b/csf_tz/csf_tz/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/accounts_receivable_multi_currency/__init__.py b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.html b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.html new file mode 100644 index 0000000..fab2f0e --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.html @@ -0,0 +1,263 @@ + + +

{%= __(report.report_name) %}

+

+ {% if (filters.customer_name) { %} + {%= filters.customer_name %} + {% } else { %} + {%= filters.customer || filters.supplier %} + {% } %} +

+
+ {% if (filters.tax_id) { %} + {%= __("Tax Id: ")%} {%= filters.tax_id %} + {% } %} +
+
+ {%= __(filters.ageing_based_on) %} + {%= __("Until") %} + {%= frappe.datetime.str_to_user(filters.report_date) %} +
+ +
+
+ {% if(filters.payment_terms) { %} + {%= __("Payment Terms") %}: {%= filters.payment_terms %} + {% } %} +
+
+ {% if(filters.credit_limit) { %} + {%= __("Credit Limit") %}: {%= format_currency(filters.credit_limit) %} + {% } %} +
+
+ +{% if(filters.show_pdc_in_print) { %} + {% var balance_row = data.slice(-1).pop(); + var range1 = report.columns[11].label; + var range2 = report.columns[12].label; + var range3 = report.columns[13].label; + var range4 = report.columns[14].label; + %} + {% if(balance_row) { %} +

Name: ___________________

Designation: ___________________

___________________

___________________
SignatureDate

Name: ___________________

Designation: ___________________

___________________

___________________
Countersignature (withholdee)Date
Official Stamp
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
(Amount in {%= data[0][__("currency")] || "" %})
{%= __(" ") %}{%= __(range1) %}{%= __(range2) %}{%= __(range3) %}{%= __(range4) %}{%= __("Total") %}
{%= __("Total Outstanding") %}{%= format_currency(balance_row[range1]) %}{%= format_currency(balance_row[range2]) %}{%= format_currency(balance_row[range3]) %}{%= format_currency(balance_row[range4]) %} + {%= format_currency(flt(balance_row[("outstanding_amount")]), data[data.length-1]["currency"]) %} +
{%= __("PDC/LC") %} + {%= format_currency(flt(balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %} +
+ {% } %} +{% } %} + + + + {% if(report.report_name === "Accounts Receivable Multi Currency" || report.report_name === "Accounts Payable Multi Currency") { %} + + + + {% if(report.report_name === "Accounts Receivable Multi Currency" && filters.show_sales_person_in_print) { %} + + + {% } else { %} + + {% } %} + {% if(!filters.show_pdc_in_print) { %} + + {% } %} + + {% if(!filters.show_pdc_in_print) { %} + + + {% } %} + + {% if(filters.show_pdc_in_print) { %} + {% if(report.report_name === "Accounts Receivable Multi Currency") { %} + + {% } %} + + + + {% } %} + {% } else { %} + + + + + + {% } %} + + + + {% for(var i=0, l=data.length; i + {% if(report.report_name === "Accounts Receivable Multi Currency" || report.report_name === "Accounts Payable") { %} + {% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %} + + + + + {% if(report.report_name === "Accounts Receivable Multi Currency" && filters.show_sales_person_in_print) { %} + + {% } %} + + {% if(!filters.show_pdc_in_print) { %} + + {% } %} + + + + {% if(!filters.show_pdc_in_print) { %} + + + {% } %} + + + {% if(filters.show_pdc_in_print) { %} + {% if(report.report_name === "Accounts Receivable Multi Currency") { %} + + {% } %} + + + + {% } %} + {% } else { %} + + {% if(!filters.show_pdc_in_print) { %} + + {% } %} + {% if(report.report_name === "Accounts Receivable Multi Currency" && filters.show_sales_person_in_print) { %} + + {% } %} + + + + + {% if(!filters.show_pdc_in_print) { %} + + + {% } %} + + + {% if(filters.show_pdc_in_print) { %} + {% if(report.report_name === "Accounts Receivable Multi Currency") { %} + + {% } %} + + + + {% } %} + {% } %} + {% } else { %} + {% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %} + {% if((data[i][__("Customer")] || data[i][__("Supplier")]) != __("'Total'")) { %} + + {% } else { %} + + {% } %} + + + + + {% } %} + {% } %} + + {% } %} + +
{%= __("Date") %}{%= __("Age (Days)") %}{%= __("Reference") %}{%= __("Sales Person") %}{%= __("Reference") %}{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}{%= __("Invoiced Amount") %}{%= __("Paid Amount") %}{%= report.report_name === "Accounts Receivable Multi Currency" ? __('Credit Note') : __('Debit Note') %}{%= __("Outstanding Amount") %}{%= __("Customer LPO No.") %}{%= __("PDC/LC Ref") %}{%= __("PDC/LC Amount") %}{%= __("Remaining Balance") %}{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}{%= __("Total Invoiced Amount") %}{%= __("Total Paid Amount") %}{%= report.report_name === "Accounts Receivable Multi Currency Summary" ? __('Credit Note Amount') : __('Debit Note Amount') %}{%= __("Total Outstanding Amount") %}
{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}{%= data[i][__("Age (Days)")] %} + {% if(!filters.show_pdc_in_print) { %} + {%= data[i]["voucher_type"] %} +
+ {% } %} + {%= data[i]["voucher_no"] %} +
{%= data[i]["sales_person"] %} + {% if(!(filters.customer || filters.supplier)) { %} + {%= data[i][__("Customer")] || data[i][__("Supplier")] %} + {% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %} +
{%= data[i][__("Customer Name")] %} + {% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %} +
{%= data[i][__("Supplier Name")] %} + {% } %} + {% } %} +
+ {% if data[i][__("Remarks")] %} + {%= __("Remarks") %}: + {%= data[i][__("Remarks")] %} + {% } %} +
+
+ {%= format_currency(data[i]["invoiced_amount"], data[i]["currency"]) %} + {%= format_currency(data[i]["paid_amount"], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable Multi Currency" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["debit_note"], data[i]["currency"]) %} + {%= format_currency(data[i]["outstanding_amount"], data[i]["currency"]) %} + {%= data[i]["po_no"] %}{%= data[i][("pdc/lc_ref")] %}{%= format_currency(data[i][("pdc/lc_amount")], data[i]["currency"]) %}{%= format_currency(data[i][("remaining_balance")], data[i]["currency"]) %}{%= __("Total") %} + {%= format_currency(data[i]["invoiced_amount"], data[i]["currency"] ) %} + {%= format_currency(data[i]["paid_amount"], data[i]["currency"]) %}{%= report.report_name === "Accounts Receivable Multi Currency" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["debit_note"], data[i]["currency"]) %} + {%= format_currency(data[i]["outstanding_amount"], data[i]["currency"]) %} + {%= data[i][__("Customer LPO")] %}{%= data[i][("pdc/lc_ref")] %}{%= format_currency(data[i][("pdc/lc_amount")], data[i]["currency"]) %}{%= format_currency(data[i][("remaining_balance")], data[i]["currency"]) %} + {% if(!(filters.customer || filters.supplier)) { %} + {%= data[i][__("Customer")] || data[i][__("Supplier")] %} + {% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %} +
{%= data[i][__("Customer Name")] %} + {% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %} +
{%= data[i][__("Supplier Name")] %} + {% } %} + {% } %} +
{%= __("Remarks") %}: + {%= data[i][__("Remarks")] %} +
{%= __("Total") %}{%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %}{%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %}{%= report.report_name === "Accounts Receivable Multi Currency Summary" ? format_currency(data[i][__("credit_note_amt")], data[i]["currency"]) : format_currency(data[i][__("debit_note_amt")], data[i]["currency"]) %}{%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %}
+

{{ __("Printed On ") }}{%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}

diff --git a/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.js b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.js new file mode 100644 index 0000000..78fbf25 --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.js @@ -0,0 +1,203 @@ +// Copyright (c) 2016, Aakvatech Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + +frappe.query_reports["Accounts Receivable Multi Currency"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "reqd": 1, + "default": frappe.defaults.get_user_default("Company") + }, + { + "fieldname":"ageing_based_on", + "label": __("Ageing Based On"), + "fieldtype": "Select", + "options": 'Posting Date\nDue Date', + "default": "Posting Date" + }, + { + "fieldname":"report_date", + "label": __("As on Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today() + }, + { + "fieldname":"range1", + "label": __("Ageing Range 1"), + "fieldtype": "Int", + "default": "30", + "reqd": 1 + }, + { + "fieldname":"range2", + "label": __("Ageing Range 2"), + "fieldtype": "Int", + "default": "60", + "reqd": 1 + }, + { + "fieldname":"range3", + "label": __("Ageing Range 3"), + "fieldtype": "Int", + "default": "90", + "reqd": 1 + }, + { + "fieldname":"range4", + "label": __("Ageing Range 4"), + "fieldtype": "Int", + "default": "120", + "reqd": 1 + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book" + }, + { + "fieldname":"cost_center", + "label": __("Cost Center"), + "fieldtype": "Link", + "options": "Cost Center", + get_query: () => { + var company = frappe.query_report.get_filter_value('company'); + return { + filters: { + 'company': company + } + } + } + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + on_change: () => { + var customer = frappe.query_report.get_filter_value('customer'); + var company = frappe.query_report.get_filter_value('company'); + if (customer) { + frappe.db.get_value('Customer', customer, ["tax_id", "customer_name", "payment_terms"], function(value) { + frappe.query_report.set_filter_value('tax_id', value["tax_id"]); + frappe.query_report.set_filter_value('customer_name', value["customer_name"]); + frappe.query_report.set_filter_value('payment_terms', value["payment_terms"]); + }); + + frappe.db.get_value('Customer Credit Limit', {'parent': customer, 'company': company}, + ["credit_limit"], function(value) { + if (value) { + frappe.query_report.set_filter_value('credit_limit', value["credit_limit"]); + } + }, "Customer"); + } else { + frappe.query_report.set_filter_value('tax_id', ""); + frappe.query_report.set_filter_value('customer_name', ""); + frappe.query_report.set_filter_value('credit_limit', ""); + frappe.query_report.set_filter_value('payment_terms', ""); + } + } + }, + { + "fieldname":"customer_group", + "label": __("Customer Group"), + "fieldtype": "Link", + "options": "Customer Group" + }, + { + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" + }, + { + "fieldname":"territory", + "label": __("Territory"), + "fieldtype": "Link", + "options": "Territory" + }, + { + "fieldname":"sales_partner", + "label": __("Sales Partner"), + "fieldtype": "Link", + "options": "Sales Partner" + }, + { + "fieldname":"sales_person", + "label": __("Sales Person"), + "fieldtype": "Link", + "options": "Sales Person" + }, + { + "fieldname": "group_by_party", + "label": __("Group By Customer"), + "fieldtype": "Check" + }, + { + "fieldname":"based_on_payment_terms", + "label": __("Based On Payment Terms"), + "fieldtype": "Check", + }, + { + "fieldname":"show_future_payments", + "label": __("Show Future Payments"), + "fieldtype": "Check", + }, + { + "fieldname":"show_delivery_notes", + "label": __("Show Delivery Notes"), + "fieldtype": "Check", + }, + { + "fieldname":"show_sales_person", + "label": __("Show Sales Person"), + "fieldtype": "Check", + }, + { + "fieldname":"tax_id", + "label": __("Tax Id"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname":"customer_name", + "label": __("Customer Name"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname":"payment_terms", + "label": __("Payment Tems"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname":"credit_limit", + "label": __("Credit Limit"), + "fieldtype": "Currency", + "hidden": 1 + } + ], + + "formatter": function(value, row, column, data, default_formatter) { + value = default_formatter(value, row, column, data); + if (data && data.bold) { + value = value.bold(); + + } + return value; + }, + + onload: function(report) { + report.page.add_inner_button(__("Accounts Receivable Summary"), function() { + var filters = report.get_values(); + frappe.set_route('query-report', 'Accounts Receivable Summary', {company: filters.company}); + }); + } +} + +erpnext.utils.add_dimensions('Accounts Receivable', 9); + diff --git a/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.json b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.json new file mode 100644 index 0000000..92ca3fa --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 1, + "creation": "2019-06-27 11:42:35.845472", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-06-27 11:42:35.845472", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Accounts Receivable Multi Currency", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "report_name": "Accounts Receivable Multi Currency", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.py b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.py new file mode 100644 index 0000000..7935c7c --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_multi_currency/accounts_receivable_multi_currency.py @@ -0,0 +1,836 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe, erpnext +from frappe import _, scrub +from frappe.utils import getdate, nowdate, flt, cint, formatdate, cstr, now, time_diff_in_seconds +from collections import OrderedDict +from erpnext.accounts.utils import get_currency_precision +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children + +# This report gives a summary of all Outstanding Invoices considering the following + +# 1. Invoice can be booked via Sales/Purchase Invoice or Journal Entry +# 2. Report handles both receivable and payable +# 3. Key balances for each row are "Invoiced Amount", "Paid Amount", "Credit/Debit Note Amount", "Oustanding Amount" +# 4. For explicit payment terms in invoice (example: 30% advance, 30% on delivery, 40% post delivery), +# the invoice will be broken up into multiple rows, one for each payment term +# 5. If there are payments after the report date (post dated), these will be updated in additional columns +# for future amount +# 6. Configurable Ageing Groups (0-30, 30-60 etc) can be set via filters +# 7. For overpayment against an invoice with payment terms, there will be an additional row +# 8. Invoice details like Sales Persons, Delivery Notes are also fetched comma separated +# 9. Report amounts are in "Party Currency" if party is selected, or company currency for multi-party +# 10. This reports is based on all GL Entries that are made against account_type "Receivable" or "Payable" + +def execute(filters=None): + args = { + "party_type": "Customer", + "naming_by": ["Selling Settings", "cust_master_name"], + } + return ReceivablePayableReport(filters).run(args) + +class ReceivablePayableReport(object): + def __init__(self, filters=None): + self.filters = frappe._dict(filters or {}) + self.filters.report_date = getdate(self.filters.report_date or nowdate()) + self.age_as_on = getdate(nowdate()) \ + if self.filters.report_date > getdate(nowdate()) \ + else self.filters.report_date + + def run(self, args): + self.filters.update(args) + self.set_defaults() + self.party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1]) + self.get_columns() + self.get_data() + self.get_chart_data() + return self.columns, self.data, None, self.chart, None, self.skip_total_row + + def set_defaults(self): + if not self.filters.get("company"): + self.filters.company = frappe.db.get_single_value('Global Defaults', 'default_company') + self.company_currency = frappe.get_cached_value('Company', self.filters.get("company"), "default_currency") + self.currency_precision = get_currency_precision() or 2 + self.dr_or_cr = "debit" if self.filters.party_type == "Customer" else "credit" + self.party_type = self.filters.party_type + self.party_details = {} + self.invoices = set() + self.skip_total_row = 0 + + if self.filters.get('group_by_party'): + self.previous_party='' + self.total_row_map = {} + self.skip_total_row = 1 + + def get_data(self): + self.get_gl_entries() + self.get_sales_invoices_or_customers_based_on_sales_person() + self.voucher_balance = OrderedDict() + self.init_voucher_balance() # invoiced, paid, credit_note, outstanding + + # Build delivery note map against all sales invoices + self.build_delivery_note_map() + + # Get invoice details like bill_no, due_date etc for all invoices + self.get_invoice_details() + + # fetch future payments against invoices + self.get_future_payments() + + # Get return entries + self.get_return_entries() + + self.data = [] + for gle in self.gl_entries: + self.update_voucher_balance(gle) + + self.build_data() + + def init_voucher_balance(self): + # build all keys, since we want to exclude vouchers beyond the report date + for gle in self.gl_entries: + # get the balance object for voucher_type + key = (gle.voucher_type, gle.voucher_no, gle.party) + if not key in self.voucher_balance: + self.voucher_balance[key] = frappe._dict( + voucher_type = gle.voucher_type, + voucher_no = gle.voucher_no, + party = gle.party, + posting_date = gle.posting_date, + remarks = gle.remarks, + account_currency = gle.account_currency, + invoiced = 0.0, + paid = 0.0, + credit_note = 0.0, + outstanding = 0.0 + ) + self.get_invoices(gle) + + if self.filters.get('group_by_party'): + self.init_subtotal_row(gle.party) + + if self.filters.get('group_by_party'): + self.init_subtotal_row('Total') + + def get_invoices(self, gle): + if gle.voucher_type in ('Sales Invoice', 'Purchase Invoice'): + if self.filters.get("sales_person"): + if gle.voucher_no in self.sales_person_records.get("Sales Invoice", []) \ + or gle.party in self.sales_person_records.get("Customer", []): + self.invoices.add(gle.voucher_no) + else: + self.invoices.add(gle.voucher_no) + + def init_subtotal_row(self, party): + if not self.total_row_map.get(party): + self.total_row_map.setdefault(party, { + 'party': party, + 'bold': 1 + }) + + for field in self.get_currency_fields(): + self.total_row_map[party][field] = 0.0 + + def get_currency_fields(self): + return ['invoiced', 'foreign_amount', 'paid', 'credit_note', 'outstanding', 'range1', + 'range2', 'range3', 'range4', 'range5'] + + def update_voucher_balance(self, gle): + # get the row where this balance needs to be updated + # if its a payment, it will return the linked invoice or will be considered as advance + row = self.get_voucher_balance(gle) + if not row: return + # gle_balance will be the total "debit - credit" for receivable type reports and + # and vice-versa for payable type reports + gle_balance = self.get_gle_balance(gle) + if gle_balance > 0: + if gle.voucher_type in ('Journal Entry', 'Payment Entry') and gle.against_voucher: + # debit against sales / purchase invoice + row.paid -= gle_balance + else: + # invoice + row.invoiced += gle_balance + else: + # payment or credit note for receivables + if self.is_invoice(gle): + # stand alone debit / credit note + row.credit_note -= gle_balance + else: + # advance / unlinked payment or other adjustment + row.paid -= gle_balance + if row.account_currency != self.company_currency: + if row.voucher_type in ["Sales Invoice","Purchase Invoice"]: + row.foreign_currency, row.foreign_amount = frappe.get_value(row.voucher_type, row.voucher_no, ["currency","rounded_total"]) or "" + elif row.voucher_type in ["Payment Entry","Journal Entry"]: + row.foreign_amount = gle.credit_in_account_currency or gle.debit_in_account_currency + row.foreign_currency = row.account_currency + + def update_sub_total_row(self, row, party): + total_row = self.total_row_map.get(party) + + for field in self.get_currency_fields(): + total_row[field] += row.get(field, 0.0) + + def append_subtotal_row(self, party): + sub_total_row = self.total_row_map.get(party) + + if sub_total_row: + self.data.append(sub_total_row) + self.data.append({}) + self.update_sub_total_row(sub_total_row, 'Total') + + def get_voucher_balance(self, gle): + if self.filters.get("sales_person"): + against_voucher = gle.against_voucher or gle.voucher_no + if not (gle.party in self.sales_person_records.get("Customer", []) or \ + against_voucher in self.sales_person_records.get("Sales Invoice", [])): + return + + voucher_balance = None + if gle.against_voucher: + # find invoice + against_voucher = gle.against_voucher + + # If payment is made against credit note + # and credit note is made against a Sales Invoice + # then consider the payment against original sales invoice. + if gle.against_voucher_type in ('Sales Invoice', 'Purchase Invoice'): + if gle.against_voucher in self.return_entries: + return_against = self.return_entries.get(gle.against_voucher) + if return_against: + against_voucher = return_against + + voucher_balance = self.voucher_balance.get((gle.against_voucher_type, against_voucher, gle.party)) + + if not voucher_balance: + # no invoice, this is an invoice / stand-alone payment / credit note + voucher_balance = self.voucher_balance.get((gle.voucher_type, gle.voucher_no, gle.party)) + + return voucher_balance + + def build_data(self): + # set outstanding for all the accumulated balances + # as we can use this to filter out invoices without outstanding + for key, row in self.voucher_balance.items(): + row.outstanding = flt(row.invoiced - row.paid - row.credit_note, self.currency_precision) + row.invoice_grand_total = row.invoiced + + if abs(row.outstanding) > 1.0/10 ** self.currency_precision: + # non-zero oustanding, we must consider this row + + if self.is_invoice(row) and self.filters.based_on_payment_terms: + # is an invoice, allocate based on fifo + # adds a list `payment_terms` which contains new rows for each term + self.allocate_outstanding_based_on_payment_terms(row) + + if row.payment_terms: + # make separate rows for each payment term + for d in row.payment_terms: + if d.outstanding > 0: + self.append_row(d) + + # if there is overpayment, add another row + self.allocate_extra_payments_or_credits(row) + else: + self.append_row(row) + else: + self.append_row(row) + + if self.filters.get('group_by_party'): + self.append_subtotal_row(self.previous_party) + if self.data: + self.data.append(self.total_row_map.get('Total')) + + def append_row(self, row): + self.allocate_future_payments(row) + self.set_invoice_details(row) + self.set_party_details(row) + self.set_ageing(row) + + if self.filters.get('group_by_party'): + self.update_sub_total_row(row, row.party) + if self.previous_party and (self.previous_party != row.party): + self.append_subtotal_row(self.previous_party) + self.previous_party = row.party + + self.data.append(row) + + def set_invoice_details(self, row): + invoice_details = self.invoice_details.get(row.voucher_no, {}) + if row.due_date: + invoice_details.pop("due_date", None) + row.update(invoice_details) + + if row.voucher_type == 'Sales Invoice': + if self.filters.show_delivery_notes: + self.set_delivery_notes(row) + + if self.filters.show_sales_person and row.sales_team: + row.sales_person = ", ".join(row.sales_team) + del row['sales_team'] + + def set_delivery_notes(self, row): + delivery_notes = self.delivery_notes.get(row.voucher_no, []) + if delivery_notes: + row.delivery_notes = ', '.join(delivery_notes) + + def build_delivery_note_map(self): + if self.invoices and self.filters.show_delivery_notes: + self.delivery_notes = frappe._dict() + + # delivery note link inside sales invoice + si_against_dn = frappe.db.sql(""" + select parent, delivery_note + from `tabSales Invoice Item` + where docstatus=1 and parent in (%s) + """ % (','.join(['%s'] * len(self.invoices))), tuple(self.invoices), as_dict=1) + + for d in si_against_dn: + if d.delivery_note: + self.delivery_notes.setdefault(d.parent, set()).add(d.delivery_note) + + dn_against_si = frappe.db.sql(""" + select distinct parent, against_sales_invoice + from `tabDelivery Note Item` + where against_sales_invoice in (%s) + """ % (','.join(['%s'] * len(self.invoices))), tuple(self.invoices) , as_dict=1) + + for d in dn_against_si: + self.delivery_notes.setdefault(d.against_sales_invoice, set()).add(d.parent) + + def get_invoice_details(self): + self.invoice_details = frappe._dict() + if self.party_type == "Customer": + si_list = frappe.db.sql(""" + select name, due_date, po_no + from `tabSales Invoice` + where posting_date <= %s + """,self.filters.report_date, as_dict=1) + for d in si_list: + self.invoice_details.setdefault(d.name, d) + + # Get Sales Team + if self.filters.show_sales_person: + sales_team = frappe.db.sql(""" + select parent, sales_person + from `tabSales Team` + where parenttype = 'Sales Invoice' + """, as_dict=1) + for d in sales_team: + self.invoice_details.setdefault(d.parent, {})\ + .setdefault('sales_team', []).append(d.sales_person) + + if self.party_type == "Supplier": + for pi in frappe.db.sql(""" + select name, due_date, bill_no, bill_date + from `tabPurchase Invoice` + where posting_date <= %s + """, self.filters.report_date, as_dict=1): + self.invoice_details.setdefault(pi.name, pi) + + # Invoices booked via Journal Entries + journal_entries = frappe.db.sql(""" + select name, due_date, bill_no, bill_date + from `tabJournal Entry` + where posting_date <= %s + and voucher_type != "Exchange Rate Revaluation" + """, self.filters.report_date, as_dict=1) + + for je in journal_entries: + if je.bill_no: + self.invoice_details.setdefault(je.name, je) + + def set_party_details(self, row): + # customer / supplier name + party_details = self.get_party_details(row.party) or {} + row.update(party_details) + if self.filters.get(scrub(self.filters.party_type)): + row.currency = row.account_currency + else: + row.currency = self.company_currency + + def allocate_outstanding_based_on_payment_terms(self, row): + self.get_payment_terms(row) + for term in row.payment_terms: + + # update "paid" and "oustanding" for this term + if not term.paid: + self.allocate_closing_to_term(row, term, 'paid') + + # update "credit_note" and "oustanding" for this term + if term.outstanding: + self.allocate_closing_to_term(row, term, 'credit_note') + + row.payment_terms = sorted(row.payment_terms, key=lambda x: x['due_date']) + + def get_payment_terms(self, row): + # build payment_terms for row + payment_terms_details = frappe.db.sql(""" + select + si.name, si.party_account_currency, si.currency, si.conversion_rate, + ps.due_date, ps.payment_amount, ps.description, ps.paid_amount + from `tab{0}` si, `tabPayment Schedule` ps + where + si.name = ps.parent and + si.name = %s + order by ps.paid_amount desc, due_date + """.format(row.voucher_type), row.voucher_no, as_dict = 1) + + + original_row = frappe._dict(row) + row.payment_terms = [] + + # If no or single payment terms, no need to split the row + if len(payment_terms_details) <= 1: + return + + for d in payment_terms_details: + term = frappe._dict(original_row) + self.append_payment_term(row, d, term) + + def append_payment_term(self, row, d, term): + if (self.filters.get("customer") or self.filters.get("supplier")) and d.currency == d.party_account_currency: + invoiced = d.payment_amount + else: + invoiced = flt(flt(d.payment_amount) * flt(d.conversion_rate), self.currency_precision) + + row.payment_terms.append(term.update({ + "due_date": d.due_date, + "invoiced": invoiced, + "invoice_grand_total": row.invoiced, + "payment_term": d.description, + "paid": d.paid_amount, + "credit_note": 0.0, + "outstanding": invoiced - d.paid_amount + })) + + if d.paid_amount: + row['paid'] -= d.paid_amount + + def allocate_closing_to_term(self, row, term, key): + if row[key]: + if row[key] > term.outstanding: + term[key] = term.outstanding + row[key] -= term.outstanding + else: + term[key] = row[key] + row[key] = 0 + term.outstanding -= term[key] + + def allocate_extra_payments_or_credits(self, row): + # allocate extra payments / credits + additional_row = None + for key in ('paid', 'credit_note'): + if row[key] > 0: + if not additional_row: + additional_row = frappe._dict(row) + additional_row.invoiced = 0.0 + additional_row[key] = row[key] + + if additional_row: + additional_row.outstanding = additional_row.invoiced - additional_row.paid - additional_row.credit_note + self.append_row(additional_row) + + def get_future_payments(self): + if self.filters.show_future_payments: + self.future_payments = frappe._dict() + future_payments = list(self.get_future_payments_from_payment_entry()) + future_payments += list(self.get_future_payments_from_journal_entry()) + if future_payments: + for d in future_payments: + if d.future_amount and d.invoice_no: + self.future_payments.setdefault((d.invoice_no, d.party), []).append(d) + + def get_future_payments_from_payment_entry(self): + return frappe.db.sql(""" + select + ref.reference_name as invoice_no, + payment_entry.party, + payment_entry.party_type, + payment_entry.posting_date as future_date, + ref.allocated_amount as future_amount, + payment_entry.reference_no as future_ref + from + `tabPayment Entry` as payment_entry inner join `tabPayment Entry Reference` as ref + on + (ref.parent = payment_entry.name) + where + payment_entry.docstatus < 2 + and payment_entry.posting_date > %s + and payment_entry.party_type = %s + """, (self.filters.report_date, self.party_type), as_dict=1) + + def get_future_payments_from_journal_entry(self): + if self.filters.get('party'): + amount_field = ("jea.debit_in_account_currency - jea.credit_in_account_currency" + if self.party_type == 'Supplier' else "jea.credit_in_account_currency - jea.debit_in_account_currency") + else: + amount_field = ("jea.debit - " if self.party_type == 'Supplier' else "jea.credit") + + return frappe.db.sql(""" + select + jea.reference_name as invoice_no, + jea.party, + jea.party_type, + je.posting_date as future_date, + sum({0}) as future_amount, + je.cheque_no as future_ref + from + `tabJournal Entry` as je inner join `tabJournal Entry Account` as jea + on + (jea.parent = je.name) + where + je.docstatus < 2 + and je.posting_date > %s + and jea.party_type = %s + and jea.reference_name is not null and jea.reference_name != '' + and je.voucher_type != "Exchange Rate Revaluation" + group by je.name, jea.reference_name + having future_amount > 0 + """.format(amount_field), (self.filters.report_date, self.party_type), as_dict=1) + + def allocate_future_payments(self, row): + # future payments are captured in additional columns + # this method allocates pending future payments against a voucher to + # the current row (which could be generated from payment terms) + if not self.filters.show_future_payments: + return + + row.remaining_balance = row.outstanding + row.future_amount = 0.0 + for future in self.future_payments.get((row.voucher_no, row.party), []): + if row.remaining_balance > 0 and future.future_amount: + if future.future_amount > row.outstanding: + row.future_amount = row.outstanding + future.future_amount = future.future_amount - row.outstanding + row.remaining_balance = 0 + else: + row.future_amount += future.future_amount + future.future_amount = 0 + row.remaining_balance = row.outstanding - row.future_amount + + row.setdefault('future_ref', []).append(cstr(future.future_ref) + '/' + cstr(future.future_date)) + + if row.future_ref: + row.future_ref = ', '.join(row.future_ref) + + def get_return_entries(self): + doctype = "Sales Invoice" if self.party_type == "Customer" else "Purchase Invoice" + filters={ + 'is_return': 1, + 'docstatus': 1 + } + party_field = scrub(self.filters.party_type) + if self.filters.get(party_field): + filters.update({party_field: self.filters.get(party_field)}) + self.return_entries = frappe._dict( + frappe.get_all(doctype, filters, ['name', 'return_against'], as_list=1) + ) + + def set_ageing(self, row): + if self.filters.ageing_based_on == "Due Date": + entry_date = row.due_date + elif self.filters.ageing_based_on == "Supplier Invoice Date": + entry_date = row.bill_date + else: + entry_date = row.posting_date + + self.get_ageing_data(entry_date, row) + + # ageing buckets should not have amounts if due date is not reached + if getdate(entry_date) > getdate(self.filters.report_date): + row.range1 = row.range2 = row.range3 = row.range4 = row.range5 = 0.0 + + def get_ageing_data(self, entry_date, row): + # [0-30, 30-60, 60-90, 90-120, 120-above] + row.range1 = row.range2 = row.range3 = row.range4 = row.range5 = 0.0 + + if not (self.age_as_on and entry_date): + return + + row.age = (getdate(self.age_as_on) - getdate(entry_date)).days or 0 + index = None + + if not (self.filters.range1 and self.filters.range2 and self.filters.range3 and self.filters.range4): + self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4 = 30, 60, 90, 120 + + for i, days in enumerate([self.filters.range1, self.filters.range2, self.filters.range3, self.filters.range4]): + if row.age <= days: + index = i + break + + if index is None: index = 4 + row['range' + str(index+1)] = row.outstanding + + def get_gl_entries(self): + # get all the GL entries filtered by the given filters + + conditions, values = self.prepare_conditions() + order_by = self.get_order_by_condition() + + if self.filters.show_future_payments: + values.insert(2, self.filters.report_date) + + date_condition = """AND (posting_date <= %s + OR (against_voucher IS NULL AND DATE(creation) <= %s))""" + else: + date_condition = "AND posting_date <=%s" + + if self.filters.get(scrub(self.party_type)): + select_fields = "debit_in_account_currency as debit, credit_in_account_currency as credit" + else: + select_fields = "debit, credit" + + self.gl_entries = frappe.db.sql(""" + select + name, posting_date, account, party_type, party, voucher_type, voucher_no, debit_in_account_currency, credit_in_account_currency, + against_voucher_type, against_voucher, account_currency, remarks, {0} + from + `tabGL Entry` + where + docstatus < 2 + and (against_voucher_type IS NULL OR against_voucher_type != "Exchange Rate Revaluation") + and party_type=%s + and (party is not null and party != '') + {1} {2} {3}""" + .format(select_fields, date_condition, conditions, order_by), values, as_dict=True) + + def get_sales_invoices_or_customers_based_on_sales_person(self): + if self.filters.get("sales_person"): + lft, rgt = frappe.db.get_value("Sales Person", + self.filters.get("sales_person"), ["lft", "rgt"]) + + records = frappe.db.sql(""" + select distinct parent, parenttype + from `tabSales Team` steam + where parenttype in ('Customer', 'Sales Invoice') + and exists(select name from `tabSales Person` where lft >= %s and rgt <= %s and name = steam.sales_person) + """, (lft, rgt), as_dict=1) + + self.sales_person_records = frappe._dict() + for d in records: + self.sales_person_records.setdefault(d.parenttype, set()).add(d.parent) + + def prepare_conditions(self): + conditions = [""] + values = [self.party_type, self.filters.report_date] + party_type_field = scrub(self.party_type) + + self.add_common_filters(conditions, values, party_type_field) + + if party_type_field=="customer": + self.add_customer_filters(conditions, values) + + elif party_type_field=="supplier": + self.add_supplier_filters(conditions, values) + + self.add_accounting_dimensions_filters(conditions, values) + return " and ".join(conditions), values + + def get_order_by_condition(self): + if self.filters.get('group_by_party'): + return "order by party, posting_date" + else: + return "order by posting_date, party" + + def add_common_filters(self, conditions, values, party_type_field): + if self.filters.company: + conditions.append("company=%s") + values.append(self.filters.company) + + if self.filters.finance_book: + conditions.append("ifnull(finance_book, '') in (%s, '')") + values.append(self.filters.finance_book) + + if self.filters.get(party_type_field): + conditions.append("party=%s") + values.append(self.filters.get(party_type_field)) + + # get GL with "receivable" or "payable" account_type + account_type = "Receivable" if self.party_type == "Customer" else "Payable" + accounts = [d.name for d in frappe.get_all("Account", + filters={"account_type": account_type, "company": self.filters.company})] + conditions.append("account in (%s)" % ','.join(['%s'] *len(accounts))) + values += accounts + + def add_customer_filters(self, conditions, values): + if self.filters.get("customer_group"): + conditions.append(self.get_hierarchical_filters('Customer Group', 'customer_group')) + + if self.filters.get("territory"): + conditions.append(self.get_hierarchical_filters('Territory', 'territory')) + + if self.filters.get("payment_terms_template"): + conditions.append("party in (select name from tabCustomer where payment_terms=%s)") + values.append(self.filters.get("payment_terms_template")) + + if self.filters.get("sales_partner"): + conditions.append("party in (select name from tabCustomer where default_sales_partner=%s)") + values.append(self.filters.get("sales_partner")) + + def add_supplier_filters(self, conditions, values): + if self.filters.get("supplier_group"): + conditions.append("""party in (select name from tabSupplier + where supplier_group=%s)""") + values.append(self.filters.get("supplier_group")) + + if self.filters.get("payment_terms_template"): + conditions.append("party in (select name from tabSupplier where payment_terms=%s)") + values.append(self.filters.get("payment_terms_template")) + + def get_hierarchical_filters(self, doctype, key): + lft, rgt = frappe.db.get_value(doctype, self.filters.get(key), ["lft", "rgt"]) + + return """party in (select name from tabCustomer + where exists(select name from `tab{doctype}` where lft >= {lft} and rgt <= {rgt} + and name=tabCustomer.{key}))""".format( + doctype=doctype, lft=lft, rgt=rgt, key=key) + + def add_accounting_dimensions_filters(self, conditions, values): + accounting_dimensions = get_accounting_dimensions(as_list=False) + + if accounting_dimensions: + for dimension in accounting_dimensions: + if self.filters.get(dimension.fieldname): + if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'): + self.filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type, + self.filters.get(dimension.fieldname)) + conditions.append("{0} in %s".format(dimension.fieldname)) + values.append(tuple(self.filters.get(dimension.fieldname))) + + def get_gle_balance(self, gle): + # get the balance of the GL (debit - credit) or reverse balance based on report type + return gle.get(self.dr_or_cr) - self.get_reverse_balance(gle) + + def get_reverse_balance(self, gle): + # get "credit" balance if report type is "debit" and vice versa + return gle.get('debit' if self.dr_or_cr=='credit' else 'credit') + + def is_invoice(self, gle): + if gle.voucher_type in ('Sales Invoice', 'Purchase Invoice'): + return True + + def get_party_details(self, party): + if not party in self.party_details: + if self.party_type == 'Customer': + self.party_details[party] = frappe.db.get_value('Customer', party, ['customer_name', + 'territory', 'customer_group', 'customer_primary_contact'], as_dict=True) + else: + self.party_details[party] = frappe.db.get_value('Supplier', party, ['supplier_name', + 'supplier_group'], as_dict=True) + + return self.party_details[party] + + + def get_columns(self): + self.columns = [] + self.add_column('Posting Date', fieldtype='Date') + self.add_column(label=_(self.party_type), fieldname='party', + fieldtype='Link', options=self.party_type, width=180) + + if self.party_naming_by == "Naming Series": + self.add_column(_('{0} Name').format(self.party_type), + fieldname = scrub(self.party_type) + '_name', fieldtype='Data') + + if self.party_type == 'Customer': + self.add_column(_("Customer Contact"), fieldname='customer_primary_contact', + fieldtype='Link', options='Contact') + + self.add_column(label=_('Voucher Type'), fieldname='voucher_type', fieldtype='Data') + self.add_column(label=_('Voucher No'), fieldname='voucher_no', fieldtype='Dynamic Link', + options='voucher_type', width=180) + self.add_column(label='Due Date', fieldtype='Date') + + if self.party_type == "Supplier": + self.add_column(label=_('Bill No'), fieldname='bill_no', fieldtype='Data') + self.add_column(label=_('Bill Date'), fieldname='bill_date', fieldtype='Date') + + if self.filters.based_on_payment_terms: + self.add_column(label=_('Payment Term'), fieldname='payment_term', fieldtype='Data') + self.add_column(label=_('Invoice Grand Total'), fieldname='invoice_grand_total') + + self.add_column(_('Invoiced Amount'), fieldname='invoiced') + self.add_column(_('Foreign Amount'), fieldname='foreign_amount', fieldtype='Float') + self.add_column(_('Foreign Currency'), fieldname='foreign_currency', fieldtype='Data') + self.add_column(_('Paid Amount'), fieldname='paid') + if self.party_type == "Customer": + self.add_column(_('Credit Note'), fieldname='credit_note') + else: + # note: fieldname is still `credit_note` + self.add_column(_('Debit Note'), fieldname='credit_note') + self.add_column(_('Outstanding Amount'), fieldname='outstanding') + + self.setup_ageing_columns() + + self.add_column(label=_('Currency'), fieldname='currency', fieldtype='Link', options='Currency', width=80) + + if self.filters.show_future_payments: + self.add_column(label=_('Future Payment Ref'), fieldname='future_ref', fieldtype='Data') + self.add_column(label=_('Future Payment Amount'), fieldname='future_amount') + self.add_column(label=_('Remaining Balance'), fieldname='remaining_balance') + + if self.filters.party_type == 'Customer': + self.add_column(label=_('Customer LPO'), fieldname='po_no', fieldtype='Data') + + # comma separated list of linked delivery notes + if self.filters.show_delivery_notes: + self.add_column(label=_('Delivery Notes'), fieldname='delivery_notes', fieldtype='Data') + self.add_column(label=_('Territory'), fieldname='territory', fieldtype='Link', + options='Territory') + self.add_column(label=_('Customer Group'), fieldname='customer_group', fieldtype='Link', + options='Customer Group') + if self.filters.show_sales_person: + self.add_column(label=_('Sales Person'), fieldname='sales_person', fieldtype='Data') + + if self.filters.party_type == "Supplier": + self.add_column(label=_('Supplier Group'), fieldname='supplier_group', fieldtype='Link', + options='Supplier Group') + + self.add_column(label=_('Remarks'), fieldname='remarks', fieldtype='Text', width=200) + + def add_column(self, label, fieldname=None, fieldtype='Currency', options=None, width=120): + if not fieldname: fieldname = scrub(label) + if fieldtype=='Currency': options='currency' + if fieldtype=='Date': width = 90 + + self.columns.append(dict( + label=label, + fieldname=fieldname, + fieldtype=fieldtype, + options=options, + width=width + )) + + def setup_ageing_columns(self): + # for charts + self.ageing_column_labels = [] + self.add_column(label=_('Age (Days)'), fieldname='age', fieldtype='Int', width=80) + + for i, label in enumerate(["0-{range1}".format(range1=self.filters["range1"]), + "{range1}-{range2}".format(range1=cint(self.filters["range1"])+ 1, range2=self.filters["range2"]), + "{range2}-{range3}".format(range2=cint(self.filters["range2"])+ 1, range3=self.filters["range3"]), + "{range3}-{range4}".format(range3=cint(self.filters["range3"])+ 1, range4=self.filters["range4"]), + "{range4}-{above}".format(range4=cint(self.filters["range4"])+ 1, above=_("Above"))]): + self.add_column(label=label, fieldname='range' + str(i+1)) + self.ageing_column_labels.append(label) + + def get_chart_data(self): + rows = [] + for row in self.data: + row = frappe._dict(row) + if not cint(row.bold): + values = [row.range1, row.range2, row.range3, row.range4, row.range5] + precision = cint(frappe.db.get_default("float_precision")) or 2 + rows.append({ + 'values': [flt(val, precision) for val in values] + }) + + self.chart = { + "data": { + 'labels': self.ageing_column_labels, + 'datasets': rows + }, + "type": 'percentage' + } diff --git a/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/__init__.py b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.js b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.js new file mode 100644 index 0000000..4c1629c --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.js @@ -0,0 +1,112 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Accounts Receivable Summary Multi Currency"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company") + }, + { + "fieldname":"ageing_based_on", + "label": __("Ageing Based On"), + "fieldtype": "Select", + "options": 'Posting Date\nDue Date', + "default": "Posting Date" + }, + { + "fieldname":"report_date", + "label": __("Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today() + }, + { + "fieldname":"range1", + "label": __("Ageing Range 1"), + "fieldtype": "Int", + "default": "30", + "reqd": 1 + }, + { + "fieldname":"range2", + "label": __("Ageing Range 2"), + "fieldtype": "Int", + "default": "60", + "reqd": 1 + }, + { + "fieldname":"range3", + "label": __("Ageing Range 3"), + "fieldtype": "Int", + "default": "90", + "reqd": 1 + }, + { + "fieldname":"range4", + "label": __("Ageing Range 4"), + "fieldtype": "Int", + "default": "120", + "reqd": 1 + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book" + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer" + }, + { + "fieldname":"customer_group", + "label": __("Customer Group"), + "fieldtype": "Link", + "options": "Customer Group" + }, + { + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" + }, + { + "fieldname":"territory", + "label": __("Territory"), + "fieldtype": "Link", + "options": "Territory" + }, + { + "fieldname":"sales_partner", + "label": __("Sales Partner"), + "fieldtype": "Link", + "options": "Sales Partner" + }, + { + "fieldname":"sales_person", + "label": __("Sales Person"), + "fieldtype": "Link", + "options": "Sales Person" + }, + { + "fieldname":"currency", + "label": __("Currency"), + "fieldtype": "Link", + "options": "Currency", + "default": "TZS" + } + ], + + onload: function(report) { + report.page.add_inner_button(__("Accounts Receivable"), function() { + var filters = report.get_values(); + frappe.set_route('query-report', 'Accounts Receivable', { company: filters.company }); + }); + } +} diff --git a/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.json b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.json new file mode 100644 index 0000000..6cd834b --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 1, + "creation": "2019-06-14 15:46:40.747263", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-06-14 15:46:42.979257", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Accounts Receivable Summary Multi Currency", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "reference_report": "Accounts Receivable Report ", + "report_name": "Accounts Receivable Summary Multi Currency", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.py b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.py new file mode 100644 index 0000000..bdf9091 --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_summary_multi_currency.py @@ -0,0 +1,244 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _, scrub +from frappe.utils import flt +from erpnext.accounts.party import get_partywise_advanced_payment_amount +from csf_tz.csf_tz.report.accounts_receivable_summary_multi_currency.accounts_receivable_utils import ReceivablePayableReport + +from six import iteritems +from six.moves import zip + +class AccountsReceivableSummary(ReceivablePayableReport): + def run(self, args): + party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1]) + return self.get_columns(party_naming_by, args), self.get_data(party_naming_by, args) + + def get_columns(self, party_naming_by, args): + columns = [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"] + + if party_naming_by == "Naming Series": + columns += [ args.get("party_type") + " Name::140"] + + credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt" + + columns += [{ + "label": _("Advance Amount"), + "fieldname": "advance_amount", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + },{ + "label": _("Total Invoiced Amt"), + "fieldname": "total_invoiced_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + }, + { + "label": _("Total Paid Amt"), + "fieldname": "total_paid_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + }] + + columns += [ + { + "label": _(credit_debit_label), + "fieldname": scrub(credit_debit_label), + "fieldtype": "Currency", + "options": "currency", + "width": 140 + }, + { + "label": _("Total Outstanding Amt"), + "fieldname": "total_outstanding_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _("0-" + str(self.filters.range1)), + "fieldname": scrub("0-" + str(self.filters.range1)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range1) + "-" + str(self.filters.range2)), + "fieldname": scrub(str(self.filters.range1) + "-" + str(self.filters.range2)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range2) + "-" + str(self.filters.range3)), + "fieldname": scrub(str(self.filters.range2) + "-" + str(self.filters.range3)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range3) + "-" + str(self.filters.range4)), + "fieldname": scrub(str(self.filters.range3) + "-" + str(self.filters.range4)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range4) + _("-Above")), + "fieldname": scrub(str(self.filters.range4) + _("-Above")), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + } + ] + + if args.get("party_type") == "Customer": + columns += [{ + "label": _("Territory"), + "fieldname": "territory", + "fieldtype": "Link", + "options": "Territory", + "width": 80 + }, + { + "label": _("Customer Group"), + "fieldname": "customer_group", + "fieldtype": "Link", + "options": "Customer Group", + "width": 80 + }, + { + "label": _("Sales Person"), + "fieldtype": "Data", + "fieldname": "sales_person", + "width": 120, + }] + + if args.get("party_type") == "Supplier": + columns += [{ + "label": _("Supplier Group"), + "fieldname": "supplier_group", + "fieldtype": "Link", + "options": "Supplier Group", + "width": 80 + }] + + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Link", + "options": "Currency", + "width": 80 + }) + + return columns + + def get_data(self, party_naming_by, args): + data = [] + + partywise_total = self.get_partywise_total(party_naming_by, args) + + partywise_advance_amount = get_partywise_advanced_payment_amount(args.get("party_type"), + self.filters.get("report_date")) or {} + for party, party_dict in iteritems(partywise_total): + row = [party] + + if party_naming_by == "Naming Series": + row += [self.get_party_name(args.get("party_type"), party)] + + row += [partywise_advance_amount.get(party, 0)] + + paid_amt = 0 + if party_dict.paid_amt > 0: + paid_amt = flt(party_dict.paid_amt - partywise_advance_amount.get(party, 0)) + + row += [ + party_dict.invoiced_amt, paid_amt, party_dict.credit_amt, party_dict.outstanding_amt, + party_dict.range1, party_dict.range2, party_dict.range3, party_dict.range4, party_dict.range5 + ] + + if args.get("party_type") == "Customer": + row += [self.get_territory(party), self.get_customer_group(party), ", ".join(set(party_dict.sales_person))] + if args.get("party_type") == "Supplier": + row += [self.get_supplier_group(party)] + + row.append(party_dict.currency) + data.append(row) + + return data + + def get_partywise_total(self, party_naming_by, args): + party_total = frappe._dict() + for d in self.get_voucherwise_data(party_naming_by, args): + party_total.setdefault(d.party, + frappe._dict({ + "invoiced_amt": 0, + "paid_amt": 0, + "credit_amt": 0, + "outstanding_amt": 0, + "range1": 0, + "range2": 0, + "range3": 0, + "range4": 0, + "range5": 0, + "sales_person": [] + }) + ) + for k in list(party_total[d.party]): + if k not in ["currency", "sales_person"]: + party_total[d.party][k] += flt(d.get(k, 0)) + + party_total[d.party].currency = d.currency + + if d.sales_person: + party_total[d.party].sales_person.append(d.sales_person) + + return party_total + + def get_voucherwise_data(self, party_naming_by, args): + voucherwise_data = ReceivablePayableReport(self.filters).run(args)[1] + + cols = ["posting_date", "party"] + + if party_naming_by == "Naming Series": + cols += ["party_name"] + + if args.get("party_type") == 'Customer': + cols += ["contact"] + + cols += ["voucher_type", "voucher_no", "due_date"] + + if args.get("party_type") == "Supplier": + cols += ["bill_no", "bill_date"] + + cols += ["invoiced_amt", "paid_amt", "credit_amt", + "outstanding_amt", "age", "range1", "range2", "range3", "range4", "range5", "currency", "pdc/lc_date", "pdc/lc_ref", + "pdc/lc_amount"] + + if args.get("party_type") == "Supplier": + cols += ["supplier_group", "remarks"] + if args.get("party_type") == "Customer": + cols += ["po_no", "do_no", "territory", "customer_group", "sales_person", "remarks"] + + return self.make_data_dict(cols, voucherwise_data) + + @staticmethod + def make_data_dict(cols, data): + data_dict = [] + for d in data: + data_dict.append(frappe._dict(zip(cols, d))) + + return data_dict + +def execute(filters=None): + args = { + "party_type": "Customer", + "naming_by": ["Selling Settings", "cust_master_name"], + } + + return AccountsReceivableSummary(filters).run(args) diff --git a/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_utils.py b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_utils.py new file mode 100644 index 0000000..029d9a5 --- /dev/null +++ b/csf_tz/csf_tz/report/accounts_receivable_summary_multi_currency/accounts_receivable_utils.py @@ -0,0 +1,736 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _, scrub +from frappe.utils import getdate, nowdate, flt, cint, formatdate, cstr + +class ReceivablePayableReport(object): + def __init__(self, filters=None): + self.filters = frappe._dict(filters or {}) + self.filters.report_date = getdate(self.filters.report_date or nowdate()) + self.age_as_on = getdate(nowdate()) \ + if self.filters.report_date > getdate(nowdate()) \ + else self.filters.report_date + + def run(self, args): + party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1]) + columns = self.get_columns(party_naming_by, args) + data = self.get_data(party_naming_by, args) + chart = self.get_chart_data(columns, data) + return columns, data, None, chart + + def get_columns(self, party_naming_by, args): + columns = [] + columns.append({ + "label": _("Posting Date"), + "fieldtype": "Date", + "fieldname": "posting_date", + "width": 90 + }) + + columns += [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"] + + if args.get("party_type") == 'Customer': + columns.append({ + "label": _("Customer Contact"), + "fieldtype": "Link", + "fieldname": "contact", + "options":"Contact", + "width": 100 + }) + + if party_naming_by == "Naming Series": + columns += [args.get("party_type") + " Name::110"] + + columns.append({ + "label": _("Voucher Type"), + "fieldtype": "Data", + "fieldname": "voucher_type", + "width": 110 + }) + + columns.append({ + "label": _("Voucher No"), + "fieldtype": "Dynamic Link", + "fieldname": "voucher_no", + "width": 110, + "options": "voucher_type", + }) + + columns += [_("Due Date") + ":Date:80"] + + if args.get("party_type") == "Supplier": + columns += [_("Bill No") + "::80", _("Bill Date") + ":Date:80"] + + credit_or_debit_note = "Credit Note" if args.get("party_type") == "Customer" else "Debit Note" + + if self.filters.based_on_payment_terms: + columns.append({ + "label": _("Payment Term"), + "fieldname": "payment_term", + "fieldtype": "Data", + "width": 120 + }) + columns.append({ + "label": _("Invoice Grand Total"), + "fieldname": "invoice_grand_total", + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }) + + for label in ("Invoiced Amount", "Paid Amount", credit_or_debit_note, "Outstanding Amount"): + columns.append({ + "label": _(label), + "fieldname": frappe.scrub(label), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }) + + columns += [_("Age (Days)") + ":Int:80"] + + self.ageing_col_idx_start = len(columns) + + if not "range1" in self.filters: + self.filters["range1"] = "30" + if not "range2" in self.filters: + self.filters["range2"] = "60" + if not "range3" in self.filters: + self.filters["range3"] = "90" + if not "range4" in self.filters: + self.filters["range4"] = "120" + + for label in ("0-{range1}".format(range1=self.filters["range1"]), + "{range1}-{range2}".format(range1=cint(self.filters["range1"])+ 1, range2=self.filters["range2"]), + "{range2}-{range3}".format(range2=cint(self.filters["range2"])+ 1, range3=self.filters["range3"]), + "{range3}-{range4}".format(range3=cint(self.filters["range3"])+ 1, range4=self.filters["range4"]), + "{range4}-{above}".format(range4=cint(self.filters["range4"])+ 1, above=_("Above"))): + columns.append({ + "label": label, + "fieldname":label, + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }) + + columns += [ + { + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Link", + "options": "Currency", + "width": 100 + }, + { + "fieldname": "pdc/lc_ref", + "label": _("PDC/LC Ref"), + "fieldtype": "Data", + "width": 110 + }, + { + "fieldname": "pdc/lc_amount", + "label": _("PDC/LC Amount"), + "fieldtype": "Currency", + "options": "currency", + "width": 130 + }, + { + "fieldname": "remaining_balance", + "label": _("Remaining Balance"), + "fieldtype": "Currency", + "options": "currency", + "width": 130 + }] + + if args.get('party_type') == 'Customer': + columns += [ + { + "label": _("Customer LPO"), + "fieldtype": "Data", + "fieldname": "po_no", + "width": 100, + }, + _("Delivery Note") + ":Data:100", + _("Territory") + ":Link/Territory:80", + _("Customer Group") + ":Link/Customer Group:120", + { + "label": _("Sales Person"), + "fieldtype": "Data", + "fieldname": "sales_person", + "width": 120, + } + ] + if args.get("party_type") == "Supplier": + columns += [_("Supplier Group") + ":Link/Supplier Group:80"] + + columns.append(_("Remarks") + "::200") + + return columns + + def get_data(self, party_naming_by, args): + from erpnext.accounts.utils import get_currency_precision + self.currency_precision = get_currency_precision() or 2 + self.dr_or_cr = "debit" if args.get("party_type") == "Customer" else "credit" + + future_vouchers = self.get_entries_after(self.filters.report_date, args.get("party_type")) + + if not self.filters.get("company"): + self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company') + + self.company_currency = frappe.get_cached_value('Company', self.filters.get("company"), "default_currency") + + return_entries = self.get_return_entries(args.get("party_type")) + + data = [] + self.pdc_details = get_pdc_details(args.get("party_type"), self.filters.report_date) + gl_entries_data = self.get_entries_till(self.filters.report_date, args.get("party_type")) + + if gl_entries_data: + voucher_nos = [d.voucher_no for d in gl_entries_data] or [] + dn_details = get_dn_details(args.get("party_type"), voucher_nos) + self.voucher_details = get_voucher_details(args.get("party_type"), voucher_nos, dn_details) + + if self.filters.based_on_payment_terms and gl_entries_data: + self.payment_term_map = self.get_payment_term_detail(voucher_nos) + + for gle in gl_entries_data: + if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers, return_entries): + outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount( + gle,self.filters.report_date, self.dr_or_cr, return_entries) + temp_outstanding_amt = outstanding_amount + temp_credit_note_amt = credit_note_amount + + if abs(outstanding_amount) > 0.1/10**self.currency_precision: + if self.filters.based_on_payment_terms and self.payment_term_map.get(gle.voucher_no): + for d in self.payment_term_map.get(gle.voucher_no): + # Allocate payment amount based on payment terms(FIFO order) + payment_amount, d.payment_amount = self.allocate_based_on_fifo(payment_amount, d.payment_term_amount) + + term_outstanding_amount = d.payment_term_amount - d.payment_amount + + # Allocate credit note based on payment terms(FIFO order) + credit_note_amount, d.credit_note_amount = self.allocate_based_on_fifo(credit_note_amount, term_outstanding_amount) + + term_outstanding_amount -= d.credit_note_amount + + row_outstanding = term_outstanding_amount + # Allocate PDC based on payment terms(FIFO order) + d.pdc_details, d.pdc_amount = self.allocate_pdc_amount_in_fifo(gle, row_outstanding) + + if term_outstanding_amount > 0: + row = self.prepare_row(party_naming_by, args, gle, term_outstanding_amount, + d.credit_note_amount, d.due_date, d.payment_amount , d.payment_term_amount, + d.description, d.pdc_amount, d.pdc_details) + data.append(row) + + if credit_note_amount: + row = self.prepare_row_without_payment_terms(party_naming_by, args, gle, temp_outstanding_amt, + temp_credit_note_amt) + data.append(row) + + else: + row = self.prepare_row_without_payment_terms(party_naming_by, args, gle, outstanding_amount, + credit_note_amount) + data.append(row) + return data + + def allocate_pdc_amount_in_fifo(self, gle, row_outstanding): + pdc_list = self.pdc_details.get((gle.voucher_no, gle.party), []) + + pdc_details = [] + pdc_amount = 0 + for pdc in pdc_list: + if row_outstanding <= pdc.pdc_amount: + pdc_amount += row_outstanding + pdc.pdc_amount -= row_outstanding + if row_outstanding and pdc.pdc_ref and pdc.pdc_date: + pdc_details.append(cstr(pdc.pdc_ref) + "/" + formatdate(pdc.pdc_date)) + row_outstanding = 0 + + else: + pdc_amount = pdc.pdc_amount + if pdc.pdc_amount and pdc.pdc_ref and pdc.pdc_date: + pdc_details.append(cstr(pdc.pdc_ref) + "/" + formatdate(pdc.pdc_date)) + pdc.pdc_amount = 0 + row_outstanding -= pdc_amount + + return pdc_details, pdc_amount + + def prepare_row_without_payment_terms(self, party_naming_by, args, gle, outstanding_amount, credit_note_amount): + pdc_list = self.pdc_details.get((gle.voucher_no, gle.party), []) + pdc_amount = 0 + pdc_details = [] + for d in pdc_list: + pdc_amount += flt(d.pdc_amount) + if pdc_amount and d.pdc_ref and d.pdc_date: + pdc_details.append(cstr(d.pdc_ref) + "/" + formatdate(d.pdc_date)) + + row = self.prepare_row(party_naming_by, args, gle, outstanding_amount, + credit_note_amount, pdc_amount=pdc_amount, pdc_details=pdc_details) + + return row + + + @staticmethod + def allocate_based_on_fifo(total_amount, row_amount): + allocated_amount = 0 + if row_amount <= total_amount: + allocated_amount = row_amount + total_amount -= row_amount + else: + allocated_amount = total_amount + total_amount = 0 + + return total_amount, allocated_amount + + def prepare_row(self, party_naming_by, args, gle, outstanding_amount, credit_note_amount, + due_date=None, paid_amt=None, payment_term_amount=None, payment_term=None, pdc_amount=None, pdc_details=None): + row = [gle.posting_date, gle.party] + + # customer / supplier name + if party_naming_by == "Naming Series": + row += [self.get_party_name(gle.party_type, gle.party)] + + if args.get("party_type") == 'Customer': + row += [self.get_customer_contact(gle.party_type, gle.party)] + + # get due date + if not due_date: + due_date = self.voucher_details.get(gle.voucher_no, {}).get("due_date", "") + bill_date = self.voucher_details.get(gle.voucher_no, {}).get("bill_date", "") + + row += [gle.voucher_type, gle.voucher_no, due_date] + + # get supplier bill details + if args.get("party_type") == "Supplier": + row += [ + self.voucher_details.get(gle.voucher_no, {}).get("bill_no", ""), + self.voucher_details.get(gle.voucher_no, {}).get("bill_date", "") + ] + + # invoiced and paid amounts + invoiced_amount = gle.get(self.dr_or_cr) if (gle.get(self.dr_or_cr) > 0) else 0 + + if self.filters.based_on_payment_terms: + row+=[payment_term, invoiced_amount] + if payment_term_amount: + invoiced_amount = payment_term_amount + + if not payment_term_amount: + paid_amt = invoiced_amount - outstanding_amount - credit_note_amount + row += [invoiced_amount, paid_amt, credit_note_amount, outstanding_amount] + + # ageing data + if self.filters.ageing_based_on == "Due Date": + entry_date = due_date + elif self.filters.ageing_based_on == "Supplier Invoice Date": + entry_date = bill_date + else: + entry_date = gle.posting_date + + row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2), + cint(self.filters.range3), cint(self.filters.range4), self.age_as_on, entry_date, outstanding_amount) + + # issue 6371-Ageing buckets should not have amounts if due date is not reached + if self.filters.ageing_based_on == "Due Date" \ + and getdate(due_date) > getdate(self.filters.report_date): + row[-1]=row[-2]=row[-3]=row[-4]=row[-5]=0 + + if self.filters.ageing_based_on == "Supplier Invoice Date" \ + and getdate(bill_date) > getdate(self.filters.report_date): + + row[-1]=row[-2]=row[-3]=row[-4]=row[-5]=0 + + if self.filters.get(scrub(args.get("party_type"))): + row.append(gle.account_currency) + else: + row.append(self.company_currency) + + remaining_balance = outstanding_amount - flt(pdc_amount) + pdc_details = ", ".join(pdc_details) + row += [pdc_details, pdc_amount, remaining_balance] + + if args.get('party_type') == 'Customer': + # customer LPO + row += [self.voucher_details.get(gle.voucher_no, {}).get("po_no")] + + # Delivery Note + row += [self.voucher_details.get(gle.voucher_no, {}).get("delivery_note")] + + # customer territory / supplier group + if args.get("party_type") == "Customer": + row += [self.get_territory(gle.party), self.get_customer_group(gle.party), + self.voucher_details.get(gle.voucher_no, {}).get("sales_person")] + if args.get("party_type") == "Supplier": + row += [self.get_supplier_group(gle.party)] + + row.append(gle.remarks) + + return row + + def get_entries_after(self, report_date, party_type): + # returns a distinct list + return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries(party_type, report_date, for_future=True)])) + + def get_entries_till(self, report_date, party_type): + # returns a generator + return self.get_gl_entries(party_type, report_date) + + @staticmethod + def is_receivable_or_payable(gle, dr_or_cr, future_vouchers, return_entries): + return ( + # advance + (not gle.against_voucher) or + + # against sales order/purchase order + (gle.against_voucher_type in ["Sales Order", "Purchase Order"]) or + + # sales invoice/purchase invoice + (gle.against_voucher==gle.voucher_no and gle.get(dr_or_cr) > 0) or + + # standalone credit notes + (gle.against_voucher==gle.voucher_no and gle.voucher_no in return_entries and not return_entries.get(gle.voucher_no)) or + + # entries adjusted with future vouchers + ((gle.against_voucher_type, gle.against_voucher) in future_vouchers) + ) + + @staticmethod + def get_return_entries(party_type): + doctype = "Sales Invoice" if party_type=="Customer" else "Purchase Invoice" + return_entries = frappe._dict(frappe.get_all(doctype, + filters={"is_return": 1, "docstatus": 1}, fields=["name", "return_against"], as_list=1)) + return return_entries + + def get_outstanding_amount(self, gle, report_date, dr_or_cr, return_entries): + payment_amount, credit_note_amount = 0.0, 0.0 + reverse_dr_or_cr = "credit" if dr_or_cr=="debit" else "debit" + for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no): + if getdate(e.posting_date) <= report_date \ + and (e.name!=gle.name or (e.voucher_no in return_entries and not return_entries.get(e.voucher_no))): + + amount = flt(e.get(reverse_dr_or_cr), self.currency_precision) - flt(e.get(dr_or_cr), self.currency_precision) + if e.voucher_no not in return_entries: + payment_amount += amount + else: + credit_note_amount += amount + + voucher_amount = flt(gle.get(dr_or_cr), self.currency_precision) - flt(gle.get(reverse_dr_or_cr), self.currency_precision) + if gle.voucher_no in return_entries and not return_entries.get(gle.voucher_no): + voucher_amount = 0 + + outstanding_amount = flt((voucher_amount - payment_amount - credit_note_amount), self.currency_precision) + credit_note_amount = flt(credit_note_amount, self.currency_precision) + + return outstanding_amount, credit_note_amount, payment_amount + + def get_party_name(self, party_type, party_name): + return self.get_party_map(party_type).get(party_name, {}).get("customer_name" if party_type == "Customer" else "supplier_name") or "" + + def get_customer_contact(self, party_type, party_name): + return self.get_party_map(party_type).get(party_name, {}).get("customer_primary_contact") + + def get_territory(self, party_name): + return self.get_party_map("Customer").get(party_name, {}).get("territory") or "" + + def get_customer_group(self, party_name): + return self.get_party_map("Customer").get(party_name, {}).get("customer_group") or "" + + def get_supplier_group(self, party_name): + return self.get_party_map("Supplier").get(party_name, {}).get("supplier_group") or "" + + def get_party_map(self, party_type): + if not hasattr(self, "party_map"): + if party_type == "Customer": + select_fields = "name, customer_name, territory, customer_group, customer_primary_contact" + elif party_type == "Supplier": + select_fields = "name, supplier_name, supplier_group" + + self.party_map = dict(((r.name, r) for r in frappe.db.sql("select {0} from `tab{1}`" + .format(select_fields, party_type), as_dict=True))) + + return self.party_map + + def get_gl_entries(self, party_type, date=None, for_future=False): + conditions, values = self.prepare_conditions(party_type) + + if self.filters.get(scrub(party_type)): + select_fields = "sum(debit_in_account_currency) as debit, sum(credit_in_account_currency) as credit" + else: + select_fields = "sum(debit) as debit, sum(credit) as credit" + + if date and not for_future: + conditions += " and posting_date <= '%s'" % date + + if date and for_future: + conditions += " and posting_date > '%s'" % date + + self.gl_entries = frappe.db.sql(""" + select + name, posting_date, account, party_type, party, voucher_type, voucher_no, + against_voucher_type, against_voucher, account_currency, remarks, {0} + from + `tabGL Entry` + where + docstatus < 2 and party_type=%s and (party is not null and party != '') {1} + group by voucher_type, voucher_no, against_voucher_type, against_voucher, party + order by posting_date, party""" + .format(select_fields, conditions), values, as_dict=True) + + return self.gl_entries + + def prepare_conditions(self, party_type): + conditions = [""] + values = [party_type] + + party_type_field = scrub(party_type) + + if self.filters.company: + conditions.append("company=%s") + values.append(self.filters.company) + + if self.filters.finance_book: + conditions.append("ifnull(finance_book,'') in (%s, '')") + values.append(self.filters.finance_book) + + if self.filters.get(party_type_field): + conditions.append("party=%s") + values.append(self.filters.get(party_type_field)) + + if party_type_field=="customer": + account_type = "Receivable" + if self.filters.get("customer_group"): + lft, rgt = frappe.db.get_value("Customer Group", + self.filters.get("customer_group"), ["lft", "rgt"]) + + conditions.append("""party in (select name from tabCustomer + where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1} + and name=tabCustomer.customer_group))""".format(lft, rgt)) + + if self.filters.get("territory"): + lft, rgt = frappe.db.get_value("Territory", + self.filters.get("territory"), ["lft", "rgt"]) + + conditions.append("""party in (select name from tabCustomer + where exists(select name from `tabTerritory` where lft >= {0} and rgt <= {1} + and name=tabCustomer.territory))""".format(lft, rgt)) + + if self.filters.get("payment_terms_template"): + conditions.append("party in (select name from tabCustomer where payment_terms=%s)") + values.append(self.filters.get("payment_terms_template")) + + if self.filters.get("sales_partner"): + conditions.append("party in (select name from tabCustomer where default_sales_partner=%s)") + values.append(self.filters.get("sales_partner")) + + if self.filters.get("sales_person"): + lft, rgt = frappe.db.get_value("Sales Person", + self.filters.get("sales_person"), ["lft", "rgt"]) + + conditions.append("""exists(select name from `tabSales Team` steam where + steam.sales_person in (select name from `tabSales Person` where lft >= {0} and rgt <= {1}) + and ((steam.parent = voucher_no and steam.parenttype = voucher_type) + or (steam.parent = against_voucher and steam.parenttype = against_voucher_type) + or (steam.parent = party and steam.parenttype = 'Customer')))""".format(lft, rgt)) + + elif party_type_field=="supplier": + account_type = "Payable" + if self.filters.get("supplier_group"): + conditions.append("""party in (select name from tabSupplier + where supplier_group=%s)""") + values.append(self.filters.get("supplier_group")) + + accounts = [d.name for d in frappe.get_all("Account", + filters={"account_type": account_type, "company": self.filters.company})] + conditions.append("account in (%s)" % ','.join(['%s'] *len(accounts))) + values += accounts + + return " and ".join(conditions), values + + def get_gl_entries_for(self, party, party_type, against_voucher_type, against_voucher): + if not hasattr(self, "gl_entries_map"): + self.gl_entries_map = {} + for gle in self.get_gl_entries(party_type): + if gle.against_voucher_type and gle.against_voucher: + self.gl_entries_map.setdefault(gle.party, {})\ + .setdefault(gle.against_voucher_type, {})\ + .setdefault(gle.against_voucher, [])\ + .append(gle) + + return self.gl_entries_map.get(party, {})\ + .get(against_voucher_type, {})\ + .get(against_voucher, []) + + def get_payment_term_detail(self, voucher_nos): + payment_term_map = frappe._dict() + payment_terms_details = frappe.db.sql(""" select si.name, + party_account_currency, currency, si.conversion_rate, + ps.due_date, ps.payment_amount, ps.description + from `tabSales Invoice` si, `tabPayment Schedule` ps + where si.name = ps.parent and + si.docstatus = 1 and si.company = '%s' and + si.name in (%s) order by ps.due_date + """ % (frappe.db.escape(self.filters.company), ','.join(['%s'] *len(voucher_nos))), + (tuple(voucher_nos)), as_dict = 1) + + for d in payment_terms_details: + payment_term_amount = d.payment_amount + + payment_term_map.setdefault(d.name, []).append(frappe._dict({ + "due_date": d.due_date, + "payment_term_amount": payment_term_amount, + "description": d.description + })) + return payment_term_map + + def get_chart_data(self, columns, data): + ageing_columns = columns[self.ageing_col_idx_start : self.ageing_col_idx_start+5] + + rows = [] + for d in data: + rows.append( + { + 'values': d[self.ageing_col_idx_start : self.ageing_col_idx_start+5] + } + ) + + return { + "data": { + 'labels': [d.get("label") for d in ageing_columns], + 'datasets': rows + }, + "type": 'percentage' + } + +def execute(filters=None): + args = { + "party_type": "Customer", + "naming_by": ["Selling Settings", "cust_master_name"], + } + return ReceivablePayableReport(filters).run(args) + +def get_ageing_data(first_range, second_range, third_range, + fourth_range, age_as_on, entry_date, outstanding_amount): + # [0-30, 30-60, 60-90, 90-120, 120-above] + outstanding_range = [0.0, 0.0, 0.0, 0.0, 0.0] + + if not (age_as_on and entry_date): + return [0] + outstanding_range + + age = (getdate(age_as_on) - getdate(entry_date)).days or 0 + index = None + for i, days in enumerate([first_range, second_range, third_range, fourth_range]): + if age <= days: + index = i + break + + if index is None: index = 4 + outstanding_range[index] = outstanding_amount + + return [age] + outstanding_range + +def get_pdc_details(party_type, report_date): + pdc_details = frappe._dict() + pdc_via_pe = frappe.db.sql(""" + select + pref.reference_name as invoice_no, pent.party, pent.party_type, + pent.posting_date as pdc_date, ifnull(pref.allocated_amount,0) as pdc_amount, + pent.reference_no as pdc_ref + from + `tabPayment Entry` as pent inner join `tabPayment Entry Reference` as pref + on + (pref.parent = pent.name) + where + pent.docstatus < 2 and pent.posting_date > %s + and pent.party_type = %s + """, (report_date, party_type), as_dict=1) + + for pdc in pdc_via_pe: + pdc_details.setdefault((pdc.invoice_no, pdc.party), []).append(pdc) + + if scrub(party_type): + amount_field = ("jea.debit_in_account_currency" + if party_type == 'Supplier' else "jea.credit_in_account_currency") + else: + amount_field = "jea.debit + jea.credit" + + pdc_via_je = frappe.db.sql(""" + select + jea.reference_name as invoice_no, jea.party, jea.party_type, + je.posting_date as pdc_date, ifnull({0},0) as pdc_amount, + je.cheque_no as pdc_ref + from + `tabJournal Entry` as je inner join `tabJournal Entry Account` as jea + on + (jea.parent = je.name) + where + je.docstatus < 2 and je.posting_date > %s + and jea.party_type = %s + """.format(amount_field), (report_date, party_type), as_dict=1) + + for pdc in pdc_via_je: + pdc_details.setdefault((pdc.invoice_no, pdc.party), []).append(pdc) + + return pdc_details + +def get_dn_details(party_type, voucher_nos): + dn_details = frappe._dict() + + if party_type == "Customer": + for si in frappe.db.sql(""" + select + parent, GROUP_CONCAT(delivery_note SEPARATOR ', ') as dn + from + `tabSales Invoice Item` + where + docstatus=1 and delivery_note is not null and delivery_note != '' + and parent in (%s) group by parent + """ %(','.join(['%s'] * len(voucher_nos))), tuple(voucher_nos) , as_dict=1): + dn_details.setdefault(si.parent, si.dn) + + for si in frappe.db.sql(""" + select + against_sales_invoice as parent, GROUP_CONCAT(parent SEPARATOR ', ') as dn + from + `tabDelivery Note Item` + where + docstatus=1 and against_sales_invoice is not null and against_sales_invoice != '' + and against_sales_invoice in (%s) + group by against_sales_invoice + """ %(','.join(['%s'] * len(voucher_nos))), tuple(voucher_nos) , as_dict=1): + if si.parent in dn_details: + dn_details[si.parent] += ', %s' %(si.dn) + else: + dn_details.setdefault(si.parent, si.dn) + + return dn_details + +def get_voucher_details(party_type, voucher_nos, dn_details): + voucher_details = frappe._dict() + + if party_type == "Customer": + for si in frappe.db.sql(""" + select inv.name, inv.due_date, inv.po_no, GROUP_CONCAT(steam.sales_person SEPARATOR ', ') as sales_person + from `tabSales Invoice` inv + left join `tabSales Team` steam on steam.parent = inv.name and steam.parenttype = 'Sales Invoice' + where inv.docstatus=1 and inv.name in (%s) + group by inv.name + """ %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1): + si['delivery_note'] = dn_details.get(si.name) + voucher_details.setdefault(si.name, si) + + if party_type == "Supplier": + for pi in frappe.db.sql("""select name, due_date, bill_no, bill_date + from `tabPurchase Invoice` where docstatus = 1 and name in (%s) + """ %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1): + voucher_details.setdefault(pi.name, pi) + + for pi in frappe.db.sql("""select name, due_date, bill_no, bill_date from + `tabJournal Entry` where docstatus = 1 and bill_no is not NULL and name in (%s) + """ %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1): + voucher_details.setdefault(pi.name, pi) + + return voucher_details diff --git a/csf_tz/csf_tz/report/balance_below_safety_stock/__init__.py b/csf_tz/csf_tz/report/balance_below_safety_stock/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/balance_below_safety_stock/balance_below_safety_stock.json b/csf_tz/csf_tz/report/balance_below_safety_stock/balance_below_safety_stock.json new file mode 100644 index 0000000..1a4d081 --- /dev/null +++ b/csf_tz/csf_tz/report/balance_below_safety_stock/balance_below_safety_stock.json @@ -0,0 +1,34 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2022-03-23 13:07:51.118324", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2022-03-23 13:07:51.118324", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Balance below Safety Stock", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT b.item_code as \"Item\", b.actual_qty, i.safety_stock, b.actual_qty - i.safety_stock as \"Below threshold\"\nFROM `tabBin` b\nINNER JOIN `tabItem` i ON b.item_code = i.name\nWHERE b.actual_qty - i.safety_stock < 0\nORDER BY b.actual_qty - i.safety_stock ASC", + "ref_doctype": "Bin", + "report_name": "Balance below Safety Stock", + "report_type": "Query Report", + "roles": [ + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Stock User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/credit_note_list/__init__.py b/csf_tz/csf_tz/report/credit_note_list/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/credit_note_list/credit_note_list.html b/csf_tz/csf_tz/report/credit_note_list/credit_note_list.html new file mode 100644 index 0000000..1f3f950 --- /dev/null +++ b/csf_tz/csf_tz/report/credit_note_list/credit_note_list.html @@ -0,0 +1,52 @@ + + + +{% + var from_date = filters.from_date; + var to_date = filters.to_date; +%} + + +REF:VIVA/TRA/2308/2018 +

Date: {%= frappe.utils.formatdate(frappe.utils.today(), ‘dd-MMM-YYYY’) %}

+ +To, +Regional Manager, +Tanzania Revenue Authority, +Domestic Revenue Department, +ILALA Tax Region, +P.O.Box – 25216, +Dar es Salaam, +Tanzania + +Dear Sir, +SUB: Issue Credit Note during the month of JULY, 2018. +REF: M/s Virgin Plaza Ltd TIN 104-582-451 +We hereby inform to your good office that we have risen following Credit Notes for the above mentioned company during the month of JULY, 2018. Please refer below table showing details of Credit Notes raised against relevant Invoices together with reasons for raising credit note. diff --git a/csf_tz/csf_tz/report/credit_note_list/credit_note_list.js b/csf_tz/csf_tz/report/credit_note_list/credit_note_list.js new file mode 100644 index 0000000..f0cbae1 --- /dev/null +++ b/csf_tz/csf_tz/report/credit_note_list/credit_note_list.js @@ -0,0 +1,28 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Credit Note List"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1 + }, + ] +} + +// $(function() { +// $(wrapper).bind("show", function() { +// frappe.query_report.load(); +// }); +// }); \ No newline at end of file diff --git a/csf_tz/csf_tz/report/credit_note_list/credit_note_list.json b/csf_tz/csf_tz/report/credit_note_list/credit_note_list.json new file mode 100644 index 0000000..b05f7c2 --- /dev/null +++ b/csf_tz/csf_tz/report/credit_note_list/credit_note_list.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 0, + "creation": "2020-03-04 10:08:34.157353", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-06-11 14:51:59.857509", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Credit Note List", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT si.customer as \"Customer:Link/Customer:200\",\n c.tax_id as \"TIN:Data:80\",\n si.name as \"Credit Note No:Link/Sales Invoice:150\",\n si.base_total_taxes_and_charges/0.18 as \"Amount Excl. Vat:Currency:120\",\n si.base_grand_total - (si.base_total_taxes_and_charges + (si.base_total_taxes_and_charges/0.18)) as \"Exempt:Currency:120\",\n si.base_total_taxes_and_charges as \"Vat:Currency:120\",\n si.base_grand_total as \"Total Amount:Currency:120\",\n si.return_against as \"Corresponding Invoice No:Link/Sales Invoice:150\",\n si2.posting_date as \"Invoice Date:Date:80\",\n si2.base_total_taxes_and_charges/0.18 as \"Amount Excl. Vat:Currency:120\",\n si2.base_grand_total - (si2.base_total_taxes_and_charges + (si2.base_total_taxes_and_charges/0.18)) as \"Exempt:Currency:120\",\n si2.base_total_taxes_and_charges as \"Vat:Currency:120\",\n si2.base_grand_total as \"Total Amount:Currency:120\"\nFROM `tabSales Invoice` si JOIN `tabSales Invoice` si2 on si.return_against = si2.name\n LEFT JOIN `tabCustomer` c ON si.customer = c.name\n LEFT OUTER JOIN `tabCompany` cmp ON si.company = cmp.name \nWHERE si.status = 'Return'\nAND si.is_return = 1\nAND si.posting_date BETWEEN %(from_date)s AND %(to_date)s \n", + "ref_doctype": "Sales Invoice", + "report_name": "Credit Note List", + "report_type": "Query Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/__init__.py b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.js b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.js new file mode 100644 index 0000000..5f9de09 --- /dev/null +++ b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.js @@ -0,0 +1,97 @@ +// Copyright (c) 2016, Aakvatech Limited and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Customer Ledger Summary Multicurrency"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company") + }, + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book" + }, + { + "fieldname":"party", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + on_change: () => { + var party = frappe.query_report.get_filter_value('party'); + if (party) { + frappe.db.get_value('Customer', party, ["tax_id", "customer_name"], function(value) { + frappe.query_report.set_filter_value('tax_id', value["tax_id"]); + frappe.query_report.set_filter_value('customer_name', value["customer_name"]); + }); + } else { + frappe.query_report.set_filter_value('tax_id', ""); + frappe.query_report.set_filter_value('customer_name', ""); + } + } + }, + { + "fieldname":"customer_group", + "label": __("Customer Group"), + "fieldtype": "Link", + "options": "Customer Group" + }, + { + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" + }, + { + "fieldname":"territory", + "label": __("Territory"), + "fieldtype": "Link", + "options": "Territory" + }, + { + "fieldname":"sales_partner", + "label": __("Sales Partner"), + "fieldtype": "Link", + "options": "Sales Partner" + }, + { + "fieldname":"sales_person", + "label": __("Sales Person"), + "fieldtype": "Link", + "options": "Sales Person" + }, + { + "fieldname":"tax_id", + "label": __("Tax Id"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname":"customer_name", + "label": __("Customer Name"), + "fieldtype": "Data", + "hidden": 1 + } + ] +}; diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.json b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.json new file mode 100644 index 0000000..00998bf --- /dev/null +++ b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2022-02-09 20:42:05.628823", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2022-02-09 20:42:05.628823", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Customer Ledger Summary Multicurrency", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "report_name": "Customer Ledger Summary Multicurrency", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.py b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.py new file mode 100644 index 0000000..a188353 --- /dev/null +++ b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.py @@ -0,0 +1,307 @@ +# Copyright (c) 2013, Aakvatech Limited and contributors +# For license information, please see license.txt + + +import frappe +from frappe import _, scrub +from frappe.utils import getdate, nowdate + + +class PartyLedgerSummaryReport(object): + def __init__(self, filters=None): + self.filters = frappe._dict(filters or {}) + self.filters.from_date = getdate(self.filters.from_date or nowdate()) + self.filters.to_date = getdate(self.filters.to_date or nowdate()) + + if not self.filters.get("company"): + self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company') + + def run(self, args): + if self.filters.from_date > self.filters.to_date: + frappe.throw(_("From Date must be before To Date")) + + self.filters.party_type = args.get("party_type") + self.party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1]) + + self.get_gl_entries() + self.get_return_invoices() + self.get_party_adjustment_amounts() + + columns = self.get_columns() + data = self.get_data() + return columns, data + + def get_columns(self): + columns = [{ + "label": _(self.filters.party_type), + "fieldtype": "Link", + "fieldname": "party", + "options": self.filters.party_type, + "width": 200 + }] + + if self.party_naming_by == "Naming Series": + columns.append({ + "label": _(self.filters.party_type + "Name"), + "fieldtype": "Data", + "fieldname": "party_name", + "width": 110 + }) + + credit_or_debit_note = "Credit Note" if self.filters.party_type == "Customer" else "Debit Note" + + columns += [ + { + "label": _("Opening Balance"), + "fieldname": "opening_balance", + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "label": _("Invoiced Amount"), + "fieldname": "invoiced_amount", + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "label": _("Paid Amount"), + "fieldname": "paid_amount", + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "label": _(credit_or_debit_note), + "fieldname": "return_amount", + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + ] + + for account in self.party_adjustment_accounts: + columns.append({ + "label": account, + "fieldname": "adj_" + scrub(account), + "fieldtype": "Currency", + "options": "currency", + "width": 120, + "is_adjustment": 1 + }) + + columns += [ + { + "label": _("Closing Balance"), + "fieldname": "closing_balance", + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "label": _("Currency"), + "fieldname": "currency", + "fieldtype": "Link", + "options": "Currency", + "width": 50 + } + ] + + return columns + + def get_data(self): + invoice_dr_or_cr = "debit_in_account_currency" if self.filters.party_type == "Customer" else "credit_in_account_currency" + reverse_dr_or_cr = "credit_in_account_currency" if self.filters.party_type == "Customer" else "debit_in_account_currency" + + self.party_data = frappe._dict({}) + for gle in self.gl_entries: + self.party_data.setdefault(gle.party, frappe._dict({ + "party": gle.party, + "party_name": gle.party_name, + "opening_balance": 0, + "invoiced_amount": 0, + "paid_amount": 0, + "return_amount": 0, + "closing_balance": 0, + "currency": gle.account_currency + })) + + amount = gle.get(invoice_dr_or_cr) - gle.get(reverse_dr_or_cr) + self.party_data[gle.party].closing_balance += amount + + if gle.posting_date < self.filters.from_date or gle.is_opening == "Yes": + self.party_data[gle.party].opening_balance += amount + else: + if amount > 0: + self.party_data[gle.party].invoiced_amount += amount + elif gle.voucher_no in self.return_invoices: + self.party_data[gle.party].return_amount -= amount + else: + self.party_data[gle.party].paid_amount -= amount + + out = [] + for party, row in self.party_data.items(): + if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount: + total_party_adjustment = sum(amount for amount in self.party_adjustment_details.get(party, {}).values()) + row.paid_amount -= total_party_adjustment + + adjustments = self.party_adjustment_details.get(party, {}) + for account in self.party_adjustment_accounts: + row["adj_" + scrub(account)] = adjustments.get(account, 0) + + out.append(row) + + return out + + def get_gl_entries(self): + conditions = self.prepare_conditions() + join = join_field = "" + if self.filters.party_type == "Customer": + join_field = ", p.customer_name as party_name" + join = "left join `tabCustomer` p on gle.party = p.name" + elif self.filters.party_type == "Supplier": + join_field = ", p.supplier_name as party_name" + join = "left join `tabSupplier` p on gle.party = p.name" + + self.gl_entries = frappe.db.sql(""" + select + gle.posting_date, gle.party, gle.voucher_type, gle.voucher_no, gle.against_voucher_type, + gle.against_voucher, gle.debit, gle.credit, gle.is_opening, gle.debit_in_account_currency, + gle.credit_in_account_currency, gle.account_currency {join_field} + from `tabGL Entry` gle + {join} + where + gle.docstatus < 2 and gle.is_cancelled = 0 and gle.party_type=%(party_type)s and + ifnull(gle.party, '') != '' and gle.posting_date <= %(to_date)s {conditions} + order by gle.posting_date + """.format(join=join, join_field=join_field, conditions=conditions), self.filters, as_dict=True) + + def prepare_conditions(self): + conditions = [""] + + if self.filters.company: + conditions.append("gle.company=%(company)s") + + if self.filters.finance_book: + conditions.append("ifnull(finance_book,'') in (%(finance_book)s, '')") + + if self.filters.get("party"): + conditions.append("party=%(party)s") + + if self.filters.party_type == "Customer": + if self.filters.get("customer_group"): + lft, rgt = frappe.db.get_value("Customer Group", + self.filters.get("customer_group"), ["lft", "rgt"]) + + conditions.append("""party in (select name from tabCustomer + where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1} + and name=tabCustomer.customer_group))""".format(lft, rgt)) + + if self.filters.get("territory"): + lft, rgt = frappe.db.get_value("Territory", + self.filters.get("territory"), ["lft", "rgt"]) + + conditions.append("""party in (select name from tabCustomer + where exists(select name from `tabTerritory` where lft >= {0} and rgt <= {1} + and name=tabCustomer.territory))""".format(lft, rgt)) + + if self.filters.get("payment_terms_template"): + conditions.append("party in (select name from tabCustomer where payment_terms=%(payment_terms_template)s)") + + if self.filters.get("sales_partner"): + conditions.append("party in (select name from tabCustomer where default_sales_partner=%(sales_partner)s)") + + if self.filters.get("sales_person"): + lft, rgt = frappe.db.get_value("Sales Person", + self.filters.get("sales_person"), ["lft", "rgt"]) + + conditions.append("""exists(select name from `tabSales Team` steam where + steam.sales_person in (select name from `tabSales Person` where lft >= {0} and rgt <= {1}) + and ((steam.parent = voucher_no and steam.parenttype = voucher_type) + or (steam.parent = against_voucher and steam.parenttype = against_voucher_type) + or (steam.parent = party and steam.parenttype = 'Customer')))""".format(lft, rgt)) + + if self.filters.party_type == "Supplier": + if self.filters.get("supplier_group"): + conditions.append("""party in (select name from tabSupplier + where supplier_group=%(supplier_group)s)""") + + return " and ".join(conditions) + + def get_return_invoices(self): + doctype = "Sales Invoice" if self.filters.party_type == "Customer" else "Purchase Invoice" + self.return_invoices = [d.name for d in frappe.get_all(doctype, filters={"is_return": 1, "docstatus": 1, + "posting_date": ["between", [self.filters.from_date, self.filters.to_date]]})] + + def get_party_adjustment_amounts(self): + conditions = self.prepare_conditions() + income_or_expense = "Expense Account" if self.filters.party_type == "Customer" else "Income Account" + invoice_dr_or_cr = "debit_in_account_currency" if self.filters.party_type == "Customer" else "credit_in_account_currency" + reverse_dr_or_cr = "credit_in_account_currency" if self.filters.party_type == "Customer" else "debit_in_account_currency" + round_off_account = frappe.get_cached_value('Company', self.filters.company, "round_off_account") + + gl_entries = frappe.db.sql(""" + select + posting_date, account, party, voucher_type, voucher_no, debit_in_account_currency, credit_in_account_currency + from + `tabGL Entry` + where + docstatus < 2 and is_cancelled = 0 + and (voucher_type, voucher_no) in ( + select voucher_type, voucher_no from `tabGL Entry` gle, `tabAccount` acc + where acc.name = gle.account and acc.account_type = '{income_or_expense}' + and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 + ) and (voucher_type, voucher_no) in ( + select voucher_type, voucher_no from `tabGL Entry` gle + where gle.party_type=%(party_type)s and ifnull(party, '') != '' + and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 {conditions} + ) + """.format(conditions=conditions, income_or_expense=income_or_expense), self.filters, as_dict=True) + + self.party_adjustment_details = {} + self.party_adjustment_accounts = set() + adjustment_voucher_entries = {} + for gle in gl_entries: + adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), []) + adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle) + + for voucher_gl_entries in adjustment_voucher_entries.values(): + parties = {} + accounts = {} + has_irrelevant_entry = False + + for gle in voucher_gl_entries: + if gle.account == round_off_account: + continue + elif gle.party: + parties.setdefault(gle.party, 0) + parties[gle.party] += gle.get(reverse_dr_or_cr) - gle.get(invoice_dr_or_cr) + elif frappe.get_cached_value("Account", gle.account, "account_type") == income_or_expense: + accounts.setdefault(gle.account, 0) + accounts[gle.account] += gle.get(invoice_dr_or_cr) - gle.get(reverse_dr_or_cr) + else: + has_irrelevant_entry = True + + if parties and accounts: + if len(parties) == 1: + party = list(parties.keys())[0] + for account, amount in accounts.items(): + self.party_adjustment_accounts.add(account) + self.party_adjustment_details.setdefault(party, {}) + self.party_adjustment_details[party].setdefault(account, 0) + self.party_adjustment_details[party][account] += amount + elif len(accounts) == 1 and not has_irrelevant_entry: + account = list(accounts.keys())[0] + self.party_adjustment_accounts.add(account) + for party, amount in parties.items(): + self.party_adjustment_details.setdefault(party, {}) + self.party_adjustment_details[party].setdefault(account, 0) + self.party_adjustment_details[party][account] += amount + +def execute(filters=None): + args = { + "party_type": "Customer", + "naming_by": ["Selling Settings", "cust_master_name"], + } + return PartyLedgerSummaryReport(filters).run(args) \ No newline at end of file diff --git a/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/__init__.py b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.js b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.js new file mode 100644 index 0000000..0530ca9 --- /dev/null +++ b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.js @@ -0,0 +1,56 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Employee Checkin & Checkout Report"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "width": "150px", + "reqd": 1 + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "width": "150px", + "reqd": 1 + }, + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "width": "150px", + "reqd": 1 + }, + { + "fieldname": "department", + "label": __("Department"), + "fieldtype": "Link", + "options": "Department", + "default": "", + "width": "150px", + "reqd": 0, + "get_query": function () { + var company = frappe.query_report.get_filter_value("company"); + return { + "doctype": "Department", + "filters": { + "company": company, + } + }; + } + }, + { + "fieldname": "employee", + "label": __("Employee"), + "fieldtype": "Link", + "options": "Employee", + "width": "150px", + "reqd": 0 + } + ] +}; diff --git a/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.json b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.json new file mode 100644 index 0000000..3139625 --- /dev/null +++ b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.json @@ -0,0 +1,36 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-11-15 09:20:24.798411", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2021-11-15 09:20:24.798411", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Employee Checkin & Checkout Report", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Employee Checkin", + "report_name": "Employee Checkin & Checkout Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "Employee" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.py b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.py new file mode 100644 index 0000000..0a663fc --- /dev/null +++ b/csf_tz/csf_tz/report/employee_checkin_&_checkout_report/employee_checkin_&_checkout_report.py @@ -0,0 +1,284 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +import pandas as pd +import numpy as np +from datetime import datetime, time, timedelta +from frappe import msgprint, _ +from frappe.utils.nestedset import get_descendants_of +from frappe.utils import cstr, cint, get_time, add_to_date, getdate + + +def execute(filters=None): + conditions, filters = get_conditions(filters) + + columns = get_columns(filters) + + chift_type_details = frappe.get_all("Shift Type", {"enable_auto_attendance": 1}, + ["name", "start_time", "end_time", "late_entry_grace_period", "early_exit_grace_period"] + ) + + data = [] + checkin_records = get_checkin_data(conditions, filters, chift_type_details) + checkout_records = get_checkout_data(conditions, filters, chift_type_details) + + if (checkin_records and checkout_records): + checkin_colnames = [key for key in checkin_records[0].keys()] + checkin_data = pd.DataFrame.from_records( + checkin_records, columns=checkin_colnames + ) + + checkout_colnames = [key for key in checkout_records[0].keys()] + checkout_data = pd.DataFrame.from_records( + checkout_records, columns=checkout_colnames + ) + + df = checkin_data.merge( + checkout_data, + how="outer", + on=["employee", "employee_name", "department", "shift", "date", "week_day"] + ) + df.fillna("", inplace=True) + + data += df.values.tolist() + + elif (checkin_records or checkout_records): + if checkin_records: + data += checkin_records + + if checkout_records: + data += checkout_records + + else: + msgprint( + "No Record found for the filters From Date: {0},To Date: {1}, Company: {2}, Department: {3} and Employee: {4}\ + you specified...!!!, Please set different filters and Try again..!!!".format( + frappe.bold(filters.from_date), + frappe.bold(filters.to_date), + frappe.bold(filters.company), + frappe.bold(filters.department), + frappe.bold(filters.employee), + ) + ) + + return columns, data + +def get_columns(filters): + columns = [ + {"fieldname": "employee", "label": _("Employee No"), "fieldtype": "Data"}, + {"fieldname": "employee_name", "label": _("Employee Name"), "fieldtype": "Data"}, + {"fieldname": "department", "label": _("Department"), "fieldtype": "Data"}, + {"fieldname": "shift", "label": _("Shift"), "fieldtype": "Data"}, + {"fieldname": "date", "label": _("Date"), "fieldtype": "Date"}, + {"fieldname": "week_day", "label": _("Week Day "), "fieldtype": "Data"}, + + # for checkin + {"fieldname": "actual_checkin_time", "label": _("Actual Time to Checkin"), "fieldtype": "Time"}, + {"fieldname": "checkin_time", "label": _("Checkin Time"), "fieldtype": "Time"}, + {"fieldname": "late_entry_grace_time", "label": _("Late Entry Grace Period"), "fieldtype": "Time"}, + {"fieldname": "checkin_status", "label": _("Checkin Status"), "fieldtype": "Data"}, + + # for checkout + {"fieldname": "actual_checkout_time", "label": _("Actual Time to Checkout"), "fieldtype": "Time"}, + {"fieldname": "checkout_time", "label": _("Checkout Time"), "fieldtype": "Time"}, + {"fieldname": "early_exit_grace_time", "label": _("Early Exit Grace Period"), "fieldtype": "Time"}, + {"fieldname": "checkout_status", "label": _("Checkout Status"), "fieldtype": "Data"}, + ] + return columns + +def get_conditions(filters): + conditions = "" + if filters.get("from_date"): + conditions += " AND DATE(chec.time) >= %(from_date)s" + if filters.get("to_date"): + conditions += " AND DATE(chec.time) <= %(to_date)s" + if filters.get("company"): + conditions += " AND emp.company = %(company)s" + if filters.get("department") and filters.get("company"): + department_list = get_department( + filters.get("department"), filters.get("company") + ) + conditions += ( + "AND emp.department in (" + + ", ".join(("'" + d + "'" for d in department_list)) + + ")" + ) + if filters.get("employee"): + conditions += " AND chec.employee = %(employee)s" + return conditions, filters + +def get_department(department, company): + department_list = get_descendants_of("Department", department) + department_list.append(department) + return department_list + +def get_checkin_data(conditions, filters, chift_type_details): + checkin_data = [] + checkin_details = get_checkin_details(conditions, filters) + + for checkin_d in checkin_details: + if checkin_d.default_shift and checkin_d.shift_type: + checkin_d["shift"] = checkin_d.shift_type + + if checkin_d.default_shift or checkin_d.shift_type: + checkin_d["shift"] = checkin_d.shift_type or checkin_d.default_shift + + if checkin_d.shift: + for shift_type in chift_type_details: + if checkin_d.shift == shift_type.name: + checkin_time_diff = get_time(checkin_d.checkin_time) + + late_entry_grace_time = str("00:" + cstr(shift_type.late_entry_grace_period) + ":00") + start_time = get_time(str(shift_type.start_time)) + + start_time_diff = get_time(add_to_date(str(shift_type.start_time), minutes=shift_type.late_entry_grace_period, as_string=False, as_datetime=True)) + + if checkin_time_diff <= start_time: + checkin_status = "Early Checkin" + else: + if checkin_time_diff <= start_time_diff: + checkin_status = "On Time" + else: + checkin_status = "Late Checkin" + + complete_row = { + "employee": checkin_d.employee, + "employee_name": checkin_d.employee_name, + "department": checkin_d.department, + "shift": checkin_d.shift, + "date": checkin_d.date, + "week_day": getdate(checkin_d.date).strftime("%A"), + "actual_checkin_time": str(shift_type.start_time), + "checkin_time": checkin_d.checkin_time, + "late_entry_grace_time": late_entry_grace_time, + "checkin_status": checkin_status + } + + checkin_data.append(complete_row) + + else: + continue + + else: + half_row = { + "employee": checkin_d.employee, + "employee_name": checkin_d.employee_name, + "department": checkin_d.department, + "shift": '', + "date": checkin_d.date, + "week_day": getdate(checkin_d.date).strftime("%A"), + "actual_checkin_time": '', + "checkin_time": checkin_d.checkin_time, + "late_entry_grace_time": '', + "checkin_status": '' + } + + checkin_data.append(half_row) + + return checkin_data + +def get_checkout_data(conditions, filters, chift_type_details): + checkout_data = [] + checkout_details = get_checkout_details(conditions, filters) + + for checkout_d in checkout_details: + if checkout_d.default_shift and checkout_d.shift_type: + checkout_d["shift"] = checkout_d.shift_type + + if checkout_d.default_shift or checkout_d.shift_type: + checkout_d["shift"] = checkout_d.shift_type or checkout_d.default_shift + + if checkout_d.shift: + for shift_type in chift_type_details: + if checkout_d.shift == shift_type.name: + checkout_time_diff = get_time(checkout_d.checkout_time) + + early_exit_grace_time = str("00:" + cstr(shift_type.early_exit_grace_period) + ":00") + end_time = get_time(str(shift_type.end_time)) + + end_time_diff = get_time(add_to_date(str(shift_type.end_time), minutes=(- + (shift_type.early_exit_grace_period)), as_string=False, as_datetime=True)) + + if checkout_time_diff <= end_time_diff: + checkout_status = "Early Checkout" + else: + if checkout_time_diff <= end_time: + checkout_status = "On Time" + else: + checkout_status = "Late Checkout" + + complete_row = { + "employee": checkout_d.employee, + "employee_name": checkout_d.employee_name, + "department": checkout_d.department, + "shift": checkout_d.shift, + "date": checkout_d.date, + "week_day": getdate(checkout_d.date).strftime("%A"), + "actual_checkout_time": str(shift_type.end_time), + "checkout_time": checkout_d.checkout_time, + "early_exit_grace_time": early_exit_grace_time, + "checkout_status": checkout_status + } + + checkout_data.append(complete_row) + + else: + continue + + else: + half_row = { + "employee": checkout_d.employee, + "employee_name": checkout_d.employee_name, + "department": checkout_d.department, + "shift": '', + "date": checkout_d.date, + "week_day": getdate(checkout_d.date).strftime("%A"), + "actual_checkout_time": '', + "checkout_time": checkout_d.checkout_time, + "early_exit_grace_time": '', + "checkout_status": '' + } + + checkout_data.append(half_row) + + return checkout_data + +def get_checkin_details(conditions, filters): + data = frappe.db.sql(""" + SELECT + chec.employee AS employee, + chec.employee_name AS employee_name, + emp.department AS department, + emp.default_shift AS default_shift, + sha.shift_type AS shift_type, + DATE_FORMAT(chec.time, '%%Y-%%m-%%d') AS date, + DATE_FORMAT(chec.time, '%%T') AS checkin_time + FROM `tabEmployee Checkin` chec + INNER JOIN `tabEmployee` emp ON emp.name = chec.employee + LEFT JOIN `tabShift Assignment` sha ON chec.employee = sha.employee + AND sha.start_date BETWEEN %(from_date)s AND %(to_date)s + AND DATE(chec.time) BETWEEN sha.start_date AND sha.end_date + WHERE chec.log_type = "IN" {conditions} + ORDER BY chec.time ASC + """.format(conditions=conditions), filters, as_dict=1) + return data + +def get_checkout_details(conditions, filters): + data = frappe.db.sql(""" + SELECT + chec.employee AS employee, + chec.employee_name AS employee_name, + emp.department AS department, + emp.default_shift AS default_shift, + sha.shift_type AS shift_type, + DATE_FORMAT(chec.time, '%%Y-%%m-%%d') AS date, + DATE_FORMAT(chec.time, '%%T') AS checkout_time + FROM `tabEmployee Checkin` chec + INNER JOIN `tabEmployee` emp ON emp.name = chec.employee + LEFT JOIN `tabShift Assignment` sha ON chec.employee = sha.employee + AND sha.start_date BETWEEN %(from_date)s AND %(to_date)s + AND DATE(chec.time) BETWEEN sha.start_date AND sha.end_date + WHERE chec.log_type = "OUT" {conditions} + ORDER BY chec.time ASC + """.format(conditions=conditions), filters, as_dict=1) + return data \ No newline at end of file diff --git a/csf_tz/csf_tz/report/excise_duty_detailed_report/__init__.py b/csf_tz/csf_tz/report/excise_duty_detailed_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/excise_duty_detailed_report/excise_duty_detailed_report.js b/csf_tz/csf_tz/report/excise_duty_detailed_report/excise_duty_detailed_report.js new file mode 100644 index 0000000..cf85cae --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_detailed_report/excise_duty_detailed_report.js @@ -0,0 +1,22 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Excise Duty Detailed Report"] = { + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ] +} diff --git a/csf_tz/csf_tz/report/excise_duty_detailed_report/excise_duty_detailed_report.json b/csf_tz/csf_tz/report/excise_duty_detailed_report/excise_duty_detailed_report.json new file mode 100644 index 0000000..43d89dd --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_detailed_report/excise_duty_detailed_report.json @@ -0,0 +1,22 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-02-23 11:00:59.652673", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-03-19 21:39:56.249210", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Excise Duty Detailed Report", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT sii.item_name AS \"Item Name:Data:200\",\r\n SUM(sii.stock_qty) AS \"Stock Quantity:Float:200\",\r\n MAX(sii.stock_uom) AS \"Stock UOM:Link/UOM:200\",\r\n SUM(sii.base_net_amount) AS \"Net Amount:Currency/currency:200\",\r\n SUM(sii.base_net_amount) * 0.090909 AS \"Excise Duty:Currency/currency:200\"\r\nFROM `tabSales Invoice` si\r\ninner join `tabSales Invoice Item` sii on si.name = sii.parent\r\nWHERE si.excise_duty_applicable\r\n AND si.posting_date BETWEEN %(from_date)s AND %(to_date)s\r\nGROUP BY sii.item_name\r\n", + "ref_doctype": "Purchase Invoice", + "report_name": "Excise Duty Detailed Report", + "report_type": "Query Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/excise_duty_report/__init__.py b/csf_tz/csf_tz/report/excise_duty_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/excise_duty_report/excise_duty_report.json b/csf_tz/csf_tz/report/excise_duty_report/excise_duty_report.json new file mode 100644 index 0000000..2d97a2b --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_report/excise_duty_report.json @@ -0,0 +1,22 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-02-23 11:00:09.796927", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-03-19 21:39:12.494465", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Excise Duty Report", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT si.name AS \"Sales Invoice No:Link/Sales Invoice:100\", si.customer AS \"Customer:Link/Customer:250\",\r\n si.posting_date AS \"Invoice Date:Date:100\",\r\n si.base_net_total AS \"VAT Exclusive:Currency/currency:200\",\r\n si.base_net_total * 0.09090909 AS \"Excise Duty:Currency/currency:200\"\r\nFROM `tabSales Invoice` si\r\nWHERE si.excise_duty_applicable\r\n AND si.posting_date BETWEEN %(from_date)s AND %(to_date)s\r\n", + "ref_doctype": "Purchase Invoice", + "report_name": "Excise Duty Report", + "report_type": "Query Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/excise_duty_report/exise_duty_report.js b/csf_tz/csf_tz/report/excise_duty_report/exise_duty_report.js new file mode 100644 index 0000000..a1e1820 --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_report/exise_duty_report.js @@ -0,0 +1,22 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Excise Duty Report"] = { + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ] +} diff --git a/csf_tz/csf_tz/report/excise_duty_stock/__init__.py b/csf_tz/csf_tz/report/excise_duty_stock/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.js b/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.js new file mode 100644 index 0000000..730a018 --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.js @@ -0,0 +1,99 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Excise Duty Stock"] = { + "filters": [ + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "width": "80", + "options": "Company", + "default": frappe.defaults.get_default("company") + }, + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.get_today() + }, + { + "fieldname": "item_group", + "label": __("Item Group"), + "fieldtype": "Link", + "width": "80", + "options": "Item Group" + }, + { + "fieldname": "item_code", + "label": __("Item"), + "fieldtype": "Link", + "width": "80", + "options": "Item", + "get_query": function () { + return { + query: "erpnext.controllers.queries.item_query", + }; + } + }, + { + "fieldname": "warehouse_type", + "label": __("Warehouse Type"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse Type" + }, + { + "fieldname": "warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse", + get_query: () => { + var warehouse_type = frappe.query_report.get_filter_value('warehouse_type'); + if (warehouse_type) { + return { + filters: { + 'warehouse_type': warehouse_type + } + }; + } + } + }, + { + "fieldname": "include_uom", + "label": __("Include UOM"), + "fieldtype": "Link", + "options": "UOM" + }, + { + "fieldname": "show_variant_attributes", + "label": __("Show Variant Attributes"), + "fieldtype": "Check" + }, + ], + + "formatter": function (value, row, column, data, default_formatter) { + value = default_formatter(value, row, column, data); + + if (column.fieldname == "out_qty" && data && data.out_qty > 0) { + value = "" + value + ""; + } + else if (column.fieldname == "in_qty" && data && data.in_qty > 0) { + value = "" + value + ""; + } + + return value; + } +}; diff --git a/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.json b/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.json new file mode 100644 index 0000000..e8611a5 --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 1, + "creation": "2021-03-08 07:07:16.593144", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-03-08 07:07:16.593144", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Excise Duty Stock", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Stock Ledger Entry", + "reference_report": "Stock Balance", + "report_name": "Excise Duty Stock", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.py b/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.py new file mode 100644 index 0000000..35f238b --- /dev/null +++ b/csf_tz/csf_tz/report/excise_duty_stock/excise_duty_stock.py @@ -0,0 +1,311 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import erpnext +from frappe import _ +from frappe.utils import flt, cint, getdate +from erpnext.stock.utils import add_additional_uom_columns +from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition + + +from six import iteritems + + +def execute(filters=None): + if not filters: + filters = {} + + validate_filters(filters) + + if filters.get("company"): + company_currency = erpnext.get_company_currency(filters.get("company")) + else: + company_currency = frappe.db.get_single_value( + "Global Defaults", "default_currency") + + include_uom = filters.get("include_uom") + columns = get_columns(filters) + items = get_items(filters) + sle = get_stock_ledger_entries(filters, items) + + # if no stock ledger entry found return + if not sle: + return columns, [] + + iwb_map = get_item_warehouse_map(filters, sle) + item_map = get_item_details(items, sle, filters) + + data = [] + conversion_factors = {} + + def _func(x): return x[1] + + for (company, item) in sorted(iwb_map): + if item_map.get(item): + qty_dict = iwb_map[(company, item)] + + report_data = { + 'currency': company_currency, + 'item_code': item, + 'company': company, + } + report_data.update(item_map[item]) + report_data.update(qty_dict) + + if include_uom: + conversion_factors.setdefault( + item, item_map[item].conversion_factor) + + data.append(report_data) + + add_additional_uom_columns(columns, data, include_uom, conversion_factors) + return columns, data + + +def get_columns(filters): + """return columns""" + columns = [ + {"label": _("Item"), "fieldname": "item_code", + "fieldtype": "Link", "options": "Item", "width": 100}, + {"label": _("Item Name"), "fieldname": "item_name", "width": 150}, + {"label": _("Item Group"), "fieldname": "item_group", + "fieldtype": "Link", "options": "Item Group", "width": 100}, + {"label": _("Stock UOM"), "fieldname": "stock_uom", + "fieldtype": "Link", "options": "UOM", "width": 90}, + {"label": _("Opening Qty"), "fieldname": "opening_qty", + "fieldtype": "Float", "width": 100, "convertible": "qty"}, + {"label": _("In Qty"), "fieldname": "in_qty", + "fieldtype": "Float", "width": 80, "convertible": "qty"}, + {"label": _("Out Qty"), "fieldname": "out_qty", + "fieldtype": "Float", "width": 80, "convertible": "qty"}, + {"label": _("Balance Qty"), "fieldname": "bal_qty", + "fieldtype": "Float", "width": 100, "convertible": "qty"}, + {"label": _("Excise Qty"), "fieldname": "excise_stock", + "fieldtype": "Float", "width": 100, "convertible": "qty"}, + {"label": _("Company"), "fieldname": "company", + "fieldtype": "Link", "options": "Company", "width": 100} + ] + + if filters.get('show_variant_attributes'): + columns += [{'label': att_name, 'fieldname': att_name, 'width': 100} + for att_name in get_variants_attributes()] + + return columns + + +def get_conditions(filters): + conditions = "" + if not filters.get("from_date"): + frappe.throw(_("'From Date' is required")) + + if filters.get("to_date"): + conditions += " and sle.posting_date <= %s" % frappe.db.escape( + filters.get("to_date")) + else: + frappe.throw(_("'To Date' is required")) + + if filters.get("company"): + conditions += " and sle.company = %s" % frappe.db.escape( + filters.get("company")) + + if filters.get("warehouse"): + warehouse_details = frappe.db.get_value("Warehouse", + filters.get("warehouse"), ["lft", "rgt"], as_dict=1) + if warehouse_details: + conditions += " and exists (select name from `tabWarehouse` wh \ + where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)" % (warehouse_details.lft, + warehouse_details.rgt) + + if filters.get("warehouse_type") and not filters.get("warehouse"): + conditions += " and exists (select name from `tabWarehouse` wh \ + where wh.warehouse_type = '%s' and sle.warehouse = wh.name)" % (filters.get("warehouse_type")) + + return conditions + + +def get_stock_ledger_entries(filters, items): + item_conditions_sql = '' + if items: + item_conditions_sql = ' and sle.item_code in ({})'\ + .format(', '.join([frappe.db.escape(i, percent=False) for i in items])) + + conditions = get_conditions(filters) + + return frappe.db.sql(""" + select + sle.item_code, sle.warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate, + sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference, + sle.item_code as name, sle.voucher_no, sle.stock_value, 0 as excise_stock + from + `tabStock Ledger Entry` sle force index (posting_sort_index) + inner join `tabStock Entry` se on sle.voucher_type = "Stock Entry" and se.name = sle.voucher_no + inner join `tabItem` i on sle.item_code = i.name + where sle.is_cancelled = 0 + and (se.purpose != "Material Transfer") + and i.excisable_item = 1 + and sle.docstatus < 2 %s %s + UNION ALL + select + sle.item_code, sle.warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate, + sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference, + sle.item_code as name, sle.voucher_no, sle.stock_value, sle.actual_qty * si.excise_duty_applicable as excise_stock + from + `tabStock Ledger Entry` sle force index (posting_sort_index) + inner join `tabSales Invoice` si on sle.voucher_type = "Sales Invoice" and si.name = sle.voucher_no + inner join `tabItem` i on sle.item_code = i.name + where sle.is_cancelled = 0 + and i.excisable_item = 1 + and sle.docstatus < 2 %s %s + UNION ALL + select + sle.item_code, sle.warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate, + sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference, + sle.item_code as name, sle.voucher_no, sle.stock_value, 0 as excise_stock + from + `tabStock Ledger Entry` sle force index (posting_sort_index) + inner join `tabItem` i on sle.item_code = i.name + where sle.is_cancelled = 0 + and sle.voucher_type NOT IN ("Stock Entry", "Sales Invoice") + and i.excisable_item = 1 + and sle.docstatus < 2 %s %s + order by 3""" % # nosec + (item_conditions_sql, conditions, item_conditions_sql, conditions, item_conditions_sql, conditions), as_dict=1) + + +def get_item_warehouse_map(filters, sle): + iwb_map = {} + from_date = getdate(filters.get("from_date")) + to_date = getdate(filters.get("to_date")) + + float_precision = cint(frappe.db.get_default("float_precision")) or 3 + + for d in sle: + key = (d.company, d.item_code) + if key not in iwb_map: + iwb_map[key] = frappe._dict({ + "opening_qty": 0.0, + "in_qty": 0.0, + "out_qty": 0.0, + "excise_stock": 0.0, + "bal_qty": 0.0 + }) + + qty_dict = iwb_map[(d.company, d.item_code)] + + if d.voucher_type == "Stock Reconciliation": + qty_diff = flt(d.qty_after_transaction) - flt(qty_dict.bal_qty) + else: + qty_diff = flt(d.actual_qty) + + if d.posting_date < from_date: + qty_dict.opening_qty += qty_diff + + elif d.posting_date >= from_date and d.posting_date <= to_date: + if flt(qty_diff, float_precision) >= 0: + qty_dict.in_qty += qty_diff + else: + qty_dict.out_qty += abs(qty_diff) + qty_dict.excise_stock += abs(d.excise_stock) or 0 + + qty_dict.bal_qty += qty_diff + + iwb_map = filter_items_with_no_transactions(iwb_map, float_precision) + + return iwb_map + + +def filter_items_with_no_transactions(iwb_map, float_precision): + for (company, item) in sorted(iwb_map): + qty_dict = iwb_map[(company, item)] + + no_transactions = True + for key, val in iteritems(qty_dict): + val = flt(val, float_precision) + qty_dict[key] = val + if key != "val_rate" and val: + no_transactions = False + + if no_transactions: + iwb_map.pop((company, item)) + + return iwb_map + + +def get_items(filters): + conditions = [] + if filters.get("item_code"): + conditions.append("item.name=%(item_code)s") + else: + if filters.get("item_group"): + conditions.append(get_item_group_condition( + filters.get("item_group"))) + + items = [] + if conditions: + items = frappe.db.sql_list("""select name from `tabItem` item where {}""" + .format(" and ".join(conditions)), filters) + return items + + +def get_item_details(items, sle, filters): + item_details = {} + if not items: + items = list(set([d.item_code for d in sle])) + + if not items: + return item_details + + cf_field = cf_join = "" + if filters.get("include_uom"): + cf_field = ", ucd.conversion_factor" + cf_join = "left join `tabUOM Conversion Detail` ucd on ucd.parent=item.name and ucd.uom=%s" \ + % frappe.db.escape(filters.get("include_uom")) + + res = frappe.db.sql(""" + select + item.name, item.item_name, item.description, item.item_group, item.brand, item.stock_uom %s + from + `tabItem` item + %s + where + item.name in (%s) + """ % (cf_field, cf_join, ','.join(['%s'] * len(items))), items, as_dict=1) + + for item in res: + item_details.setdefault(item.name, item) + + if filters.get('show_variant_attributes', 0) == 1: + variant_values = get_variant_values_for(list(item_details)) + item_details = {k: v.update(variant_values.get(k, {})) + for k, v in iteritems(item_details)} + + return item_details + + +def validate_filters(filters): + if not (filters.get("item_code") or filters.get("warehouse")): + sle_count = flt(frappe.db.sql( + """select count(name) from `tabStock Ledger Entry`""")[0][0]) + if sle_count > 500000: + frappe.throw( + _("Please set filter based on Item or Warehouse due to a large amount of entries.")) + + +def get_variants_attributes(): + '''Return all item variant attributes.''' + return [i.name for i in frappe.get_all('Item Attribute')] + + +def get_variant_values_for(items): + '''Returns variant values for items.''' + attribute_map = {} + for attr in frappe.db.sql('''select parent, attribute, attribute_value + from `tabItem Variant Attribute` where parent in (%s) + ''' % ", ".join(["%s"] * len(items)), tuple(items), as_dict=1): + attribute_map.setdefault(attr['parent'], {}) + attribute_map[attr['parent']].update( + {attr['attribute']: attr['attribute_value']}) + + return attribute_map diff --git a/csf_tz/csf_tz/report/exempt_purchases/expenses/__init__.py b/csf_tz/csf_tz/report/exempt_purchases/expenses/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/general_ledger_pro/__init__.py b/csf_tz/csf_tz/report/general_ledger_pro/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/general_ledger_pro/general_ledger.py b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger.py new file mode 100644 index 0000000..c36d6c0 --- /dev/null +++ b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger.py @@ -0,0 +1,478 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe, erpnext +from erpnext import get_company_currency, get_default_company +from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency +from frappe.utils import getdate, cstr, flt, fmt_money +from frappe import _, _dict +from erpnext.accounts.utils import get_account_currency +from erpnext.accounts.report.financial_statements import get_cost_centers_with_children +from six import iteritems +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children +from collections import OrderedDict + +def execute(filters=None): + if not filters: + return [], [] + + account_details = {} + + if filters and filters.get('print_in_account_currency') and \ + not filters.get('account'): + frappe.throw(_("Select an account to print in account currency")) + + for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1): + account_details.setdefault(acc.name, acc) + + if filters.get('party'): + filters.party = frappe.parse_json(filters.get("party")) + + validate_filters(filters, account_details) + + validate_party(filters) + + filters = set_account_currency(filters) + + columns = get_columns(filters) + + res = get_result(filters, account_details) + + return columns, res + + +def validate_filters(filters, account_details): + if not filters.get("company"): + frappe.throw(_("{0} is mandatory").format(_("Company"))) + + if not filters.get("from_date") and not filters.get("to_date"): + frappe.throw(_("{0} and {1} are mandatory").format(frappe.bold(_("From Date")), frappe.bold(_("To Date")))) + + if filters.get("account") and not account_details.get(filters.account): + frappe.throw(_("Account {0} does not exists").format(filters.account)) + + if (filters.get("account") and filters.get("group_by") == _('Group by Account') + and account_details[filters.account].is_group == 0): + frappe.throw(_("Can not filter based on Account, if grouped by Account")) + + if (filters.get("voucher_no") + and filters.get("group_by") in [_('Group by Voucher')]): + frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher")) + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date")) + + if filters.get('project'): + filters.project = frappe.parse_json(filters.get('project')) + + if filters.get('cost_center'): + filters.cost_center = frappe.parse_json(filters.get('cost_center')) + + +def validate_party(filters): + party_type, party = filters.get("party_type"), filters.get("party") + + if party: + if not party_type: + frappe.throw(_("To filter based on Party, select Party Type first")) + else: + for d in party: + if not frappe.db.exists(party_type, d): + frappe.throw(_("Invalid {0}: {1}").format(party_type, d)) + +def set_account_currency(filters): + if filters.get("account") or (filters.get('party') and len(filters.party) == 1): + filters["company_currency"] = frappe.get_cached_value('Company', filters.company, "default_currency") + account_currency = None + + if filters.get("account"): + account_currency = get_account_currency(filters.account) + elif filters.get("party"): + gle_currency = frappe.db.get_value( + "GL Entry", { + "party_type": filters.party_type, "party": filters.party[0], "company": filters.company + }, + "account_currency" + ) + + if gle_currency: + account_currency = gle_currency + else: + account_currency = (None if filters.party_type in ["Employee", "Student", "Shareholder", "Member"] else + frappe.db.get_value(filters.party_type, filters.party[0], "default_currency")) + + filters["account_currency"] = account_currency or filters.company_currency + if filters.account_currency != filters.company_currency and not filters.presentation_currency: + filters.presentation_currency = filters.account_currency + + return filters + +def get_result(filters, account_details): + gl_entries = get_gl_entries(filters) + + data = get_data_with_opening_closing(filters, account_details, gl_entries) + + result = get_result_as_list(data, filters) + + return result + +def get_gl_entries(filters): + currency_map = get_currency(filters) + select_fields = """, debit, credit, debit_in_account_currency, + credit_in_account_currency """ + + order_by_statement = "order by posting_date, account, creation" + + if filters.get("group_by") == _("Group by Voucher"): + order_by_statement = "order by posting_date, voucher_type, voucher_no" + + if filters.get("include_default_book_entries"): + filters['company_fb'] = frappe.db.get_value("Company", + filters.get("company"), 'default_finance_book') + + gl_entries = frappe.db.sql( + """ + select + name as gl_entry, posting_date, account, party_type, party, + voucher_type, voucher_no, cost_center, project, + against_voucher_type, against_voucher, account_currency, + remarks, against, is_opening {select_fields} + from `tabGL Entry` + where company=%(company)s {conditions} + {order_by_statement} + """.format( + select_fields=select_fields, conditions=get_conditions(filters), + order_by_statement=order_by_statement + ), + filters, as_dict=1) + + if filters.get('presentation_currency'): + return convert_to_presentation_currency(gl_entries, currency_map) + else: + return gl_entries + + +def get_conditions(filters): + conditions = [] + if filters.get("account"): + lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"]) + conditions.append("""account in (select name from tabAccount + where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt)) + + if filters.get("cost_center"): + filters.cost_center = get_cost_centers_with_children(filters.cost_center) + conditions.append("cost_center in %(cost_center)s") + + if filters.get("voucher_no"): + conditions.append("voucher_no=%(voucher_no)s") + + if filters.get("group_by") == "Group by Party" and not filters.get("party_type"): + conditions.append("party_type in ('Customer', 'Supplier')") + + if filters.get("party_type"): + conditions.append("party_type=%(party_type)s") + + if filters.get("party"): + conditions.append("party in %(party)s") + + if not (filters.get("account") or filters.get("party") or + filters.get("group_by") in ["Group by Account", "Group by Party"]): + conditions.append("posting_date >=%(from_date)s") + + conditions.append("(posting_date <=%(to_date)s or is_opening = 'Yes')") + + if filters.get("project"): + conditions.append("project in %(project)s") + + if filters.get("finance_book"): + if filters.get("include_default_book_entries"): + conditions.append("(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)") + else: + conditions.append("finance_book in (%(finance_book)s)") + + from frappe.desk.reportview import build_match_conditions + match_conditions = build_match_conditions("GL Entry") + + if match_conditions: + conditions.append(match_conditions) + + accounting_dimensions = get_accounting_dimensions(as_list=False) + + if accounting_dimensions: + for dimension in accounting_dimensions: + if filters.get(dimension.fieldname): + if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'): + filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type, + filters.get(dimension.fieldname)) + conditions.append("{0} in %({0})s".format(dimension.fieldname)) + else: + conditions.append("{0} in (%({0})s)".format(dimension.fieldname)) + + return "and {}".format(" and ".join(conditions)) if conditions else "" + + +def get_data_with_opening_closing(filters, account_details, gl_entries): + data = [] + + gle_map = initialize_gle_map(gl_entries, filters) + + totals, entries = get_accountwise_gle(filters, gl_entries, gle_map) + + # Opening for filtered account + data.append(totals.opening) + + if filters.get("group_by") != _('Group by Voucher (Consolidated)'): + for acc, acc_dict in iteritems(gle_map): + # acc + if acc_dict.entries: + # opening + data.append({}) + if filters.get("group_by") != _("Group by Voucher"): + data.append(acc_dict.totals.opening) + + data += acc_dict.entries + + # totals + data.append(acc_dict.totals.total) + + # closing + if filters.get("group_by") != _("Group by Voucher"): + data.append(acc_dict.totals.closing) + data.append({}) + else: + data += entries + + # totals + data.append(totals.total) + + # closing + data.append(totals.closing) + + return data + +def get_totals_dict(): + def _get_debit_credit_dict(label): + return _dict( + account="'{0}'".format(label), + debit=0.0, + credit=0.0, + debit_in_account_currency=0.0, + credit_in_account_currency=0.0 + ) + return _dict( + opening = _get_debit_credit_dict(_('Opening')), + total = _get_debit_credit_dict(_('Total')), + closing = _get_debit_credit_dict(_('Closing (Opening + Total)')) + ) + +def group_by_field(group_by): + if group_by == _('Group by Party'): + return 'party' + elif group_by in [_('Group by Voucher (Consolidated)'), _('Group by Account')]: + return 'account' + else: + return 'voucher_no' + +def initialize_gle_map(gl_entries, filters): + gle_map = OrderedDict() + group_by = group_by_field(filters.get('group_by')) + + for gle in gl_entries: + gle_map.setdefault(gle.get(group_by), _dict(totals=get_totals_dict(), entries=[])) + return gle_map + + +def get_accountwise_gle(filters, gl_entries, gle_map): + totals = get_totals_dict() + entries = [] + consolidated_gle = OrderedDict() + group_by = group_by_field(filters.get('group_by')) + + def update_value_in_dict(data, key, gle): + data[key].debit += flt(gle.debit) + data[key].credit += flt(gle.credit) + + data[key].debit_in_account_currency += flt(gle.debit_in_account_currency) + data[key].credit_in_account_currency += flt(gle.credit_in_account_currency) + + if data[key].against_voucher and gle.against_voucher: + data[key].against_voucher += ', ' + gle.against_voucher + + from_date, to_date = getdate(filters.from_date), getdate(filters.to_date) + for gle in gl_entries: + if (gle.posting_date < from_date or + (cstr(gle.is_opening) == "Yes" and not filters.get("show_opening_entries"))): + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'opening', gle) + update_value_in_dict(totals, 'opening', gle) + + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'closing', gle) + update_value_in_dict(totals, 'closing', gle) + + elif gle.posting_date <= to_date: + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'total', gle) + update_value_in_dict(totals, 'total', gle) + if filters.get("group_by") != _('Group by Voucher (Consolidated)'): + gle_map[gle.get(group_by)].entries.append(gle) + elif filters.get("group_by") == _('Group by Voucher (Consolidated)'): + key = (gle.get("voucher_type"), gle.get("voucher_no"), + gle.get("account"), gle.get("cost_center")) + if key not in consolidated_gle: + consolidated_gle.setdefault(key, gle) + else: + update_value_in_dict(consolidated_gle, key, gle) + + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'closing', gle) + update_value_in_dict(totals, 'closing', gle) + + for key, value in consolidated_gle.items(): + entries.append(value) + + return totals, entries + +def get_result_as_list(data, filters): + balance, balance_in_account_currency = 0, 0 + inv_details = get_supplier_invoice_details() + + for d in data: + if not d.get('posting_date'): + balance, balance_in_account_currency = 0, 0 + + balance = get_balance(d, balance, 'debit', 'credit') + d['balance'] = balance + + d['account_currency'] = filters.account_currency + d['bill_no'] = inv_details.get(d.get('against_voucher'), '') + + return data + +def get_supplier_invoice_details(): + inv_details = {} + for d in frappe.db.sql(""" select name, bill_no from `tabPurchase Invoice` + where docstatus = 1 and bill_no is not null and bill_no != '' """, as_dict=1): + inv_details[d.name] = d.bill_no + + return inv_details + +def get_balance(row, balance, debit_field, credit_field): + balance += (row.get(debit_field, 0) - row.get(credit_field, 0)) + + return balance + +def get_columns(filters): + if filters.get("presentation_currency"): + currency = filters["presentation_currency"] + else: + if filters.get("company"): + currency = get_company_currency(filters["company"]) + else: + company = get_default_company() + currency = get_company_currency(company) + + columns = [ + { + "label": _("GL Entry"), + "fieldname": "gl_entry", + "fieldtype": "Link", + "options": "GL Entry", + "hidden": 1 + }, + { + "label": _("Posting Date"), + "fieldname": "posting_date", + "fieldtype": "Date", + "width": 90 + }, + { + "label": _("Account"), + "fieldname": "account", + "fieldtype": "Link", + "options": "Account", + "width": 180 + }, + { + "label": _("Debit ({0})".format(currency)), + "fieldname": "debit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Credit ({0})".format(currency)), + "fieldname": "credit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Balance ({0})".format(currency)), + "fieldname": "balance", + "fieldtype": "Float", + "width": 130 + } + ] + + columns.extend([ + { + "label": _("Voucher Type"), + "fieldname": "voucher_type", + "width": 120 + }, + { + "label": _("Voucher No"), + "fieldname": "voucher_no", + "fieldtype": "Dynamic Link", + "options": "voucher_type", + "width": 180 + }, + { + "label": _("Against Account"), + "fieldname": "against", + "width": 120 + }, + { + "label": _("Party Type"), + "fieldname": "party_type", + "width": 100 + }, + { + "label": _("Party"), + "fieldname": "party", + "width": 100 + }, + { + "label": _("Project"), + "options": "Project", + "fieldname": "project", + "width": 100 + }, + { + "label": _("Cost Center"), + "options": "Cost Center", + "fieldname": "cost_center", + "width": 100 + }, + { + "label": _("Against Voucher Type"), + "fieldname": "against_voucher_type", + "width": 100 + }, + { + "label": _("Against Voucher"), + "fieldname": "against_voucher", + "fieldtype": "Dynamic Link", + "options": "against_voucher_type", + "width": 100 + }, + { + "label": _("Supplier Invoice No"), + "fieldname": "bill_no", + "fieldtype": "Data", + "width": 100 + }, + { + "label": _("Remarks"), + "fieldname": "remarks", + "width": 400 + } + ]) + + return columns diff --git a/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.html b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.html new file mode 100644 index 0000000..378fa37 --- /dev/null +++ b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.html @@ -0,0 +1,76 @@ +

{%= __("Statement of Account") %}

+

+ {% if (filters.party_name) { %} + {%= filters.party_name %} + {% } else if (filters.party && filters.party.length) { %} + {%= filters.party %} + {% } else if (filters.account) { %} + {%= filters.account %} + {% } %} +

+ +
+ {% if (filters.tax_id) { %} + {%= __("Tax Id: ")%} {%= filters.tax_id %} + {% } %} +
+ +
+ {%= frappe.datetime.str_to_user(filters.from_date) %} + {%= __("to") %} + {%= frappe.datetime.str_to_user(filters.to_date) %} +
+
+ + + + + + + + + + + + + {% for(var i=0, l=data.length; i + {% if(data[i].posting_date) { %} + + + + + + {% } else { %} + + + + + + {% } %} + + + {% } %} + +
{%= __("Date") %}{%= __("Ref") %}{%= __("Party") %}{%= __("Debit") %}{%= __("Credit") %}{%= __("Balance (Dr - Cr)") %}
{%= frappe.datetime.str_to_user(data[i].posting_date) %}{%= data[i].voucher_type %} +
{%= data[i].voucher_no %}
+ {% if(!(filters.party || filters.account)) { %} + {%= data[i].party || data[i].account %} +
+ {% } %} + + {{ __("Against") }}: {%= data[i].against %} +
{%= __("Remarks") %}: {%= data[i].remarks %} + {% if(data[i].bill_no) { %} +
{%= __("Supplier Invoice No") %}: {%= data[i].bill_no %} + {% } %} +
+ {%= format_currency(data[i].debit, filters.presentation_currency) %} + {%= format_currency(data[i].credit, filters.presentation_currency) %}{%= frappe.format(data[i].account, {fieldtype: "Link"}) || " " %} + {%= data[i].account && format_currency(data[i].debit, filters.presentation_currency) %} + + {%= data[i].account && format_currency(data[i].credit, filters.presentation_currency) %} + + {%= format_currency(data[i].balance, filters.presentation_currency) %} +
+

Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}

diff --git a/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.js b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.js new file mode 100644 index 0000000..f8a4153 --- /dev/null +++ b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.js @@ -0,0 +1,175 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["General Ledger Pro"] = { + "filters": [ + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "reqd": 1 + }, + { + "fieldname": "finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book" + }, + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + { + "fieldname": "account", + "label": __("Account"), + "fieldtype": "Link", + "options": "Account", + "get_query": function () { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Account", + "filters": { + "company": company, + } + } + } + }, + { + "fieldname": "voucher_no", + "label": __("Voucher No"), + "fieldtype": "Data", + on_change: function () { + frappe.query_report.set_filter_value('group_by', "Group by Voucher (Consolidated)"); + } + }, + { + "fieldtype": "Break", + }, + { + "fieldname": "party_type", + "label": __("Party Type"), + "fieldtype": "Link", + "options": "Party Type", + "default": "Customer", + on_change: function () { + frappe.query_report.set_filter_value('party', ""); + } + }, + { + "fieldname": "party", + "label": __("Party"), + "fieldtype": "MultiSelectList", + get_data: function (txt) { + if (!frappe.query_report.filters) return; + + let party_type = frappe.query_report.get_filter_value('party_type'); + if (!party_type) return; + + return frappe.db.get_link_options(party_type, txt); + }, + on_change: function () { + var party_type = frappe.query_report.get_filter_value('party_type'); + var parties = frappe.query_report.get_filter_value('party'); + + if (!party_type || parties.length === 0 || parties.length > 1) { + frappe.query_report.set_filter_value('party_name', ""); + frappe.query_report.set_filter_value('tax_id', ""); + return; + } else { + var party = parties[0]; + var fieldname = erpnext.utils.get_party_name(party_type) || "name"; + frappe.db.get_value(party_type, party, fieldname, function (value) { + frappe.query_report.set_filter_value('party_name', value[fieldname]); + }); + + if (party_type === "Customer" || party_type === "Supplier") { + frappe.db.get_value(party_type, party, "tax_id", function (value) { + frappe.query_report.set_filter_value('tax_id', value["tax_id"]); + }); + } + } + } + }, + { + "fieldname": "party_name", + "label": __("Party Name"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname": "group_by", + "label": __("Group by"), + "fieldtype": "Select", + "options": ["", __("Group by Voucher"), __("Group by Voucher (Consolidated)"), + __("Group by Account"), __("Group by Party")], + "default": __("Group by Voucher (Consolidated)") + }, + { + "fieldname": "tax_id", + "label": __("Tax Id"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname": "presentation_currency", + "label": __("Currency"), + "fieldtype": "Select", + "options": erpnext.get_presentation_currency_list() + }, + { + "fieldname": "cost_center", + "label": __("Cost Center"), + "fieldtype": "MultiSelectList", + get_data: function (txt) { + return frappe.db.get_link_options('Cost Center', txt); + } + }, + { + "fieldname": "project", + "label": __("Project"), + "fieldtype": "MultiSelectList", + get_data: function (txt) { + return frappe.db.get_link_options('Project', txt); + } + }, + { + "fieldname": "include_dimensions", + "label": __("Consider Accounting Dimensions"), + "fieldtype": "Check", + "default": 0 + }, + { + "fieldname": "show_opening_entries", + "label": __("Show Opening Entries"), + "fieldtype": "Check" + }, + { + "fieldname": "include_default_book_entries", + "label": __("Include Default Book Entries"), + "fieldtype": "Check", + "default": 1 + }, + { + "fieldname": "show_cancelled_entries", + "label": __("Show Cancelled Entries"), + "fieldtype": "Check" + } + ] +}; + +erpnext.utils.add_dimensions('General Ledger Pro', 15) diff --git a/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.json b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.json new file mode 100644 index 0000000..e5e5a8d --- /dev/null +++ b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "creation": "2021-01-28 18:53:16.038692", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-01-28 18:53:16.038692", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "General Ledger Pro", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "GL Entry", + "report_name": "General Ledger Pro", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.py b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.py new file mode 100644 index 0000000..1d54e30 --- /dev/null +++ b/csf_tz/csf_tz/report/general_ledger_pro/general_ledger_pro.py @@ -0,0 +1,594 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import erpnext +from erpnext import get_company_currency, get_default_company +from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency +from frappe.utils import getdate, cstr, flt, fmt_money +from frappe import _, _dict +from erpnext.accounts.utils import get_account_currency +from erpnext.accounts.report.financial_statements import get_cost_centers_with_children +from six import iteritems +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children +from collections import OrderedDict + + +def execute(filters=None): + if not filters: + return [], [] + + account_details = {} + + if filters and filters.get('print_in_account_currency') and \ + not filters.get('account'): + frappe.throw(_("Select an account to print in account currency")) + + for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1): + account_details.setdefault(acc.name, acc) + + if filters.get('party'): + filters.party = frappe.parse_json(filters.get("party")) + + validate_filters(filters, account_details) + + validate_party(filters) + + filters = set_account_currency(filters) + + columns = get_columns(filters) + + res = get_result(filters, account_details) + + return columns, res + + +def validate_filters(filters, account_details): + if not filters.get("company"): + frappe.throw(_("{0} is mandatory").format(_("Company"))) + + if not filters.get("from_date") and not filters.get("to_date"): + frappe.throw(_("{0} and {1} are mandatory").format( + frappe.bold(_("From Date")), frappe.bold(_("To Date")))) + + if filters.get("account") and not account_details.get(filters.account): + frappe.throw(_("Account {0} does not exists").format(filters.account)) + + if (filters.get("account") and filters.get("group_by") == _('Group by Account') + and account_details[filters.account].is_group == 0): + frappe.throw( + _("Can not filter based on Account, if grouped by Account")) + + if (filters.get("voucher_no") + and filters.get("group_by") in [_('Group by Voucher')]): + frappe.throw( + _("Can not filter based on Voucher No, if grouped by Voucher")) + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date")) + + if filters.get('project'): + filters.project = frappe.parse_json(filters.get('project')) + + if filters.get('cost_center'): + filters.cost_center = frappe.parse_json(filters.get('cost_center')) + + +def validate_party(filters): + party_type, party = filters.get("party_type"), filters.get("party") + + if party: + if not party_type: + frappe.throw( + _("To filter based on Party, select Party Type first")) + else: + for d in party: + if not frappe.db.exists(party_type, d): + frappe.throw(_("Invalid {0}: {1}").format(party_type, d)) + + +def set_account_currency(filters): + if filters.get("account") or (filters.get('party') and len(filters.party) == 1): + filters["company_currency"] = frappe.get_cached_value( + 'Company', filters.company, "default_currency") + account_currency = None + + if filters.get("account"): + account_currency = get_account_currency(filters.account) + elif filters.get("party"): + gle_currency = frappe.db.get_value( + "GL Entry", { + "party_type": filters.party_type, "party": filters.party[0], "company": filters.company + }, + "account_currency" + ) + + if gle_currency: + account_currency = gle_currency + else: + account_currency = (None if filters.party_type in ["Employee", "Student", "Shareholder", "Member"] else + frappe.db.get_value(filters.party_type, filters.party[0], "default_currency")) + + filters["account_currency"] = account_currency or filters.company_currency + if filters.account_currency != filters.company_currency and not filters.presentation_currency: + filters.presentation_currency = filters.account_currency + + return filters + + +def get_result(filters, account_details): + accounting_dimensions = [] + if filters.get("include_dimensions"): + accounting_dimensions = get_accounting_dimensions() + + gl_entries = get_gl_entries(filters, accounting_dimensions) + + data = get_data_with_opening_closing(filters, account_details, + accounting_dimensions, gl_entries) + + result = get_result_as_list(data, filters) + + return result + + +def get_gl_entries(filters, accounting_dimensions): + currency_map = get_currency(filters) + select_fields = """, debit, credit, debit_in_account_currency, + credit_in_account_currency """ + + order_by_statement = "order by posting_date, account, creation" + + if filters.get("group_by") == _("Group by Voucher"): + order_by_statement = "order by posting_date, voucher_type, voucher_no" + + if filters.get("include_default_book_entries"): + filters['company_fb'] = frappe.db.get_value("Company", + filters.get("company"), 'default_finance_book') + + dimension_fields = "" + if accounting_dimensions: + dimension_fields = ', '.join(accounting_dimensions) + ',' + + distributed_cost_center_query = "" + if filters and filters.get('cost_center'): + select_fields_with_percentage = """, debit*(DCC_allocation.percentage_allocation/100) as debit, credit*(DCC_allocation.percentage_allocation/100) as credit, debit_in_account_currency*(DCC_allocation.percentage_allocation/100) as debit_in_account_currency, + credit_in_account_currency*(DCC_allocation.percentage_allocation/100) as credit_in_account_currency """ + + distributed_cost_center_query = """ + UNION ALL + SELECT name as gl_entry, + posting_date, + account, + party_type, + party, + voucher_type, + voucher_no, {dimension_fields} + cost_center, project, + against_voucher_type, + against_voucher, + account_currency, + remarks, against, + is_opening, `tabGL Entry`.creation {select_fields_with_percentage} + FROM `tabGL Entry`, + ( + SELECT parent, sum(percentage_allocation) as percentage_allocation + FROM `tabDistributed Cost Center` + WHERE cost_center IN %(cost_center)s + AND parent NOT IN %(cost_center)s + GROUP BY parent + ) as DCC_allocation + WHERE company=%(company)s + {conditions} + AND posting_date <= %(to_date)s + AND cost_center = DCC_allocation.parent + """.format(dimension_fields=dimension_fields, select_fields_with_percentage=select_fields_with_percentage, conditions=get_conditions(filters).replace("and cost_center in %(cost_center)s ", '')) + + gl_entries_all_except_students = frappe.db.sql( + """ + select + gle.name as gl_entry, posting_date, account, party_type, party, + voucher_type, voucher_no, {dimension_fields} + cost_center, project, + against_voucher_type, against_voucher, account_currency, + remarks, against, is_opening, gle.creation {select_fields} + from `tabGL Entry` as gle + where party != 'Student' and company=%(company)s {conditions} + {distributed_cost_center_query} + {order_by_statement} + """.format( + dimension_fields=dimension_fields, select_fields=select_fields, conditions=get_conditions(filters), distributed_cost_center_query=distributed_cost_center_query, + order_by_statement=order_by_statement + ), + filters, as_dict=1) + + gl_entries_students = frappe.db.sql( + """ + select + gle.name as gl_entry, posting_date, account, party_type, CONCAT(std.first_name, " ", IFNULL(std.middle_name, ''), " ", IFNULL(std.last_name, '')) as party, + voucher_type, voucher_no, {dimension_fields} + cost_center, project, + against_voucher_type, against_voucher, account_currency, + remarks, against, is_opening, gle.creation {select_fields} + from `tabGL Entry` AS gle + INNER JOIN `tabStudent` AS std ON gle.party = std.name + where gle.party_type = 'Student' and company=%(company)s {conditions} + {distributed_cost_center_query} + {order_by_statement} + """.format( + dimension_fields=dimension_fields, select_fields=select_fields, conditions=get_conditions(filters), distributed_cost_center_query=distributed_cost_center_query, + order_by_statement=order_by_statement + ), + filters, as_dict=1) + + gl_entries = (gl_entries_all_except_students or []) + \ + (gl_entries_students or []) + + if filters.get('presentation_currency'): + return convert_to_presentation_currency(gl_entries, currency_map, filters.get('company')) + else: + return gl_entries + + +def get_conditions(filters): + conditions = [] + if filters.get("account"): + lft, rgt = frappe.db.get_value( + "Account", filters["account"], ["lft", "rgt"]) + conditions.append("""account in (select name from tabAccount + where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt)) + + if filters.get("cost_center"): + filters.cost_center = get_cost_centers_with_children( + filters.cost_center) + conditions.append("cost_center in %(cost_center)s") + + if filters.get("voucher_no"): + conditions.append("voucher_no=%(voucher_no)s") + + if filters.get("group_by") == "Group by Party" and not filters.get("party_type"): + conditions.append("party_type in ('Customer', 'Supplier')") + + if filters.get("party_type"): + conditions.append("party_type=%(party_type)s") + + if filters.get("party"): + conditions.append("party in %(party)s") + + if not (filters.get("account") or filters.get("party") or + filters.get("group_by") in ["Group by Account", "Group by Party"]): + conditions.append("posting_date >=%(from_date)s") + + conditions.append("(posting_date <=%(to_date)s or is_opening = 'Yes')") + + if filters.get("project"): + conditions.append("project in %(project)s") + + if filters.get("finance_book"): + if filters.get("include_default_book_entries"): + conditions.append( + "(finance_book in (%(finance_book)s, %(company_fb)s, '') OR finance_book IS NULL)") + else: + conditions.append("finance_book in (%(finance_book)s)") + + if not filters.get("show_cancelled_entries"): + conditions.append("is_cancelled = 0") + + from frappe.desk.reportview import build_match_conditions + match_conditions = build_match_conditions("GL Entry") + + if match_conditions: + conditions.append(match_conditions) + + accounting_dimensions = get_accounting_dimensions(as_list=False) + + if accounting_dimensions: + for dimension in accounting_dimensions: + if filters.get(dimension.fieldname): + if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'): + filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type, + filters.get(dimension.fieldname)) + conditions.append( + "{0} in %({0})s".format(dimension.fieldname)) + else: + conditions.append( + "{0} in (%({0})s)".format(dimension.fieldname)) + + return "and {}".format(" and ".join(conditions)) if conditions else "" + + +def get_data_with_opening_closing(filters, account_details, accounting_dimensions, gl_entries): + data = [] + + gle_map = initialize_gle_map(gl_entries, filters) + + totals, entries = get_accountwise_gle( + filters, accounting_dimensions, gl_entries, gle_map) + + # Opening for filtered account + data.append(totals.opening) + + if filters.get("group_by") != _('Group by Voucher (Consolidated)'): + for acc, acc_dict in iteritems(gle_map): + # acc + if acc_dict.entries: + # opening + data.append({}) + if filters.get("group_by") != _("Group by Voucher"): + data.append(acc_dict.totals.opening) + + data += acc_dict.entries + + # totals + data.append(acc_dict.totals.total) + + # closing + if filters.get("group_by") != _("Group by Voucher"): + data.append(acc_dict.totals.closing) + data.append({}) + else: + data += entries + + # totals + data.append(totals.total) + + # closing + data.append(totals.closing) + + return data + + +def get_totals_dict(): + def _get_debit_credit_dict(label): + return _dict( + account="'{0}'".format(label), + debit=0.0, + credit=0.0, + debit_in_account_currency=0.0, + credit_in_account_currency=0.0 + ) + return _dict( + opening=_get_debit_credit_dict(_('Opening')), + total=_get_debit_credit_dict(_('Total')), + closing=_get_debit_credit_dict(_('Closing (Opening + Total)')) + ) + + +def group_by_field(group_by): + if group_by == _('Group by Party'): + return 'party' + elif group_by in [_('Group by Voucher (Consolidated)'), _('Group by Account')]: + return 'account' + else: + return 'voucher_no' + + +def initialize_gle_map(gl_entries, filters): + gle_map = OrderedDict() + group_by = group_by_field(filters.get('group_by')) + + for gle in gl_entries: + gle_map.setdefault(gle.get(group_by), _dict( + totals=get_totals_dict(), entries=[])) + return gle_map + + +def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map): + totals = get_totals_dict() + entries = [] + consolidated_gle = OrderedDict() + group_by = group_by_field(filters.get('group_by')) + + def update_value_in_dict(data, key, gle): + data[key].debit += flt(gle.debit) + data[key].credit += flt(gle.credit) + + data[key].debit_in_account_currency += flt( + gle.debit_in_account_currency) + data[key].credit_in_account_currency += flt( + gle.credit_in_account_currency) + + if data[key].against_voucher and gle.against_voucher: + data[key].against_voucher += ', ' + gle.against_voucher + + from_date, to_date = getdate(filters.from_date), getdate(filters.to_date) + for gle in gl_entries: + if (gle.posting_date < from_date or + (cstr(gle.is_opening) == "Yes" and not filters.get("show_opening_entries"))): + update_value_in_dict( + gle_map[gle.get(group_by)].totals, 'opening', gle) + update_value_in_dict(totals, 'opening', gle) + + update_value_in_dict( + gle_map[gle.get(group_by)].totals, 'closing', gle) + update_value_in_dict(totals, 'closing', gle) + + elif gle.posting_date <= to_date: + update_value_in_dict( + gle_map[gle.get(group_by)].totals, 'total', gle) + update_value_in_dict(totals, 'total', gle) + if filters.get("group_by") != _('Group by Voucher (Consolidated)'): + gle_map[gle.get(group_by)].entries.append(gle) + elif filters.get("group_by") == _('Group by Voucher (Consolidated)'): + keylist = [gle.get("voucher_type"), gle.get( + "voucher_no"), gle.get("account")] + for dim in accounting_dimensions: + keylist.append(gle.get(dim)) + keylist.append(gle.get("cost_center")) + key = tuple(keylist) + if key not in consolidated_gle: + consolidated_gle.setdefault(key, gle) + else: + update_value_in_dict(consolidated_gle, key, gle) + + update_value_in_dict( + gle_map[gle.get(group_by)].totals, 'closing', gle) + update_value_in_dict(totals, 'closing', gle) + + for key, value in consolidated_gle.items(): + entries.append(value) + + return totals, entries + + +def get_result_as_list(data, filters): + balance, balance_in_account_currency = 0, 0 + inv_details = get_supplier_invoice_details() + + for d in data: + if not d.get('posting_date'): + balance, balance_in_account_currency = 0, 0 + + balance = get_balance(d, balance, 'debit', 'credit') + d['balance'] = balance + + d['account_currency'] = filters.account_currency + d['bill_no'] = inv_details.get(d.get('against_voucher'), '') + + return data + + +def get_supplier_invoice_details(): + inv_details = {} + for d in frappe.db.sql(""" select name, bill_no from `tabPurchase Invoice` + where docstatus = 1 and bill_no is not null and bill_no != '' """, as_dict=1): + inv_details[d.name] = d.bill_no + + return inv_details + + +def get_balance(row, balance, debit_field, credit_field): + balance += (row.get(debit_field, 0) - row.get(credit_field, 0)) + + return balance + + +def get_columns(filters): + if filters.get("presentation_currency"): + currency = filters["presentation_currency"] + else: + if filters.get("company"): + currency = get_company_currency(filters["company"]) + else: + company = get_default_company() + currency = get_company_currency(company) + + columns = [ + { + "label": _("GL Entry"), + "fieldname": "gl_entry", + "fieldtype": "Link", + "options": "GL Entry", + "hidden": 1 + }, + { + "label": _("Posting Date"), + "fieldname": "posting_date", + "fieldtype": "Date", + "width": 90 + }, + { + "label": _("Account"), + "fieldname": "account", + "fieldtype": "Link", + "options": "Account", + "width": 180 + }, + { + "label": _("Debit ({0})").format(currency), + "fieldname": "debit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Credit ({0})").format(currency), + "fieldname": "credit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Balance ({0})").format(currency), + "fieldname": "balance", + "fieldtype": "Float", + "width": 130 + } + ] + + columns.extend([ + { + "label": _("Voucher Type"), + "fieldname": "voucher_type", + "width": 120 + }, + { + "label": _("Voucher No"), + "fieldname": "voucher_no", + "fieldtype": "Dynamic Link", + "options": "voucher_type", + "width": 180 + }, + { + "label": _("Against Account"), + "fieldname": "against", + "width": 120 + }, + { + "label": _("Party Type"), + "fieldname": "party_type", + "width": 100 + }, + { + "label": _("Party"), + "fieldname": "party", + "width": 100 + }, + { + "label": _("Project"), + "options": "Project", + "fieldname": "project", + "width": 100 + } + ]) + + if filters.get("include_dimensions"): + for dim in get_accounting_dimensions(as_list=False): + columns.append({ + "label": _(dim.label), + "options": dim.label, + "fieldname": dim.fieldname, + "width": 100 + }) + + columns.extend([ + { + "label": _("Cost Center"), + "options": "Cost Center", + "fieldname": "cost_center", + "width": 100 + }, + { + "label": _("Against Voucher Type"), + "fieldname": "against_voucher_type", + "width": 100 + }, + { + "label": _("Against Voucher"), + "fieldname": "against_voucher", + "fieldtype": "Dynamic Link", + "options": "against_voucher_type", + "width": 100 + }, + { + "label": _("Supplier Invoice No"), + "fieldname": "bill_no", + "fieldtype": "Data", + "width": 100 + }, + { + "label": _("Remarks"), + "fieldname": "remarks", + "width": 400 + } + ]) + + return columns diff --git a/csf_tz/csf_tz/report/gross_profit_pro/__init__.py b/csf_tz/csf_tz/report/gross_profit_pro/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.js b/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.js new file mode 100644 index 0000000..1e47989 --- /dev/null +++ b/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.js @@ -0,0 +1,41 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Gross Profit Pro"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "reqd": 1, + "default": frappe.defaults.get_user_default("Company") + }, + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.defaults.get_user_default("year_start_date") + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.defaults.get_user_default("year_end_date") + }, + { + "fieldname":"sales_invoice", + "label": __("Sales Invoice"), + "fieldtype": "Link", + "options": "Sales Invoice" + }, + { + "fieldname":"group_by", + "label": __("Group By"), + "fieldtype": "Select", + "options": "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject", + "default": "Invoice" + }, + ] +} diff --git a/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.json b/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.json new file mode 100644 index 0000000..e6e6564 --- /dev/null +++ b/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.json @@ -0,0 +1,41 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-08-13 20:04:10.047024", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-08-13 20:04:10.047024", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Gross Profit Pro", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "report_name": "Gross Profit Pro", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + }, + { + "role": "Employee Self Service" + }, + { + "role": "System Manager" + }, + { + "role": "Purchase User" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.py b/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.py new file mode 100644 index 0000000..66035e3 --- /dev/null +++ b/csf_tz/csf_tz/report/gross_profit_pro/gross_profit_pro.py @@ -0,0 +1,392 @@ +# Copyright (c) 2021, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _, scrub +from erpnext.stock.utils import get_incoming_rate +from erpnext.controllers.queries import get_match_cond +from frappe.utils import flt, cint + + +from csf_tz import console + +def execute(filters=None): + if not filters: filters = frappe._dict() + filters.currency = frappe.get_cached_value('Company', filters.company, "default_currency") + + gross_profit_data = GrossProfitGenerator(filters) + + data = [] + + group_wise_columns = frappe._dict({ + "invoice": ["parent", "customer", "customer_group", "posting_date","item_code", "item_name","item_group", "brand", "description", \ + "warehouse", "qty", "base_rate", "buying_rate", "base_amount", + "buying_amount", "gross_profit", "gross_profit_percent", "project"], + "item_code": ["item_code", "item_name", "brand", "description", "qty", "base_rate", + "buying_rate", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"], + "warehouse": ["warehouse", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount", + "gross_profit", "gross_profit_percent"], + "brand": ["brand", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount", + "gross_profit", "gross_profit_percent"], + "item_group": ["item_group", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount", + "gross_profit", "gross_profit_percent"], + "customer": ["customer", "customer_group", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount", + "gross_profit", "gross_profit_percent"], + "customer_group": ["customer_group", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount", + "gross_profit", "gross_profit_percent"], + "sales_person": ["sales_person", "allocated_amount", "qty", "base_rate", "buying_rate", "base_amount", "buying_amount", + "gross_profit", "gross_profit_percent"], + "project": ["project", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"], + "territory": ["territory", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"] + }) + + columns = get_columns(group_wise_columns, filters) + + for idx, src in enumerate(gross_profit_data.grouped_data): + row = [] + for col in group_wise_columns.get(scrub(filters.group_by)): + row.append(src.get(col)) + + row.append(filters.currency) + if idx == len(gross_profit_data.grouped_data)-1: + row[0] = frappe.bold("Total") + data.append(row) + + return columns, data + +def get_columns(group_wise_columns, filters): + columns = [] + column_map = frappe._dict({ + "parent": _("Sales Invoice") + ":Link/Sales Invoice:120", + "posting_date": _("Posting Date") + ":Date:100", + "posting_time": _("Posting Time") + ":Data:100", + "item_code": _("Item Code") + ":Link/Item:100", + "item_name": _("Item Name") + ":Data:100", + "item_group": _("Item Group") + ":Link/Item Group:100", + "brand": _("Brand") + ":Link/Brand:100", + "description": _("Description") +":Data:100", + "warehouse": _("Warehouse") + ":Link/Warehouse:100", + "qty": _("Qty") + ":Float:80", + "base_rate": _("Avg. Selling Rate") + ":Currency/currency:100", + "buying_rate": _("Valuation Rate") + ":Currency/currency:100", + "base_amount": _("Selling Amount") + ":Currency/currency:100", + "buying_amount": _("Buying Amount") + ":Currency/currency:100", + "gross_profit": _("Gross Profit") + ":Currency/currency:100", + "gross_profit_percent": _("Gross Profit %") + ":Percent:100", + "project": _("Project") + ":Link/Project:100", + "sales_person": _("Sales person"), + "allocated_amount": _("Allocated Amount") + ":Currency/currency:100", + "customer": _("Customer") + ":Link/Customer:100", + "customer_group": _("Customer Group") + ":Link/Customer Group:100", + "territory": _("Territory") + ":Link/Territory:100" + }) + + for col in group_wise_columns.get(scrub(filters.group_by)): + columns.append(column_map.get(col)) + + columns.append({ + "fieldname": "currency", + "label" : _("Currency"), + "fieldtype": "Link", + "options": "Currency", + "hidden": 1 + }) + + return columns + +class GrossProfitGenerator(object): + def __init__(self, filters=None): + self.data = [] + self.average_buying_rate = {} + self.filters = frappe._dict(filters) + self.load_invoice_items() + self.load_stock_ledger_entries() + self.load_product_bundle() + self.load_non_stock_items() + self.get_returned_invoice_items() + self.process() + + def process(self): + self.grouped = {} + self.grouped_data = [] + + self.currency_precision = cint(frappe.db.get_default("currency_precision")) or 3 + self.float_precision = cint(frappe.db.get_default("float_precision")) or 2 + + for row in self.si_list: + if self.skip_row(row, self.product_bundles): + continue + + row.base_amount = flt(row.base_net_amount, self.currency_precision) + + product_bundles = [] + if row.update_stock: + product_bundles = self.product_bundles.get(row.parenttype, {}).get(row.parent, frappe._dict()) + elif row.dn_detail: + product_bundles = self.product_bundles.get("Delivery Note", {})\ + .get(row.delivery_note, frappe._dict()) + row.item_row = row.dn_detail + + # get buying amount + if row.item_code in product_bundles: + row.buying_amount = flt(self.get_buying_amount_from_product_bundle(row, + product_bundles[row.item_code]), self.currency_precision) + else: + row.buying_amount = flt(self.get_buying_amount(row, row.item_code), + self.currency_precision) + + # get buying rate + if row.qty: + row.buying_rate = flt(row.buying_amount / row.qty, self.float_precision) + row.base_rate = flt(row.base_amount / row.qty, self.float_precision) + else: + row.buying_rate, row.base_rate = 0.0, 0.0 + + # calculate gross profit + row.gross_profit = flt(row.base_amount - row.buying_amount, self.currency_precision) + if row.base_amount: + row.gross_profit_percent = flt((row.gross_profit / row.base_amount) * 100.0, self.currency_precision) + else: + row.gross_profit_percent = 0.0 + + # add to grouped + self.grouped.setdefault(row.get(scrub(self.filters.group_by)), []).append(row) + + if self.grouped: + self.get_average_rate_based_on_group_by() + + def get_average_rate_based_on_group_by(self): + # sum buying / selling totals for group + self.totals = frappe._dict( + qty=0, + base_amount=0, + buying_amount=0, + gross_profit=0, + gross_profit_percent=0, + base_rate=0, + buying_rate=0 + ) + for key in list(self.grouped): + if self.filters.get("group_by") != "Invoice": + for i, row in enumerate(self.grouped[key]): + if i==0: + new_row = row + else: + new_row.qty += row.qty + new_row.buying_amount += flt(row.buying_amount, self.currency_precision) + new_row.base_amount += flt(row.base_amount, self.currency_precision) + new_row = self.set_average_rate(new_row) + self.grouped_data.append(new_row) + self.add_to_totals(new_row) + else: + for i, row in enumerate(self.grouped[key]): + if row.parent in self.returned_invoices \ + and row.item_code in self.returned_invoices[row.parent]: + returned_item_rows = self.returned_invoices[row.parent][row.item_code] + for returned_item_row in returned_item_rows: + row.qty += returned_item_row.qty + row.base_amount += flt(returned_item_row.base_amount, self.currency_precision) + row.buying_amount = flt(row.qty * row.buying_rate, self.currency_precision) + if row.qty or row.base_amount: + row = self.set_average_rate(row) + self.grouped_data.append(row) + self.add_to_totals(row) + self.set_average_gross_profit(self.totals) + self.grouped_data.append(self.totals) + + def set_average_rate(self, new_row): + self.set_average_gross_profit(new_row) + new_row.buying_rate = flt(new_row.buying_amount / new_row.qty, self.float_precision) if new_row.qty else 0 + new_row.base_rate = flt(new_row.base_amount / new_row.qty, self.float_precision) if new_row.qty else 0 + return new_row + + def set_average_gross_profit(self, new_row): + new_row.gross_profit = flt(new_row.base_amount - new_row.buying_amount, self.currency_precision) + new_row.gross_profit_percent = flt(((new_row.gross_profit / new_row.base_amount) * 100.0), self.currency_precision) \ + if new_row.base_amount else 0 + + def add_to_totals(self, new_row): + for key in self.totals: + if new_row.get(key): + self.totals[key] += new_row[key] + + def get_returned_invoice_items(self): + returned_invoices = frappe.db.sql(""" + select + si.name, si_item.item_code, si_item.stock_qty as qty, si_item.base_net_amount as base_amount, si.return_against + from + `tabSales Invoice` si, `tabSales Invoice Item` si_item + where + si.name = si_item.parent + and si.docstatus = 1 + and si.is_return = 1 + """, as_dict=1) + + self.returned_invoices = frappe._dict() + for inv in returned_invoices: + self.returned_invoices.setdefault(inv.return_against, frappe._dict())\ + .setdefault(inv.item_code, []).append(inv) + + def skip_row(self, row, product_bundles): + if self.filters.get("group_by") != "Invoice": + if not row.get(scrub(self.filters.get("group_by", ""))): + return True + elif row.get("is_return") == 1: + return True + + def get_buying_amount_from_product_bundle(self, row, product_bundle): + buying_amount = 0.0 + for packed_item in product_bundle: + if packed_item.get("parent_detail_docname")==row.item_row: + buying_amount += self.get_buying_amount(row, packed_item.item_code) + + return flt(buying_amount, self.currency_precision) + + def get_buying_amount(self, row, item_code): + console("in buying amount", item_code) + # IMP NOTE + # stock_ledger_entries should already be filtered by item_code and warehouse and + # sorted by posting_date desc, posting_time desc + if item_code in self.non_stock_items and (row.project or row.cost_center): + #Issue 6089-Get last purchasing rate for non-stock item + item_rate = self.get_last_purchase_rate(item_code, row) + console("non stock items item_rate", item_rate) + + return flt(row.qty) * item_rate + + else: + my_sle = self.sle.get((item_code, row.warehouse)) + if (row.update_stock or row.dn_detail) and my_sle: + parenttype, parent = row.parenttype, row.parent + if row.dn_detail: + parenttype, parent = "Delivery Note", row.delivery_note + + for i, sle in enumerate(my_sle): + # find the stock valution rate from stock ledger entry + if sle.voucher_type == parenttype and parent == sle.voucher_no and \ + sle.voucher_detail_no == row.item_row: + previous_stock_value = len(my_sle) > i+1 and \ + flt(my_sle[i+1].stock_value) or 0.0 + + if previous_stock_value: + return (previous_stock_value - flt(sle.stock_value)) * flt(row.qty) / abs(flt(sle.qty)) + else: + return flt(row.qty) * self.get_average_buying_rate(row, item_code) + else: + console("unknown criteria hit", sle.voucher_type, parenttype, parent, sle.voucher_no, sle.voucher_detail_no, row.item_row) + else: + console("NO update stock or dn detail and no my_sel") + return flt(row.qty) * self.get_average_buying_rate(row, item_code) + + console("0 returned as no matching code") + return 0.0 + + def get_average_buying_rate(self, row, item_code): + args = row + if not item_code in self.average_buying_rate: + args.update({ + 'voucher_type': row.parenttype, + 'voucher_no': row.parent, + 'allow_zero_valuation': True, + 'company': self.filters.company + }) + + average_buying_rate = get_incoming_rate(args) + self.average_buying_rate[item_code] = flt(average_buying_rate) + + return self.average_buying_rate[item_code] + + def get_last_purchase_rate(self, item_code, row): + condition = '' + if row.project: + condition += " AND a.project=%s" % (frappe.db.escape(row.project)) + elif row.cost_center: + condition += " AND a.cost_center=%s" % (frappe.db.escape(row.cost_center)) + if self.filters.to_date: + condition += " AND modified='%s'" % (self.filters.to_date) + + last_purchase_rate = frappe.db.sql(""" + select (a.base_rate / a.conversion_factor) + from `tabPurchase Invoice Item` a + where a.item_code = %s and a.docstatus=1 + {0} + order by a.modified desc limit 1""".format(condition), item_code) + + return flt(last_purchase_rate[0][0]) if last_purchase_rate else 0 + + def load_invoice_items(self): + conditions = "" + if self.filters.company: + conditions += " and company = %(company)s" + if self.filters.from_date: + conditions += " and posting_date >= %(from_date)s" + if self.filters.to_date: + conditions += " and posting_date <= %(to_date)s" + + if self.filters.group_by=="Sales Person": + sales_person_cols = ", sales.sales_person, sales.allocated_amount, sales.incentives" + sales_team_table = "left join `tabSales Team` sales on sales.parent = `tabSales Invoice`.name" + else: + sales_person_cols = "" + sales_team_table = "" + + if self.filters.get("sales_invoice"): + conditions += " and `tabSales Invoice`.name = %(sales_invoice)s" + + if self.filters.get("item_code"): + conditions += " and `tabSales Invoice Item`.item_code = %(item_code)s" + + self.si_list = frappe.db.sql(""" + select + `tabSales Invoice Item`.parenttype, `tabSales Invoice Item`.parent, + `tabSales Invoice`.posting_date, `tabSales Invoice`.posting_time, + `tabSales Invoice`.project, `tabSales Invoice`.update_stock, + `tabSales Invoice`.customer, `tabSales Invoice`.customer_group, + `tabSales Invoice`.territory, `tabSales Invoice Item`.item_code, + `tabSales Invoice Item`.item_name, `tabSales Invoice Item`.description, + `tabSales Invoice Item`.warehouse, `tabSales Invoice Item`.item_group, + `tabSales Invoice Item`.brand, `tabSales Invoice Item`.dn_detail, + `tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty, + `tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount, + `tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return, + `tabSales Invoice Item`.cost_center + {sales_person_cols} + from + `tabSales Invoice` inner join `tabSales Invoice Item` + on `tabSales Invoice Item`.parent = `tabSales Invoice`.name + {sales_team_table} + where + `tabSales Invoice`.docstatus=1 and `tabSales Invoice`.is_opening!='Yes' {conditions} {match_cond} + order by + `tabSales Invoice`.posting_date desc, `tabSales Invoice`.posting_time desc""" + .format(conditions=conditions, sales_person_cols=sales_person_cols, + sales_team_table=sales_team_table, match_cond = get_match_cond('Sales Invoice')), self.filters, as_dict=1) + + def load_stock_ledger_entries(self): + res = frappe.db.sql("""select item_code, voucher_type, voucher_no, + voucher_detail_no, stock_value, warehouse, actual_qty as qty + from `tabStock Ledger Entry` + where company=%(company)s and is_cancelled = 0 + order by + item_code desc, warehouse desc, posting_date desc, + posting_time desc, creation desc""", self.filters, as_dict=True) + self.sle = {} + for r in res: + if (r.item_code, r.warehouse) not in self.sle: + self.sle[(r.item_code, r.warehouse)] = [] + + self.sle[(r.item_code, r.warehouse)].append(r) + + def load_product_bundle(self): + self.product_bundles = {} + + for d in frappe.db.sql("""select parenttype, parent, parent_item, + item_code, warehouse, -1*qty as total_qty, parent_detail_docname + from `tabPacked Item` where docstatus=1""", as_dict=True): + self.product_bundles.setdefault(d.parenttype, frappe._dict()).setdefault(d.parent, + frappe._dict()).setdefault(d.parent_item, []).append(d) + + def load_non_stock_items(self): + self.non_stock_items = frappe.db.sql_list("""select name from tabItem + where is_stock_item=0""") \ No newline at end of file diff --git a/csf_tz/csf_tz/report/heslb_return_online/__init__.py b/csf_tz/csf_tz/report/heslb_return_online/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/heslb_return_online/heslb_return_online.json b/csf_tz/csf_tz/report/heslb_return_online/heslb_return_online.json new file mode 100644 index 0000000..f8588ed --- /dev/null +++ b/csf_tz/csf_tz/report/heslb_return_online/heslb_return_online.json @@ -0,0 +1,57 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-08-16 18:44:28.095692", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-08-16 18:44:28.095692", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "HESLB Return online", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT emp.heslb_f4_index_number AS \"F4indexno:Data:150\", \r\n CONCAT_WS(' ', emp.last_name,emp.first_name,emp.middle_name) AS \"FullName:Data:150\",\r\n ssd.amount AS \"AmountDeducted:Float/2:150\"\r\nFROM `tabSalary Slip` ss RIGHT JOIN `tabEmployee` emp ON ss.employee = emp.name AND emp.heslb_f4_index_number != \"\"\r\n LEFT JOIN `tabSalary Detail` ssd ON ss.name = ssd.parent AND ssd.salary_component = 'HESLB'\r\nWHERE ss.docstatus = 1 \r\nAND ss.start_date >= %(from_date)s\r\nAND ss.end_date <= %(to_date)s\r\nORDER BY emp.name", + "ref_doctype": "Salary Slip", + "report_name": "HESLB Return online", + "report_type": "Query Report", + "roles": [ + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "Employee" + }, + { + "role": "Leave Approver" + }, + { + "role": "All" + }, + { + "role": "Employee Self Service" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/itemwise_stock_movement/__init__.py b/csf_tz/csf_tz/report/itemwise_stock_movement/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.js b/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.js new file mode 100644 index 0000000..346c55c --- /dev/null +++ b/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.js @@ -0,0 +1,64 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Itemwise Stock Movement"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "reqd": 1 + }, + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1 + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + "default": "DAR - VC", + "reqd": 1 + }, + { + "fieldname":"item_group", + "label": __("Item Group"), + "fieldtype": "Link", + "options": "Item Group", + "default": "VOUCHERS" + }, + { + "fieldname":"brand", + "label": __("Brand"), + "fieldtype": "Link", + "options": "Brand", + "default": "HALOTEL" + }, + { + "fieldname":"include_uom", + "label": __("Include UOM"), + "fieldtype": "Link", + "options": "UOM" + } + ] +} + +// $(function() { +// $(wrapper).bind("show", function() { +// frappe.query_report.load(); +// }); +// }); \ No newline at end of file diff --git a/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.json b/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.json new file mode 100644 index 0000000..389e13a --- /dev/null +++ b/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 1, + "creation": "2019-07-04 14:54:51.834733", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-07-17 12:15:07.719762", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Itemwise Stock Movement", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Stock Ledger Entry", + "report_name": "Itemwise Stock Movement", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock Manager" + }, + { + "role": "Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.py b/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.py new file mode 100644 index 0000000..c12804f --- /dev/null +++ b/csf_tz/csf_tz/report/itemwise_stock_movement/itemwise_stock_movement.py @@ -0,0 +1,174 @@ +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +import pandas as pd + +def execute(filters=None): + # frappe.msgprint(str(filters)) + columns = get_columns() + data = [] + items = get_items(filters) + + # Get opening balances as first row in the sl_entries + sl_entries = get_opening_balance_entries(filters, items) + # frappe.msgprint("sle entries are: " + str(sl_entries)) + # Get rest of the stock ledgers + sl_entries += get_stock_ledger_entries(filters, items) + + # below is to try overcome issue of not getting column names in pivot_table + if sl_entries: + colnames = [key for key in sl_entries[0].keys()] + # frappe.msgprint("colnames are: " + str(colnames)) + df = pd.DataFrame.from_records(sl_entries, columns=colnames) + # frappe.msgprint("dataframe columns are is: " + str(df.columns.tolist())) + pvt = pd.pivot_table( + df, + values='actual_qty', + index=['posting_date', 'Particulars'], + columns='item_code', + fill_value=0 + ) + # frappe.msgprint(str(pvt)) + + data = pvt.reset_index().values.tolist() + # frappe.msgprint("Data is: " + str(data)) + + columns += pvt.columns.values.tolist() + + return columns, data + +def get_columns(): + columns = [ + {"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 95}, + {"label": _("Particulars"), "fieldname": "Particulars", "width": 110}, + ] + + return columns + +def get_stock_ledger_entries(filters, items): + item_conditions_sql = '' + if items: + item_conditions_sql = 'and sle.item_code in ({})'\ + .format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])) + + return frappe.db.sql("""SELECT sle.posting_date, + CASE sle.voucher_type + WHEN "Purchase Invoice" THEN "Purchase Invoice" + WHEN "Purchase Receipt" THEN "Purchase Receipt" + WHEN "Sales Invoice" THEN si.customer + WHEN "Delivery Note" THEN dn.customer + WHEN "Stock Entry" THEN "Stock Entry" + ELSE "Other" + END as "Particulars", + sle.item_code, + sum(sle.actual_qty) as "actual_qty" + FROM `tabStock Ledger Entry` sle + LEFT OUTER JOIN `tabSales Invoice` si + ON sle.voucher_no = si.name + AND sle.company = si.company + LEFT OUTER JOIN `tabDelivery Note` dn + ON sle.voucher_no = dn.name + AND sle.company = dn.company + WHERE sle.actual_qty != 0 + AND sle.company = %(company)s + AND sle.posting_date BETWEEN %(from_date)s AND %(to_date)s + {sle_conditions} + {item_conditions_sql} + GROUP BY sle.posting_date, `Particulars`, sle.item_code + ORDER BY sle.posting_date asc"""\ + .format( + sle_conditions=get_sle_conditions(filters), + item_conditions_sql = item_conditions_sql + ), filters, as_dict = 1) + +def get_opening_balance_entries(filters, items): + item_conditions_sql = '' + if items: + item_conditions_sql = 'and sle.item_code in ({})'\ + .format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])) + + return frappe.db.sql("""SELECT STR_TO_DATE(%(from_date)s, '%%Y-%%m-%%d') as posting_date, + ". Opening Balance" as "Particulars", + sle.item_code, + sum(if(sle.actual_qty = 0, sle.qty_after_transaction, sle.actual_qty)) as "actual_qty" + FROM `tabStock Ledger Entry` sle + LEFT OUTER JOIN `tabSales Invoice` si + ON sle.voucher_no = si.name + AND sle.company = si.company + LEFT OUTER JOIN `tabDelivery Note` dn + ON sle.voucher_no = dn.name + AND sle.company = dn.company + WHERE sle.company = %(company)s + AND sle.posting_date < %(from_date)s + {sle_conditions} + {item_conditions_sql} + GROUP BY `Particulars`, sle.item_code"""\ + .format( + sle_conditions=get_sle_conditions(filters), + item_conditions_sql = item_conditions_sql + ), filters, as_dict = 1) + +def get_items(filters): + conditions = [] + if filters.get("item_code"): + conditions.append("item.name=%(item_code)s") + else: + if filters.get("brand"): + conditions.append("item.brand=%(brand)s") + if filters.get("item_group"): + conditions.append(get_item_group_condition(filters.get("item_group"))) + + items = [] + if conditions: + items = frappe.db.sql_list("""select name from `tabItem` item where {}""" + .format(" and ".join(conditions)), filters) + return items + +def get_sle_conditions(filters): + conditions = [] + if filters.get("warehouse"): + warehouse_condition = get_warehouse_condition(filters.get("warehouse")) + if warehouse_condition: + conditions.append(warehouse_condition) + + return "and {}".format(" and ".join(conditions)) if conditions else "" + +def get_opening_balance(filters, _columns, date, balance_type, item_code): + if not (item_code and filters.warehouse and date): + return + + from erpnext.stock.stock_ledger import get_previous_sle + last_entry = get_previous_sle({ + "item_code": item_code, + "warehouse_condition": get_warehouse_condition(filters.warehouse), + "posting_date": date, + "posting_time": "00:00:00" + }) + row = {} + row["voucher_type"] = _(balance_type) + for dummy, v in ((9, 'actual_qty')): + row[v] = last_entry.get(v, 0) + + return row + +def get_warehouse_condition(warehouse): + warehouse_details = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"], as_dict=1) + if warehouse_details: + return " exists (select name from `tabWarehouse` wh \ + where wh.lft >= %s and wh.rgt <= %s and warehouse = wh.name)"%(warehouse_details.lft, + warehouse_details.rgt) + + return '' + +def get_item_group_condition(item_group): + item_group_details = frappe.db.get_value("Item Group", item_group, ["lft", "rgt"], as_dict=1) + if item_group_details: + return "item.item_group in (select ig.name from `tabItem Group` ig \ + where ig.lft >= %s and ig.rgt <= %s and item.item_group = ig.name)"%(item_group_details.lft, + item_group_details.rgt) + + return '' + diff --git a/csf_tz/csf_tz/report/itx.215.03.e_sdl_monthly_returns/__init__.py b/csf_tz/csf_tz/report/itx.215.03.e_sdl_monthly_returns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/itx.215.03.e_sdl_monthly_returns/itx.215.03.e_sdl_monthly_returns.json b/csf_tz/csf_tz/report/itx.215.03.e_sdl_monthly_returns/itx.215.03.e_sdl_monthly_returns.json new file mode 100644 index 0000000..1a5ef60 --- /dev/null +++ b/csf_tz/csf_tz/report/itx.215.03.e_sdl_monthly_returns/itx.215.03.e_sdl_monthly_returns.json @@ -0,0 +1,57 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-08-13 11:10:56.406635", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-10-07 15:46:15.318993", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "ITX.215.03.E SDL Monthly Returns", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT\t\n IF(e.employment_type != 'Temporary', \"PERM\", \"TEMP\") AS \"NATURE OF EMPLOYEMENT:Data:200\",\n COUNT(*) AS \"NUMBER OF EMPLOYEE:Integer:200\",\n SUM(IF(sdb.salary_component = 'Basic', sdb.amount, 0)) AS \"BASIC SALARY:Currency:200\",\n SUM(ss.gross_pay) - SUM(IF(sdb.salary_component = 'Basic', sdb.amount, 0)) AS \"OTHER ALLOWANCES:Currency:200\",\n SUM(ss.gross_pay) \"GROSS PAYMENT:Currency:200\",\n SUM(IF(sdd.salary_component = 'NSSF', sdd.amount, 0)) AS \"EXEMPTION:Currency:200\",\n SUM(ss.gross_pay) - SUM(IF(sdd.salary_component = 'NSSF', sdd.amount, 0)) AS \"AMOUNT SUBJECT TO SDL:Currency:200\"\nFROM `tabSalary Slip` ss LEFT JOIN `tabEmployee` e ON ss.employee = e.name\n LEFT JOIN `tabSalary Detail` sdb ON ss.name = sdb.parent AND sdb.salary_component = 'Basic'\n LEFT JOIN `tabSalary Detail` sdd ON ss.name = sdd.parent AND sdd.salary_component = 'NSSF'\nWHERE\tss.start_date >= %(from_date)s\nAND\t ss.end_date <= %(to_date)s\nAND ss.docstatus = 1\nGROUP BY IF(e.employment_type != 'Temporary', \"PERM\", \"TEMP\")", + "ref_doctype": "Salary Slip", + "report_name": "ITX.215.03.E SDL Monthly Returns", + "report_type": "Query Report", + "roles": [ + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "Employee" + }, + { + "role": "Leave Approver" + }, + { + "role": "All" + }, + { + "role": "Employee Self Service" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/itx.219.03.e_statement_of_tax_withheld/__init__.py b/csf_tz/csf_tz/report/itx.219.03.e_statement_of_tax_withheld/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/itx.219.03.e_statement_of_tax_withheld/itx.219.03.e_statement_of_tax_withheld.json b/csf_tz/csf_tz/report/itx.219.03.e_statement_of_tax_withheld/itx.219.03.e_statement_of_tax_withheld.json new file mode 100644 index 0000000..4b6f301 --- /dev/null +++ b/csf_tz/csf_tz/report/itx.219.03.e_statement_of_tax_withheld/itx.219.03.e_statement_of_tax_withheld.json @@ -0,0 +1,48 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-08-13 12:28:43.544884", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-10-07 15:38:14.144054", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "ITX.219.03.E Statement of Tax Withheld", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT\t\n ss.employee_name AS \"Employee:Data:220\",\n SUM(IF(sdb.salary_component = 'Basic', sdb.amount, 0)) AS \"BASIC SALARY:Currency:150\",\n SUM(ss.gross_pay) - SUM(IF(sdb.salary_component = 'Basic', sdb.amount, 0)) AS \"OTHER ALLOWANCES:Currency:180\",\n SUM(ss.gross_pay) \"GROSS PAYMENT:Currency:150\",\n SUM(IF(sdd.salary_component = 'NSSF', sdd.amount, 0)) AS \"EXEMPTION:Currency:150\",\n SUM(ss.gross_pay) - SUM(IF(sdd.salary_component = 'NSSF', sdd.amount, 0)) AS \"TAXBALE AMOUNT:Currency:150\",\n SUM(IF(sdp.salary_component = 'PAYE', sdp.amount, 0)) AS \"PAYE:Currency:150\"\nFROM `tabSalary Slip` ss LEFT JOIN `tabEmployee` e ON ss.employee = e.name\n LEFT JOIN `tabSalary Detail` sdb ON ss.name = sdb.parent AND sdb.salary_component = 'Basic'\n LEFT JOIN `tabSalary Detail` sdd ON ss.name = sdd.parent AND sdd.salary_component = 'NSSF'\n LEFT JOIN `tabSalary Detail` sdp ON ss.name = sdp.parent AND sdp.salary_component = 'PAYE'\nWHERE\tss.start_date >= %(from_date)s\nAND\t ss.end_date <= %(to_date)s\nAND ss.docstatus = 1\nGROUP BY ss.employee", + "ref_doctype": "Salary Slip", + "report_name": "ITX.219.03.E Statement of Tax Withheld", + "report_type": "Query Report", + "roles": [ + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "Office Admin" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/__init__.py b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.html b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.html new file mode 100644 index 0000000..80f9957 --- /dev/null +++ b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.html @@ -0,0 +1,365 @@ + + {% var start_date = filters.from_date %} + {% var end_date = filters.to_date %} + {% var tin = data[0][ __("TIN")] %} + + {% if ( end_date[5]+ end_date[6] == "06") { %} + {% var tick1 = "X" %} + {% } %} + + {% if ( end_date[5]+ end_date[6] == "12") { %} + {% var tick2 = "X" %} + {% } %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ +

+

+ WITHHOLDING TAXES +

+

+ STATEMENT AND PAYMENT OF TAX WITHHELD +

+

+ (Please, read the notes carefully before filling the form.) +

+

+
+ + + + + + + + + + + + + + + + + +
YEAR{%= start_date[0] %}{%= start_date[1] %}{%= start_date[2] %}{%= start_date[3] %}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TIN{%= tin[0] %}{%= tin[1] %}{%= tin[2] %}{%= tin[4] %}{%= tin[5] %}{%= tin[6] %}{%= tin[8] %}{%= tin[9] %}{%= tin[10] %}
+
+ Period: (Please tick the appropriate box) +
+ + + + + + + + + + + + + + +
{%= tick1 %}From 1 January to 30 June
{%= tick2 %}From 1 July to 31 December
+
+ + + + + + + + + + +
WITHHOLDING TAX ON{%= data[0][ __("Withholding Type")] %}
+
+ Name of Withholder: +
+ {%= data[0][ __("Withholder")] %} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Postal Address:
P. O. Box{%= data[0][ __("P O Box")] %}Postal Address 

Contact Numbers:
Phone number{%= data[0][ __("Phone")] %}Second Phone 
Third Phone Fax number{%= data[0][ __("Fax Number")] %}
E-mail address:{%= data[0][ __("Email")] %}

Physical Adddress:
Plot Number{%= data[0][ __("Plot Number")] %}Block Number {%= data[0][ __("Block Number")] %}
Street/Location{%= data[0][ __("Street")] %}
Name of Branch 
+ +



ITX 230.01.E – Withholding Tax Statement + +
+
+
+
+ + + + + + + + + + + + + + +
+ + WITHHOLDING TAX - DETAILS OF PAYMENT OF TAX WITHHELD

+
+
+
+ + Name of Withholder: + {%= data[0][ __("Withholder")] %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TIN{%= tin[0] %}{%= tin[1] %}{%= tin[2] %}{%= tin[4] %}{%= tin[5] %}{%= tin[6] %}{%= tin[8] %}{%= tin[9] %}{%= tin[10] %}
+
+ + + + + + + + + + + + + + + + + + + + + + + {% + var post_add=0; + var gross_total=0; + var tax_withheld=0; + %} + {% for(var i=0, l=data.length; i + {% + var gross_total = gross_total + data[i][ __("Gross Payment")]; + var tax_withheld = tax_withheld + data[i][ __("Tax Withheld")]; + %} + + + + + + + + + {% } else { %} + + + + + + {% } %} + {% } %} + +
S/NOTINNAME OF WITHHOLDEEPOSTAL ADDRESSPOSTAL CITYGROSS PAYMENT TZSTAX WITHHELD TZS
{%= i+1 %}{%= data[i][ __("Withholdee TIN")] %}{%= data[i][ __("Withholdee")] %}{%= data[i][ __("Withholdee Post")] %}{%= data[i][ __("Withholdee City")] %}{%= data[i][ __("Gross Payment")].toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}{%= data[i][ __("Tax Withheld")].toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}
TOTAL{%= gross_total.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}{%= tax_withheld.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}
diff --git a/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.js b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.js new file mode 100644 index 0000000..c0a34ed --- /dev/null +++ b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.js @@ -0,0 +1,24 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["ITX 230.01.E – Withholding Tax Statement"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + } + ] +} diff --git a/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.json b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.json new file mode 100644 index 0000000..10a04a8 --- /dev/null +++ b/csf_tz/csf_tz/report/itx_230.01.e_–_withholding_tax_statement/itx_230.01.e_–_withholding_tax_statement.json @@ -0,0 +1,25 @@ +{ + "add_total_row": 1, + "creation": "2020-05-05 18:07:11.546023", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-07-24 10:09:14.780929", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "ITX 230.01.E \u2013 Withholding Tax Statement", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT cmp.tax_id AS \"TIN:Data:0\",\n pi.company AS \"Withholder:Data:0\",\n cmp.p_o_box AS \"P O Box:Data:0\",\n cmp.city AS \"City:Data:0\",\n cmp.plot_number AS \"Plot No.:Data:0\",\n cmp.block_number AS \"Block No.:Data:0\",\n cmp.street AS \"Street:Data:0\",\n cmp.phone_no AS \"Phone:Data:0\",\n cmp.fax AS \"Fax:Data:0\",\n cmp.email AS \"Email:Data:0\",\n pi.tax_id AS \"Withholdee TIN:Data:0\",\n pi.supplier AS \"Withholdee:Data:0\",\n addr.pincode AS \"Withholdee Post:Data:0\",\n addr.city AS \"Withholdee City:Data:0\",\n pii.base_amount AS \"Gross Payment:Currency:0\",\n pii.withholding_tax_rate as \"Withholding Rate::0\",\n if(pii.withholding_tax_rate = 5, 'Service', 'Rent') as \"Withholding Type:Data:0\",\n (pii.withholding_tax_rate/100) * pii.base_amount AS \"Tax Withheld:Currency:0\"\nFROM `tabPurchase Invoice` pi LEFT JOIN `tabPurchase Invoice Item` pii ON pi.name = pii.parent\n LEFT JOIN `tabCompany` cmp ON pi.company = cmp.company_name\n LEFT JOIN `tabAddress` addr ON pi.supplier = addr.address_title and addr.is_primary_address = 1\nWHERE pii.withholding_tax_rate > 0\nAND pi.docstatus = 1\nAND pi.posting_date >= %(from_date)s \nAND pi.posting_date <= %(to_date)s", + "ref_doctype": "Purchase Invoice", + "report_name": "ITX 230.01.E \u2013 Withholding Tax Statement", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/loan_outstanding/__init__.py b/csf_tz/csf_tz/report/loan_outstanding/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/loan_outstanding/loan_outstanding.json b/csf_tz/csf_tz/report/loan_outstanding/loan_outstanding.json new file mode 100644 index 0000000..06539fb --- /dev/null +++ b/csf_tz/csf_tz/report/loan_outstanding/loan_outstanding.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2022-01-29 15:22:01.878094", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2022-02-01 15:55:53.167175", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Loan Outstanding", + "owner": "av-dev2@aakvatech.com", + "prepared_report": 0, + "query": "SELECT \n applicant AS \"Employee:Data:120\", \n applicant_name AS \"Employee Name:Data:200\",\n GROUP_CONCAT(name ORDER BY posting_date SEPARATOR ', ') AS \"Loan:Link/Loan:200\",\n SUM(total_payment) AS \"Total Payable Amount:Currency:150\",\n SUM(total_amount_paid) AS \"Total Paid Amount:Currency:150\",\n (SUM(total_payment) - SUM(total_amount_paid)) AS \"Loan Outstanding:Currency:200\"\nFROM `tabLoan`\nWHERE loan_type = \"Staff Loan\"\nGROUP BY applicant\nORDER BY posting_date, applicant\n\n", + "ref_doctype": "Loan", + "report_name": "Loan Outstanding", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Loan Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/loan_repayment_details/__init__.py b/csf_tz/csf_tz/report/loan_repayment_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.js b/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.js new file mode 100644 index 0000000..294d382 --- /dev/null +++ b/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.js @@ -0,0 +1,14 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Loan Repayment Details"] = { + "filters": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "label": __("Employee"), + "options": "Employee" + } + ] +}; diff --git a/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.json b/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.json new file mode 100644 index 0000000..23b41bd --- /dev/null +++ b/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.json @@ -0,0 +1,41 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2022-07-11 09:16:52.609103", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2022-07-11 09:33:54.206509", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Loan Repayment Details", + "owner": "Administrator", + "prepared_report": 1, + "query": "", + "ref_doctype": "Loan", + "report_name": "Loan Repayment Details", + "report_script": "", + "report_type": "Script Report", + "roles": [ + { + "role": "HR Manager" + }, + { + "role": "Employee" + }, + { + "role": "HR User" + }, + { + "role": "HR Manager (Group)" + }, + { + "role": "Directorate" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.py b/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.py new file mode 100644 index 0000000..b94171a --- /dev/null +++ b/csf_tz/csf_tz/report/loan_repayment_details/loan_repayment_details.py @@ -0,0 +1,144 @@ +# Copyright (c) 2022, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +from frappe import _ +from frappe.utils import flt + +def execute(filters=None): + loans = [] + data = [] + columns = get_columns(filters) + + repayments_from_salaries, repayments_not_from_salaries, all_repayments = get_repayments(filters) + + if repayments_from_salaries: + loans += get__paid_loans(filters, repayments_from_salaries, True) + + if repayments_not_from_salaries: + loans += get__paid_loans(filters, repayments_not_from_salaries, False) + + if all_repayments: + loans += get_loans_not_started_to_be_paid(filters, all_repayments) + + custom_loan_repayment_records = get_custom_loan_repayment_not_from_salary(filters) + + for loan in loans: + for custom_loan_repayment in custom_loan_repayment_records: + if custom_loan_repayment.loan in loan.loan: + loan.amount_paid_not_from_salary += flt(custom_loan_repayment.amount_paid_not_from_salary) + + loan.update({ + "loan_balance": flt(loan.total_payable_amount) - flt(loan.amount_paid_from_salary) - flt(loan.amount_paid_not_from_salary) - flt(loan.write_off_amount) + }) + data.append(loan) + + return columns, data + +def get_columns(filters): + return [ + {"fieldname": "applicant", "fieldtype": "Data", "label": _("Applicant"), "width": "150px"}, + {"fieldname": "applicant_name", "fieldtype": "Data", "label": _("Applicant Name"), "width": "150px"}, + {"fieldname": "loan", "fieldtype": "Data", "label": _("Loan"), "width": "100px"}, + {"fieldname": "total_payable_amount", "fieldtype": "Currency", "label": _("Total Payable Amount"), "width": "150px"}, + {"fieldname": "amount_paid_from_salary", "fieldtype": "Currency", "label": _("Amount Paid From Salary"), "width": "150px"}, + {"fieldname": "amount_paid_not_from_salary", "fieldtype": "Currency", "label": _("Amount Paid not From Salary"), "width": "150px"}, + {"fieldname": "write_off_amount", "fieldtype": "Currency", "label": _("Write Off Amount"), "width": "150px"}, + {"fieldname": "loan_balance", "fieldtype": "Currency", "label": _("Loan Balance"), "width": "150px"}, + ] + + +def get_loans_not_started_to_be_paid(filters, all_repayments): + conditions = "" + if filters.get("employee"): + conditions += " AND l.applicant = '%s' " % filters["employee"] + + return frappe.db.sql(""" + SELECT + l.applicant AS applicant, + l.applicant_name AS applicant_name, + GROUP_CONCAT(l.name ORDER BY l.posting_date SEPARATOR ', ') AS loan, + SUM(l.total_payment) AS total_payable_amount, + null AS amount_paid_from_salary, + null AS amount_paid_not_from_salary, + SUM(wr.write_off_amount) AS write_off_amount, + null AS loan_balance + FROM `tabLoan` l + LEFT JOIN `tabLoan Write Off` wr ON l.name = wr.loan and l.applicant = wr.applicant + WHERE l.name NOT IN ({}) + AND l.status != "Closed" + AND l.docstatus = 1 {conditions} + GROUP BY l.applicant + ORDER BY l.posting_date, l.applicant + """.format(", ".join( + frappe.db.escape(loan.against_loan) for loan in all_repayments), + conditions=conditions + ), as_dict=True) + + +def get__paid_loans(filters, repayments, from_salary): + conditional_columns = "" + if from_salary: + conditional_columns += """ + SUM(l.total_amount_paid) AS amount_paid_from_salary, + null AS amount_paid_not_from_salary, + """ + else: + conditional_columns += """ + null AS amount_paid_from_salary, + SUM(l.total_amount_paid) AS amount_paid_not_from_salary, + """ + + loans = frappe.db.sql(""" + SELECT + l.applicant AS applicant, + l.applicant_name AS applicant_name, + GROUP_CONCAT(l.name ORDER BY l.posting_date SEPARATOR ', ') AS loan, + SUM(l.total_payment) AS total_payable_amount, + {conditional_columns} + SUM(l.written_off_amount) AS write_off_amount, + null AS loan_balance + FROM `tabLoan` l + WHERE l.name in ({}) + AND l.status != "Closed" + GROUP BY l.applicant + ORDER BY l.posting_date, l.applicant + """.format(", ".join( + frappe.db.escape(loan.against_loan) for loan in repayments), + conditional_columns=conditional_columns + ), as_dict=True) + + return loans + + +def get_repayments(filters): + employee = None + if filters.get("employee"): + employee = filters["employee"] + else: + employee = ["!=", ""] + + repayments_from_salaries = frappe.get_all("Loan Repayment", + filters={"loan_type": "Staff Loan", "repay_from_salary": 1, "docstatus": 1, "applicant": employee}, + fields=["Distinct(against_loan) as against_loan"], + order_by="posting_date" + ) + + repayments_not_from_salaries = frappe.get_all("Loan Repayment", + filters={"loan_type": "Staff Loan", "repay_from_salary": 0, "docstatus": 1, "applicant": employee}, + fields=["Distinct(against_loan) as against_loan"], + order_by="posting_date" + ) + + all_repayments = repayments_from_salaries + repayments_not_from_salaries + + return repayments_from_salaries, repayments_not_from_salaries, all_repayments + + +def get_custom_loan_repayment_not_from_salary(filters): + return frappe.db.sql(""" + SELECT loan, SUM(payment_amount) AS amount_paid_not_from_salary + FROM `tabLoan Repayment Not From Salary` + WHERE loan != "" + GROUP BY loan + """, as_dict=True) \ No newline at end of file diff --git a/csf_tz/csf_tz/report/master_data_statistics/__init__.py b/csf_tz/csf_tz/report/master_data_statistics/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/master_data_statistics/master_data_statistics.json b/csf_tz/csf_tz/report/master_data_statistics/master_data_statistics.json new file mode 100644 index 0000000..e5ad2bb --- /dev/null +++ b/csf_tz/csf_tz/report/master_data_statistics/master_data_statistics.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2020-05-27 10:48:04.727934", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "modified": "2022-03-16 09:38:48.731312", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Master Data Statistics", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT SUBSTRING(table_name, 4) as DocType, d.module as 'Module', table_rows as `Number of Rows`,\r\n ROUND((t.DATA_LENGTH + t.INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`\r\n FROM INFORMATION_SCHEMA.TABLES t\r\n LEFT OUTER JOIN `tabDocType` d ON d.name = SUBSTRING(t.table_name, 4)\r\n WHERE table_rows > 0\r\n AND SUBSTRING(table_name, 4) IN (SELECT name FROM tabDocType WHERE is_submittable != 1 and istable = 0)\r\n ORDER BY table_rows DESC\r\n", + "ref_doctype": "Company", + "report_name": "Master Data Statistics", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/monthly_timesheet_report/__init__.py b/csf_tz/csf_tz/report/monthly_timesheet_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.js b/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.js new file mode 100644 index 0000000..48ccf1e --- /dev/null +++ b/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.js @@ -0,0 +1,30 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Monthly Timesheet Report"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "reqd": 1 + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "reqd": 1 + }, + { + "fieldname": "hours_per_day", + "label": __("Hours Per Day"), + "fieldtype": "Check" + }, + { + "fieldname": "hours_per_project", + "label": __("Hours Per Project"), + "fieldtype": "Check" + } + ] +}; diff --git a/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.json b/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.json new file mode 100644 index 0000000..f79e92e --- /dev/null +++ b/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.json @@ -0,0 +1,41 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-10-18 17:06:56.514512", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-10-18 17:06:56.514512", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Monthly Timesheet Report", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Timesheet", + "report_name": "Monthly Timesheet Report", + "report_type": "Script Report", + "roles": [ + { + "role": "HR User" + }, + { + "role": "Projects User" + }, + { + "role": "Accounts User" + }, + { + "role": "Manufacturing User" + }, + { + "role": "Employee" + }, + { + "role": "Employee Self Service" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.py b/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.py new file mode 100644 index 0000000..b3b5224 --- /dev/null +++ b/csf_tz/csf_tz/report/monthly_timesheet_report/monthly_timesheet_report.py @@ -0,0 +1,220 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +import pandas as pd +import numpy as np +from frappe import msgprint, _ +from frappe.utils import data, flt + +def execute(filters=None): + conditions, filters = get_conditions(filters) + + columns = get_columns(filters) + data = [] + + if filters.hours_per_day: + columns = [_("Date") + "::160"] + + records = hours_per_day_data(conditions, filters) + if not records: + frappe.throw("No Record found for the filters From Date: {0}, To Date: {1}, Hours Per Day: {2} you specified..., \ + Please change your filters and try again..!!".format( + frappe.bold(filters.from_date), + frappe.bold(filters.to_date), + frappe.bold(filters.hours_per_day), + )) + + df_colnames = [key for key in records[0].keys()] + + df = pd.DataFrame.from_records(records, columns=df_colnames) + + table_pvt = pd.pivot_table( + df, + index=["employee_name"], + values="total_hours", + columns="date", + fill_value = " ", + aggfunc="first" + ) + + columns += table_pvt.columns.values.tolist() + data += table_pvt.reset_index().values.tolist() + + if filters.hours_per_project: + frappe.throw(frappe.bold("No Records..!!")) + + + elif filters.hours_per_project: + columns = [_("Project") + ":Link/Project:180"] + + project_details = hours_per_project_data(conditions, filters) + + if not project_details: + frappe.throw("No Record found for the filters From Date: {0}, To Date: {1} and Hours Per Project: {2} you specified..., \ + Please change your filters and try again..!!".format( + frappe.bold(filters.from_date), + frappe.bold(filters.to_date), + frappe.bold(filters.hours_per_project) + )) + + project_colnames = [key for key in project_details[0].keys()] + + df_project = pd.DataFrame.from_records(project_details, columns=project_colnames) + + project_pvt = pd.pivot_table( + df_project, + index=["employee_name"], + values="hours", + columns="project", + fill_value = " ", + aggfunc= np.sum, + margins = True + ) + + columns += project_pvt.columns.values.tolist() + data += project_pvt.reset_index().values.tolist() + + if filters.hours_per_day: + frappe.throw(frappe.bold("No Records..!!")) + + else: + timesheet_rows = timesheet_details(conditions, filters) + + if not timesheet_rows: + frappe.throw("No Record found for the filters From Date: {0}, To Date: {1} you specified..., \ + Please change your filters and try again..!!".format( + frappe.bold(filters.from_date), + frappe.bold(filters.to_date), + )) + + for row in timesheet_rows: + data.append(row) + + return columns, data + + +def get_columns(filters): + columns = [] + + if ( filters.summerized_view != "Hours Used Per Day" and + filters.summerized_view != "Hours Used Per Project" ): + columns += [ + {"fieldname": "date", "label": _("Date"), "fieldtype": "Date", "width": 120 }, + # {"fieldname": "employee", "label": _("Employee"), "fieldtype": "Data", "width": 120 }, + {"fieldname": "employee_name", "label": _("Employee Name"), "fieldtype": "Data", "width": 120 }, + {"fieldname": "activity_type", "label": _("Actuvuty Type"), "fieldtype": "Data", "width": 120 }, + {"fieldname": "from_time", "label": _("From Time"), "fieldtype": "Time", "width": 120 }, + { "fieldname": "to_time", "label": _("To Time"), "fieldtype": "Time", "width": 120 }, + {"fieldname": "hours_used", "label": _("Hours Used"), "fieldtype": "Data", "width": 120 }, + {"fieldname": "task", "label": _("Task"), "fieldtype": "Data", "width": 120 }, + { "fieldname": "project", "label": _("Project"), "fieldtype": "Data", "width": 120 }, + ] + return columns + + +def get_conditions(filters): + conditions = "" + if filters.get("from_date"): conditions += "ts.start_date >= %(from_date)s" + if filters.get("to_date"): conditions += "AND ts.start_date <= %(to_date)s" + return conditions, filters + + +def timesheet_details(conditions, filters): + employees = frappe.get_all("Timesheet", + filters=[["start_date", ">=", filters.from_date],["start_date", "<=", filters.to_date]], + fields=["start_date", "employee", "employee_name"] + ) + + logs_data = get_timesheet_logs(conditions, filters) + + data = [] + for emp in employees: + parent_row = { + "date": emp["start_date"].strftime("%Y-%m-%d"), + # "employee": emp["employee"], + "employee_name": emp["employee_name"] + } + + data.append(parent_row) + + for log in logs_data: + if ( + emp["start_date"].strftime("%Y-%m-%d") == log["date2"] and + emp["employee"] == log["employee"] and + emp["employee_name"] == log["employee_name"] + ): + + child_row = { + "indent": 2, + "activity_type": log.activity_type, + "from_time": log.from_time, + "to_time": log.to_time, + "hours_used": flt(log.hours_used, 1), + "task": log.task, + "project": log.project + } + + data.append(child_row) + + else: + continue + return data + + +def hours_per_day_data(conditions, filters): + data = [] + records = frappe.get_all("Timesheet", + filters=[["start_date", ">=", filters.from_date], ["start_date", "<=", filters.to_date]], + fields=["employee", "employee_name", "start_date", "total_hours"]) + + for record in records: + data.append({ + "employee": record.employee, + "employee_name": record.employee_name, + "date": record.start_date.strftime("%d-%m-%Y"), + "total_hours": flt(record.total_hours, 1) + }) + return data + + +def hours_per_project_data(conditions, filters): + project_details = frappe.db.sql(""" + SELECT ts.employee, + ts.employee_name, + tsd.project, + tsd.hours + FROM `tabTimesheet Detail` tsd + INNER JOIN `tabTimesheet` ts ON tsd.parent = ts.name + WHERE {conditions} + ORDER BY ts.start_date + """.format(conditions=conditions), filters, as_dict=1 + ) + + data = [] + for entry in project_details: + entry.update({ + "hours": flt(entry.hours, 1) + }) + data.append(entry) + return data + + +def get_timesheet_logs(conditions, filters): + timesheet_logs = frappe.db.sql(""" + SELECT ts.employee AS employee, + ts.employee_name AS employee_name, + tsd.activity_type AS activity_type, + DATE_FORMAT(tsd.from_time, "%%Y-%%m-%%d") AS date2, + DATE_FORMAT(tsd.from_time, "%%T") AS from_time, + DATE_FORMAT(tsd.to_time, "%%T") AS to_time, + tsd.hours AS hours_used, + tsd.task AS task, + tsd.project AS project + FROM `tabTimesheet Detail` tsd + INNER JOIN `tabTimesheet` ts ON tsd.parent = ts.name + WHERE {conditions} + ORDER BY ts.start_date + """.format(conditions=conditions), filters, as_dict=1 + ) + return timesheet_logs diff --git a/csf_tz/csf_tz/report/multi_currency_ledger/__init__.py b/csf_tz/csf_tz/report/multi_currency_ledger/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.html b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.html new file mode 100644 index 0000000..40469ae --- /dev/null +++ b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.html @@ -0,0 +1,76 @@ +

{%= __("Statement of Account") %}

+

+ {% if (filters.party_name) { %} + {%= filters.party_name %} + {% } else if (filters.party && filters.show_name) { %} + {%= filters.party %} + {% } else if (filters.account) { %} + {%= filters.account %} + {% } %} +

+ +
+ {% if (filters.tax_id) { %} + {%= __("Tax Id: ")%} {%= filters.tax_id %} + {% } %} +
+ +
+ {%= frappe.datetime.str_to_user(filters.from_date) %} + {%= __("to") %} + {%= frappe.datetime.str_to_user(filters.to_date) %} +
+
+ + + + + + + + + + + + + {% for(var i=0, l=data.length; i + {% if(data[i].posting_date) { %} + + + + + + {% } else { %} + + + + + + {% } %} + + + {% } %} + +
{%= __("Date") %}{%= __("Ref") %}{%= __("Party") %}{%= __("Debit") %}{%= __("Credit") %}{%= __("Balance (Dr - Cr)") %}
{%= frappe.datetime.str_to_user(data[i].posting_date) %}{%= data[i].voucher_type %} +
{%= data[i].voucher_no %}
+ {% if(!(filters.party || filters.account)) { %} + {%= data[i].party || data[i].account %} +
+ {% } %} + + {{ __("Against") }}: {%= data[i].against %} +
{%= __("Remarks") %}: {%= data[i].remarks %} + {% if(data[i].bill_no) { %} +
{%= __("Supplier Invoice No") %}: {%= data[i].bill_no %} + {% } %} +
+ {%= format_currency(data[i].debit, filters.presentation_currency) %} + {%= format_currency(data[i].credit, filters.presentation_currency) %}{%= frappe.format(data[i].account, {fieldtype: "Link"}) || " " %} + {%= data[i].account && format_currency(data[i].debit, filters.presentation_currency) %} + + {%= data[i].account && format_currency(data[i].credit, filters.presentation_currency) %} + + {%= format_currency(data[i].balance, filters.presentation_currency) %} +
+

Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}

diff --git a/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.js b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.js new file mode 100644 index 0000000..ead835b --- /dev/null +++ b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.js @@ -0,0 +1,172 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + + +frappe.query_reports["Multi-Currency Ledger"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "reqd": 1 + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book" + }, + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"account", + "label": __("Account"), + "fieldtype": "Link", + "options": "Account", + "get_query": function() { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Account", + "filters": { + "company": company, + } + } + } + }, + { + "fieldname":"voucher_no", + "label": __("Voucher No"), + "fieldtype": "Data", + on_change: function() { + frappe.query_report.set_filter_value('group_by', ""); + } + }, + { + "fieldtype": "Break", + }, + { + "fieldname":"party_type", + "label": __("Party Type"), + "fieldtype": "Link", + "options": "Party Type", + "default": "", + on_change: function() { + frappe.query_report.set_filter_value('party', ""); + } + }, + { + "fieldname":"party", + "label": __("Party"), + "fieldtype": "MultiSelectList", + get_data: function(txt) { + if (!frappe.query_report.filters) return; + + let party_type = frappe.query_report.get_filter_value('party_type'); + if (!party_type) return; + + return frappe.db.get_link_options(party_type, txt); + }, + on_change: function() { + var party_type = frappe.query_report.get_filter_value('party_type'); + var parties = frappe.query_report.get_filter_value('party'); + + if(!party_type || parties.length === 0 || parties.length > 1) { + frappe.query_report.set_filter_value('party_name', ""); + frappe.query_report.set_filter_value('tax_id', ""); + return; + } else { + var party = parties[0]; + var fieldname = erpnext.utils.get_party_name(party_type) || "name"; + frappe.db.get_value(party_type, party, fieldname, function(value) { + frappe.query_report.set_filter_value('party_name', value[fieldname]); + }); + + if (party_type === "Customer" || party_type === "Supplier") { + frappe.db.get_value(party_type, party, "tax_id", function(value) { + frappe.query_report.set_filter_value('tax_id', value["tax_id"]); + }); + } + } + } + }, + { + "fieldname":"party_name", + "label": __("Party Name"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname":"group_by", + "label": __("Group by"), + "fieldtype": "Select", + "options": ["", __("Group by Voucher"), __("Group by Voucher (Consolidated)"), + __("Group by Account"), __("Group by Party")], + "default": __("Group by Voucher (Consolidated)") + }, + { + "fieldname":"tax_id", + "label": __("Tax Id"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname": "presentation_currency", + "label": __("Currency"), + "fieldtype": "Select", + "options": erpnext.get_presentation_currency_list() + }, + { + "fieldname":"cost_center", + "label": __("Cost Center"), + "fieldtype": "MultiSelectList", + get_data: function(txt) { + return frappe.db.get_link_options('Cost Center', txt); + } + }, + { + "fieldname":"project", + "label": __("Project"), + "fieldtype": "MultiSelectList", + get_data: function(txt) { + return frappe.db.get_link_options('Project', txt); + } + }, + { + "fieldname": "show_opening_entries", + "label": __("Show Opening Entries"), + "fieldtype": "Check" + }, + { + "fieldname": "include_default_book_entries", + "label": __("Include Default Book Entries"), + "fieldtype": "Check" + } + ] +} + +erpnext.dimension_filters.forEach((dimension) => { + frappe.query_reports["Multi-Currency Ledger"].filters.splice(15, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] + }); +}); + diff --git a/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.json b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.json new file mode 100644 index 0000000..27407ae --- /dev/null +++ b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "creation": "2020-03-28 17:19:07.214960", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-03-28 17:19:07.214960", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Multi-Currency Ledger", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "GL Entry", + "report_name": "Multi-Currency Ledger", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.py b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.py new file mode 100644 index 0000000..4ad1ede --- /dev/null +++ b/csf_tz/csf_tz/report/multi_currency_ledger/multi_currency_ledger.py @@ -0,0 +1,648 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from erpnext import get_company_currency, get_default_company +from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency +from frappe.utils import getdate, cstr, flt +from frappe import _, _dict +from erpnext.accounts.utils import get_account_currency +from erpnext.accounts.report.financial_statements import get_cost_centers_with_children +from six import iteritems +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children +from collections import OrderedDict +# from csf_tz import console + +def execute(filters=None): + if not filters: + return [], [] + + account_details = {} + + if filters and filters.get('print_in_account_currency') and \ + not filters.get('account'): + frappe.throw(_("Select an account to print in account currency")) + + for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1): + account_details.setdefault(acc.name, acc) + + if filters.get('party'): + filters.party = frappe.parse_json(filters.get("party")) + + validate_filters(filters, account_details) + + validate_party(filters) + + filters = set_account_currency(filters) + + columns = get_columns(filters) + + res = get_result(filters) + + return columns, res + + +def validate_filters(filters, account_details): + if not filters.get('company'): + frappe.throw(_('{0} is mandatory').format(_('Company'))) + + if filters.get("account") and not account_details.get(filters.account): + frappe.throw(_("Account {0} does not exists").format(filters.account)) + + if (filters.get("account") and filters.get("group_by") == _('Group by Account') + and account_details[filters.account].is_group == 0): + frappe.throw(_("Can not filter based on Account, if grouped by Account")) + + if (filters.get("voucher_no") + and filters.get("group_by") in [_('Group by Voucher')]): + frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher")) + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date")) + + if filters.get('project'): + filters.project = frappe.parse_json(filters.get('project')) + + if filters.get('cost_center'): + filters.cost_center = frappe.parse_json(filters.get('cost_center')) + + +def validate_party(filters): + party_type, party = filters.get("party_type"), filters.get("party") + + if party: + if not party_type: + frappe.throw(_("To filter based on Party, select Party Type first")) + else: + for d in party: + if not frappe.db.exists(party_type, d): + frappe.throw(_("Invalid {0}: {1}").format(party_type, d)) + +def set_account_currency(filters): + if filters.get("account") or (filters.get('party') and len(filters.party) == 1): + filters["company_currency"] = frappe.get_cached_value('Company', filters.company, "default_currency") + account_currency = None + + if filters.get("account"): + account_currency = get_account_currency(filters.account) + elif filters.get("party"): + gle_currency = frappe.db.get_value( + "GL Entry", { + "party_type": filters.party_type, "party": filters.party[0], "company": filters.company + }, + "account_currency" + ) + + if gle_currency: + account_currency = gle_currency + else: + account_currency = (None if filters.party_type in ["Employee", "Student", "Shareholder", "Member"] else + frappe.db.get_value(filters.party_type, filters.party[0], "default_currency")) + + filters["account_currency"] = account_currency or filters.company_currency + if filters.account_currency != filters.company_currency and not filters.presentation_currency: + filters.presentation_currency = filters.account_currency + + return filters + +def get_result(filters): + gl_entries = get_gl_entries(filters) + + data = get_data_with_opening_closing(filters, gl_entries) + + result = get_result_as_list(data, filters) + + return result + +def get_gl_entries(filters): + currency_map = get_currency(filters) + select_fields = """, debit, credit, debit_in_account_currency, + credit_in_account_currency """ + + order_by_statement = "order by posting_date, account" + + if filters.get("group_by") == _("Group by Voucher"): + order_by_statement = "order by posting_date, voucher_type, voucher_no" + + if filters.get("include_default_book_entries"): + filters['company_fb'] = frappe.db.get_value("Company", + filters.get("company"), 'default_finance_book') + + gl_entries = frappe.db.sql( + """ + select + posting_date, account, party_type, party, + voucher_type, voucher_no, cost_center, project, + against_voucher_type, against_voucher, account_currency, + remarks, against, is_opening {select_fields} + from `tabGL Entry` + where company=%(company)s {conditions} + {order_by_statement} + """.format( + select_fields=select_fields, conditions=get_conditions(filters), + order_by_statement=order_by_statement + ), + filters, as_dict=1) + + converted_gl_list = [] + + company_currency = currency_map['company_currency'] + + for entry in gl_entries: + docktype = entry['voucher_type'] + docname = entry['voucher_no'] + entry_currency = entry['account_currency'] + doc_currency = company_currency + items_list = "" + + if docktype == "Payment Entry": + doc = frappe.db.sql( + """ + select + payment_type, paid_to_account_currency, paid_from_account_currency, received_amount, paid_amount + from `tabPayment Entry` + where name=%(docname)s + limit 1 + """,{'docname':docname},as_dict=1) + if doc[0].payment_type == "Receive": + doc_currency = doc[0].paid_to_account_currency + doc_amount = doc[0].received_amount + elif doc[0].payment_type == "Pay": + doc_currency = doc[0].paid_from_account_currency + doc_amount = doc[0].paid_amount + elif doc[0].payment_type == "Internal Transfer": + if entry.get('credit'): + doc_currency = doc[0].paid_from_account_currency + doc_amount = doc[0].paid_amount + else: + doc_currency = doc[0].paid_to_account_currency + doc_amount = doc[0].received_amount + + elif docktype == "Sales Invoice": + if entry["party"]: + doc = frappe.db.sql( + """ + select + name, currency, grand_total ,rounded_total + from `tabSales Invoice` + where name=%(docname)s + limit 1 + """,{'docname':entry['voucher_no']},as_dict=1) + + doc_currency = doc[0].currency + doc_amount = doc[0].rounded_total or doc[0].grand_total + + items = frappe.db.sql( + """ + select + item_name, service_start_date, service_end_date + from `tabSales Invoice Item` + where parent=%(docname)s + """,{'docname':entry['voucher_no']},as_dict=1) + + for item in items: + items_list += "({0}".format(item.item_name) + if item.service_start_date: + items_list += " , {0} ".format(item.service_start_date) + if item.service_end_date: + items_list += ", {0}".format(item.service_end_date) + items_list += ") " + + elif docktype == "Purchase Invoice": + if entry["party"]: + doc = frappe.db.sql( + """ + select + name, currency, grand_total, rounded_total + from `tabPurchase Invoice` + where name=%(docname)s + limit 1 + """,{'docname':entry['voucher_no']},as_dict=1) + + doc_currency = doc[0].currency + doc_amount = doc[0].rounded_total or doc[0].grand_total + + items = frappe.db.sql( + """ + select + item_name, service_start_date, service_end_date + from `tabPurchase Invoice Item` + where parent=%(docname)s + """,{'docname':entry['voucher_no']},as_dict=1) + + for item in items: + items_list += "({0}".format(item.item_name) + if item.service_start_date: + items_list += " , {0} ".format(item.service_start_date) + if item.service_end_date: + items_list += ", {0}".format(item.service_end_date) + items_list += ") " + + elif docktype == "Journal Entry": + doc_currency = entry_currency + if entry.get('credit'): + doc_amount = entry['credit_in_account_currency'] + else: + doc_amount = entry['debit_in_account_currency'] + + if company_currency != doc_currency: + + if entry.get('debit'): + entry['debit_foreign'] = doc_amount + entry['exchange_rate'] = entry.get('debit') / doc_amount + + if entry.get('credit'): + entry['credit_foreign'] = doc_amount + entry['exchange_rate'] = entry.get('credit') / doc_amount + + entry['foreign_currency'] = doc_currency + + + entry['items'] = str(items_list) if items_list else "" + converted_gl_list.append(entry) + + + if filters.get('presentation_currency'): + return convert_to_presentation_currency(converted_gl_list, currency_map, company=filters.get("company")) + else: + return converted_gl_list + + +def get_conditions(filters): + conditions = [] + if filters.get("account"): + lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"]) + conditions.append("""account in (select name from tabAccount + where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt)) + + if filters.get("cost_center"): + filters.cost_center = get_cost_centers_with_children(filters.cost_center) + conditions.append("cost_center in %(cost_center)s") + + if filters.get("voucher_no"): + conditions.append("voucher_no=%(voucher_no)s") + + if filters.get("group_by") == "Group by Party" and not filters.get("party_type"): + conditions.append("party_type in ('Customer', 'Supplier')") + + if filters.get("party_type"): + conditions.append("party_type=%(party_type)s") + + if filters.get("party"): + conditions.append("party in %(party)s") + + if not (filters.get("account") or filters.get("party") or + filters.get("group_by") in ["Group by Account", "Group by Party"]): + conditions.append("posting_date >=%(from_date)s") + + conditions.append("(posting_date <=%(to_date)s or is_opening = 'Yes')") + + if filters.get("project"): + conditions.append("project in %(project)s") + + if filters.get("finance_book"): + if filters.get("include_default_book_entries"): + conditions.append("finance_book in (%(finance_book)s, %(company_fb)s)") + else: + conditions.append("finance_book in (%(finance_book)s)") + + from frappe.desk.reportview import build_match_conditions + match_conditions = build_match_conditions("GL Entry") + + if match_conditions: + conditions.append(match_conditions) + + accounting_dimensions = get_accounting_dimensions(as_list=False) + + if accounting_dimensions: + for dimension in accounting_dimensions: + if filters.get(dimension.fieldname): + if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'): + filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type, + filters.get(dimension.fieldname)) + conditions.append("{0} in %({0})s".format(dimension.fieldname)) + + return "and {}".format(" and ".join(conditions)) if conditions else "" + + +def get_data_with_opening_closing(filters, gl_entries): + data = [] + + gle_map = initialize_gle_map(gl_entries, filters) + + totals, entries = get_accountwise_gle(filters, gl_entries, gle_map) + + # Opening for filtered account + data.append(totals.opening) + + if filters.get("group_by") != _('Group by Voucher (Consolidated)'): + for acc, acc_dict in iteritems(gle_map): + # acc + if acc_dict.entries: + # opening + data.append({}) + if filters.get("group_by") != _("Group by Voucher"): + data.append(acc_dict.totals.opening) + + data += acc_dict.entries + + # totals + data.append(acc_dict.totals.total) + + # closing + if filters.get("group_by") != _("Group by Voucher"): + data.append(acc_dict.totals.closing) + data.append({}) + else: + data += entries + + # totals + data.append(totals.total) + + # closing + data.append(totals.closing) + + return data + +def get_totals_dict(): + def _get_debit_credit_dict(label): + return _dict( + account="'{0}'".format(label), + debit=0.0, + credit=0.0, + debit_in_account_currency=0.0, + credit_in_account_currency=0.0 + ) + return _dict( + opening = _get_debit_credit_dict(_('Opening')), + total = _get_debit_credit_dict(_('Total')), + closing = _get_debit_credit_dict(_('Closing (Opening + Total)')) + ) + +def group_by_field(group_by): + if group_by == _('Group by Party'): + return 'party' + elif group_by in [_('Group by Voucher (Consolidated)'), _('Group by Account')]: + return 'account' + else: + return 'voucher_no' + +def initialize_gle_map(gl_entries, filters): + gle_map = OrderedDict() + group_by = group_by_field(filters.get('group_by')) + + for gle in gl_entries: + gle_map.setdefault(gle.get(group_by), _dict(totals=get_totals_dict(), entries=[])) + return gle_map + + +def get_accountwise_gle(filters, gl_entries, gle_map): + totals = get_totals_dict() + entries = [] + consolidated_gle = OrderedDict() + group_by = group_by_field(filters.get('group_by')) + + def update_value_in_dict(data, key, gle): + data[key].debit += flt(gle.debit) + data[key].credit += flt(gle.credit) + + data[key].debit_in_account_currency += flt(gle.debit_in_account_currency) + data[key].credit_in_account_currency += flt(gle.credit_in_account_currency) + + from_date, to_date = getdate(filters.from_date), getdate(filters.to_date) + for gle in gl_entries: + if (gle.posting_date < from_date or + (cstr(gle.is_opening) == "Yes" and not filters.get("show_opening_entries"))): + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'opening', gle) + update_value_in_dict(totals, 'opening', gle) + + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'closing', gle) + update_value_in_dict(totals, 'closing', gle) + + elif gle.posting_date <= to_date: + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'total', gle) + update_value_in_dict(totals, 'total', gle) + if filters.get("group_by") != _('Group by Voucher (Consolidated)'): + gle_map[gle.get(group_by)].entries.append(gle) + elif filters.get("group_by") == _('Group by Voucher (Consolidated)'): + key = (gle.get("voucher_type"), gle.get("voucher_no"), + gle.get("account"), gle.get("cost_center")) + if key not in consolidated_gle: + consolidated_gle.setdefault(key, gle) + else: + update_value_in_dict(consolidated_gle, key, gle) + + update_value_in_dict(gle_map[gle.get(group_by)].totals, 'closing', gle) + update_value_in_dict(totals, 'closing', gle) + + for key, value in consolidated_gle.items(): + entries.append(value) + + return totals, entries + +def get_result_as_list(data, filters): + balance = 0 + inv_details = get_supplier_invoice_details() + updated_data = [] + + for d in data: + if not d.get('posting_date'): + balance = 0 + + balance = get_balance(d, balance, 'debit', 'credit') + d['balance'] = balance + + d['account_currency'] = filters.account_currency + d['bill_no'] = inv_details.get(d.get('against_voucher'), '') + + if not ((d.get("credit_foreign") and d.get("debit_foreign")) and (d.get("credit_foreign") == d.get("debit_foreign"))): + updated_data.append(d) + + if d.get("voucher_type") == "Journal Entry" and filters.get("account"): + jv_doc = frappe.get_doc(d["voucher_type"],d["voucher_no"]) + for row in jv_doc.accounts: + if row.account != d["account"]: + new_entry = {} + new_entry["posting_date"] = d["posting_date"] + new_entry["against_acount"] = row.account + new_entry["against_debit"] = row.debit_in_account_currency + new_entry["against_credit"] = row.credit_in_account_currency + new_entry["against_currency"] = row.account_currency + updated_data.append(new_entry) + + return updated_data + +def get_supplier_invoice_details(): + inv_details = {} + for d in frappe.db.sql(""" select name, bill_no from `tabPurchase Invoice` + where docstatus = 1 and bill_no is not null and bill_no != '' """, as_dict=1): + inv_details[d.name] = d.bill_no + return inv_details + +def get_balance(row, balance, debit_field, credit_field): + balance += (row.get(debit_field, 0) - row.get(credit_field, 0)) + return balance + +def get_columns(filters): + if filters.get("presentation_currency"): + currency = filters["presentation_currency"] + else: + if filters.get("company"): + currency = get_company_currency(filters["company"]) + else: + company = get_default_company() + currency = get_company_currency(company) + + columns = [ + { + "label": _("Posting Date"), + "fieldname": "posting_date", + "fieldtype": "Date", + "width": 90 + }, + { + "label": _("Account"), + "fieldname": "account", + "fieldtype": "Link", + "options": "Account", + "width": 180 + }, + { + "label": _("Debit ({0})".format(currency)), + "fieldname": "debit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Credit ({0})".format(currency)), + "fieldname": "credit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Debit Foreign"), + "fieldname": "debit_foreign", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Credit Foreign"), + "fieldname": "credit_foreign", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Foreign Currency"), + "fieldname": "foreign_currency", + # "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Exchange Rate"), + "fieldname": "exchange_rate", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Balance ({0})".format(currency)), + "fieldname": "balance", + "fieldtype": "Float", + "width": 130 + } + ] + + columns.extend([ + { + "label": _("Voucher Type"), + "fieldname": "voucher_type", + "width": 120 + }, + { + "label": _("Voucher No"), + "fieldname": "voucher_no", + "fieldtype": "Dynamic Link", + "options": "voucher_type", + "width": 180 + }, + { + "label": _("Against Account"), + "fieldname": "against", + "width": 120 + }, + { + "label": _("Against AC Name"), + "fieldname": "against_acount", + "width": 120 + }, + { + "label": _("Against Debit"), + "fieldname": "against_debit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Against Credit"), + "fieldname": "against_credit", + "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Against Currency"), + "fieldname": "against_currency", + # "fieldtype": "Float", + "width": 100 + }, + { + "label": _("Party Type"), + "fieldname": "party_type", + "width": 100 + }, + { + "label": _("Party"), + "fieldname": "party", + "width": 100 + }, + { + "label": _("Project"), + "options": "Project", + "fieldname": "project", + "width": 100 + }, + { + "label": _("Cost Center"), + "options": "Cost Center", + "fieldname": "cost_center", + "width": 100 + }, + { + "label": _("Against Voucher Type"), + "fieldname": "against_voucher_type", + "width": 100 + }, + { + "label": _("Against Voucher"), + "fieldname": "against_voucher", + "fieldtype": "Dynamic Link", + "options": "against_voucher_type", + "width": 100 + }, + { + "label": _("Supplier Invoice No"), + "fieldname": "bill_no", + "fieldtype": "Data", + "width": 100 + }, + { + "label": _("Remarks"), + "fieldname": "remarks", + "width": 400 + }, + { + "label": _("Items"), + "fieldname": "items", + "width": 400 + } + ]) + + return columns diff --git a/csf_tz/csf_tz/report/nssf_con5_monthly_contribution___online_version/__init__.py b/csf_tz/csf_tz/report/nssf_con5_monthly_contribution___online_version/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/nssf_con5_monthly_contribution___online_version/nssf_con5_monthly_contribution___online_version.json b/csf_tz/csf_tz/report/nssf_con5_monthly_contribution___online_version/nssf_con5_monthly_contribution___online_version.json new file mode 100644 index 0000000..3797747 --- /dev/null +++ b/csf_tz/csf_tz/report/nssf_con5_monthly_contribution___online_version/nssf_con5_monthly_contribution___online_version.json @@ -0,0 +1,57 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-08-16 16:53:14.889431", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-08-16 17:00:03.847173", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "NSSF CON5 Monthly Contribution - Online Version", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT emp.pension_fund_number AS \"MEMBER NO:Data:150\", \r\n emp.first_name AS \"FIRST NAME:Data:150\",\r\n emp.middle_name AS \"MIDDLE NAME:Data:150\",\r\n emp.last_name AS \"LAST NAME:Data:150\",\r\n ss.gross_pay AS \"WAGE:Float/2:150\"\r\nFROM `tabSalary Slip` ss RIGHT JOIN `tabEmployee` emp ON ss.employee = emp.name AND emp.pension_fund = 'NSSF'\r\nWHERE ss.docstatus = 1 \r\nAND ss.start_date >= %(from_date)s\r\nAND ss.end_date <= %(to_date)s\r\nHAVING ss.gross_pay > 0\r\nORDER BY emp.name", + "ref_doctype": "Salary Slip", + "report_name": "NSSF CON5 Monthly Contribution - Online Version", + "report_type": "Query Report", + "roles": [ + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "Employee" + }, + { + "role": "Leave Approver" + }, + { + "role": "All" + }, + { + "role": "Employee Self Service" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/output_vat_reconciliation/__init__.py b/csf_tz/csf_tz/report/output_vat_reconciliation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.js b/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.js new file mode 100644 index 0000000..117b778 --- /dev/null +++ b/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.js @@ -0,0 +1,29 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Output VAT Reconciliation"] = { + "filters": [ + { + "fieldname":"efd_report", + "label": __("EFD Report"), + "fieldtype": "Link", + "options": "EFD Z Report", + "reqd": 1, + "get_query" : function(){ + return { + "filters":{ + "docstatus":1, + } + } + } + } + ], + "formatter": function(value, row, column, data, default_formatter) { + value = default_formatter(value, row, column, data); + if (value === "Credit Note - Sales Returns" || value === "Sales - Sales Returns" || value === "Sales as VAT Returns" ){ + value = ''+value+''; + } + return value; + } +}; diff --git a/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.json b/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.json new file mode 100644 index 0000000..443fbff --- /dev/null +++ b/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 0, + "creation": "2020-01-07 06:00:13.703158", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Viva Towers Official", + "modified": "2020-01-07 06:00:13.703158", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Output VAT Reconciliation", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "EFD Z Report", + "report_name": "Output VAT Reconciliation", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.py b/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.py new file mode 100644 index 0000000..4e9cc2d --- /dev/null +++ b/csf_tz/csf_tz/report/output_vat_reconciliation/output_vat_reconciliation.py @@ -0,0 +1,85 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import fmt_money +def execute(filters=None): + columns, data = get_columns(), [] + credit_note_label = {"details": "Credit Note - Sales Returns"} + sales_label = {"details": "Sales - Sales Returns"} + totals = {} + generate_sales_returns(filters,data,totals,sales_label) + data[0]["std_sales"] = fmt_money(float(totals['total_std_sales']), 2, data[1]['invoice_currency']) + data[0]["vat"] = fmt_money(float(totals['vat']), 2, data[1]['invoice_currency']) + data[0]["ex_amount"] = fmt_money(float(totals['ex_amount']), 2, data[1]['invoice_currency']) + data[0]["total"] = fmt_money(float(totals['total']), 2, data[1]['invoice_currency']) + generate_credit_note(data,totals,credit_note_label) + + data.append({ + "details": "Sales as VAT Returns", + "std_sales": fmt_money(float(totals['total_std_sales']), 2, data[1]['invoice_currency']), + "vat": fmt_money(float(totals['vat']), 2, data[1]['invoice_currency']), + "ex_amount": fmt_money(float(totals['ex_amount']), 2, data[1]['invoice_currency']), + "total": fmt_money(float(totals['total']), 2, data[1]['invoice_currency']) + }) + return columns, data + +def generate_credit_note(data,totals,credit_note_label): + + for i in range(1,len(data)): + if data[i]['details'] != "Credit Note - Sales Returns": + credit_notes = frappe.get_list("Sales Invoice", filters={"is_return": 1, "return_against": "ACC-SINV-2019-07382", "docstatus": 1}, fields=["*"]) + print(credit_notes) + for ii in credit_notes: + + if i == 1: + data.append(credit_note_label) + + totals['total_std_sales'] = totals['total_std_sales'] + float(ii.total) if "total_std_sales" in totals else float(ii.total) + totals['vat'] = totals['vat'] + float(ii.total_taxes_and_charges) if "vat" in totals else float(ii.total_taxes_and_charges) + totals['ex_amount'] = totals['ex_amount'] + float(ii.grand_total) if "ex_amount" in totals else float(ii.grand_total) + totals['total'] = totals['total'] + float(ii.total + ii.total_taxes_and_charges + ii.grand_total) if "total" in totals else float(ii.total + ii.total_taxes_and_charges + ii.grand_total) + + data.append({ + "details": ii.name, + "std_sales": fmt_money(float(ii.total), 2, data[i]['invoice_currency']), + "vat": fmt_money(float(ii.total_taxes_and_charges), 2, data[i]['invoice_currency']), + "ex_amount": fmt_money(ii.grand_total, 2, data[i]['invoice_currency']), + "total": fmt_money( + float(ii.total + ii.total_taxes_and_charges + ii.grand_total),2, data[i]['invoice_currency']) + }) + +def generate_sales_returns(filters,data,totals,sales_label): + + efd_z_report_invoices = frappe.get_list("EFD Z Report Invoice", filters={"parent": filters.get("efd_report")}, + fields=["*"]) + for idx,i in enumerate(efd_z_report_invoices): + sales_invoice = frappe.get_doc("Sales Invoice", i.invoice_number).__dict__ + if idx == 0: + data.append(sales_label) + totals['total_std_sales'] = totals['total_std_sales'] + float(sales_invoice['total']) if "total_std_sales" in totals else float(sales_invoice['total']) + totals['vat'] = totals['vat'] + float(sales_invoice['total_taxes_and_charges']) if "vat" in totals else float(sales_invoice['total_taxes_and_charges']) + totals['ex_amount'] = totals['ex_amount'] + float(sales_invoice['grand_total']) if "ex_amount" in totals else float(sales_invoice['grand_total']) + totals['total'] = totals['total'] + float(sales_invoice['total'] + sales_invoice['total_taxes_and_charges'] + sales_invoice['grand_total']) if "total" in totals else float(sales_invoice['total'] + sales_invoice['total_taxes_and_charges'] + sales_invoice['grand_total']) + data.append({ + "details": i.invoice_number, + "std_sales": fmt_money(float(sales_invoice['total']), 2, i.invoice_currency), + "vat": fmt_money(float(sales_invoice['total_taxes_and_charges']), 2, i.invoice_currency), + "ex_amount": fmt_money(sales_invoice['grand_total'], 2, i.invoice_currency), + "total": fmt_money( + float(sales_invoice['total'] + sales_invoice['total_taxes_and_charges'] + sales_invoice['grand_total']), + 2, i.invoice_currency), + "invoice_currency": i.invoice_currency + }) +def get_columns(): + + columns = [ + {"label": "Details", "fieldname": "details", "fieldtype": "Data", "width": 200}, + {"label": "STD Sales", "fieldname": "std_sales","fieldtype": "Data", "width": 170}, + {"label": "VAT", "fieldname": "vat", "fieldtype": "Data","width": 170}, + {"label": "EX Amount", "fieldname": "ex_amount","fieldtype": "Data", "width": 170}, + {"label": "Total", "fieldname": "total", "fieldtype": "Data","width": 170}, + ] + + return columns \ No newline at end of file diff --git a/csf_tz/csf_tz/report/parent_child_relationship/__init__.py b/csf_tz/csf_tz/report/parent_child_relationship/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/parent_child_relationship/parent_child_relationship.json b/csf_tz/csf_tz/report/parent_child_relationship/parent_child_relationship.json new file mode 100644 index 0000000..5a06899 --- /dev/null +++ b/csf_tz/csf_tz/report/parent_child_relationship/parent_child_relationship.json @@ -0,0 +1,55 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-08-21 20:28:54.008883", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "module", + "fieldtype": "Link", + "label": "Module", + "mandatory": 1, + "options": "Module Def", + "wildcard_filter": 0 + }, + { + "fieldname": "is_table", + "fieldtype": "Select", + "label": "Is Child", + "mandatory": 1, + "options": "\n0\n1", + "wildcard_filter": 0 + }, + { + "fieldname": "is_submittable", + "fieldtype": "Select", + "label": "Is Submittable", + "mandatory": 1, + "options": "\n0\n1", + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-08-21 21:42:36.003335", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Parent Child Relationship", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT CONCAT_WS('-', dt.module, dt.name) as name, GROUP_CONCAT(df.options) as imports\nFROM `tabDocType` dt\nINNER JOIN `tabDocField` df ON dt.name = df.parent\nWHERE df.options IS NOT NULL\n AND df.fieldtype = \"Link\"\n AND dt.is_submittable = %(is_submittable)s\n AND dt.istable = %(is_table)s\n AND dt.module = %(module)s\nGROUP BY dt.module, dt.name\nUNION ALL\nSELECT CONCAT_WS('-', dt.module, dt.name) as name, GROUP_CONCAT(df.options) as imports\nFROM `tabDocType` dt\nINNER JOIN `tabCustom Field` df ON dt.name = df.parent\nWHERE df.options IS NOT NULL\n AND df.fieldtype = \"Link\"\n AND dt.is_submittable = %(is_submittable)s\n AND dt.istable = %(is_table)s\n AND dt.module = %(module)s\nGROUP BY dt.module, dt.name", + "ref_doctype": "DocType", + "report_name": "Parent Child Relationship", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Administrator" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_report_by_type/__init__.py b/csf_tz/csf_tz/report/purchase_report_by_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/purchase_report_by_type/purchase_report_by_type.json b/csf_tz/csf_tz/report/purchase_report_by_type/purchase_report_by_type.json new file mode 100644 index 0000000..7a9c02e --- /dev/null +++ b/csf_tz/csf_tz/report/purchase_report_by_type/purchase_report_by_type.json @@ -0,0 +1,23 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-02-23 10:59:37.822514", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-03-19 21:42:28.687134", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Purchase Report by Type", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT pi.name AS \"Purchase Invoice:Link/Purchase Invoice:150\",\r\n s.name AS \"SUPPLIER_NAME:Link/Supplier:250\",\r\n s.vrn AS \"SUPPLIER_VRN::100\", \r\n pi.bill_no AS \"TAX_INVOICE_NUMBER::100\", \r\n pi.posting_date AS \"DATE_OF_INVOICE:Date:120\", \r\n GROUP_CONCAT(pii.item_name) AS \"ITEMS::250\", \r\n pi.base_net_total AS \"AMOUNT_VAT_EXCL:Currency:150\", \r\n pi.base_total_taxes_and_charges AS \"VAT_AMT:Currency:100\",\r\n IF(pi.base_rounded_total > 0, pi.base_rounded_total, pi.base_grand_total) AS \"AMOUNT_VAT_INCL:Currency:150\"\r\nFROM `tabPurchase Invoice` pi \r\n INNER JOIN `tabPurchase Invoice Item` pii\r\n ON pii.parent = pi.name\r\n INNER JOIN `tabSupplier` s \r\n ON pi.supplier = s.name \r\nWHERE ((pi.posting_date >= %(from_date)s and pi.posting_date <= %(to_date)s))\r\n and pi.docstatus = 1\r\nGROUP BY s.name, s.vrn, pi.bill_no, pi.bill_date, pi.base_net_total, pi.total_taxes_and_charges\r\nORDER BY pi.posting_date", + "ref_doctype": "Purchase Invoice", + "report_name": "Purchase Report by Type", + "report_type": "Query Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/__init__.py b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.js b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.js new file mode 100644 index 0000000..c7fe75c --- /dev/null +++ b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.js @@ -0,0 +1,32 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Purchase Reports by Tax Category"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + { + "fieldname": "taxes_and_charges", + "label": __("Taxes and Charges"), + "fieldtype": "Link", + "width": "120", + "options": "Purchase Taxes and Charges Template", + "default": "Tanzania Tax - VPL" + }, + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.json b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.json new file mode 100644 index 0000000..38820bb --- /dev/null +++ b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.json @@ -0,0 +1,34 @@ +{ + "add_total_row": 1, + "creation": "2019-09-27 09:25:21.146387", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-09-27 12:12:04.173724", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Purchase Reports by Tax Category", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT pi.posting_date \"Date:Date:80\",\n\tpi.name \"Invoice No:Link/Purchase Invoice:120\",\n\tpi.supplier \"Supplier:Link/Supplier:200\",\n\ts.vrn \"VRN:Data:80\", \n\tGROUP_CONCAT(pid.item_code) \"Item Description:Link/Item:200\", \n\tpi.bill_no \"Supp. Tax Inv:Data:100\", \n\tpi.bill_date \"Supp. Inv Date:Date:80\", \n\tpi.base_net_total \"Amount:Currency:120\", \n\tpi.base_total_taxes_and_charges \"VAT:Currency:120\", \n\tpi.base_grand_total \"Total:Currency:120\"\nFROM `tabPurchase Invoice` pi\n\tINNER JOIN `tabPurchase Invoice Item` pid ON pi.name = pid.parent\n\tINNER JOIN `tabSupplier` s ON pi.supplier = s.name \nWHERE pi.docstatus = 1\nAND pi.posting_date BETWEEN %(from_date)s AND %(to_date)s \nAND pi.taxes_and_charges LIKE %(taxes_and_charges)s \nGROUP BY pi.name", + "ref_doctype": "Purchase Invoice", + "report_name": "Purchase Reports by Tax Category", + "report_type": "Query Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Purchase User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/__init__.py b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.js b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.js new file mode 100644 index 0000000..93b243a --- /dev/null +++ b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.js @@ -0,0 +1,24 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Purchases by Tax Category Summary"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.json b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.json new file mode 100644 index 0000000..d6a31ae --- /dev/null +++ b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.json @@ -0,0 +1,35 @@ +{ + "add_total_row": 1, + "creation": "2019-09-27 10:07:38.564272", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "json": "{\"add_total_row\": 0}", + "modified": "2019-09-27 12:04:01.754793", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Purchases by Tax Category Summary", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT pi.taxes_and_charges \"Tax Category:Link/Purchase Taxes and Charges Template:200\",\n\tsum(pi.net_total) \"Amount:Currency:120\", \n\tsum(pi.base_total_taxes_and_charges) \"VAT:Currency:120\", \n\tsum(pi.grand_total) \"Total:Currency:120\"\nFROM `tabPurchase Invoice` pi\nWHERE docstatus = 1\nAND pi.posting_date BETWEEN %(from_date)s AND %(to_date)s \nGROUP BY pi.taxes_and_charges\n\n", + "ref_doctype": "Purchase Invoice", + "report_name": "Purchases by Tax Category Summary", + "report_type": "Query Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Purchase User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/salary_register_csf/__init__.py b/csf_tz/csf_tz/report/salary_register_csf/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.html b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.html new file mode 100644 index 0000000..3abc3a0 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.html @@ -0,0 +1,40 @@ +{% + var report_columns = report.get_columns_for_print(); +%} +
+ {%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")].header %} +
+

{%= __(report.report_name) %}

+
{{ __("From") }} {%= filters.from_date %} {{ __("to") }} {%= filters.to_date %}
+
+ + + + {% for(var i=1, l=report_columns.length; i{%= report_columns[i].label %} + {% } %} + + + + {% for(var j=0, k=data.length; j + {% for(var i=1, l=report_columns.length; i + {% var fieldname = report_columns[i].fieldname; %} + {% if (report_columns[i].fieldtype=='Currency' && !isNaN(row[fieldname])) { %} + {%= format_currency(row[fieldname]) %} + {% } else { %} + {% if (!is_null(row[fieldname])) { %} + {%= row[fieldname] %} + {% } %} + {% } %} + + {% } %} + + {% } %} + +
+

{{ __("Printed On") }} {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}

diff --git a/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.js b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.js new file mode 100644 index 0000000..6b87e2c --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.js @@ -0,0 +1,94 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Salary Register csf"] = { + onload: function (report) { + report.page.add_inner_button(__("Approve"), function () { + return frappe.call({ + method: + "csf_tz.csf_tz.report.salary_register_csf.salary_register_csf.approve", + args: { data: report.data }, + callback: function (r) { + frappe.msgprint("Starting Approve Processing"); + console.info(r.message); + }, + }); + }); + }, + filters: [ + { + fieldname: "from_date", + label: __("From"), + fieldtype: "Date", + default: frappe.datetime.add_months(frappe.datetime.get_today(), -1), + reqd: 1, + width: "100px", + }, + { + fieldname: "to_date", + label: __("To"), + fieldtype: "Date", + default: frappe.datetime.get_today(), + reqd: 1, + width: "100px", + }, + { + fieldname: "currency", + fieldtype: "Link", + options: "Currency", + label: __("Currency"), + default: erpnext.get_currency(frappe.defaults.get_default("Company")), + width: "50px", + }, + { + fieldname: "employee", + label: __("Employee"), + fieldtype: "Link", + options: "Employee", + width: "100px", + }, + { + fieldname: "company", + label: __("Company"), + fieldtype: "Link", + options: "Company", + default: frappe.defaults.get_user_default("Company"), + width: "100px", + reqd: 1, + }, + { + fieldname: "department", + label: __("Department"), + fieldtype: "Link", + options: "Department", + default: "", + width: "100px", + get_query: function () { + var company = frappe.query_report.get_filter_value("company"); + return { + doctype: "Department", + filters: { + company: company, + }, + }; + }, + }, + { + fieldname: "docstatus", + label: __("Document Status"), + fieldtype: "Select", + options: ["Draft", "Submitted", "Cancelled"], + default: "Submitted", + width: "100px", + }, + { + fieldname: "workflow_state", + label: __("Workflow"), + fieldtype: "Select", + options: ["", "Pending", "Approved", "Rejected"], + // default: "Pending", + width: "100px", + }, + ], +}; diff --git a/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.json b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.json new file mode 100644 index 0000000..b59bdf8 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.json @@ -0,0 +1,39 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-04-23 21:38:36.067131", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2021-05-05 18:27:14.800890", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Salary Register csf", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Salary Slip", + "report_name": "Salary Register csf", + "report_type": "Script Report", + "roles": [ + { + "role": "Employee" + }, + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "HR Manager (Group)" + }, + { + "role": "Directorate" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.py b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.py new file mode 100644 index 0000000..7b3e338 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_csf/salary_register_csf.py @@ -0,0 +1,286 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + + +from __future__ import unicode_literals +import frappe +import erpnext +from frappe.utils import flt +from frappe import _, msgprint +from frappe.utils.nestedset import get_descendants_of + + +def execute(filters=None): + if not filters: + filters = {} + currency = None + if filters.get("currency"): + currency = filters.get("currency") + company_currency = erpnext.get_company_currency(filters.get("company")) + salary_slips = get_salary_slips(filters, company_currency) + if not salary_slips: + return [], [] + + columns, earning_types, ded_types = get_columns(salary_slips) + ss_earning_map = get_ss_earning_map(salary_slips, currency, company_currency) + ss_ded_map = get_ss_ded_map(salary_slips, currency, company_currency) + doj_map = get_employee_doj_map() + + data = [] + for ss in salary_slips: + row = [ + ss.name, + ss.employee, + ss.employee_name, + doj_map.get(ss.employee), + ss.branch, + ss.department, + ss.designation, + ss.company, + ss.start_date, + ss.end_date, + ss.leave_without_pay, + ss.payment_days, + ] + + if ss.branch is not None: + columns[3] = columns[3].replace("-1", "120") + if ss.department is not None: + columns[4] = columns[4].replace("-1", "120") + if ss.designation is not None: + columns[5] = columns[5].replace("-1", "120") + if ss.leave_without_pay is not None: + columns[9] = columns[9].replace("-1", "130") + + for e in earning_types: + row.append(ss_earning_map.get(ss.name, {}).get(e)) + + if currency == company_currency: + row += [flt(ss.gross_pay) * flt(ss.exchange_rate)] + else: + row += [ss.gross_pay] + + for d in ded_types: + row.append(ss_ded_map.get(ss.name, {}).get(d)) + + row.append(ss.total_loan_repayment) + + if currency == company_currency: + row += [ + flt(ss.total_deduction) * flt(ss.exchange_rate), + flt(ss.net_pay) * flt(ss.exchange_rate), + ] + else: + row += [ss.total_deduction, ss.net_pay] + row.append(currency or company_currency) + data.append(row) + + return columns, data + + +def get_columns(salary_slips): + """ + columns = [ + _("Salary Slip ID") + ":Link/Salary Slip:150", + _("Employee") + ":Link/Employee:120", + _("Employee Name") + "::140", + _("Date of Joining") + "::80", + _("Branch") + ":Link/Branch:120", + _("Department") + ":Link/Department:120", + _("Designation") + ":Link/Designation:120", + _("Company") + ":Link/Company:120", + _("Start Date") + "::80", + _("End Date") + "::80", + _("Leave Without Pay") + ":Float:130", + _("Payment Days") + ":Float:120", + _("Currency") + ":Link/Currency:80" + ] + """ + columns = [ + _("Salary Slip ID") + ":Link/Salary Slip:150", + _("Employee") + ":Link/Employee:120", + _("Employee Name") + "::140", + _("Date of Joining") + "::80", + _("Branch") + ":Link/Branch:-1", + _("Department") + ":Link/Department:-1", + _("Designation") + ":Link/Designation:120", + _("Company") + ":Link/Company:120", + _("Start Date") + "::80", + _("End Date") + "::80", + _("Leave Without Pay") + ":Float:50", + _("Payment Days") + ":Float:120", + ] + + salary_components = {_("Earning"): [], _("Deduction"): []} + + for component in frappe.db.sql( + """select distinct sd.salary_component, sc.type + from `tabSalary Detail` sd, `tabSalary Component` sc + where sc.do_not_include_in_total = 0 and sc.name=sd.salary_component and sd.amount != 0 and sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), + tuple([d.name for d in salary_slips]), + as_dict=1, + ): + salary_components[_(component.type)].append(component.salary_component) + + columns = ( + columns + + [(e + ":Currency:120") for e in salary_components[_("Earning")]] + + [_("Gross Pay") + ":Currency:120"] + + [(d + ":Currency:120") for d in salary_components[_("Deduction")]] + + [ + _("Loan Repayment") + ":Currency:120", + _("Total Deduction") + ":Currency:120", + _("Net Pay") + ":Currency:120", + ] + ) + + return columns, salary_components[_("Earning")], salary_components[_("Deduction")] + + +def get_salary_slips(filters, company_currency): + filters.update( + {"from_date": filters.get("from_date"), "to_date": filters.get("to_date")} + ) + conditions, filters = get_conditions(filters, company_currency) + salary_slips = frappe.db.sql( + """select * from `tabSalary Slip` where %s + order by employee""" + % conditions, + filters, + as_dict=1, + ) + + return salary_slips or [] + + +def get_conditions(filters, company_currency): + conditions = "" + doc_status = {"Draft": 0, "Submitted": 1, "Cancelled": 2} + + if filters.get("docstatus"): + conditions += "docstatus = {0}".format(doc_status[filters.get("docstatus")]) + + if filters.get("from_date"): + conditions += " and start_date >= %(from_date)s" + if filters.get("to_date"): + conditions += " and end_date <= %(to_date)s" + if filters.get("company"): + conditions += " and company = %(company)s" + if filters.get("employee"): + conditions += " and employee = %(employee)s" + if filters.get("currency") and filters.get("currency") != company_currency: + conditions += " and currency = %(currency)s" + if filters.get("department") and filters.get("company"): + department_list = get_departments( + filters.get("department"), filters.get("company") + ) + conditions += ( + "and department in (" + + ",".join(("'" + n + "'" for n in department_list)) + + ")" + ) + if filters.get("workflow_state"): + conditions += " and workflow_state = %(workflow_state)s" + + return conditions, filters + + +def get_employee_doj_map(): + return frappe._dict( + frappe.db.sql( + """ + SELECT + employee, + date_of_joining + FROM `tabEmployee` + """ + ) + ) + + +def get_ss_earning_map(salary_slips, currency, company_currency): + ss_earnings = frappe.db.sql( + """select sd.parent, sd.salary_component, sd.amount, ss.exchange_rate, ss.name + from `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name and sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), + tuple([d.name for d in salary_slips]), + as_dict=1, + ) + + ss_earning_map = {} + for d in ss_earnings: + ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault( + d.salary_component, [] + ) + if currency == company_currency: + ss_earning_map[d.parent][d.salary_component] = flt(d.amount) * flt( + d.exchange_rate if d.exchange_rate else 1 + ) + else: + ss_earning_map[d.parent][d.salary_component] = flt(d.amount) + + return ss_earning_map + + +def get_ss_ded_map(salary_slips, currency, company_currency): + ss_deductions = frappe.db.sql( + """select sd.parent, sd.salary_component, sd.amount, ss.exchange_rate, ss.name + from `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name and sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), + tuple([d.name for d in salary_slips]), + as_dict=1, + ) + + ss_ded_map = {} + for d in ss_deductions: + ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault( + d.salary_component, [] + ) + if currency == company_currency: + ss_ded_map[d.parent][d.salary_component] = flt(d.amount) * flt( + d.exchange_rate if d.exchange_rate else 1 + ) + else: + ss_ded_map[d.parent][d.salary_component] = flt(d.amount) + + return ss_ded_map + + +def get_departments(department, company): + departments_list = get_descendants_of("Department", department) + departments_list.append(department) + return departments_list + + +@frappe.whitelist() +def approve(data): + from frappe.utils.background_jobs import enqueue + import json + + data = json.loads(data) + enqueue( + method=enqueue_approve, + queue="short", + timeout=10000, + job_name="approve_salary_slip", + is_async=True, + kwargs=data, + ) + return _("Start Processing") + + +def enqueue_approve(kwargs): + from frappe.model.workflow import apply_workflow + + data = kwargs + for i in data: + if not i.get("salary_slip_id") or i.get("salary_slip_id") == "Total": + continue + doc = frappe.get_doc("Salary Slip", i.get("salary_slip_id")) + if doc.workflow_state == "Pending": + try: + apply_workflow(doc, "Approve") + frappe.db.commit() + except Exception as e: + frappe.log_error(e) diff --git a/csf_tz/csf_tz/report/salary_register_ctc/__init__.py b/csf_tz/csf_tz/report/salary_register_ctc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.html b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.html new file mode 100644 index 0000000..3abc3a0 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.html @@ -0,0 +1,40 @@ +{% + var report_columns = report.get_columns_for_print(); +%} +
+ {%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")].header %} +
+

{%= __(report.report_name) %}

+
{{ __("From") }} {%= filters.from_date %} {{ __("to") }} {%= filters.to_date %}
+
+ + + + {% for(var i=1, l=report_columns.length; i{%= report_columns[i].label %} + {% } %} + + + + {% for(var j=0, k=data.length; j + {% for(var i=1, l=report_columns.length; i + {% var fieldname = report_columns[i].fieldname; %} + {% if (report_columns[i].fieldtype=='Currency' && !isNaN(row[fieldname])) { %} + {%= format_currency(row[fieldname]) %} + {% } else { %} + {% if (!is_null(row[fieldname])) { %} + {%= row[fieldname] %} + {% } %} + {% } %} + + {% } %} + + {% } %} + +
+

{{ __("Printed On") }} {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}

diff --git a/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.js b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.js new file mode 100644 index 0000000..381f1a4 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.js @@ -0,0 +1,81 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Salary Register CTC"] = { + filters: [ + { + fieldname: "from_date", + label: __("From"), + fieldtype: "Date", + default: frappe.datetime.add_months(frappe.datetime.get_today(), -1), + reqd: 1, + width: "100px", + }, + { + fieldname: "to_date", + label: __("To"), + fieldtype: "Date", + default: frappe.datetime.get_today(), + reqd: 1, + width: "100px", + }, + { + fieldname: "currency", + fieldtype: "Link", + options: "Currency", + label: __("Currency"), + default: erpnext.get_currency(frappe.defaults.get_default("Company")), + width: "50px", + }, + { + fieldname: "employee", + label: __("Employee"), + fieldtype: "Link", + options: "Employee", + width: "100px", + }, + { + fieldname: "company", + label: __("Company"), + fieldtype: "Link", + options: "Company", + default: frappe.defaults.get_user_default("Company"), + width: "100px", + reqd: 1, + }, + { + fieldname: "department", + label: __("Department"), + fieldtype: "Link", + options: "Department", + default: "", + width: "100px", + get_query: function () { + var company = frappe.query_report.get_filter_value("company"); + return { + doctype: "Department", + filters: { + company: company, + }, + }; + }, + }, + { + fieldname: "docstatus", + label: __("Document Status"), + fieldtype: "Select", + options: ["Draft", "Submitted", "Cancelled"], + default: "Submitted", + width: "100px", + }, + { + fieldname: "workflow_state", + label: __("Workflow"), + fieldtype: "Select", + options: ["", "Pending", "Approved", "Rejected"], + // default: "Pending", + width: "100px", + }, + ], +}; diff --git a/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.json b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.json new file mode 100644 index 0000000..ee58e56 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.json @@ -0,0 +1,48 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-12-16 18:03:32.706655", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2021-12-16 18:06:43.038320", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Salary Register CTC", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Salary Slip", + "report_name": "Salary Register CTC", + "report_type": "Script Report", + "roles": [ + { + "role": "Employee" + }, + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "HR Manager (Group)" + }, + { + "role": "Directorate" + }, + { + "role": "Leave Approver" + }, + { + "role": "All" + }, + { + "role": "Employee Self Service" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.py b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.py new file mode 100644 index 0000000..5a7b4d0 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_ctc/salary_register_ctc.py @@ -0,0 +1,310 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +import erpnext +from frappe.utils import flt +from frappe import _, msgprint +from frappe.utils.nestedset import get_descendants_of + + +def execute(filters=None): + if not filters: + filters = {} + currency = None + if filters.get("currency"): + currency = filters.get("currency") + company_currency = erpnext.get_company_currency(filters.get("company")) + salary_slips = get_salary_slips(filters, company_currency) + if not salary_slips: + return [], [] + + columns, earning_types, ded_types, ded_types_ctc = get_columns(salary_slips) + ss_earning_map = get_ss_earning_map(salary_slips, currency, company_currency) + ss_ded_map = get_ss_ded_map(salary_slips, currency, company_currency) + doj_map = get_employee_doj_map() + + data = [] + for ss in salary_slips: + CTC = ss.gross_pay + row = [ + ss.name, + ss.employee, + ss.employee_name, + doj_map.get(ss.employee), + ss.branch, + ss.department, + ss.designation, + ss.company, + ss.start_date, + ss.end_date, + ss.leave_without_pay, + ss.payment_days, + ] + + if ss.branch is not None: + columns[3] = columns[3].replace("-1", "120") + if ss.department is not None: + columns[4] = columns[4].replace("-1", "120") + if ss.designation is not None: + columns[5] = columns[5].replace("-1", "120") + if ss.leave_without_pay is not None: + columns[9] = columns[9].replace("-1", "130") + + for e in earning_types: + row.append(ss_earning_map.get(ss.name, {}).get(e)) + + if currency == company_currency: + row += [flt(ss.gross_pay) * flt(ss.exchange_rate)] + else: + row += [ss.gross_pay] + + for d in ded_types: + row.append(ss_ded_map.get(ss.name, {}).get(d)) + + row.append(ss.total_loan_repayment) + + if currency == company_currency: + row += [ + flt(ss.total_deduction) * flt(ss.exchange_rate), + flt(ss.net_pay) * flt(ss.exchange_rate), + ] + else: + row += [ss.total_deduction, ss.net_pay] + + for d_ctc in ded_types_ctc: + amount = flt(ss_ded_map.get(ss.name, {}).get(d_ctc)) + CTC = CTC + amount + row.append(amount) + + row.append(CTC) + row.append(currency or company_currency) + data.append(row) + + columns += [_("CTC") + ":Currency:120"] + + return columns, data + + +def get_columns(salary_slips): + """ + columns = [ + _("Salary Slip ID") + ":Link/Salary Slip:150", + _("Employee") + ":Link/Employee:120", + _("Employee Name") + "::140", + _("Date of Joining") + "::80", + _("Branch") + ":Link/Branch:120", + _("Department") + ":Link/Department:120", + _("Designation") + ":Link/Designation:120", + _("Company") + ":Link/Company:120", + _("Start Date") + "::80", + _("End Date") + "::80", + _("Leave Without Pay") + ":Float:130", + _("Payment Days") + ":Float:120", + _("Currency") + ":Link/Currency:80" + ] + """ + columns = [ + _("Salary Slip ID") + ":Link/Salary Slip:150", + _("Employee") + ":Link/Employee:120", + _("Employee Name") + "::140", + _("Date of Joining") + "::80", + _("Branch") + ":Link/Branch:-1", + _("Department") + ":Link/Department:-1", + _("Designation") + ":Link/Designation:120", + _("Company") + ":Link/Company:120", + _("Start Date") + "::80", + _("End Date") + "::80", + _("Leave Without Pay") + ":Float:50", + _("Payment Days") + ":Float:120", + ] + + salary_components = {_("Earning"): [], _("Deduction"): []} + + for component in frappe.db.sql( + """select distinct sd.salary_component, sc.type + from `tabSalary Detail` sd, `tabSalary Component` sc + where sc.do_not_include_in_total = 0 and sc.name=sd.salary_component and sd.amount != 0 and sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), + tuple([d.name for d in salary_slips]), + as_dict=1, + ): + salary_components[_(component.type)].append(component.salary_component) + + columns = ( + columns + + [(e + ":Currency:120") for e in salary_components[_("Earning")]] + + [_("Gross Pay") + ":Currency:120"] + + [(d + ":Currency:120") for d in salary_components[_("Deduction")]] + + [ + _("Loan Repayment") + ":Currency:120", + _("Total Deduction") + ":Currency:120", + _("Net Pay") + ":Currency:120", + ] + ) + components = {_("Deduction"): []} + company_expenses = frappe.db.sql(""" + SELECT distinct sd.salary_component, sc.type + FROM `tabSalary Detail` sd, `tabSalary Component` sc + WHERE sc.do_not_include_in_total = 1 + AND sc.type = "Deduction" + AND sc.name=sd.salary_component + AND sd.amount != 0 + AND sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1 + ) + for entry in company_expenses: + components[_(entry.type)].append(entry.salary_component) + + columns = (columns + [(d_ctc + ":Currency:120") for d_ctc in components[_("Deduction")]]) + + return columns, salary_components[_("Earning")], salary_components[_("Deduction")], components[_("Deduction")] + + +def get_salary_slips(filters, company_currency): + filters.update( + {"from_date": filters.get("from_date"), "to_date": filters.get("to_date")} + ) + conditions, filters = get_conditions(filters, company_currency) + salary_slips = frappe.db.sql( + """select * from `tabSalary Slip` where %s + order by employee""" + % conditions, + filters, + as_dict=1, + ) + + return salary_slips or [] + + +def get_conditions(filters, company_currency): + conditions = "" + doc_status = {"Draft": 0, "Submitted": 1, "Cancelled": 2} + + if filters.get("docstatus"): + conditions += "docstatus = {0}".format(doc_status[filters.get("docstatus")]) + + if filters.get("from_date"): + conditions += " and start_date >= %(from_date)s" + if filters.get("to_date"): + conditions += " and end_date <= %(to_date)s" + if filters.get("company"): + conditions += " and company = %(company)s" + if filters.get("employee"): + conditions += " and employee = %(employee)s" + if filters.get("currency") and filters.get("currency") != company_currency: + conditions += " and currency = %(currency)s" + if filters.get("department") and filters.get("company"): + department_list = get_departments( + filters.get("department"), filters.get("company") + ) + conditions += ( + "and department in (" + + ",".join(("'" + n + "'" for n in department_list)) + + ")" + ) + if filters.get("workflow_state"): + conditions += " and workflow_state = %(workflow_state)s" + + return conditions, filters + + +def get_employee_doj_map(): + return frappe._dict( + frappe.db.sql( + """ + SELECT + employee, + date_of_joining + FROM `tabEmployee` + """ + ) + ) + + +def get_ss_earning_map(salary_slips, currency, company_currency): + ss_earnings = frappe.db.sql( + """select sd.parent, sd.salary_component, sd.amount, ss.exchange_rate, ss.name + from `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name and sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), + tuple([d.name for d in salary_slips]), + as_dict=1, + ) + + ss_earning_map = {} + for d in ss_earnings: + ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault( + d.salary_component, [] + ) + if currency == company_currency: + ss_earning_map[d.parent][d.salary_component] = flt(d.amount) * flt( + d.exchange_rate if d.exchange_rate else 1 + ) + else: + ss_earning_map[d.parent][d.salary_component] = flt(d.amount) + + return ss_earning_map + + +def get_ss_ded_map(salary_slips, currency, company_currency): + ss_deductions = frappe.db.sql( + """select sd.parent, sd.salary_component, sd.amount, ss.exchange_rate, ss.name + from `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name and sd.parent in (%s)""" + % (", ".join(["%s"] * len(salary_slips))), + tuple([d.name for d in salary_slips]), + as_dict=1, + ) + + ss_ded_map = {} + for d in ss_deductions: + ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault( + d.salary_component, [] + ) + if currency == company_currency: + ss_ded_map[d.parent][d.salary_component] = flt(d.amount) * flt( + d.exchange_rate if d.exchange_rate else 1 + ) + else: + ss_ded_map[d.parent][d.salary_component] = flt(d.amount) + + return ss_ded_map + + +def get_departments(department, company): + departments_list = get_descendants_of("Department", department) + departments_list.append(department) + return departments_list + + +@frappe.whitelist() +def approve(data): + from frappe.utils.background_jobs import enqueue + import json + + data = json.loads(data) + enqueue( + method=enqueue_approve, + queue="short", + timeout=10000, + job_name="approve_salary_slip", + is_async=True, + kwargs=data, + ) + return _("Start Processing") + + +def enqueue_approve(kwargs): + from frappe.model.workflow import apply_workflow + + data = kwargs + for i in data: + if not i.get("salary_slip_id") or i.get("salary_slip_id") == "Total": + continue + doc = frappe.get_doc("Salary Slip", i.get("salary_slip_id")) + if doc.workflow_state == "Pending": + try: + apply_workflow(doc, "Approve") + frappe.db.commit() + except Exception as e: + frappe.log_error(e) + diff --git a/csf_tz/csf_tz/report/salary_register_summary/__init__.py b/csf_tz/csf_tz/report/salary_register_summary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.js b/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.js new file mode 100644 index 0000000..0f0d3d4 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.js @@ -0,0 +1,73 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Salary Register Summary"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "to_date", + "label": __("To"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "options": "Currency", + "label": __("Currency"), + "default": erpnext.get_currency(frappe.defaults.get_default("Company")), + "width": "50px" + }, + { + "fieldname": "employee", + "label": __("Employee"), + "fieldtype": "Link", + "options": "Employee", + "width": "100px" + }, + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "width": "100px", + "reqd": 1 + }, + { + "fieldname": "department", + "label": __("Department"), + "fieldtype": "Link", + "options": "Department", + "default": "", + "width": "100px", + "get_query": function () { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Department", + "filters": { + "company": company, + } + }; + } + }, + { + "fieldname": "docstatus", + "label": __("Document Status"), + "fieldtype": "Select", + "options": ["Draft", "Submitted", "Cancelled"], + "default": "Submitted", + "width": "100px" + } + ] +}; diff --git a/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.json b/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.json new file mode 100644 index 0000000..18b9a55 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.json @@ -0,0 +1,37 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-04-23 21:40:23.607142", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "json": "{}", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2021-05-05 10:53:20.479090", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Salary Register Summary", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Salary Slip", + "report_name": "Salary Register Summary", + "report_type": "Script Report", + "roles": [ + { + "role": "Employee" + }, + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "HR Manager (Group)" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.py b/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.py new file mode 100644 index 0000000..30a3fe2 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary/salary_register_summary.py @@ -0,0 +1,171 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import erpnext +from frappe.utils import flt +from frappe import _, msgprint +from frappe.utils.nestedset import get_descendants_of + + +def execute(filters=None): + columns = [{ + "fieldname": "salary_component", + "label": _("Salary Component"), + "fieldtype": "Data", + "width": 300 + }, + { + "fieldname": "total", + "label": _("Total"), + "fieldtype": "Float", + "width": 300 + }] + data = get_data(filters) + return columns, data + + +def get_data(filters=None): + if not filters: + filters = {} + currency = None + data = [] + if filters.get('currency'): + currency = filters.get('currency') + company_currency = erpnext.get_company_currency(filters.get("company")) + salary_slips = get_salary_slips(filters, company_currency) + if not salary_slips: + return [] + + blank_line = {"salary_component": "", "total": ""} + total_employees = len(salary_slips) + #frappe.msgprint(str(total_employees)) + total_employee_record = { + "salary_component": "Total Employees", "total": total_employees} + data.append(total_employee_record) + data.append(blank_line) + + ss_basic_map = get_ss_basic_map(salary_slips, currency, company_currency) + data.extend(ss_basic_map) + t_basic = 0 + for basic in ss_basic_map: + t_basic = t_basic + basic["total"] + + ss_earning_map = get_ss_earning_map(salary_slips, currency, company_currency) + #data.extend(ss_earning_map) + + #frappe.msgprint(str(ss_earning_map)) + total_earnings = 0 + for earning in ss_earning_map: + total_earnings = total_earnings + earning["total"] + te_record = {"salary_component": "Total Allowances", "total": total_earnings} + data.append(te_record) + + gross_pay = total_earnings + t_basic + gp_record = {"salary_component": "GROSS PAY", "total": gross_pay} + data.append(gp_record) + + ss_deduction_map = get_ss_ded_map(salary_slips, currency, company_currency) + #data.extend(ss_deduction_map) + + total_deduction = 0 + for deduction in ss_deduction_map: + total_deduction = total_deduction + deduction["total"] + + ded_record = {"salary_component": "Total Deductions", "total": total_deduction} + data.append(ded_record) + + netpay = gross_pay + total_deduction + np_record = {"salary_component": "NET PAY", "total": netpay} + data.append(np_record) + + # ss_ded_map = get_ss_ded_map(salary_slips, currency, company_currency) + # data.extend(ss_ded_map) + return data + + +def get_salary_slips(filters, company_currency): + filters.update({"from_date": filters.get("from_date"), + "to_date": filters.get("to_date")}) + conditions, filters = get_conditions(filters, company_currency) + salary_slips = frappe.db.sql("""select * from `tabSalary Slip` where %s + order by employee""" % conditions, filters, as_dict=1) + + return salary_slips or [] + + +def get_ss_basic_map(salary_slips, currency, company_currency): + ss_basic = frappe.db.sql(""" + SELECT sd.salary_component, SUM(sd.amount) as total + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component = 'Basic' + GROUP BY sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + return ss_basic + + + +def get_ss_earning_map(salary_slips, currency, company_currency): + ss_earnings = frappe.db.sql(""" + SELECT sd.salary_component, SUM(sd.amount) as total + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component != 'Basic' + GROUP BY sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + return ss_earnings + + +def get_ss_ded_map(salary_slips, currency, company_currency): + ss_deductions = frappe.db.sql(""" + SELECT sd.salary_component, SUM(sd.amount) * -1 as total + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name AND sd.parent in (%s) + AND do_not_include_in_total = 0 + AND sd.parentfield = 'deductions' + GROUP BY sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + return ss_deductions + + +def get_conditions(filters, company_currency): + conditions = "" + doc_status = {"Draft": 0, "Submitted": 1, "Cancelled": 2} + + if filters.get("docstatus"): + conditions += "docstatus = {0}".format( + doc_status[filters.get("docstatus")]) + + if filters.get("from_date"): + conditions += " and start_date >= %(from_date)s" + if filters.get("to_date"): + conditions += " and end_date <= %(to_date)s" + if filters.get("company"): + conditions += " and company = %(company)s" + if filters.get("employee"): + conditions += " and employee = %(employee)s" + if filters.get("currency") and filters.get("currency") != company_currency: + conditions += " and currency = %(currency)s" + if filters.get("department") and filters.get("company"): + department_list = get_departments( + filters.get("department"), filters.get("company")) + conditions += 'and department in (' + ','.join( + ("'"+n+"'" for n in department_list)) + ')' + + return conditions, filters + + +def get_departments(department,company): + departments_list = get_descendants_of("Department", department) + departments_list.append(department) + return departments_list diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_components/__init__.py b/csf_tz/csf_tz/report/salary_register_summary_with_components/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.js b/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.js new file mode 100644 index 0000000..d9399ba --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.js @@ -0,0 +1,73 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Salary Register Summary with Components"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "to_date", + "label": __("To"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "options": "Currency", + "label": __("Currency"), + "default": erpnext.get_currency(frappe.defaults.get_default("Company")), + "width": "50px" + }, + { + "fieldname": "employee", + "label": __("Employee"), + "fieldtype": "Link", + "options": "Employee", + "width": "100px" + }, + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "width": "100px", + "reqd": 1 + }, + { + "fieldname": "department", + "label": __("Department"), + "fieldtype": "Link", + "options": "Department", + "default": "", + "width": "100px", + "get_query": function () { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Department", + "filters": { + "company": company, + } + }; + } + }, + { + "fieldname": "docstatus", + "label": __("Document Status"), + "fieldtype": "Select", + "options": ["Draft", "Submitted", "Cancelled"], + "default": "Submitted", + "width": "100px" + } + ] +}; diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.json b/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.json new file mode 100644 index 0000000..cb2499f --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.json @@ -0,0 +1,37 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-05-05 14:30:30.503397", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "json": "{}", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2021-05-05 14:30:30.503397", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Salary Register Summary with Components", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Salary Slip", + "report_name": "Salary Register Summary with Components", + "report_type": "Script Report", + "roles": [ + { + "role": "Employee" + }, + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "HR Manager (Group)" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.py b/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.py new file mode 100644 index 0000000..b10347b --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary_with_components/salary_register_summary_with_components.py @@ -0,0 +1,168 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import erpnext +from frappe.utils import flt +from frappe import _, msgprint +from frappe.utils.nestedset import get_descendants_of + + +def execute(filters=None): + columns = [{ + "fieldname": "salary_component", + "label": _("Salary Component"), + "fieldtype": "Data", + "width": 300 + }, + { + "fieldname": "total", + "label": _("Total"), + "fieldtype": "Float", + "width": 300, + "precision": 2 + }] + data = get_data(filters) + return columns, data + + +def get_data(filters=None): + if not filters: + filters = {} + currency = None + data = [] + if filters.get('currency'): + currency = filters.get('currency') + company_currency = erpnext.get_company_currency(filters.get("company")) + salary_slips = get_salary_slips(filters, company_currency) + if not salary_slips: + return [] + + blank_line = {"salary_component": "", "total": ""} + total_employees = len(salary_slips) + #frappe.msgprint(str(total_employees)) + total_employee_record = {"salary_component": "Total Employees", "total": total_employees} + data.append(total_employee_record) + data.append(blank_line) + + ss_basic_map = get_ss_basic_map(salary_slips, currency, company_currency) + data.extend(ss_basic_map) + t_basic = 0 + for basic in ss_basic_map: + t_basic = t_basic + basic["total"] + + ss_earning_map = get_ss_earning_map( + salary_slips, currency, company_currency) + data.extend(ss_earning_map) + + #frappe.msgprint(str(ss_earning_map)) + total_earnings = 0 + for earning in ss_earning_map: + total_earnings = total_earnings + earning["total"] + te_record = {"salary_component": "Total Allowances", "total": total_earnings} + #data.append(te_record) + + gross_pay = total_earnings + t_basic + gp_record = {"salary_component": "GROSS PAY", "total": gross_pay} + data.append(gp_record) + + ss_deduction_map = get_ss_ded_map(salary_slips, currency, company_currency) + data.extend(ss_deduction_map) + + total_deduction = 0 + for deduction in ss_deduction_map: + total_deduction = total_deduction + deduction["total"] + + ded_record = {"salary_component": "Total Deductions", "total": total_deduction} + # data.append(ded_record) + + netpay = gross_pay + total_deduction + np_record = {"salary_component": "NET PAY BEFORE LOAN", "total": netpay} + data.append(np_record) + return data + + +def get_salary_slips(filters, company_currency): + filters.update({"from_date": filters.get("from_date"), + "to_date": filters.get("to_date")}) + conditions, filters = get_conditions(filters, company_currency) + salary_slips = frappe.db.sql("""select * from `tabSalary Slip` where %s + order by employee""" % conditions, filters, as_dict=1) + + return salary_slips or [] + + +def get_ss_basic_map(salary_slips, currency, company_currency): + ss_basic = frappe.db.sql(""" + SELECT sd.salary_component, SUM(sd.amount) as total + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component = 'Basic' + GROUP BY sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + return ss_basic + + +def get_ss_earning_map(salary_slips, currency, company_currency): + ss_earnings = frappe.db.sql(""" + SELECT sd.salary_component, SUM(sd.amount) as total + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component != 'Basic' + GROUP BY sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + return ss_earnings + + +def get_ss_ded_map(salary_slips, currency, company_currency): + ss_deductions = frappe.db.sql(""" + SELECT sd.salary_component, SUM(sd.amount) * -1 as total + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name AND sd.parent in (%s) + AND do_not_include_in_total = 0 + AND sd.parentfield = 'deductions' + GROUP BY sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + return ss_deductions + + +def get_conditions(filters, company_currency): + conditions = "" + doc_status = {"Draft": 0, "Submitted": 1, "Cancelled": 2} + + if filters.get("docstatus"): + conditions += "docstatus = {0}".format( + doc_status[filters.get("docstatus")]) + + if filters.get("from_date"): + conditions += " and start_date >= %(from_date)s" + if filters.get("to_date"): + conditions += " and end_date <= %(to_date)s" + if filters.get("company"): + conditions += " and company = %(company)s" + if filters.get("employee"): + conditions += " and employee = %(employee)s" + if filters.get("currency") and filters.get("currency") != company_currency: + conditions += " and currency = %(currency)s" + if filters.get("department") and filters.get("company"): + department_list = get_departments( + filters.get("department"), filters.get("company")) + conditions += 'and department in (' + ','.join( + ("'"+n+"'" for n in department_list)) + ')' + + return conditions, filters + + +def get_departments(department,company): + departments_list = get_descendants_of("Department", department) + departments_list.append(department) + return departments_list diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/__init__.py b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.js b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.js new file mode 100644 index 0000000..422654e --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.js @@ -0,0 +1,73 @@ +// Copyright (c) 2022, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Salary Register Summary with Monthly Comparison"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "to_date", + "label": __("To"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "options": "Currency", + "label": __("Currency"), + "default": erpnext.get_currency(frappe.defaults.get_default("Company")), + "width": "50px" + }, + { + "fieldname": "employee", + "label": __("Employee"), + "fieldtype": "Link", + "options": "Employee", + "width": "100px" + }, + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "width": "100px", + "reqd": 1 + }, + { + "fieldname": "department", + "label": __("Department"), + "fieldtype": "Link", + "options": "Department", + "default": "", + "width": "100px", + "get_query": function () { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Department", + "filters": { + "company": company, + } + }; + } + }, + { + "fieldname": "docstatus", + "label": __("Document Status"), + "fieldtype": "Select", + "options": ["Draft", "Submitted", "Cancelled"], + "default": "Submitted", + "width": "100px" + } + ] +}; diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.json b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.json new file mode 100644 index 0000000..bc83524 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.json @@ -0,0 +1,48 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2022-08-10 15:22:42.599454", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2022-08-10 15:22:42.599454", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Salary Register Summary with Monthly Comparison", + "owner": "Administrator", + "prepared_report": 1, + "ref_doctype": "Salary Slip", + "report_name": "Salary Register Summary with Monthly Comparison", + "report_type": "Script Report", + "roles": [ + { + "role": "Employee" + }, + { + "role": "HR Manager" + }, + { + "role": "HR User" + }, + { + "role": "HR Manager (Group)" + }, + { + "role": "Directorate" + }, + { + "role": "Leave Approver" + }, + { + "role": "All" + }, + { + "role": "Employee Self Service" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.py b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.py new file mode 100644 index 0000000..91feb22 --- /dev/null +++ b/csf_tz/csf_tz/report/salary_register_summary_with_monthly_comparison/salary_register_summary_with_monthly_comparison.py @@ -0,0 +1,578 @@ + +import frappe +import erpnext +from frappe.utils import flt, cstr, getdate +from frappe import _, msgprint +from frappe.utils.nestedset import get_descendants_of + +import calendar + +def execute(filters=None): + company_currency = erpnext.get_company_currency(filters.get("company")) + + prev_first_date, prev_last_date, prev_month, prev_year = get_prev_month_date(filters) + + prev_salary_slips = get_prev_salary_slips(filters, company_currency, prev_first_date, prev_last_date) + if len(prev_salary_slips) == 0: + msgprint(_("No salary slip found for the previous month: {0} {1}".format( + frappe.bold(calendar.month_name[prev_month]), frappe.bold(prev_year))) + ) + return [] + + + columns = get_columns(filters, prev_month, prev_year) + data = get_data(filters, company_currency, prev_salary_slips) + + return columns, data + +def get_columns(filters, prev_month, prev_year): + cur_month_name = calendar.month_name[getdate(filters.from_date).month] + cur_year = getdate(filters.from_date).year + + prev_month_name = calendar.month_name[prev_month] + + columns = [ + { + "fieldname": "department", + "label": _("Department"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "salary_component", + "label": _("Salary Component"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "total_prev_month", + "label": _("{0} {1}".format(prev_month_name, prev_year)), + "fieldtype": "Float", + "width": 150, + "precision": 2 + }, + { + "fieldname": "total_cur_month", + "label": _("{0} {1}".format(cur_month_name, cur_year)), + "fieldtype": "Float", + "width": 150, + "precision": 2 + }, + { + "fieldname": "difference_amount", + "label": _("Difference Amount"), + "fieldtype": "Data", + "width": 150 + } + ] + return columns + + +def get_data(filters, company_currency, prev_salary_slips): + records = [] + currency = None + if filters.get('currency'): + currency = filters.get('currency') + + salary_slips = get_salary_slips(filters, company_currency) + if len(salary_slips) == 0: + msgprint(_("No salary slip found for the this month: {0} {1}".format( + frappe.bold(calendar.month_name[getdate(filters.from_date).month]), + frappe.bold(getdate(filters.from_date).year))) + ) + return [] + + no_employee_diff = len(salary_slips) - len(prev_salary_slips) + result = None + if no_employee_diff > 0: + result = "+" + cstr(no_employee_diff) + elif no_employee_diff < 0: + result = "-" + cstr(abs(no_employee_diff)) + else: + result = "0" + + records.append({ + "department": "", + "salary_component": "TOTAL EMPLOYEES", + "total_prev_month": len(prev_salary_slips), + "total_cur_month": len(salary_slips), + "difference_amount": result + }) + records.append({"department": "", "salary_component": "", "total_prev_month": "", "total_cur_month": "", "difference_amount": ""}) + + prev_ss_basic, prev_ss_earnings, prev_ss_deductions = get_salary_map(prev_salary_slips) + + basic_data, total_prev_basic, total_cur_basic = get_basic_data(records, salary_slips, currency, company_currency, prev_ss_basic) + basic_data.append({"department": "", "salary_component": "", "total_prev_month": "", "total_cur_month": "", "difference_amount": ""}) + + earnings_data, total_prev_earning, total_cur_earning = get_earnings_data(basic_data, salary_slips, currency, company_currency, prev_ss_earnings) + + cur_gross_pay = total_cur_earning + total_cur_basic + prev_gross_pay = total_prev_earning + total_prev_basic + + total_gross_amount_diff = flt(cur_gross_pay - prev_gross_pay, 2) + grs_diff = "" + if total_gross_amount_diff > 0: + grs_diff = "+" + cstr(total_gross_amount_diff) + elif total_gross_amount_diff < 0: + grs_diff = "-" + cstr(abs(total_gross_amount_diff)) + else: + grs_diff = "0" + + earnings_data.append({ + "department": "", + "salary_component": "GROSS PAY", + "total_prev_month": prev_gross_pay, + "total_cur_month": cur_gross_pay, + "difference_amount": grs_diff + }) + + earnings_data.append({"department": "", "salary_component": "", "total_prev_month": "", "total_cur_month": "", "difference_amount": ""}) + + data = get_deduction_data(earnings_data, salary_slips, currency, company_currency, prev_ss_deductions, cur_gross_pay, prev_gross_pay) + + return basic_data + + +def get_basic_data(data, salary_slips, currency, company_currency, prev_ss_basic): + ss_basic_map = get_ss_basic_map(salary_slips, currency, company_currency) + + total_cur_basic = 0 + unique_cur_basic_salary_components = [] + unique_prev_basic_salary_components = [] + total_prev_basic = sum(flt(d.total_prev_month) for d in prev_ss_basic) + for cur_basic_row in ss_basic_map: + total_cur_basic += cur_basic_row["total_cur_month"] + + for prev_basic_row in prev_ss_basic: + if ( + cur_basic_row.get("department") == prev_basic_row.get("department") and + cur_basic_row.get("salary_component") == prev_basic_row.get("salary_component") + ): + bsc_amount_diff = flt(cur_basic_row.get("total_cur_month") - prev_basic_row.get("total_prev_month"), 2) + result = "" + if bsc_amount_diff > 0: + result = "+" + cstr(bsc_amount_diff) + elif bsc_amount_diff < 0: + result = "-" + cstr(abs(bsc_amount_diff)) + else: + result = "0" + cur_basic_row.update({ + "total_prev_month": prev_basic_row.get("total_prev_month"), + "difference_amount": result + }) + data.append(cur_basic_row) + + unique_cur_basic_salary_components.append({ + "department": cur_basic_row.get("department"), + "salary_component": cur_basic_row.get("salary_component") + }) + unique_prev_basic_salary_components.append({ + "department": prev_basic_row.get("department"), + "salary_component": prev_basic_row.get("salary_component") + }) + + cur_row = {"department": cur_basic_row.get("department"), "salary_component": cur_basic_row.get("salary_component")} + if cur_row not in unique_cur_basic_salary_components: + unique_cur_basic_salary_components.append({ + "department": cur_basic_row.get("department"), + "salary_component": cur_basic_row.get("salary_component") + }) + + data.append({ + "department": cur_basic_row.get("department"), + "salary_component": cur_basic_row.get("salary_component"), + "total_prev_month": 0, + "total_cur_month": cur_basic_row.get("total_cur_month"), + "difference_amount": "+" + cstr(cur_basic_row.get("total_cur_month")) + }) + + for row in prev_ss_basic: + prev_row = {"department": row.get("department"), "salary_component": row.get("salary_component")} + if prev_row not in unique_prev_basic_salary_components: + data.append({ + "department": row.get("department"), + "salary_component": row.get("salary_component"), + "total_prev_month": row.get("total_prev_month") or 0, + "total_cur_month": 0, + "difference_amount": "-" + cstr(row.get("total_prev_month")) + }) + + total_bsc_amount_diff = flt(total_cur_basic - total_prev_basic, 2) + d = "" + if total_bsc_amount_diff > 0: + d = "+" + cstr(total_bsc_amount_diff) + elif total_bsc_amount_diff < 0: + d = "-" + cstr(abs(total_bsc_amount_diff)) + else: + d = "0" + + data.append({ + "department": "", + "salary_component": "Total Basic", + "total_prev_month": total_prev_basic, + "total_cur_month": total_cur_basic, + "difference_amount": d + }) + + return data, total_prev_basic, total_cur_basic + + +def get_earnings_data(data, salary_slips, currency, company_currency, prev_ss_earnings): + ss_earning_map = get_ss_earning_map(salary_slips, currency, company_currency) + + total_cur_earning = 0 + unique_cur_earnings_salary_components = [] + unique_prev_earnings_salary_components = [] + total_prev_earning = sum(flt(d.total_prev_month) for d in prev_ss_earnings) + for cur_earning_row in ss_earning_map: + total_cur_earning += cur_earning_row["total_cur_month"] + + for prev_earning_row in prev_ss_earnings: + if ( + cur_earning_row.get("deaprtment") == prev_earning_row.get("department") and + cur_earning_row.get("salary_component") == prev_earning_row.get("salary_component") + ): + earn_amount_diff = flt(cur_earning_row.get("total_cur_month") - prev_earning_row.get("total_prev_month"), 2) + result = "" + if earn_amount_diff > 0: + result = "+" + cstr(earn_amount_diff) + elif earn_amount_diff < 0: + result = "-" + cstr(abs(earn_amount_diff)) + else: + result = "0" + + cur_earning_row.update({ + "total_prev_month": prev_earning_row.get("total_prev_month"), + "difference_amount": result + }) + data.append(cur_earning_row) + + unique_cur_earnings_salary_components.append({ + "department": cur_earning_row.get("department"), + "salary_component": cur_earning_row.get("salary_component") + }) + unique_prev_earnings_salary_components.append({ + "department": prev_earning_row.get("department"), + "salary_component": prev_earning_row.get("salary_component") + }) + + cur_row = {"department": cur_earning_row.get("department"), "salary_component": cur_earning_row.get("salary_component")} + if cur_row not in unique_cur_earnings_salary_components: + unique_cur_earnings_salary_components.append({ + "department": cur_earning_row.get("department"), + "salary_component": cur_earning_row.get("salary_component") + }) + + data.append({ + "department": cur_earning_row.get("department"), + "salary_component": cur_earning_row.get("salary_component"), + "total_prev_month": 0, + "total_cur_month": cur_earning_row.get("total_cur_month"), + "difference_amount": "+" + cstr(cur_earning_row.get("total_cur_month")) + }) + + for row in prev_ss_earnings: + prev_row = {"department": row.get("department"), "salary_component": row.get("salary_component")} + if prev_row not in unique_prev_earnings_salary_components: + data.append({ + "department": row.get("department"), + "salary_component": row.get("salary_component"), + "total_prev_month": row.get("total_prev_month") or 0, + "total_cur_month": 0, + "difference_amount": "-" + cstr(row.get("total_prev_month")) + }) + total_earn_amount_diff = flt(total_cur_earning - total_prev_earning, 2) + d = "" + if total_earn_amount_diff > 0: + d = "+" + cstr(total_earn_amount_diff) + elif total_earn_amount_diff < 0: + d = "-" + cstr(abs(total_earn_amount_diff)) + else: + d = "0" + + data.append({ + "department": "", + "salary_component": "TOTAL ALLOWANCES", + "total_prev_month": total_prev_earning, + "total_cur_month": total_cur_earning, + "difference_amount": d + }) + + return data, total_prev_earning, total_cur_earning + + +def get_deduction_data(data, salary_slips, currency, company_currency, prev_ss_deductions, cur_gross_pay, prev_gross_pay): + ss_deduction_map = get_ss_ded_map(salary_slips, currency, company_currency) + + total_cur_deduction = 0 + unique_cur_deduction_salary_components = [] + unique_prev_deduction_salary_components = [] + total_prev_deduction = sum(flt(d.total_prev_month) for d in prev_ss_deductions) + for cur_deduction_row in ss_deduction_map: + total_cur_deduction += cur_deduction_row["total_cur_month"] + + for prev_deduction_row in prev_ss_deductions: + if ( + cur_deduction_row.get("salary_component") == prev_deduction_row.get("salary_component") + and cur_deduction_row.get("department") == prev_deduction_row.get("department") + ): + ded_amount_diff = flt(cur_deduction_row.get("total_cur_month") - prev_deduction_row.get("total_prev_month"), 2) + result = "" + if ded_amount_diff > 0: + result = "+" + cstr(ded_amount_diff) + elif ded_amount_diff < 0: + result = "-" + cstr(abs(ded_amount_diff)) + else: + result = "0" + + cur_deduction_row.update({ + "total_prev_month": prev_deduction_row.get("total_prev_month"), + "difference_amount": result + }) + data.append(cur_deduction_row) + + unique_cur_deduction_salary_components.append({ + "department": cur_deduction_row.get("department"), + "salary_component": cur_deduction_row.get("salary_component") + }) + + unique_prev_deduction_salary_components.append({ + "department": prev_deduction_row.get("department"), + "salary_component": prev_deduction_row.get("salary_component") + }) + + cur_row = {"salary_component": cur_deduction_row.get("salary_component"), "department": cur_deduction_row.get("department")} + if cur_row not in unique_cur_deduction_salary_components: + unique_cur_deduction_salary_components.append({ + "department": cur_deduction_row.get("department"), + "salary_component": cur_deduction_row.get("salary_component") + }) + + data.append({ + "department": cur_deduction_row.get("department"), + "salary_component": cur_deduction_row.get("salary_component"), + "total_prev_month": 0, + "total_cur_month": cur_deduction_row.get("total_cur_month"), + "difference_amount": "+" + cstr(cur_deduction_row.get("total_cur_month")) + }) + + + for row in prev_ss_deductions: + prev_row = {"department": row.get("department"), "salary_component": row.get("salary_component")} + if prev_row not in unique_prev_deduction_salary_components: + data.append({ + "department": row.get("department"), + "salary_component": row.get("salary_component"), + "total_prev_month": row.get("total_prev_month"), + "total_cur_month": 0, + "difference_amount": "-" + cstr(row.get("total_prev_month")) + }) + total_ded_amount_diff = flt(total_cur_deduction - total_prev_deduction, 2) + d = "" + if total_ded_amount_diff > 0: + d = "+" + cstr(total_ded_amount_diff) + elif total_ded_amount_diff < 0: + d = "-" + cstr(abs(total_ded_amount_diff)) + else: + d = "0" + + data.append({ + "deartment": "", + "salary_component": "TOTAL DEDUCTIONS", + "total_prev_month": total_prev_deduction, + "total_cur_month": total_cur_deduction, + "difference_amount": d + }) + + net_pay_amount_diff = flt((cur_gross_pay - total_cur_deduction) - (prev_gross_pay - total_prev_deduction), 2) + h = "" + if net_pay_amount_diff > 0: + h = "+" + cstr(net_pay_amount_diff) + elif net_pay_amount_diff < 0: + h = "-" + cstr(abs(net_pay_amount_diff)) + else: + h = "0" + + data.append({ + "deartment": "", + "salary_component": "NET PAY BEFORE LOAN", + "total_prev_month": prev_gross_pay + total_prev_deduction, + "total_cur_month": cur_gross_pay + total_cur_deduction, + "difference_amount": h + }) + + return data + + +def get_prev_month_date(filters): + prev_month = getdate(filters.from_date).month - 1 + prev_year = getdate(filters.from_date).year + + if prev_month == 0: + prev_month = 12 + prev_year = prev_year - 1 + + prev_first_date = getdate(str(prev_year) + "-" + str(prev_month) + "-" + "01") + prev_last_date = getdate(str(prev_year) + "-" + str(prev_month) + "-" + "{0}".format(calendar.monthrange(prev_year, prev_month)[1])) + + return prev_first_date, prev_last_date, prev_month, prev_year + + +def get_salary_map(prev_salary_slips): + prev_ss_basic = frappe.db.sql(""" + SELECT ss.department, sd.salary_component, SUM(sd.amount) as total_prev_month + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND sd.do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component = 'Basic' + GROUP BY ss.department, sd.salary_component + ORDER BY sd.salary_component ASC + """ % (', '.join(['%s']*len(prev_salary_slips))), tuple([d.name for d in prev_salary_slips]), as_dict=1) + + prev_ss_earnings = frappe.db.sql(""" + SELECT ss.department, sd.salary_component, SUM(sd.amount) as total_prev_month + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND sd.do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component != 'Basic' + GROUP BY ss.department, sd.salary_component + ORDER BY sd.salary_component ASC + """ % (', '.join(['%s']*len(prev_salary_slips))), tuple([d.name for d in prev_salary_slips]), as_dict=1) + + prev_ss_deductions = frappe.db.sql(""" + SELECT ss.department, sd.salary_component, SUM(sd.amount) as total_prev_month + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name AND sd.parent in (%s) + AND sd.do_not_include_in_total = 0 + AND sd.parentfield = 'deductions' + GROUP BY ss.department, sd.salary_component + ORDER BY sd.salary_component ASC + """ % (', '.join(['%s']*len(prev_salary_slips))), tuple([d.name for d in prev_salary_slips]), as_dict=1) + return prev_ss_basic, prev_ss_earnings, prev_ss_deductions + + +def get_prev_salary_slips(filters, company_currency, prev_first_date, prev_last_date): + custom_filters = filters + custom_filters.update({ + "prev_first_date": prev_first_date, + "prev_last_date": prev_last_date + }) + prev_conditions = get_prev_conditions(custom_filters, company_currency) + prev_salary_slips = frappe.db.sql("""select name from `tabSalary Slip` where %s + order by employee"""% prev_conditions, filters, as_dict=1) + + return prev_salary_slips or [] + + +def get_prev_conditions(filters, company_currency): + conditions = "" + doc_status = {"Draft": 0, "Submitted": 1, "Cancelled": 2} + + if filters.get("docstatus"): + conditions += "docstatus = {0}".format( + doc_status[filters.get("docstatus")]) + + if filters.get("prev_first_date"): + conditions += " and start_date >= %(prev_first_date)s" + if filters.get("prev_last_date"): + conditions += " and end_date <= %(prev_last_date)s" + if filters.get("company"): + conditions += " and company = %(company)s" + if filters.get("employee"): + conditions += " and employee = %(employee)s" + if filters.get("currency") and filters.get("currency") != company_currency: + conditions += " and currency = %(currency)s" + if filters.get("department") and filters.get("company"): + department_list = get_departments( + filters.get("department"), filters.get("company")) + conditions += 'and department in (' + ','.join( + ("'"+n+"'" for n in department_list)) + ')' + + return conditions + + +def get_salary_slips(filters, company_currency): + filters.update({"from_date": filters.get("from_date"), + "to_date": filters.get("to_date")}) + conditions, filters = get_conditions(filters, company_currency) + salary_slips = frappe.db.sql("""select name from `tabSalary Slip` where %s + order by employee""" % conditions, filters, as_dict=1) + + return salary_slips or [] + + +def get_ss_basic_map(salary_slips, currency, company_currency): + ss_basic = frappe.db.sql(""" + SELECT ss.department, sd.salary_component, SUM(sd.amount) as total_cur_month + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND sd.do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component = 'Basic' + GROUP BY ss.department, sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + return ss_basic + + +def get_ss_earning_map(salary_slips, currency, company_currency): + ss_earnings = frappe.db.sql(""" + SELECT ss.department, sd.salary_component, SUM(sd.amount) as total_cur_month + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name + AND sd.parent in (%s) + AND sd.do_not_include_in_total = 0 + AND sd.parentfield = 'earnings' + AND sd.salary_component != 'Basic' + GROUP BY ss.department, sd.salary_component + ORDER BY sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + + return ss_earnings + + +def get_ss_ded_map(salary_slips, currency, company_currency): + ss_deductions = frappe.db.sql(""" + SELECT ss.department, sd.salary_component, SUM(sd.amount) as total_cur_month + FROM `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name AND sd.parent in (%s) + AND sd.do_not_include_in_total = 0 + AND sd.parentfield = 'deductions' + GROUP BY sd.salary_component + ORDER BY ss.department, sd.salary_component ASC""" % + (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) + return ss_deductions + + +def get_conditions(filters, company_currency): + conditions = "" + doc_status = {"Draft": 0, "Submitted": 1, "Cancelled": 2} + + if filters.get("docstatus"): + conditions += "docstatus = {0}".format( + doc_status[filters.get("docstatus")]) + + if filters.get("from_date"): + conditions += " and start_date >= %(from_date)s" + if filters.get("to_date"): + conditions += " and end_date <= %(to_date)s" + if filters.get("company"): + conditions += " and company = %(company)s" + if filters.get("employee"): + conditions += " and employee = %(employee)s" + if filters.get("currency") and filters.get("currency") != company_currency: + conditions += " and currency = %(currency)s" + if filters.get("department") and filters.get("company"): + department_list = get_departments( + filters.get("department"), filters.get("company")) + conditions += 'and department in (' + ','.join( + ("'"+n+"'" for n in department_list)) + ')' + + return conditions, filters + + +def get_departments(department,company): + departments_list = get_descendants_of("Department", department) + departments_list.append(department) + return departments_list \ No newline at end of file diff --git a/csf_tz/csf_tz/report/sales_report_by_type/__init__.py b/csf_tz/csf_tz/report/sales_report_by_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.js b/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.js new file mode 100644 index 0000000..8a023a0 --- /dev/null +++ b/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.js @@ -0,0 +1,30 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Sales Report by Type"] = { + filters: [ + { + fieldname: "from_date", + fieldtype: "Date", + label: "From Date", + mandatory: 1, + wildcard_filter: 0, + }, + { + fieldname: "to_date", + fieldtype: "Date", + label: "To Date", + mandatory: 1, + wildcard_filter: 0, + }, + { + fieldname: "is_pos", + fieldtype: "Select", + label: "Is POS", + mandatory: 1, + options: "No\nYes", + wildcard_filter: 0, + } + ] +} diff --git a/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.json b/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.json new file mode 100644 index 0000000..7e20335 --- /dev/null +++ b/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.json @@ -0,0 +1,22 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-02-23 10:59:12.652346", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-03-19 21:47:38.110605", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Sales Report by Type", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT c.name AS \"Customer:Link/Supplier:250\",\r\n si.name AS \"Invoice Number::150\",\r\n si.vfd_rctvnum AS \"VFD No::75\",\r\n si.posting_date AS \"Invoice Date::100\",\r\n si.vfd_date AS \"VFD Date::100\",\r\n si.base_net_total AS \"AMOUNT_VAT_EXCL:Currency:200\",\r\n si.total_taxes_and_charges AS \"VAT_AMT:Currency:150\",\r\n si.base_rounded_total AS \"AMOUNT_VAT_INCL:Currency:200\",\r\n si.taxes_and_charges AS \"Sales Taxes and Charges Template:Link/Sales Taxes and Charges Template:350\"\r\nFROM `tabSales Invoice` si\r\n INNER JOIN `tabSales Invoice Item` sii\r\n ON sii.parent = si.name\r\n INNER JOIN `tabCustomer` c\r\n ON si.customer = c.name\r\nWHERE (si.posting_date >= %(from_date)s and si.posting_date <= %(to_date)s)\r\n and si.docstatus = 1\r\n and si.is_pos = if(%(is_pos)s = \"No\", 0, 1)\r\nGROUP BY si.posting_date, si.vfd_rctvnum, c.name, si.name\r\nORDER BY si.name", + "ref_doctype": "Sales Invoice", + "report_name": "Sales Report by Type", + "report_type": "Query Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/schema_details/__init__.py b/csf_tz/csf_tz/report/schema_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/schema_details/schema_details.json b/csf_tz/csf_tz/report/schema_details/schema_details.json new file mode 100644 index 0000000..40b6b9d --- /dev/null +++ b/csf_tz/csf_tz/report/schema_details/schema_details.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2020-10-18 04:59:57.432583", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "modified": "2021-03-11 21:09:52.543776", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Schema Details", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT 'DocType Field', df.parent as 'Parent', df.fieldname as 'Field Name', df.fieldtype as 'Field Type',\n df.label as 'Field Full Name', df.options as 'Linked To DocType', dt.istable as 'Is Child',\n dt.issingle as 'Is Single', dt.is_submittable as 'Is Submittable', dt.is_tree as 'Is Tree', dt.module as 'Module Name',\n m.app_name as 'App Name', dt.restrict_to_domain as 'Domain', dt.allow_guest_to_view as 'Allow Guest to View'\n FROM `tabDocField` as df\n INNER JOIN `tabDocType` as dt ON df.parent = dt.name\n INNER JOIN `tabModule Def` as m ON dt.module = m.name\n WHERE (df.fieldtype = 'Link' or df.fieldtype = 'Dynamic Link')\nUNION ALL\nSELECT 'Custom Field', df.dt as 'Parent', df.fieldname as 'Field Name', df.fieldtype as 'Field Type',\n df.label as 'Field Full Name', df.options as 'Linked To DocType', dt.istable as 'Is Child',\n dt.issingle as 'Is Single', dt.is_submittable as 'Is Submittable', dt.is_tree as 'Is Tree', dt.module as 'Module Name',\n m.app_name as 'App Name', dt.restrict_to_domain as 'Domain', dt.allow_guest_to_view as 'Allow Guest to View'\n FROM `tabCustom Field` as df\n INNER JOIN `tabDocType` as dt ON df.dt = dt.name\n INNER JOIN `tabModule Def` as m ON dt.module = m.name\n WHERE (df.fieldtype = 'Link' or df.fieldtype = 'Dynamic Link')", + "ref_doctype": "CSF TZ Settings", + "report_name": "Schema Details", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/show_processlist/__init__.py b/csf_tz/csf_tz/report/show_processlist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/show_processlist/show_processlist.json b/csf_tz/csf_tz/report/show_processlist/show_processlist.json new file mode 100644 index 0000000..1cbb1d4 --- /dev/null +++ b/csf_tz/csf_tz/report/show_processlist/show_processlist.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2022-08-01 15:37:29.961801", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "", + "modified": "2022-08-01 15:37:29.961801", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "SHOW PROCESSLIST", + "owner": "Administrator", + "prepared_report": 0, + "query": "select id AS \"ID:Int:100\", time AS \"Time Running (Secs):Int:150\",\n info AS \"SQL Query:Text:500\"\n from information_schema.processlist\n WHERE info IS NOT NULL", + "ref_doctype": "Company", + "report_name": "SHOW PROCESSLIST", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/__init__.py b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.js b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.js new file mode 100644 index 0000000..660f7fa --- /dev/null +++ b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.js @@ -0,0 +1,51 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Stock Balance pivot warehouse"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.get_today() + }, + { + "fieldname": "item_group", + "label": __("Item Group"), + "fieldtype": "Link", + "width": "80", + "options": "Item Group" + }, + { + "fieldname": "item_code", + "label": __("Item"), + "fieldtype": "Link", + "width": "80", + "options": "Item" + }, + { + "fieldname": "warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse" + }, + { + "fieldname": "filter_total_zero_qty", + "label": __("Filter Total Zero Qty"), + "fieldtype": "Check", + "default": 1 + }, + ] +} diff --git a/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.json b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.json new file mode 100644 index 0000000..80238aa --- /dev/null +++ b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 1, + "creation": "2019-06-14 15:58:42.361397", + "disable_prepared_report": 1, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "modified": "2019-06-15 00:31:27.080061", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Stock Balance pivot warehouse", + "owner": "Administrator", + "prepared_report": 1, + "ref_doctype": "Stock Ledger Entry", + "reference_report": "Used Salary Report to make this report.", + "report_name": "Stock Balance pivot warehouse", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.py b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.py new file mode 100644 index 0000000..fee6c9b --- /dev/null +++ b/csf_tz/csf_tz/report/stock_balance_pivot_warehouse/stock_balance_pivot_warehouse.py @@ -0,0 +1,87 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt +from frappe import _ + +def execute(filters=None): + if not filters: filters = {} + stock_ledger_entry = get_stock_ledger_entries(filters) + if not stock_ledger_entry: return [], [] + + columns, warehouses = get_columns(stock_ledger_entry) + sle_warehouse_map = get_sle_warehouse_map(stock_ledger_entry) + + + data = [] + for sle in stock_ledger_entry: + row = [sle.item_code, sle.item_name, sle.brand, sle.item_group] + + for e in warehouses: + row.append(sle_warehouse_map.get(sle.item_code, {}).get(e)) + #row += [total_qty] + + data.append(row) + + return columns, data + +def get_columns(stock_ledger_entry): + columns = [ + _("Item Code") + ":Link/Item:150", _("Item") + ":Data/Item Name:150", _("Brand") + ":Link/Brand:150", _("Item Group") + ":Link/Item Group:150" + ] + + warehouses = {_("Warehouse"): []} + + for warehouse in frappe.db.sql("""select distinct sle.warehouse + from `tabStock Ledger Entry` sle + where sle.actual_qty != 0 and sle.item_code in (%s)""" % + (', '.join(['%s']*len(stock_ledger_entry))), tuple([d.item_code for d in stock_ledger_entry]), as_dict=1): + warehouses[_("Warehouse")].append(warehouse.warehouse) + + columns = columns + [(e + ":Float:120") for e in warehouses[_("Warehouse")]] + \ + [_("Total Stock") + ":Float:120"] + + #frappe.msgprint(warehouses[_("Warehouse")]) + + return columns, warehouses[_("Warehouse")] + +def get_stock_ledger_entries(filters): + filters.update({"from_date": filters.get("from_date"), "to_date":filters.get("to_date")}) + conditions, filters = get_conditions(filters) + stock_ledger_entry = frappe.db.sql("""select sle.item_code, i.item_name, i.brand, i.item_group, sle.warehouse, sum(sle.actual_qty) + from `tabStock Ledger Entry` sle + inner join `tabItem` i on sle.item_code = i.item_code + where %s + group by i.item_name, i.brand, i.item_group, sle.warehouse + order by i.brand, i.item_group, sle.item_code""" % conditions, filters, as_dict=1) + + return stock_ledger_entry or [] + +def get_conditions(filters): + conditions = "" + + if filters.get("from_date"): conditions += "posting_date >= %(from_date)s" + if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s" + if filters.get("item_group"): conditions += " and i.item_group = %(item_group)s" + if filters.get("brand"): conditions += " and i.brand = %(brand)s" + if filters.get("warehouse"): conditions += " and sle.warehouse = %(warehouse)s" + + return conditions, filters + +def get_sle_warehouse_map(stock_ledger_entry): + sle_warehouses = frappe.db.sql("""select sle.item_code, sle.warehouse, sum(actual_qty) + from `tabStock Ledger Entry` sle + inner join `tabItem` i on sle.item_code = i.item_code + where item_code in (%s) + group by i.item_name, i.brand, i.item_group, sle.warehouse""" % + (', '.join(['%s']*len(stock_ledger_entry))), tuple([d.item_code for d in stock_ledger_entry]), as_dict=1) + + sle_warehouse_map = {} + for d in sle_warehouses: + sle_warehouse_map.setdefault(d.item_code, frappe._dict()).setdefault(d.warehouse, []) + #frappe.msgprint(d) + sle_warehouse_map[d.item_code][d.warehouse] = flt(d.actual_qty) + + return sle_warehouse_map diff --git a/csf_tz/csf_tz/report/stock_balance_pro/__init__.py b/csf_tz/csf_tz/report/stock_balance_pro/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.js b/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.js new file mode 100644 index 0000000..c84a075 --- /dev/null +++ b/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.js @@ -0,0 +1,99 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Stock Balance Pro"] = { + "filters": [ + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "width": "80", + "options": "Company", + "default": frappe.defaults.get_default("company") + }, + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.get_today() + }, + { + "fieldname": "item_group", + "label": __("Item Group"), + "fieldtype": "Link", + "width": "80", + "options": "Item Group" + }, + { + "fieldname": "item_code", + "label": __("Item"), + "fieldtype": "Link", + "width": "80", + "options": "Item", + "get_query": function () { + return { + query: "erpnext.controllers.queries.item_query", + }; + } + }, + { + "fieldname": "warehouse_type", + "label": __("Warehouse Type"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse Type" + }, + { + "fieldname": "warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse", + get_query: () => { + var warehouse_type = frappe.query_report.get_filter_value('warehouse_type'); + if (warehouse_type) { + return { + filters: { + 'warehouse_type': warehouse_type + } + }; + } + } + }, + { + "fieldname": "include_uom", + "label": __("Include UOM"), + "fieldtype": "Link", + "options": "UOM" + }, + { + "fieldname": "show_variant_attributes", + "label": __("Show Variant Attributes"), + "fieldtype": "Check" + }, + ], + + "formatter": function (value, row, column, data, default_formatter) { + value = default_formatter(value, row, column, data); + + if (column.fieldname == "out_qty" && data && data.out_qty > 0) { + value = "" + value + ""; + } + else if (column.fieldname == "in_qty" && data && data.in_qty > 0) { + value = "" + value + ""; + } + + return value; + } +}; diff --git a/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.json b/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.json new file mode 100644 index 0000000..d92178b --- /dev/null +++ b/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 1, + "creation": "2021-02-21 14:19:11.239792", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-02-21 14:19:11.239792", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Stock Balance Pro", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Stock Ledger Entry", + "reference_report": "Stock Balance", + "report_name": "Stock Balance Pro", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.py b/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.py new file mode 100644 index 0000000..4cbc3f6 --- /dev/null +++ b/csf_tz/csf_tz/report/stock_balance_pro/stock_balance_pro.py @@ -0,0 +1,310 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import erpnext +from frappe import _ +from frappe.utils import flt, cint, getdate +from erpnext.stock.utils import add_additional_uom_columns +from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition + + +from six import iteritems + + +def execute(filters=None): + if not filters: + filters = {} + + validate_filters(filters) + + if filters.get("company"): + company_currency = erpnext.get_company_currency(filters.get("company")) + else: + company_currency = frappe.db.get_single_value( + "Global Defaults", "default_currency") + + include_uom = filters.get("include_uom") + columns = get_columns(filters) + items = get_items(filters) + sle = get_stock_ledger_entries(filters, items) + + # if no stock ledger entry found return + if not sle: + return columns, [] + + iwb_map = get_item_warehouse_map(filters, sle) + item_map = get_item_details(items, sle, filters) + + data = [] + conversion_factors = {} + + def _func(x): return x[1] + + for (company, item) in sorted(iwb_map): + if item_map.get(item): + qty_dict = iwb_map[(company, item)] + + report_data = { + 'currency': company_currency, + 'item_code': item, + 'company': company, + } + report_data.update(item_map[item]) + report_data.update(qty_dict) + + if include_uom: + conversion_factors.setdefault( + item, item_map[item].conversion_factor) + + data.append(report_data) + + add_additional_uom_columns(columns, data, include_uom, conversion_factors) + return columns, data + + +def get_columns(filters): + """return columns""" + columns = [ + {"label": _("Item"), "fieldname": "item_code", + "fieldtype": "Link", "options": "Item", "width": 100}, + {"label": _("Item Name"), "fieldname": "item_name", "width": 150}, + {"label": _("Item Group"), "fieldname": "item_group", + "fieldtype": "Link", "options": "Item Group", "width": 100}, + {"label": _("Stock UOM"), "fieldname": "stock_uom", + "fieldtype": "Link", "options": "UOM", "width": 90}, + {"label": _("Balance Qty"), "fieldname": "bal_qty", + "fieldtype": "Float", "width": 100, "convertible": "qty"}, + {"label": _("Opening Qty"), "fieldname": "opening_qty", + "fieldtype": "Float", "width": 100, "convertible": "qty"}, + {"label": _("In Qty"), "fieldname": "in_qty", + "fieldtype": "Float", "width": 80, "convertible": "qty"}, + {"label": _("Out Qty"), "fieldname": "out_qty", + "fieldtype": "Float", "width": 80, "convertible": "qty"}, + {"label": _("Excise Qty"), "fieldname": "excise_stock", + "fieldtype": "Float", "width": 100, "convertible": "qty"}, + {"label": _("Company"), "fieldname": "company", + "fieldtype": "Link", "options": "Company", "width": 100} + ] + + if filters.get('show_variant_attributes'): + columns += [{'label': att_name, 'fieldname': att_name, 'width': 100} + for att_name in get_variants_attributes()] + + return columns + + +def get_conditions(filters): + conditions = "" + if not filters.get("from_date"): + frappe.throw(_("'From Date' is required")) + + if filters.get("to_date"): + conditions += " and sle.posting_date <= %s" % frappe.db.escape( + filters.get("to_date")) + else: + frappe.throw(_("'To Date' is required")) + + if filters.get("company"): + conditions += " and sle.company = %s" % frappe.db.escape( + filters.get("company")) + + if filters.get("warehouse"): + warehouse_details = frappe.db.get_value("Warehouse", + filters.get("warehouse"), ["lft", "rgt"], as_dict=1) + if warehouse_details: + conditions += " and exists (select name from `tabWarehouse` wh \ + where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)" % (warehouse_details.lft, + warehouse_details.rgt) + + if filters.get("warehouse_type") and not filters.get("warehouse"): + conditions += " and exists (select name from `tabWarehouse` wh \ + where wh.warehouse_type = '%s' and sle.warehouse = wh.name)" % (filters.get("warehouse_type")) + + return conditions + + +def get_stock_ledger_entries(filters, items): + item_conditions_sql = '' + if items: + item_conditions_sql = ' and sle.item_code in ({})'\ + .format(', '.join([frappe.db.escape(i, percent=False) for i in items])) + + conditions = get_conditions(filters) + + return frappe.db.sql(""" + select + sle.item_code, sle.warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate, + sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference, + sle.item_code as name, sle.voucher_no, sle.stock_value, 0 as excise_stock + from + `tabStock Ledger Entry` sle force index (posting_sort_index) + inner join `tabStock Entry` se on sle.voucher_type = "Stock Entry" and se.name = sle.voucher_no + inner join `tabItem` i on sle.item_code = i.name + where sle.is_cancelled = 0 + and (se.purpose != "Material Transfer") + and i.excisable_item = 1 + and sle.docstatus < 2 %s %s + UNION ALL + select + sle.item_code, sle.warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate, + sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference, + sle.item_code as name, sle.voucher_no, sle.stock_value, sle.actual_qty * si.excise_duty_applicable as excise_stock + from + `tabStock Ledger Entry` sle force index (posting_sort_index) + inner join `tabSales Invoice` si on sle.voucher_type = "Sales Invoice" and si.name = sle.voucher_no + inner join `tabItem` i on sle.item_code = i.name + where sle.is_cancelled = 0 + and i.excisable_item = 1 + and sle.docstatus < 2 %s %s + UNION ALL + select + sle.item_code, sle.warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate, + sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference, + sle.item_code as name, sle.voucher_no, sle.stock_value, 0 as excise_stock + from + `tabStock Ledger Entry` sle force index (posting_sort_index) + inner join `tabItem` i on sle.item_code = i.name + where sle.is_cancelled = 0 + and sle.voucher_type NOT IN ("Stock Entry", "Sales Invoice") + and i.excisable_item = 1 + and sle.docstatus < 2 %s %s""" % # nosec + (item_conditions_sql, conditions, item_conditions_sql, conditions, item_conditions_sql, conditions), as_dict=1) + + +def get_item_warehouse_map(filters, sle): + iwb_map = {} + from_date = getdate(filters.get("from_date")) + to_date = getdate(filters.get("to_date")) + + float_precision = cint(frappe.db.get_default("float_precision")) or 3 + + for d in sle: + key = (d.company, d.item_code) + if key not in iwb_map: + iwb_map[key] = frappe._dict({ + "opening_qty": 0.0, + "in_qty": 0.0, + "out_qty": 0.0, + "excise_stock": 0.0, + "bal_qty": 0.0 + }) + + qty_dict = iwb_map[(d.company, d.item_code)] + + if d.voucher_type == "Stock Reconciliation": + qty_diff = flt(d.qty_after_transaction) - flt(qty_dict.bal_qty) + else: + qty_diff = flt(d.actual_qty) + + if d.posting_date < from_date: + qty_dict.opening_qty += qty_diff + + elif d.posting_date >= from_date and d.posting_date <= to_date: + if flt(qty_diff, float_precision) >= 0: + qty_dict.in_qty += qty_diff + else: + qty_dict.out_qty += abs(qty_diff) + qty_dict.excise_stock += abs(d.excise_stock) or 0 + + qty_dict.bal_qty += qty_diff + + iwb_map = filter_items_with_no_transactions(iwb_map, float_precision) + + return iwb_map + + +def filter_items_with_no_transactions(iwb_map, float_precision): + for (company, item) in sorted(iwb_map): + qty_dict = iwb_map[(company, item)] + + no_transactions = True + for key, val in iteritems(qty_dict): + val = flt(val, float_precision) + qty_dict[key] = val + if key != "val_rate" and val: + no_transactions = False + + if no_transactions: + iwb_map.pop((company, item)) + + return iwb_map + + +def get_items(filters): + conditions = [] + if filters.get("item_code"): + conditions.append("item.name=%(item_code)s") + else: + if filters.get("item_group"): + conditions.append(get_item_group_condition( + filters.get("item_group"))) + + items = [] + if conditions: + items = frappe.db.sql_list("""select name from `tabItem` item where {}""" + .format(" and ".join(conditions)), filters) + return items + + +def get_item_details(items, sle, filters): + item_details = {} + if not items: + items = list(set([d.item_code for d in sle])) + + if not items: + return item_details + + cf_field = cf_join = "" + if filters.get("include_uom"): + cf_field = ", ucd.conversion_factor" + cf_join = "left join `tabUOM Conversion Detail` ucd on ucd.parent=item.name and ucd.uom=%s" \ + % frappe.db.escape(filters.get("include_uom")) + + res = frappe.db.sql(""" + select + item.name, item.item_name, item.description, item.item_group, item.brand, item.stock_uom %s + from + `tabItem` item + %s + where + item.name in (%s) + """ % (cf_field, cf_join, ','.join(['%s'] * len(items))), items, as_dict=1) + + for item in res: + item_details.setdefault(item.name, item) + + if filters.get('show_variant_attributes', 0) == 1: + variant_values = get_variant_values_for(list(item_details)) + item_details = {k: v.update(variant_values.get(k, {})) + for k, v in iteritems(item_details)} + + return item_details + + +def validate_filters(filters): + if not (filters.get("item_code") or filters.get("warehouse")): + sle_count = flt(frappe.db.sql( + """select count(name) from `tabStock Ledger Entry`""")[0][0]) + if sle_count > 500000: + frappe.throw( + _("Please set filter based on Item or Warehouse due to a large amount of entries.")) + + +def get_variants_attributes(): + '''Return all item variant attributes.''' + return [i.name for i in frappe.get_all('Item Attribute')] + + +def get_variant_values_for(items): + '''Returns variant values for items.''' + attribute_map = {} + for attr in frappe.db.sql('''select parent, attribute, attribute_value + from `tabItem Variant Attribute` where parent in (%s) + ''' % ", ".join(["%s"] * len(items)), tuple(items), as_dict=1): + attribute_map.setdefault(attr['parent'], {}) + attribute_map[attr['parent']].update( + {attr['attribute']: attr['attribute_value']}) + + return attribute_map diff --git a/csf_tz/csf_tz/report/stock_ledger_mismatch/__init__.py b/csf_tz/csf_tz/report/stock_ledger_mismatch/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.js b/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.js new file mode 100644 index 0000000..3247731 --- /dev/null +++ b/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.js @@ -0,0 +1,27 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Stock Ledger Mismatch"] = { + "filters": [ + { + label: __("Company"), + fieldtype: "Link", + fieldname: "company", + options: "Company", + default: frappe.defaults.get_user_default("Company"), + reqd: 1 + }, + { + label: __('Item Code'), + fieldtype: 'Link', + fieldname: 'item_code', + options: 'Item' + }, + { + label: __('Warehouse'), + fieldtype: 'Link', + fieldname: 'warehouse' + } + ] +}; diff --git a/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.json b/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.json new file mode 100644 index 0000000..e1b1741 --- /dev/null +++ b/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.json @@ -0,0 +1,50 @@ +{ + "add_total_row": 0, + "columns": [], + "creation": "2021-08-18 19:30:02.515019", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "letter_head": "SHM-Hospital Letter Head", + "modified": "2021-08-18 19:30:02.515019", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Stock Ledger Mismatch", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Stock Ledger Entry", + "report_name": "Stock Ledger Mismatch", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Healthcare Head Pharmacist" + }, + { + "role": "Healthcare Pharmacist" + }, + { + "role": "SHM Store" + }, + { + "role": "EB Secretary (Read Olny)" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.py b/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.py new file mode 100644 index 0000000..0ea6031 --- /dev/null +++ b/csf_tz/csf_tz/report/stock_ledger_mismatch/stock_ledger_mismatch.py @@ -0,0 +1,143 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +import frappe +from frappe import _ +from frappe.utils import flt + + +def execute(filters=None): + columns, data = [], [] + columns = get_columns() + data = get_data(filters) + return columns, data + + +def get_data(filters): + data = get_stock_ledger_entries(filters) + itewise_balance_qty = {} + + for row in data: + key = (row.item_code, row.warehouse) + itewise_balance_qty.setdefault(key, []).append(row) + + res = validate_data(itewise_balance_qty) + return res + + +def validate_data(itewise_balance_qty): + res = [] + for key, data in itewise_balance_qty.items(): + row = get_incorrect_data(data) + if row: + res.append(row) + res.append({}) + + return res + + +def get_incorrect_data(data): + balance_qty = 0.0 + for row in data: + balance_qty += row.actual_qty + if row.voucher_type == "Stock Reconciliation" and not row.batch_no: + balance_qty = flt(row.qty_after_transaction) + + row.expected_balance_qty = balance_qty + if abs(flt(row.expected_balance_qty) - flt(row.qty_after_transaction)) > 0.5: + row.differnce = abs( + flt(row.expected_balance_qty) - flt(row.qty_after_transaction) + ) + return row + + +def get_stock_ledger_entries(report_filters): + filters = {"is_cancelled": 0} + fields = [ + "name", + "voucher_type", + "voucher_no", + "item_code", + "actual_qty", + "posting_date", + "posting_time", + "company", + "warehouse", + "qty_after_transaction", + "batch_no", + ] + + for field in ["warehouse", "item_code", "company"]: + if report_filters.get(field): + filters[field] = report_filters.get(field) + + return frappe.get_all( + "Stock Ledger Entry", + fields=fields, + filters=filters, + order_by="timestamp(posting_date, posting_time) asc, creation asc", + ) + + +def get_columns(): + return [ + { + "label": _("Id"), + "fieldtype": "Link", + "fieldname": "name", + "options": "Stock Ledger Entry", + "width": 120, + }, + { + "label": _("Posting Date"), + "fieldtype": "Date", + "fieldname": "posting_date", + "width": 110, + }, + { + "label": _("Voucher Type"), + "fieldtype": "Link", + "fieldname": "voucher_type", + "options": "DocType", + "width": 120, + }, + { + "label": _("Voucher No"), + "fieldtype": "Dynamic Link", + "fieldname": "voucher_no", + "options": "voucher_type", + "width": 120, + }, + { + "label": _("Item Code"), + "fieldtype": "Link", + "fieldname": "item_code", + "options": "Item", + "width": 120, + }, + { + "label": _("Warehouse"), + "fieldtype": "Link", + "fieldname": "warehouse", + "options": "Warehouse", + "width": 120, + }, + { + "label": _("Expected Balance Qty"), + "fieldtype": "Float", + "fieldname": "expected_balance_qty", + "width": 170, + }, + { + "label": _("Actual Balance Qty"), + "fieldtype": "Float", + "fieldname": "qty_after_transaction", + "width": 150, + }, + { + "label": _("Difference"), + "fieldtype": "Float", + "fieldname": "differnce", + "width": 110, + }, + ] diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/__init__.py b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.js b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.js new file mode 100644 index 0000000..18905e2 --- /dev/null +++ b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.js @@ -0,0 +1,97 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Supplier Ledger Summary Multicurrency"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company") + }, + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book" + }, + { + "fieldname":"party", + "label": __("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + on_change: () => { + var party = frappe.query_report.get_filter_value('party'); + if (party) { + frappe.db.get_value('Supplier', party, ["tax_id", "supplier_name"], function(value) { + frappe.query_report.set_filter_value('tax_id', value["tax_id"]); + frappe.query_report.set_filter_value('supplier_name', value["supplier_name"]); + }); + } else { + frappe.query_report.set_filter_value('tax_id', ""); + frappe.query_report.set_filter_value('supplier_name', ""); + } + } + }, + { + "fieldname":"supplier_group", + "label": __("Supplier Group"), + "fieldtype": "Link", + "options": "Supplier Group" + }, + { + "fieldname":"payment_terms_template", + "label": __("Payment Terms Template"), + "fieldtype": "Link", + "options": "Payment Terms Template" + }, + { + "fieldname":"territory", + "label": __("Territory"), + "fieldtype": "Link", + "options": "Territory" + }, + { + "fieldname":"sales_partner", + "label": __("Sales Partner"), + "fieldtype": "Link", + "options": "Sales Partner" + }, + { + "fieldname":"sales_person", + "label": __("Sales Person"), + "fieldtype": "Link", + "options": "Sales Person" + }, + { + "fieldname":"tax_id", + "label": __("Tax Id"), + "fieldtype": "Data", + "hidden": 1 + }, + { + "fieldname":"supplier_name", + "label": __("Supplier Name"), + "fieldtype": "Data", + "hidden": 1 + } + ] +}; diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.json b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.json new file mode 100644 index 0000000..2f5cfc6 --- /dev/null +++ b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2022-02-10 02:53:10.255563", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2022-02-10 02:53:10.255563", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Supplier Ledger Summary Multicurrency", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Purchase Invoice", + "report_name": "Supplier Ledger Summary Multicurrency", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.py b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.py new file mode 100644 index 0000000..983b8ce --- /dev/null +++ b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from csf_tz.csf_tz.report.customer_ledger_summary_multicurrency.customer_ledger_summary_multicurrency import ( + PartyLedgerSummaryReport, +) + + +def execute(filters=None): + args = { + "party_type": "Supplier", + "naming_by": ["Buying Settings", "supp_master_name"], + } + return PartyLedgerSummaryReport(filters).run(args) diff --git a/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/__init__.py b/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/tra_input_vat_returns_efiling.js b/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/tra_input_vat_returns_efiling.js new file mode 100644 index 0000000..056b101 --- /dev/null +++ b/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/tra_input_vat_returns_efiling.js @@ -0,0 +1,21 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["TRA Input VAT Returns eFiling"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "width": "80" + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today() + } + ] +} diff --git a/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/tra_input_vat_returns_efiling.json b/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/tra_input_vat_returns_efiling.json new file mode 100644 index 0000000..20a83b8 --- /dev/null +++ b/csf_tz/csf_tz/report/tra_input_vat_returns_efiling/tra_input_vat_returns_efiling.json @@ -0,0 +1,35 @@ +{ + "add_total_row": 0, + "creation": "2020-03-04 10:07:25.505547", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2021-01-19 20:39:14.141784", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "TRA Input VAT Returns eFiling", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT s.name AS \"SUPPLIER_NAME:Link/Supplier:200\",\n s.vrn AS \"SUPPLIER_VRN::50\", \n pi.bill_no AS \"TAX_INVOICE_NUMBER::50\", \n pi.bill_date AS \"DATE_OF_INVOICE:Date:120\", \n GROUP_CONCAT(pii.item_name) AS \"ITEMS\", \n pi.base_net_total AS \"AMOUNT_VAT_EXCL:Currency:100\", \n pi.total_taxes_and_charges AS \"VAT_AMT:Currency:100\" \nFROM `tabPurchase Invoice` pi \n INNER JOIN `tabPurchase Invoice Item` pii\n ON pii.parent = pi.name\n INNER JOIN `tabSupplier` s \n ON pi.supplier = s.name \nWHERE pi.total_taxes_and_charges != 0\n and (pi.bill_date >= %(from_date)s and pi.bill_date <= %(to_date)s)\n and pi.docstatus = 1\nGROUP BY s.name, s.vrn, pi.bill_no, pi.bill_date, pi.base_net_total, pi.total_taxes_and_charges", + "ref_doctype": "Purchase Invoice", + "report_name": "TRA Input VAT Returns eFiling", + "report_type": "Query Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Purchase User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/transaction_statistics/__init__.py b/csf_tz/csf_tz/report/transaction_statistics/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/transaction_statistics/transaction_statistics.json b/csf_tz/csf_tz/report/transaction_statistics/transaction_statistics.json new file mode 100644 index 0000000..c8834a1 --- /dev/null +++ b/csf_tz/csf_tz/report/transaction_statistics/transaction_statistics.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2020-05-27 10:44:54.637872", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "modified": "2022-03-16 09:39:27.163260", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Transaction Statistics", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT SUBSTRING(table_name, 4) as DocType, table_rows as `Number of Rows`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`\r\n FROM INFORMATION_SCHEMA.TABLES\r\n WHERE table_rows > 0\r\n AND SUBSTRING(table_name, 4) IN (SELECT name FROM tabDocType WHERE is_submittable = 1 and istable = 0)\r\n ORDER BY table_rows DESC\r\n", + "ref_doctype": "Company", + "report_name": "Transaction Statistics", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/trial_balance_report_in_usd/__init__.py b/csf_tz/csf_tz/report/trial_balance_report_in_usd/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.js b/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.js new file mode 100644 index 0000000..ae5fa83 --- /dev/null +++ b/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.js @@ -0,0 +1,106 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.require("assets/erpnext/js/financial_statements.js", function() { + frappe.query_reports["Trial Balance Report in USD"] = { + "filters": [ + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "reqd": 1 + }, + { + "fieldname": "fiscal_year", + "label": __("Fiscal Year"), + "fieldtype": "Link", + "options": "Fiscal Year", + "default": frappe.defaults.get_user_default("fiscal_year"), + "reqd": 1, + "on_change": function(query_report) { + var fiscal_year = query_report.get_values().fiscal_year; + if (!fiscal_year) { + return; + } + frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) { + var fy = frappe.model.get_doc("Fiscal Year", fiscal_year); + frappe.query_report.set_filter_value({ + from_date: fy.year_start_date, + to_date: fy.year_end_date + }); + }); + } + }, + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.defaults.get_user_default("year_start_date"), + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.defaults.get_user_default("year_end_date"), + }, + { + "fieldname":"cost_center", + "label": __("Cost Center"), + "fieldtype": "Link", + "options": "Cost Center", + "get_query": function() { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Cost Center", + "filters": { + "company": company, + } + } + } + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book", + }, + { + "fieldname": "with_period_closing_entry", + "label": __("Period Closing Entry"), + "fieldtype": "Check", + "default": 1 + }, + { + "fieldname": "show_zero_values", + "label": __("Show zero values"), + "fieldtype": "Check" + }, + { + "fieldname": "show_unclosed_fy_pl_balances", + "label": __("Show unclosed fiscal year's P&L balances"), + "fieldtype": "Check" + }, + { + "fieldname": "include_default_book_entries", + "label": __("Include Default Book Entries"), + "fieldtype": "Check" + } + ], + "formatter": erpnext.financial_statements.formatter, + "tree": true, + "name_field": "account", + "parent_field": "parent_account", + "initial_depth": 3 + }; + erpnext.dimension_filters.forEach((dimension) => { + frappe.query_reports["Trial Balance Eport in USD"].filters.splice(5, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] + }); + }); +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.json b/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.json new file mode 100644 index 0000000..5b0b1c7 --- /dev/null +++ b/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2019-12-19 10:07:41.849294", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2019-12-19 10:07:56.919342", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Trial Balance Report in USD", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "GL Entry", + "report_name": "Trial Balance Report in USD", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.py b/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.py new file mode 100644 index 0000000..bc6af24 --- /dev/null +++ b/csf_tz/csf_tz/report/trial_balance_report_in_usd/trial_balance_report_in_usd.py @@ -0,0 +1,311 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.utils import flt, getdate, formatdate, cstr +from erpnext.accounts.report.financial_statements \ + import filter_accounts, set_gl_entries_by_account, filter_out_zero_value_rows +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions + +value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit") + +def execute(filters=None): + validate_filters(filters) + data = get_data(filters) + columns = get_columns() + return columns, data + +def validate_filters(filters): + if not filters.fiscal_year: + frappe.throw(_("Fiscal Year {0} is required").format(filters.fiscal_year)) + + fiscal_year = frappe.db.get_value("Fiscal Year", filters.fiscal_year, ["year_start_date", "year_end_date"], as_dict=True) + if not fiscal_year: + frappe.throw(_("Fiscal Year {0} does not exist").format(filters.fiscal_year)) + else: + filters.year_start_date = getdate(fiscal_year.year_start_date) + filters.year_end_date = getdate(fiscal_year.year_end_date) + + if not filters.from_date: + filters.from_date = filters.year_start_date + + if not filters.to_date: + filters.to_date = filters.year_end_date + + filters.from_date = getdate(filters.from_date) + filters.to_date = getdate(filters.to_date) + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date cannot be greater than To Date")) + + if (filters.from_date < filters.year_start_date) or (filters.from_date > filters.year_end_date): + frappe.msgprint(_("From Date should be within the Fiscal Year. Assuming From Date = {0}")\ + .format(formatdate(filters.year_start_date))) + + filters.from_date = filters.year_start_date + + if (filters.to_date < filters.year_start_date) or (filters.to_date > filters.year_end_date): + frappe.msgprint(_("To Date should be within the Fiscal Year. Assuming To Date = {0}")\ + .format(formatdate(filters.year_end_date))) + filters.to_date = filters.year_end_date + +def get_data(filters): + + accounts = frappe.db.sql("""select name, account_number, parent_account, account_name, root_type, report_type, lft, rgt + + from `tabAccount` where company=%s order by lft""", filters.company, as_dict=True) + company_currency = "USD" + + if not accounts: + return None + + accounts, accounts_by_name, parent_children_map = filter_accounts(accounts) + + min_lft, max_rgt = frappe.db.sql("""select min(lft), max(rgt) from `tabAccount` + where company=%s""", (filters.company,))[0] + + gl_entries_by_account = {} + + opening_balances = get_opening_balances(filters) + set_gl_entries_by_account(filters.company, filters.from_date, + filters.to_date, min_lft, max_rgt, filters, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry)) + + total_row = calculate_values(accounts, gl_entries_by_account, opening_balances, filters, company_currency) + accumulate_values_into_parents(accounts, accounts_by_name) + + data = prepare_data(accounts, filters, total_row, parent_children_map, company_currency) + data = filter_out_zero_value_rows(data, parent_children_map, show_zero_values=filters.get("show_zero_values")) + + return data + +def get_opening_balances(filters): + balance_sheet_opening = get_rootwise_opening_balances(filters, "Balance Sheet") + pl_opening = get_rootwise_opening_balances(filters, "Profit and Loss") + + balance_sheet_opening.update(pl_opening) + return balance_sheet_opening + + +def get_rootwise_opening_balances(filters, report_type): + additional_conditions = "" + if not filters.show_unclosed_fy_pl_balances: + additional_conditions = " and posting_date >= %(year_start_date)s" \ + if report_type == "Profit and Loss" else "" + + if not flt(filters.with_period_closing_entry): + additional_conditions += " and ifnull(voucher_type, '')!='Period Closing Voucher'" + + if filters.cost_center: + lft, rgt = frappe.db.get_value('Cost Center', filters.cost_center, ['lft', 'rgt']) + additional_conditions += """ and cost_center in (select name from `tabCost Center` + where lft >= %s and rgt <= %s)""" % (lft, rgt) + + if filters.finance_book: + fb_conditions = " and finance_book = %(finance_book)s" + if filters.include_default_book_entries: + fb_conditions = " and (finance_book in (%(finance_book)s, %(company_fb)s))" + + additional_conditions += fb_conditions + + accounting_dimensions = get_accounting_dimensions() + + query_filters = { + "company": filters.company, + "from_date": filters.from_date, + "report_type": report_type, + "year_start_date": filters.year_start_date, + "finance_book": filters.finance_book, + "company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book') + } + + if accounting_dimensions: + for dimension in accounting_dimensions: + if filters.get(dimension): + additional_conditions += """ and {0} in (%({0})s) """.format(dimension) + + query_filters.update({ + dimension: filters.get(dimension) + }) + + gle = frappe.db.sql(""" + select + account, sum(debit) as opening_debit, sum(credit) as opening_credit + from `tabGL Entry` + where + company=%(company)s + {additional_conditions} + and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes') + and account in (select name from `tabAccount` where report_type=%(report_type)s) + group by account""".format(additional_conditions=additional_conditions), query_filters , as_dict=True) + + opening = frappe._dict() + for d in gle: + opening.setdefault(d.account, d) + + return opening + +def calculate_values(accounts, gl_entries_by_account, opening_balances, _filters, company_currency): + init = { + "opening_debit": 0.0, + "opening_credit": 0.0, + "debit": 0.0, + "credit": 0.0, + "closing_debit": 0.0, + "closing_credit": 0.0 + } + + total_row = { + "account": "'" + _("Total") + "'", + "account_name": "'" + _("Total") + "'", + "warn_if_negative": True, + "opening_debit": 0.0, + "opening_credit": 0.0, + "debit": 0.0, + "credit": 0.0, + "closing_debit": 0.0, + "closing_credit": 0.0, + "parent_account": None, + "indent": 0, + "has_value": True, + "currency": company_currency + } + + for d in accounts: + d.update(init.copy()) + + # add opening + d["opening_debit"] = opening_balances.get(d.name, {}).get("opening_debit", 0) + d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0) + + for entry in gl_entries_by_account.get(d.name, []): + if cstr(entry.is_opening) != "Yes": + d["debit"] += flt(entry.debit) + d["credit"] += flt(entry.credit) + + d["closing_debit"] = d["opening_debit"] + d["debit"] + d["closing_credit"] = d["opening_credit"] + d["credit"] + + prepare_opening_closing(d) + + for field in value_fields: + total_row[field] += d[field] + + return total_row + +def accumulate_values_into_parents(accounts, accounts_by_name): + for d in reversed(accounts): + if d.parent_account: + for key in value_fields: + accounts_by_name[d.parent_account][key] += d[key] + +def prepare_data(accounts, filters, total_row, parent_children_map, company_currency): + data = [] + currency_value = frappe.get_list("Currency Exchange", filters={"from_currency": "USD", "to_currency": "TZS"}, fields=["exchange_rate"], order_by="date") + if len(currency_value) == 0: + frappe.throw("No Currency Exchange for USD") + for d in accounts: + # Prepare opening closing for group account + if parent_children_map.get(d.account): + prepare_opening_closing(d) + + has_value = False + row = { + "account": d.name, + "parent_account": d.parent_account, + "indent": d.indent, + "from_date": filters.from_date, + "to_date": filters.to_date, + "currency": company_currency, + "account_name": ('{} - {}'.format(d.account_number, d.account_name) + if d.account_number else d.account_name) + } + + for key in value_fields: + row[key] = flt(d.get(key, 0.0) / currency_value[len(currency_value) - 1].exchange_rate, 3) + + if abs(row[key]) >= 0.005: + # ignore zero values + has_value = True + + row["has_value"] = has_value + data.append(row) + + data.extend([{},total_row]) + + return data + +def get_columns(): + return [ + { + "fieldname": "account", + "label": _("Account"), + "fieldtype": "Link", + "options": "Account", + "width": 300 + }, + { + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Link", + "options": "Currency", + "hidden": 1 + }, + { + "fieldname": "opening_debit", + "label": _("Opening (Dr)"), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "fieldname": "opening_credit", + "label": _("Opening (Cr)"), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "fieldname": "debit", + "label": _("Debit"), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "fieldname": "credit", + "label": _("Credit"), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "fieldname": "closing_debit", + "label": _("Closing (Dr)"), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + }, + { + "fieldname": "closing_credit", + "label": _("Closing (Cr)"), + "fieldtype": "Currency", + "options": "currency", + "width": 120 + } + ] + +def prepare_opening_closing(row): + dr_or_cr = "debit" if row["root_type"] in ["Asset", "Equity", "Expense"] else "credit" + reverse_dr_or_cr = "credit" if dr_or_cr == "debit" else "debit" + + for col_type in ["opening", "closing"]: + valid_col = col_type + "_" + dr_or_cr + reverse_col = col_type + "_" + reverse_dr_or_cr + row[valid_col] -= row[reverse_col] + if row[valid_col] < 0: + row[reverse_col] = abs(row[valid_col]) + row[valid_col] = 0.0 + else: + row[reverse_col] = 0.0 \ No newline at end of file diff --git a/csf_tz/csf_tz/report/vat_efiling_returns/__init__.py b/csf_tz/csf_tz/report/vat_efiling_returns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.js b/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.js new file mode 100644 index 0000000..7d6aa99 --- /dev/null +++ b/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.js @@ -0,0 +1,32 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["VAT eFiling Returns"] = { + "filters": [ + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "reqd": 1, + "default": frappe.defaults.get_user_default("company") + }, + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + "reqd": 1, + "width": "60px" + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1, + "width": "60px" + }, + ] +}; diff --git a/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.json b/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.json new file mode 100644 index 0000000..4010a3d --- /dev/null +++ b/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.json @@ -0,0 +1,27 @@ +{ + "add_total_row": 0, + "creation": "2021-01-21 02:10:48.740186", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-01-21 02:10:48.740186", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "VAT eFiling Returns", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "report_name": "VAT eFiling Returns", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.py b/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.py new file mode 100644 index 0000000..7cef170 --- /dev/null +++ b/csf_tz/csf_tz/report/vat_efiling_returns/vat_efiling_returns.py @@ -0,0 +1,150 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from erpnext.controllers.taxes_and_totals import get_itemised_taxable_amount +import json +from frappe.utils import flt +from csf_tz import console + + +def execute(filters=None): + columns = get_columns() + data = get_data(filters) + return columns, data + + +def get_columns(): + columns = [ + { + "fieldname": "type", + "label": _("Type"), + "fieldtype": "Data", + "options": "", + "width": 150 + }, + { + "fieldname": "line", + "label": _("Line"), + "fieldtype": "Data", + "options": "", + "width": 100 + }, + { + "fieldname": "excl", + "label": _("Excl Amount"), + "fieldtype": "Float", + "options": "", + "width": 150 + }, + { + "fieldname": "vat", + "label": _("VAT Amount"), + "fieldtype": "Float", + "options": "", + "width": 150 + }, + { + "fieldname": "category", + "label": _("Category"), + "fieldtype": "Data", + "options": "", + "width": 300 + }, + ] + return columns + + +def get_data(filters): + + imported = { + "type": "Foreign Purchase", + "line": "Line 3", + "excl": 0, + "vat": 0, + "category": "Value of imported services" + } + non_creditable_purchases = { + "type": "Purchase", + "line": "Line 2", + "excl": 0, + "vat": 0, + "category": "Non-creditable purchases" + } + taxable_purchases = { + "type": "Purchase", + "line": "Line 1", + "excl": 0, + "vat": 0, + "category": "Taxable purchases" + } + + purchase_list = frappe.get_all("Purchase Invoice", filters={ + "docstatus": 1, + "is_return": 0, + "company": filters.company, + "posting_date": ["between", [ + filters.from_date, + filters.to_date + ] + ] + }, + fields={"*"} + ) + + for element in purchase_list: + country = frappe.get_value( + "Supplier", element.supplier, "country") + if country and country != "Tanzania": + imported["excl"] += element.base_net_total + elif not element.base_total_taxes_and_charges: + non_creditable_purchases["excl"] += element.base_net_total + else: + taxable_purchases["vat"] += element.base_total_taxes_and_charges + taxable = element.base_total_taxes_and_charges / 0.18 + taxable_purchases["excl"] += taxable + non_creditable = element.base_net_total - taxable + non_creditable_purchases["excl"] += non_creditable + + non_creditable_supplies = { + "type": "Sales", + "line": "Line 2", + "excl": 0, + "vat": 0, + "category": "Non-creditable supplies" + } + taxable_supplies = { + "type": "Sales", + "line": "Line 1", + "excl": 0, + "vat": 0, + "category": "Taxable supplies" + } + + sales_list = frappe.get_all("Sales Invoice", filters={ + "docstatus": 1, + "is_return": 0, + "status": ["!=", "Credit Note Issued"], + "company": filters.company, + "posting_date": ["between", [ + filters.from_date, + filters.to_date + ] + ] + }, + fields={"*"} + ) + + for element in sales_list: + if not element.base_total_taxes_and_charges: + non_creditable_supplies["excl"] += element.base_net_total + else: + taxable_supplies["vat"] += element.base_total_taxes_and_charges + taxable = element.base_total_taxes_and_charges / 0.18 + taxable_supplies["excl"] += taxable + non_creditable = element.base_net_total - taxable + non_creditable_supplies["excl"] += non_creditable + + return [taxable_purchases, non_creditable_purchases, taxable_supplies, non_creditable_supplies, imported] diff --git a/csf_tz/csf_tz/report/version_table_statistics/__init__.py b/csf_tz/csf_tz/report/version_table_statistics/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/version_table_statistics/version_table_statistics.json b/csf_tz/csf_tz/report/version_table_statistics/version_table_statistics.json new file mode 100644 index 0000000..76854d8 --- /dev/null +++ b/csf_tz/csf_tz/report/version_table_statistics/version_table_statistics.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2022-03-16 09:51:56.811424", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [], + "idx": 0, + "is_standard": "Yes", + "letter_head": "Letterhead Official", + "modified": "2022-03-16 09:51:56.811424", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Version Table Statistics", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT ref_doctype as \"DocType::\", SUM(LENGTH(data)) as \"Data:Int:\", COUNT(*) as \"Number of rows::\"\nFROM `tabVersion`\nGROUP BY ref_doctype\nORDER BY count(*)", + "ref_doctype": "Version", + "report_name": "Version Table Statistics", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Administrator" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/__init__.py b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.js b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.js new file mode 100644 index 0000000..457a9ad --- /dev/null +++ b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.js @@ -0,0 +1,60 @@ +// Copyright (c) 2019, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Warehouse wise Item Balance and Value"] = { + "filters": [ +{ + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "width": "80", + "reqd": 1, + "default": frappe.datetime.get_today() + }, + { + "fieldname": "item_group", + "label": __("Item Group"), + "fieldtype": "Link", + "width": "80", + "options": "Item Group", + "default": "Vouchers" + }, + { + "fieldname": "brand", + "label": __("Brand"), + "fieldtype": "Link", + "width": "80", + "options": "Brand", + "default": "Halotel" + }, + { + "fieldname": "item_code", + "label": __("Item"), + "fieldtype": "Link", + "width": "80", + "options": "Item" + }, + { + "fieldname": "warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse" + }, + { + "fieldname": "filter_total_zero_qty", + "label": __("Filter Total Zero Qty"), + "fieldtype": "Check", + "default": 1 + }, + ] +} diff --git a/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.json b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.json new file mode 100644 index 0000000..a76c403 --- /dev/null +++ b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.json @@ -0,0 +1,33 @@ +{ + "add_total_row": 1, + "creation": "2019-07-03 12:26:52.454472", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-07-03 13:16:02.061969", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Warehouse wise Item Balance and Value", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Stock Ledger Entry", + "report_name": "Warehouse wise Item Balance and Value", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Stock Manager" + }, + { + "role": "Sales User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.py b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.py new file mode 100644 index 0000000..81ce0a8 --- /dev/null +++ b/csf_tz/csf_tz/report/warehouse_wise_item_balance_and_value/warehouse_wise_item_balance_and_value.py @@ -0,0 +1,141 @@ +# Copyright (c) 2019, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.utils import flt +from erpnext.stock.report.stock_balance.stock_balance import (get_item_details, get_item_warehouse_map, get_items, get_stock_ledger_entries) +from erpnext.stock.report.stock_ageing.stock_ageing import get_fifo_queue, get_average_age +from six import iteritems + +def execute(filters=None): + if not filters: filters = {} + + validate_filters(filters) + + columns = get_columns(filters) + + items = get_items(filters) + sle = get_stock_ledger_entries(filters, items) + + item_map = get_item_details(items, sle, filters) + iwb_map = get_item_warehouse_map(filters, sle) + warehouse_list = get_warehouse_list(filters) + item_ageing = get_fifo_queue(filters) + data = [] + item_balance = {} + item_value = {} + + for (company, item, warehouse) in sorted(iwb_map): + if not item_map.get(item): continue + + row = [] + qty_dict = iwb_map[(company, item, warehouse)] + item_balance.setdefault((item, item_map[item]["item_group"]), []) + total_stock_value = 0.00 + for wh in warehouse_list: + row += [qty_dict.bal_qty] if wh.name in warehouse else [0.00] + total_stock_value += qty_dict.bal_val if wh.name in warehouse else 0.00 + + item_balance[(item, item_map[item]["item_group"])].append(row) + item_value.setdefault((item, item_map[item]["item_group"]),[]) + item_value[(item, item_map[item]["item_group"])].append(total_stock_value) + + + # sum bal_qty by item + for (item, item_group), wh_balance in iteritems(item_balance): + if not item_ageing.get(item): continue + + total_stock_value = sum(item_value[(item, item_group)]) + row = [item, item_group, total_stock_value] + + fifo_queue = item_ageing[item]["fifo_queue"] + average_age = 0.00 + if fifo_queue: + average_age = get_average_age(fifo_queue, filters["to_date"]) + + row += [average_age] + + bal_qty = [sum(bal_qty) for bal_qty in zip(*wh_balance)] + total_qty = sum(bal_qty) + if len(warehouse_list) > 1: + row += [total_qty] + row += bal_qty + + if total_qty > 0: + data.append(row) + elif not filters.get("filter_total_zero_qty"): + data.append(row) + # frappe.msgprint("Debug start") + # frappe.msgprint(str(data)) + add_warehouse_column(columns, warehouse_list) + check_zero_total_qty(columns, data) + # frappe.msgprint(str(columns) + " " + str(data)) + return columns, data + +def get_columns(_filters): + """return columns""" + + columns = [ + _("Item")+":Link/Item:100", + _("Item Group")+"::100", + _("Value")+":Currency:120", + _("Age")+":Float:60", + ] + return columns + +def validate_filters(filters): + if not (filters.get("item_code") or filters.get("warehouse")): + sle_count = flt(frappe.db.sql("""select count(name) from `tabStock Ledger Entry`""")[0][0]) + if sle_count > 500000: + frappe.throw(_("Please set filter based on Item or Warehouse")) + if not filters.get("company"): + filters["company"] = frappe.defaults.get_user_default("Company") + +def get_warehouse_list(filters): + from frappe.core.doctype.user_permission.user_permission import get_permitted_documents + + condition = '' + user_permitted_warehouse = get_permitted_documents('Warehouse') + value = () + if user_permitted_warehouse: + condition = "and name in %s" + value = set(user_permitted_warehouse) + elif not user_permitted_warehouse and filters.get("warehouse"): + condition = "and name = %s" + value = filters.get("warehouse") + + return frappe.db.sql("""select name + from `tabWarehouse` where is_group = 0 + {condition}""".format(condition=condition), value, as_dict=1) + +def add_warehouse_column(columns, warehouse_list): + if len(warehouse_list) > 1: + columns += [_("Total Qty")+":Int:80"] + + for wh in warehouse_list: + columns += [_(wh.name)+":Int:100"] + +def check_zero_total_qty(columns, data): + zero_qty_columns = [] + # frappe.msgprint("Number of rows: " + str(len(data)) + " and number of columns " + str(len(columns))) + for column_num in range(5, len(columns)): + column_total = 0 + for row_num in range(0, len(data)): + # frappe.msgprint("row " + str(row_num + 1) + " column " + str(column_num + 1) + " value" + str(data[row_num][column_num])) + column_total += data[row_num][column_num] + if column_total == 0: + zero_qty_columns.append(column_num) + # frappe.msgprint("These columns should be removed: " + str(zero_qty_columns)) + + if len(zero_qty_columns) > 0: + # frappe.msgprint("Total number of columns to be deleted: " + str(len(zero_qty_columns))) + index = 0 + for col_num in zero_qty_columns: + # frappe.msgprint("Deleting column " + str(col_num - index)) + for row in data: + del row[col_num - index] + del columns[col_num - index] + index += 1 + # frappe.msgprint(str(columns) + " " + str(data)) diff --git a/csf_tz/csf_tz/report/withholding_tax_payment_summary/__init__.py b/csf_tz/csf_tz/report/withholding_tax_payment_summary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.js b/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.js new file mode 100644 index 0000000..9ac0672 --- /dev/null +++ b/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.js @@ -0,0 +1,15 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Withholding Tax Payment Summary"] = { + "filters": [ + { + "fieldname": "rental", + "label": __("Rental"), + "fieldtype": "Select", + "options": "Commercial Rent\nResidential Rent", + "default": "Commercial Rent" + } + ] +}; \ No newline at end of file diff --git a/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.json b/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.json new file mode 100644 index 0000000..aa91cd3 --- /dev/null +++ b/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 0, + "creation": "2019-12-16 05:26:38.625694", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Viva Towers Official", + "modified": "2019-12-16 05:26:38.625694", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Withholding Tax Payment Summary", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Sales Invoice", + "report_name": "Withholding Tax Payment Summary", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.py b/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.py new file mode 100644 index 0000000..9f52308 --- /dev/null +++ b/csf_tz/csf_tz/report/withholding_tax_payment_summary/withholding_tax_payment_summary.py @@ -0,0 +1,44 @@ +# Copyright (c) 2013, Aakvatech and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +def execute(filters=None): + rental = filters.get("rental") + columns, data = get_columns(rental), [] + + sales_invoice_data = frappe.get_list("Sales Invoice", filters={"lease_item": rental}, fields=["*"]) + for i in sales_invoice_data: + tin_number = frappe.get_value("Customer", i.customer, "tax_id") + lease = frappe.get_value("Lease", i.lease, "property") + data.append({ + "date": i.posting_date, + "particulars": i.customer, + "voucher_ref": i.name, + "office_no" if rental == "Commercial Rent" else "apt": lease, + "period": str(i.from_date) + " to " + str(i.to_date) if i.from_date and i.to_date else "", + "rental_income": "$ " + str(i.total), + "withholding_tax_usd": "$ " + str(i.total / 10), + "withholding_tax_tzs": i.base_total / 10, + "control_sheet_no": i.tra_control_number or "", + "tax_certificate": i.witholding_tax_certificate_number, + "tin_number": tin_number or "", + + }) + return columns, data + +def get_columns(rental): + return [ + {"fieldname": "date","label": _("Date"),"fieldtype": "Date","width": 150}, + {"fieldname": "particulars","label": _("Particulars"),"fieldtype": "Link","options": "Customer","width": 300}, + {"fieldname": "voucher_ref","label": _("Voucher Ref."),"fieldtype": "Data","width": 180}, + {"fieldname": "office_no" if rental == "Commercial Rent" else "apt","label": _("Shop/Office No") if rental == "Commercial Rent" else "APT","fieldtype": "Data","width": 200}, + {"fieldname": "period","label": _("Period"),"fieldtype": "Data","width": 220}, + {"fieldname": "rental_income","label": _("Rental Income"),"fieldtype": "Data","options": "currency","width": 120}, + {"fieldname": "withholding_tax_usd","label": _("Withholding Tax USD"),"fieldtype": "Data","options": "currency","width": 180}, + {"fieldname": "withholding_tax_tzs","label": _("Withholding Tax TZS"),"fieldtype": "Currency","options": "currency","width": 180}, + {"fieldname": "control_sheet_no","label": _("Control Sheet No"),"fieldtype": "Data","width": 120}, + {"fieldname": "tax_certificate","label": _("Withholding Tax Certificate Number"),"fieldtype": "Data","width": 250 }, + {"fieldname": "tin_number","label": _("Tin Number"),"fieldtype": "Data","width": 300} + ] \ No newline at end of file diff --git a/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/__init__.py b/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/withholding_tax_summary_on_sales.js b/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/withholding_tax_summary_on_sales.js new file mode 100644 index 0000000..9d18b6e --- /dev/null +++ b/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/withholding_tax_summary_on_sales.js @@ -0,0 +1,20 @@ +// Copyright (c) 2016, Aakvatech +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Withholding Tax Summary on Sales"] = { + "filters": [ + { + "fieldname": "from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.defaults.get_user_default("year_start_date"), + }, + { + "fieldname": "to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.defaults.get_user_default("year_end_date"), + }, + ] +}; \ No newline at end of file diff --git a/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/withholding_tax_summary_on_sales.json b/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/withholding_tax_summary_on_sales.json new file mode 100644 index 0000000..b61e0b2 --- /dev/null +++ b/csf_tz/csf_tz/report/withholding_tax_summary_on_sales/withholding_tax_summary_on_sales.json @@ -0,0 +1,21 @@ +{ + "add_total_row": 1, + "creation": "2020-06-02 12:10:46.230266", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-06-09 12:56:05.577159", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Withholding Tax Summary on Sales", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT si.posting_date as \"Date:Date:\",\n sii.item_name as \"Perticulars:Data:\", \n si.name \"Voucher No:Link/Sales Invoice:\", \n sii.base_net_amount as \"Amount:Currency:\", \n sii.base_net_amount * (sii.withholding_tax_rate/100) as \"Withholding Tax:Currency:\",\n si.tra_control_number as \"Contol Number:Data:\",\n si.witholding_tax_certificate_number as \"Contol Number:Data:\",\n si.tax_id as \"TIN Number:Data:\"\nFROM `tabSales Invoice` si LEFT JOIN `tabSales Invoice Item` sii ON si.name = sii.parent \nWHERE si.docstatus = 1\nAND si.is_return = '0' \nAND sii.withholding_tax_rate > 0\nAND si.posting_date >= %(from_date)s \nAND si.posting_date <= %(to_date)s", + "ref_doctype": "Sales Invoice", + "report_name": "Withholding Tax Summary on Sales", + "report_type": "Query Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/withholding_tax_upload/__init__.py b/csf_tz/csf_tz/report/withholding_tax_upload/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csf_tz/report/withholding_tax_upload/withholding_tax_upload.json b/csf_tz/csf_tz/report/withholding_tax_upload/withholding_tax_upload.json new file mode 100644 index 0000000..0934a6e --- /dev/null +++ b/csf_tz/csf_tz/report/withholding_tax_upload/withholding_tax_upload.json @@ -0,0 +1,21 @@ +{ + "add_total_row": 1, + "creation": "2021-01-07 11:27:07.803998", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2021-01-07 11:27:13.787510", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Withholding Tax Upload", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT company AS COMPANY_CODE,\r\nREPLACE(tin, ' ', '') AS WITHHOLDER_TIN,\r\nREPLACE(pi.tax_id, '-', '') AS WITHHOLDEE_TIN,\r\nsupplier AS WITHHOLDEE_NAME,\r\nposting_date AS DATE_OF_DEDUCTION,\r\nbill_no AS INVOICE_NUMBER,\r\n'11122111' AS GFS_CODE,\r\ndescription AS DESCRIPTION,\r\n'TZS' AS CURRENCY,\r\nbase_net_amount AS GROSS,\r\nwithholding_tax_rate AS RATE,\r\nbase_net_amount * withholding_tax_rate / 100 AS TAX_WITHHELD\r\nFROM `tabPurchase Invoice` pi INNER JOIN `tabPurchase Invoice Item` pit ON pi.name = pit.parent\r\n INNER JOIN `tabCompany` c ON pi.company = c.name\r\nWHERE pi.docstatus = 1 AND pit.withholding_tax_rate != 0", + "ref_doctype": "Purchase Invoice", + "report_name": "Withholding Tax Upload", + "report_type": "Query Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/salary_slip.js b/csf_tz/csf_tz/salary_slip.js new file mode 100644 index 0000000..33177cf --- /dev/null +++ b/csf_tz/csf_tz/salary_slip.js @@ -0,0 +1,27 @@ +frappe.ui.form.on("Salary Slip", { + setup: function(frm) { + frm.trigger("create_update_slip_btn"); + + }, + refresh:function(frm) { + frm.trigger("create_update_slip_btn"); + }, + create_update_slip_btn: function (frm) { + if (frm.doc.docstatus != 0 || frm.is_new()) { + return + } + frm.add_custom_button(__("Update Salary Slip"), function() { + frappe.call({ + method: 'csf_tz.csftz_hooks.payroll.update_slip', + args: { + salary_slip: frm.doc.name, + }, + callback: function(r) { + if (r.message) { + frm.reload_doc(); + } + } + }); + }); + }, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/sales_invoice.js b/csf_tz/csf_tz/sales_invoice.js new file mode 100644 index 0000000..9ecb359 --- /dev/null +++ b/csf_tz/csf_tz/sales_invoice.js @@ -0,0 +1,428 @@ +frappe.ui.form.on("Sales Invoice", { + setup: function (frm) { + + // frm.trigger("update_stock"); + }, + refresh: function (frm) { + frm.trigger("set_pos"); + frm.trigger("make_sales_invoice_btn"); + + }, + onload: function (frm) { + frm.trigger("set_pos"); + if (frm.doc.document_status == "Draft") { + if (frm.doc.is_return == "0") { + frm.set_value("naming_series", "ACC-SINV-.YYYY.-"); + } + else if (frm.doc.is_return == "1") { + frm.set_value("naming_series", "ACC-CN-.YYYY.-"); + frm.set_value("select_print_heading", "CREDIT NOTE"); + } + } + // frm.trigger("update_stock"); + }, + customer: function (frm) { + setTimeout(function () { + if (!frm.doc.customer) { + return + } + if (!frm.doc.tax_category) { + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function (r) { + if (!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, + default_item_discount: function (frm) { + frm.doc.items.forEach(item => { + frappe.model.set_value(item.doctype, item.name, 'discount_percentage', frm.doc.default_item_discount); + }); + }, + default_item_tax_template: function (frm) { + frm.doc.items.forEach(item => { + frappe.model.set_value(item.doctype, item.name, 'item_tax_template', frm.doc.default_item_tax_template); + }); + }, + // update_stock: (frm) => { + // const warehouse_field = frappe.meta.get_docfield("Sales Invoice Item", "warehouse", frm.doc.name); + // const item_field = frappe.meta.get_docfield("Sales Invoice Item", "item_code", frm.doc.name); + // const qty_field = frappe.meta.get_docfield("Sales Invoice Item", "qty", frm.doc.name); + // if (frm.doc.update_stock){ + // warehouse_field.in_list_view = 1; + // warehouse_field.idx = 3; + // warehouse_field.columns = 2; + // item_field.columns =3; + // qty_field.columns =1; + // refresh_field("items"); + // }else{ + // warehouse_field.in_list_view = 0; + // warehouse_field.columns = 0; + // item_field.columns =4; + // qty_field.columns =2; + // refresh_field("items"); + // } + // }, + make_sales_invoice_btn: function (frm) { + if (frm.doc.docstatus == 1 && frm.doc.enabled_auto_create_delivery_notes == 1) { + frm.add_custom_button(__('Create Delivery Note'), + + function () { + frappe.call({ + method: "csf_tz.custom_api.create_delivery_note", + args: { + doc_name: frm.doc.name, + method: 1, + }, + }); + }); + } + }, + set_pos: function (frm) { + frappe.db.get_value("CSF TZ Settings", {}, "auto_pos_for_role").then(r => { + if (r.message) { + if ( + frappe.user_roles.includes(r.message.auto_pos_for_role) && + frm.doc.docstatus == 0 && + frappe.session.user != 'Administrator' && + frm.doc.is_pos != 1 + ) { + frm.set_value("is_pos", true); + frm.set_df_property("is_pos", "read_only", true); + } + } + }); + }, +}); + +frappe.ui.form.on("Sales Invoice Item", { + item_code: function (frm, cdt, cdn) { + validate_item_remaining_qty(frm, cdt, cdn); + }, + qty: function (frm, cdt, cdn) { + validate_item_remaining_qty(frm, cdt, cdn); + }, + stock_qty: function (frm, cdt, cdn) { + validate_item_remaining_stock_qty(frm, cdt, cdn); + }, + uom: function (frm, cdt, cdn) { + validate_item_remaining_qty(frm, cdt, cdn); + }, + allow_over_sell: function (frm, cdt, cdn) { + validate_item_remaining_stock_qty(frm, cdt, cdn); + }, + conversion_factor: function (frm, cdt, cdn) { + validate_item_remaining_stock_qty(frm, cdt, cdn); + }, + warehouse: function (frm, cdt, cdn) { + validate_item_remaining_stock_qty(frm, cdt, cdn); + }, + csf_tz_create_wtax_entry: (frm, cdt, cdn) => { + frappe.call('csf_tz.custom_api.make_withholding_tax_gl_entries_for_sales', { + doc: frm.doc, method: 'From Front End' + }).then(r => { + frm.refresh(); + }) + } +}); + +var validate_item_remaining_qty = function (frm, cdt, cdn) { + const item_row = locals[cdt][cdn]; + if (item_row.item_code == null) { return } + if (item_row.allow_over_sell == 1) { return } + const conversion_factor = get_conversion_factor(item_row, item_row.item_code, item_row.uom); + frappe.call({ + method: 'csf_tz.custom_api.validate_item_remaining_qty', + args: { + item_code: item_row.item_code, + company: frm.doc.company, + warehouse: item_row.warehouse, + stock_qty: item_row.qty * conversion_factor, + so_detail: item_row.so_detail, + }, + async: false, + }); +}; + +var validate_item_remaining_stock_qty = function (frm, cdt, cdn) { + const item_row = locals[cdt][cdn]; + if (item_row.item_code == null) { return } + if (item_row.allow_over_sell == 1) { return } + frappe.call({ + method: 'csf_tz.custom_api.validate_item_remaining_qty', + args: { + item_code: item_row.item_code, + company: frm.doc.company, + warehouse: item_row.warehouse, + stock_qty: item_row.stock_qty, + }, + async: false, + }); +}; + + +var get_conversion_factor = function (item_row, item_code, uom) { + if (item_code && uom) { + let conversion_factor = 0; + frappe.call({ + method: "erpnext.stock.get_item_details.get_conversion_factor", + child: item_row, + args: { + item_code: item_code, + uom: uom + }, + async: false, + callback: function (r) { + if (!r.exc) { + + conversion_factor = r.message.conversion_factor + } + } + }); + return conversion_factor + } +}; + +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+q', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Sales Invoice Item"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_info', + args: { item_code: item_row.item_code }, + callback: function (r) { + if (r.message.length > 0) { + const d = new frappe.ui.Dialog({ + title: __('Item Balance'), + width: 600 + }); + $(``).appendTo(d.body); + const thead = $(d.body).find('thead'); + if (r.message[0].batch_no) { + r.message.sort((a, b) => a.expiry_status - b.expiry_status); + $(` + Check + Warehouse + Qty + UOM + Batch No + Expires On + Expires in Days + `).appendTo(thead); + } else { + $(` + Check + Warehouse + Qty + UOM + `).appendTo(thead); + } + r.message.forEach(element => { + const tbody = $(d.body).find('tbody'); + const tr = $(` + + + ${element.warehouse} + ${element.actual_qty} + ${item_row.stock_uom} + + `).appendTo(tbody); + if (element.batch_no) { + $(` + ${element.batch_no} + ${element.expires_on} + ${element.expiry_status} + `).appendTo(tr); + tr.find('.check-warehouse').attr('data-batch', element.batch_no); + tr.find('.check-warehouse').attr('data-batchQty', element.actual_qty); + } + tbody.find('.check-warehouse').on('change', function () { + $('input.check-warehouse').not(this).prop('checked', false); + }); + }); + d.set_primary_action("Select", function () { + $(d.body).find('input:checked').each(function (i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 'warehouse', $(input).attr('data-warehouse')); + if ($(input).attr('data-batch')) { + frappe.model.set_value(item_row.doctype, item_row.name, 'batch_no', $(input).attr('data-batch')); + } + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = d; + d.show(); + } + else { + frappe.show_alert({ message: __('There are no records'), indicator: 'red' }, 5); + } + } + }); + }, + page: this.page, + description: __('Select Item Warehouse'), + ignore_inputs: true, +}); + + +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+i', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Sales Invoice Item"][current_doc]; + new frappe.ui.form.SelectDialog({ + target: cur_frm, + title: "Select The Rate", + multi_select: 0, + date_field: "posting_date", + query_fields: [ + { + fieldname: "rate", + fieldtype: "Currency", + label: "Rate", + options: "currency", + precision: "2", + filter: 0 + }, + { + fieldname: "qty", + fieldtype: "Float", + label: "Qty", + filter: 0 + }, + { + fieldname: "invoice", + fieldtype: "Link", + label: "Invoice", + options: "Sales Invoice", + filter: 0 + }, + { + default: cur_frm.doc.customer, + fieldname: "customer", + fieldtype: "Link", + label: "Customer", + options: "Customer", + filter: 1 + }, + + ], + get_query() { + return { + filters: { + item_code: item_row.item_code, + customer: "", + currency: cur_frm.doc.currency, + company: cur_frm.doc.company + }, + query: "csf_tz.custom_api.get_item_prices_custom", + } + }, + return_field: "rate", + action(selections) { + console.log(selections); + frappe.model.set_value(item_row.doctype, item_row.name, 'rate', selections[0]); + cur_frm.refresh_fields(); + + } + }); + }, + page: this.page, + description: __('Select Customer Item Price'), + ignore_inputs: true, +}); + + +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+u', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Sales Invoice Item"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_prices', + args: { + item_code: item_row.item_code, + currency: cur_frm.doc.currency, + company: cur_frm.doc.company + }, + callback: function (r) { + if (r.message.length > 0) { + const e = new frappe.ui.Dialog({ + title: __('Item Prices'), + width: 600 + }); + $(``).appendTo(e.body); + const thead = $(e.body).find('thead'); + $(` + Check + Rate + Qty + Date + Invoice + Customer + `).appendTo(thead); + r.message.forEach(element => { + const tbody = $(e.body).find('tbody'); + const tr = $(` + + + ${element.price} + ${element.qty} + ${element.date} + ${element.invoice} + ${element.customer} + + `).appendTo(tbody); + + tbody.find('.check-rate').on('change', function () { + $('input.check-rate').not(this).prop('checked', false); + }); + }); + e.set_primary_action("Select", function () { + $(e.body).find('input:checked').each(function (i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 'rate', $(input).attr('data-rate')); + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = e; + e.show(); + } + else { + frappe.show_alert({ message: __('There are no records'), indicator: 'red' }, 5); + } + } + }); + }, + page: this.page, + description: __('Select Item Price'), + ignore_inputs: true, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/sales_order.js b/csf_tz/csf_tz/sales_order.js new file mode 100644 index 0000000..6a25075 --- /dev/null +++ b/csf_tz/csf_tz/sales_order.js @@ -0,0 +1,274 @@ +frappe.ui.form.on("Sales Order", { + customer: function(frm) { + if (!frm.doc.customer) { + return + } + setTimeout(function() { + if (!frm.doc.tax_category){ + frappe.call({ + method: "csf_tz.custom_api.get_tax_category", + args: { + doc_type: frm.doc.doctype, + company: frm.doc.company, + }, + callback: function(r) { + if(!r.exc) { + frm.set_value("tax_category", r.message); + frm.trigger("tax_category"); + } + } + }); + } + }, 1000); + }, + default_item_discount: function (frm) { + frm.doc.items.forEach(item => { + frappe.model.set_value(item.doctype, item.name, 'discount_percentage', frm.doc.default_item_discount); + }); + },}); + +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+q', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Sales Order Item"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_info', + args: {item_code: item_row.item_code}, + callback: function(r) { + if (r.message.length > 0){ + const d = new frappe.ui.Dialog({ + title: __('Item Balance'), + width: 600 + }); + $(``).appendTo(d.body); + const thead = $(d.body).find('thead'); + if (r.message[0].batch_no){ + r.message.sort((a,b) => a.expiry_status-b.expiry_status); + $(` + Check + Warehouse + Qty + UOM + Batch No + Expires On + Expires in Days + `).appendTo(thead); + } else { + $(` + Check + Warehouse + Qty + UOM + `).appendTo(thead); + } + r.message.forEach(element => { + const tbody = $(d.body).find('tbody'); + const tr = $(` + + + ${element.warehouse} + ${element.actual_qty} + ${item_row.stock_uom } + + `).appendTo(tbody); + if (element.batch_no) { + $(` + ${element.batch_no} + ${element.expires_on} + ${element.expiry_status } + `).appendTo(tr); + tr.find('.check-warehouse').attr('data-batch',element.batch_no); + tr.find('.check-warehouse').attr('data-batchQty',element.actual_qty); + } + tbody.find('.check-warehouse').on('change', function() { + $('input.check-warehouse').not(this).prop('checked', false); + }); + }); + d.set_primary_action("Select", function() { + $(d.body).find('input:checked').each(function(i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 'warehouse', $(input).attr('data-warehouse')); + if ($(input).attr('data-batch')) { + frappe.model.set_value(item_row.doctype, item_row.name, 'batch_no', $(input).attr('data-batch')); + } + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = d; + d.show(); + } + else { + frappe.show_alert({message:__('There are no records'), indicator:'red'}, 5); + } + } + }); + }, + page: this.page, + description: __('Select Item Warehouse'), + ignore_inputs: true, +}); + + +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+i', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Sales Order Item"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_prices', + args: { + item_code: item_row.item_code, + customer: cur_frm.doc.customer, + currency: cur_frm.doc.currency, + company: cur_frm.doc.company + }, + callback: function(r) { + if (r.message.length > 0){ + const c = new frappe.ui.Dialog({ + title: __('Item Prices'), + width: 600 + }); + $(``).appendTo(c.body); + const thead = $(c.body).find('thead'); + // if (r.message[0].rate){ + // r.message.sort((a,b) => a.expiry_status-b.expiry_status); + $(` + Check + Rate + Qty + Date + Invoice + Customer + `).appendTo(thead); + // } + r.message.forEach(element => { + const tbody = $(c.body).find('tbody'); + const tr = $(` + + + ${element.price} + ${element.qty} + ${element.date } + ${element.invoice } + ${element.customer } + + `).appendTo(tbody); + + tbody.find('.check-rate').on('change', function() { + $('input.check-rate').not(this).prop('checked', false); + }); + }); + c.set_primary_action("Select", function() { + $(c.body).find('input:checked').each(function(i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 'rate', $(input).attr('data-rate')); + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = c; + c.show(); + } + else { + frappe.show_alert({message:__('There are no records'), indicator:'red'}, 5); + } + } + }); + }, + page: this.page, + description: __('Select Customer Item Price'), + ignore_inputs: true, +}); + +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+u', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Sales Order Item"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_prices', + args: { + item_code: item_row.item_code, + currency: cur_frm.doc.currency, + company: cur_frm.doc.company + }, + callback: function(r) { + if (r.message.length > 0){ + const e = new frappe.ui.Dialog({ + title: __('Item Prices'), + width: 600 + }); + $(``).appendTo(e.body); + const thead = $(e.body).find('thead'); + $(` + Check + Rate + Qty + Date + Invoice + Customer + `).appendTo(thead); + r.message.forEach(element => { + const tbody = $(e.body).find('tbody'); + const tr = $(` + + + ${element.price} + ${element.qty} + ${element.date } + ${element.invoice } + ${element.customer } + + `).appendTo(tbody); + + tbody.find('.check-rate').on('change', function() { + $('input.check-rate').not(this).prop('checked', false); + }); + }); + e.set_primary_action("Select", function() { + $(e.body).find('input:checked').each(function(i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 'rate', $(input).attr('data-rate')); + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = e; + e.show(); + } + else { + frappe.show_alert({message:__('There are no records'), indicator:'red'}, 5); + } + } + }); + }, + page: this.page, + description: __('Select Item Price'), + ignore_inputs: true, +}); diff --git a/csf_tz/csf_tz/stock_entry.js b/csf_tz/csf_tz/stock_entry.js new file mode 100644 index 0000000..9a37bfd --- /dev/null +++ b/csf_tz/csf_tz/stock_entry.js @@ -0,0 +1,209 @@ +frappe.ui.form.on("Stock Entry", { + setup: function(frm) { + if(me.frm.fields_dict["items"]) { + me["items_remove"] = me.calculate_net_weight; + } + frm.trigger("set_warehouse_options"); + }, + onload: function(frm) { + if (frm.docstatus == 0) { + frm.trigger("stock_entry_type"); + frm.set_query("repack_template", function() { + return { + "filters": { + "docstatus": 1 + } + }; + }); + frm.trigger("set_warehouse_options"); + } + }, + company: function (frm) { + frm.trigger("set_warehouse_options"); + }, + repack_template: function(frm) { + frm.trigger("get_repack_template"); + }, + repack_qty: function(frm) { + frm.trigger("get_repack_template"); + }, + get_repack_template: function(frm) { + if (!frm.doc.repack_template || !frm.doc.repack_qty){return} + frappe.call({ + method: 'csf_tz.custom_api.get_repack_template', + args: { + template_name: frm.doc.repack_template, + qty: frm.doc.repack_qty, + }, + callback: function(r) { + frm.clear_table("items"); + r.message.forEach(d => { + const child = frm.add_child("items"); + frappe.model.set_value(child.doctype, child.name, "item_code", d.item_code) + frappe.model.set_value(child.doctype, child.name, "qty", d.qty) + frappe.model.set_value(child.doctype, child.name, "uom", d.item_uom) + if (d.s_warehouse) { + frappe.model.set_value(child.doctype, child.name, "s_warehouse", d.s_warehouse) + } + if (d.t_warehouse) { + frappe.model.set_value(child.doctype, child.name, "t_warehouse", d.t_warehouse) + } + }); + + } + }); + frm.refresh_field("items"); + }, + stock_entry_type: function(frm) { + if (frm.doc.stock_entry_type == "Repack from template") { + frappe.meta.get_docfield("Stock Entry Detail", "item_code", frm.doc.name).read_only = 1; + frappe.meta.get_docfield("Stock Entry Detail", "item_group", frm.doc.name).read_only = 1; + $('.grid-add-multiple-rows').hide(); + $('.grid-add-row').hide(); + $('.grid-remove-rows').hide(); + $('.grid-download').hide(); + $('.grid-upload').hide(); + frm.toggle_reqd("qty", frm.doc.stock_entry_type == "Repack from template" ? 1:0); + } else { + frappe.meta.get_docfield("Stock Entry Detail", "item_code", frm.doc.name).read_only = 0; + frappe.meta.get_docfield("Stock Entry Detail", "item_group", frm.doc.name).read_only = 0; + $('.grid-add-multiple-rows').show(); + $('.grid-add-row').show(); + $('.grid-remove-rows').show(); + $('.grid-download').show(); + $('.grid-upload').show(); + frm.toggle_reqd("qty", frm.doc.stock_entry_type == "Repack from template" ? 1:0); + } + if (["Repack from template","Manufacture"].includes(frm.doc.stock_entry_type)) { + frm.set_df_property('total_net_weight', 'hidden', 1) + } + else { + frm.set_df_property('total_net_weight', 'hidden', 0) + } + frm.refresh_field("items"); + frm.refresh(); + }, + calculate_net_weight: function(frm){ + frm.doc.total_net_weight= 0.0; + + $.each(frm.doc["items"] || [], function(i, item) { + frm.doc.total_net_weight += flt(item.total_weight); + }); + refresh_field("total_net_weight"); + }, + set_warehouse_options: function(frm) { + frappe.call({ + "method": "csf_tz.custom_api.get_warehouse_options", + "args":{company:frm.doc.company}, + callback: function(r) { + if(r.message && r.message.length) { + // frappe.meta.get_docfield("ModulesT", "module", frm.doc.name).options = r.message; + // frm.get_docfield("taxes", "rate").reqd = 0; + frm.set_df_property("final_destination", "options", r.message); + } + } + }); + }, +}); + +frappe.ui.form.on("Stock Entry Detail", { + conversion_factor: function(frm, cdt, cdn){ + var item = frappe.get_doc(cdt, cdn); + item.total_weight = flt(item.transfer_qty * item.weight_per_unit * item.conversion_factor); + refresh_field("total_weight"); + frm.trigger("calculate_net_weight"); + }, + qty: function(frm, cdt, cdn) { + frm.script_manager.trigger("conversion_factor",cdt,cdn); + }, +}); +frappe.ui.keys.add_shortcut({ + shortcut: 'ctrl+q', + action: () => { + const current_doc = $('.data-row.editable-row').parent().attr("data-name"); + const item_row = locals["Stock Entry Detail"][current_doc]; + frappe.call({ + method: 'csf_tz.custom_api.get_item_info', + args: {item_code: item_row.item_code}, + callback: function(r) { + if (r.message.length > 0){ + const d = new frappe.ui.Dialog({ + title: __('Item Balance'), + width: 600 + }); + $(``).appendTo(d.body); + const thead = $(d.body).find('thead'); + if (r.message[0].batch_no){ + r.message.sort((a,b) => a.expiry_status-b.expiry_status); + $(` + Check + Warehouse + Qty + UOM + Batch No + Expires On + Expires in Days + `).appendTo(thead); + } else { + $(` + Check + Warehouse + Qty + UOM + `).appendTo(thead); + } + r.message.forEach(element => { + const tbody = $(d.body).find('tbody'); + const tr = $(` + + + ${element.warehouse} + ${element.actual_qty} + ${item_row.stock_uom } + + `).appendTo(tbody); + if (element.batch_no) { + $(` + ${element.batch_no} + ${element.expires_on} + ${element.expiry_status } + `).appendTo(tr); + tr.find('.check-warehouse').attr('data-batch',element.batch_no); + tr.find('.check-warehouse').attr('data-batchQty',element.actual_qty); + } + tbody.find('.check-warehouse').on('change', function() { + $('input.check-warehouse').not(this).prop('checked', false); + }); + }); + d.set_primary_action("Select", function() { + $(d.body).find('input:checked').each(function(i, input) { + frappe.model.set_value(item_row.doctype, item_row.name, 's_warehouse', $(input).attr('data-warehouse')); + if ($(input).attr('data-batch')) { + frappe.model.set_value(item_row.doctype, item_row.name, 'batch_no', $(input).attr('data-batch')); + } + }); + cur_frm.rec_dialog.hide(); + cur_frm.refresh_fields(); + }); + cur_frm.rec_dialog = d; + d.show(); + } + else { + frappe.show_alert({message:__('There is No Records'), indicator:'red'}, 5); + } + } + }); + }, + page: this.page, + description: __('Select Item Warehouse'), + ignore_inputs: true, +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/stock_reconciliation.js b/csf_tz/csf_tz/stock_reconciliation.js new file mode 100644 index 0000000..0522fce --- /dev/null +++ b/csf_tz/csf_tz/stock_reconciliation.js @@ -0,0 +1,11 @@ +frappe.ui.form.on('Stock Reconciliation', { + sort_items: function (frm, cdt, cdn) { + const sorted_list =frm.doc.items.sort((a,b) => (a.item_code > b.item_code) ? 1 : -1); + sorted_list.forEach((i,idx) => { + const row = locals["Stock Reconciliation Item"][i.name]; + row.idx = idx + 1; + }); + refresh_field("items"); + }, + +}) diff --git a/csf_tz/csf_tz/student_applicant.js b/csf_tz/csf_tz/student_applicant.js new file mode 100644 index 0000000..a21b970 --- /dev/null +++ b/csf_tz/csf_tz/student_applicant.js @@ -0,0 +1,37 @@ +frappe.ui.form.on('Student Applicant', { + onload: function(frm) { + frm.trigger("setup_btns"); + }, + refresh: function(frm) { + frm.trigger("setup_btns"); + }, + setup_btns: function(frm) { + if (!frm.send_fee_details_to_bank) { + return; + } + if(frm.doc.docstatus == 1 && frm.doc.application_status != "Approved") { + frm.clear_custom_buttons(); + if(frm.doc.application_status == "Applied") { + frm.add_custom_button(__("Reject"), function() { + frm.set_value("application_status", "Rejected"); + frm.save_or_update(); + }, 'Student Applicant Actions'); + } + if(["Applied", "Rejected"].includes(frm.doc.application_status)) { + frm.add_custom_button(__("Awaiting Registration Fees"), function() { + frm.set_value("application_status", "Awaiting Registration Fees"); + frm.save_or_update(); + }, 'Student Applicant Actions'); + } + } + }, + setup: function(frm) { + frappe.db.get_value('Fee Structure', frm.doc.fee_structure, ["company"], function(value1) { + frappe.db.get_value('Company', value1.company, ["send_fee_details_to_bank"], function(value2) { + frm.send_fee_details_to_bank = value2.send_fee_details_to_bank || 0; + + }); + }); + }, + +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/supplier.js b/csf_tz/csf_tz/supplier.js new file mode 100644 index 0000000..cb89dc1 --- /dev/null +++ b/csf_tz/csf_tz/supplier.js @@ -0,0 +1,21 @@ +// Copyright (c) 2016, Aakvatech and contributors +// For license information, please see license.txt +/* eslint-disable */ + + +frappe.ui.form.on("Supplier", { + + + refresh: function(frm) { + + if(!frm.doc.__islocal) { + // custom buttons + frm.add_custom_button(__('Multi-Currency Ledger'), function() { + frappe.set_route('query-report', 'Multi-Currency Ledger', + {party_type:'Supplier', party:frm.doc.name}); + }); + + } + }, + +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/warehouse.js b/csf_tz/csf_tz/warehouse.js new file mode 100644 index 0000000..4835eb8 --- /dev/null +++ b/csf_tz/csf_tz/warehouse.js @@ -0,0 +1,14 @@ +frappe.ui.form.on("Warehouse", { + + refresh: function(frm, dt, dn) { + + frm.add_custom_button(__('Create Stock Reconciliation'), + function() { + frappe.call({ + method: 'csf_tz.custom_api.make_stock_reconciliation_for_all_pending_material_request', + }); + }); + + }, + +}); \ No newline at end of file diff --git a/csf_tz/csf_tz/workspace/piece_work/piece_work.json b/csf_tz/csf_tz/workspace/piece_work/piece_work.json new file mode 100644 index 0000000..432946a --- /dev/null +++ b/csf_tz/csf_tz/workspace/piece_work/piece_work.json @@ -0,0 +1,113 @@ +{ + "category": "Modules", + "charts": [], + "creation": "2021-10-08 12:19:16.514999", + "developer_mode_only": 0, + "disable_user_customization": 0, + "docstatus": 0, + "doctype": "Workspace", + "extends_another_page": 0, + "hide_custom": 1, + "idx": 0, + "is_default": 0, + "is_standard": 1, + "label": "Piece work", + "links": [ + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Single Piecework", + "link_to": "Piecework Single", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Group Piecework", + "link_to": "Piecework", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Salary Disbursement", + "link_to": "Piecework Salary Disbursement", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Setup", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework Type", + "link_to": "Piecework Type", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Reports", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework Net Pay", + "link_to": "Piecework Net Pay", + "link_type": "Report", + "onboard": 0, + "type": "Link" + } + ], + "modified": "2021-10-08 12:19:16.514999", + "modified_by": "Administrator", + "module": "CSF TZ", + "name": "Piece work", + "owner": "Administrator", + "pin_to_bottom": 0, + "pin_to_top": 0, + "shortcuts": [ + { + "doc_view": "", + "label": "Single Piecework", + "link_to": "Piecework Single", + "type": "DocType" + }, + { + "doc_view": "", + "label": "Group Piecework", + "link_to": "Piecework", + "type": "DocType" + }, + { + "doc_view": "", + "label": "Salary Disbursement", + "link_to": "Piecework Salary Disbursement", + "type": "DocType" + } + ] +} \ No newline at end of file diff --git a/csf_tz/csf_tz/workspace/tanzania/tanzania.json b/csf_tz/csf_tz/workspace/tanzania/tanzania.json new file mode 100644 index 0000000..5a514d3 --- /dev/null +++ b/csf_tz/csf_tz/workspace/tanzania/tanzania.json @@ -0,0 +1,654 @@ +{ + "category": "Domains", + "charts": [], + "creation": "2021-07-03 11:42:22.359205", + "developer_mode_only": 0, + "disable_user_customization": 0, + "docstatus": 0, + "doctype": "Workspace", + "extends_another_page": 0, + "hide_custom": 1, + "icon": "drag", + "idx": 0, + "is_default": 0, + "is_standard": 1, + "label": "Tanzania", + "links": [ + { + "hidden": 0, + "is_query_report": 0, + "label": "NSSF", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "NSSF/CON.05", + "link_to": "NSSF-CON.05", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "NSSF CON5 - Online Version", + "link_to": "NSSF CON5 Monthly Contribution - Online Version", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TRA - PAYE", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "ITX.219.03.E PAYE Returns (efiling)", + "link_to": "ITX.219.03.E Statement of Tax Withheld", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "ITX.215.01.E PAY Half Yearly Returns (Part 1)", + "link_to": "ITX 215.01.E - PAYE Withheld Part 1", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "ITX.215.01.E PAY Half Yearly Returns (Part 2)", + "link_to": "ITX 215.01.E - PAYE Withheld Part 2", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TRA - SDL", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "ITX.215.03.E SDL Returns (efiling)", + "link_to": "ITX.215.03.E SDL Monthly Returns", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "ITX 220.01.E SDL Half Yearly Certificate", + "link_to": "ITX 220.01.E - Employer\u2019s Half Year Certificate", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TRA - Withholding Tax", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TRA - VAT", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "WCF", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "WCF Monthly Returns", + "link_to": "WCF-3", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "HESLB", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 1, + "label": "HESLB Return", + "link_to": "HESLB Return online", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Setting", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Payware Settings", + "link_to": "Payware Settings", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "AV Customization", + "link_to": "AV Customization", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "CSF API Response Log", + "link_to": "CSF API Response Log", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "CSF TZ Settings", + "link_to": "CSF TZ Settings", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Consignment", + "link_to": "", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Vehicle Consignment", + "link_to": "Vehicle Consignment", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Work Order Consignment", + "link_to": "Work Order Consignment", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Ordered vs Received", + "link_to": "Ordered vs Received", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Location", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TZ Village", + "link_to": "TZ Village", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TZ Wards", + "link_to": "TZ Ward", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TZ Regions", + "link_to": "TZ Region", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "TZ District", + "link_to": "TZ District", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Payments", + "link_to": "", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Vehicle Fine Record", + "link_to": "Vehicle Fine Record", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Expense Record", + "link_to": "Expense Record", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Expense Type", + "link_to": "Expense Type", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Supplier Ledger Summary Multicurrency", + "link_to": "Supplier Ledger Summary Multicurrency", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Single Piecework", + "link_to": "Piecework Single", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Group Piecework", + "link_to": "Piecework", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework Payment Allocation", + "link_to": "Piecework Payment Allocation", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework Salary Disbursement", + "link_to": "Piecework Salary Disbursement", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework Net Pay", + "link_to": "Piecework Net Pay", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework Payment", + "link_to": "Piecework Payment", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Piecework by Employee", + "link_to": "Piecework by Employee", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Employee Reports", + "link_to": "", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Employee Checkin & Checkout Report", + "link_to": "Employee Checkin & Checkout Report", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Monthly Timesheet Report", + "link_to": "Monthly Timesheet Report", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Monthly Attendance Sheet", + "link_to": "Monthly Attendance Sheet", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Salary Register CTC", + "link_to": "Salary Register CTC", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Salary Register", + "link_to": "Salary Register csf", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Salary Register Summary", + "link_to": "Salary Register Summary", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Salary Register Summary with Components", + "link_to": "Salary Register Summary with Components", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Email Salary Slips", + "link_to": "Email Salary Slips", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Ledger Reports", + "link_to": "", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Supplier Ledger Summary", + "link_to": "Supplier Ledger Summary", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Customer Ledger Summary", + "link_to": "Customer Ledger Summary", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Stock Ledger ", + "link_to": "Stock Ledger Mismatch", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "General Ledger Pro", + "link_to": "General Ledger Pro", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Multi-Currency Ledger", + "link_to": "Multi-Currency Ledger", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Accounting", + "link_type": "DocType", + "onboard": 0, + "type": "Card Break" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Payment Reconciliation Pro", + "link_to": "Payment Reconciliation Pro", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Bank Clearance Pro", + "link_to": "Bank Clearance Pro", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Special Closing Balance", + "link_to": "Special Closing Balance", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "NMB Callback", + "link_to": "NMB Callback", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Loan Outstanding", + "link_to": "Loan Outstanding", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Gross Profit Pro", + "link_to": "Gross Profit Pro", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Credit Note List", + "link_to": "Credit Note List", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Sales Report by Type", + "link_to": "Sales Report by Type", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Purchase Report by Type", + "link_to": "Purchase Report by Type", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "USD Trial Balance Report", + "link_to": "Trial Balance Report in USD", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Purchase Reports by Tax Category", + "link_to": "Purchase Reports by Tax Category", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Purchase Reports by Tax Category", + "link_to": "Purchase Reports by Tax Category", + "link_type": "Report", + "onboard": 0, + "type": "Link" + } + ], + "modified": "2022-02-16 16:47:27.327968", + "modified_by": "mohammedt243@gmail.com", + "module": "CSF TZ", + "name": "Tanzania", + "owner": "Administrator", + "pin_to_bottom": 0, + "pin_to_top": 0, + "shortcuts": [] +} \ No newline at end of file diff --git a/csf_tz/csftz_hooks/__init__.py b/csf_tz/csftz_hooks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/csftz_hooks/custom_docperm.py b/csf_tz/csftz_hooks/custom_docperm.py new file mode 100644 index 0000000..db0e2c0 --- /dev/null +++ b/csf_tz/csftz_hooks/custom_docperm.py @@ -0,0 +1,62 @@ +import frappe +from frappe import _ +from frappe.utils.csvutils import getlink +from frappe.model import core_doctypes_list + + +def grant_dependant_access(doc, method): + if frappe.flags.in_install or frappe.flags.in_migrate: + return + enable_dependent_auto_permission = frappe.db.get_single_value( + "CSF TZ Settings", "enable_dependent_auto_permission" + ) + if not enable_dependent_auto_permission: + return + if doc.dependent: + frappe.msgprint( + _( + "Warning! {0} is a dependant doctype. If you wish to change access to it, remove it and add again." + ).format(getlink("DocType", doc.parent)) + ) + return + fields = frappe.get_meta(doc.parent).fields + # console(fields) + doctypes_granted_access = [] + for field in fields: + if field.get("fieldtype") in ["Link"]: + if create_custom_docperm(field.options, doc.role, doc.parent): + doctypes_granted_access += [field.options] + if field.get("fieldtype") in ["Table"]: + child_fields = frappe.get_meta(field.options).fields + for child_field in child_fields: + if child_field.get("fieldtype") in ["Link"]: + if create_custom_docperm(child_field.options, doc.role, doc.parent): + doctypes_granted_access += [child_field.options] + + if len(doctypes_granted_access) > 0: + frappe.msgprint( + _( + "Auto granted SELECT access to the following doctypes: " + + str(doctypes_granted_access) + ) + ) + + +def create_custom_docperm(doctype, role, parent): + if doctype == parent or doctype in core_doctypes_list: + return + is_permission_exists = frappe.get_all( + "Custom DocPerm", filters={"parent": doctype, "role": role} + ) + if len(is_permission_exists) > 0: + return False + custom_docperm = frappe.new_doc("Custom DocPerm") + custom_docperm.parent = doctype + custom_docperm.role = role + custom_docperm.permlevel = 0 + custom_docperm.select = 1 + custom_docperm.read = 0 + custom_docperm.export = 0 + custom_docperm.dependent = 1 + custom_docperm.save() + return True diff --git a/csf_tz/csftz_hooks/get_relation_json.py b/csf_tz/csftz_hooks/get_relation_json.py new file mode 100644 index 0000000..8647e2f --- /dev/null +++ b/csf_tz/csftz_hooks/get_relation_json.py @@ -0,0 +1,32 @@ +import frappe +import json + +def get_json(): + + doc_list = frappe.db.sql( + """SELECT CONCAT_WS('.', "erpnext", dt.module, dt.name) as name, dt.name as doctype_name + FROM `tabDocType` dt + INNER JOIN `tabDocField` df ON dt.name = df.parent + WHERE df.options IS NOT NULL + AND df.fieldtype = "Link" + GROUP BY dt.module, dt.name + UNION ALL + SELECT CONCAT_WS('.', "erpnext", dt.module, dt.name) as name, dt.name as doctype_name + FROM `tabDocType` dt + INNER JOIN `tabCustom Field` df ON dt.name = df.parent + WHERE df.options IS NOT NULL + AND df.fieldtype = "Link" + GROUP BY dt.module, dt.name""", as_dict=1) + + for doc in doc_list: + docfield_list = frappe.get_all("DocField", filters={"parent": doc.doctype_name, "fieldtype": "Link"}, fields="options", group_by="options") + custom_field_list = frappe.get_all("Custom Field", filters={"parent": doc.doctype_name, "fieldtype": "Link"}, fields="options", group_by="options") + doc["imports"] = [] + for options in docfield_list: + options_string = "erpnext." + frappe.get_value("DocType", doc.doctype_name, "module") + "." + options.get("options") + doc["imports"].append(options_string) + for options in custom_field_list: + options_string = "erpnext." + frappe.get_value("DocType", doc.doctype_name, "module") + "." + options.get("options") + doc["imports"].append(options_string) + + return json.dumps(doc_list) diff --git a/csf_tz/csftz_hooks/get_successor_json.py b/csf_tz/csftz_hooks/get_successor_json.py new file mode 100644 index 0000000..93aeee7 --- /dev/null +++ b/csf_tz/csftz_hooks/get_successor_json.py @@ -0,0 +1,33 @@ +import frappe +import json + +def get_json(main_ancestor, ancestor_type="Accounts"): + doc_list = frappe.db.sql( + """SELECT CONCAT_WS('.', "erpnext", dt.module, dt.name) as name, dt.name as doctype_name + FROM `tabDocType` dt + INNER JOIN `tabDocField` df ON dt.name = df.parent + WHERE df.options IS NOT NULL + AND df.fieldtype = "Link" + AND dt.module = ancestor_type + GROUP BY dt.module, dt.name + UNION ALL + SELECT CONCAT_WS('.', "erpnext", dt.module, dt.name) as name, dt.name as doctype_name + FROM `tabDocType` dt + INNER JOIN `tabCustom Field` df ON dt.name = df.parent + WHERE df.options IS NOT NULL + AND df.fieldtype = "Link" + AND dt.module = ancestor_type + GROUP BY dt.module, dt.name""", as_dict=1) + + for doc in doc_list: + docfield_list = frappe.get_all("DocField", filters={"parent": doc.doctype_name, "fieldtype": "Link"}, fields="options", group_by="options") + custom_field_list = frappe.get_all("Custom Field", filters={"parent": doc.doctype_name, "fieldtype": "Link"}, fields="options", group_by="options") + doc["imports"] = [] + for options in docfield_list: + options_string = "erpnext." + frappe.get_value("DocType", doc.doctype_name, "module") + "." + options.get("options") + doc["imports"].append(options_string) + for options in custom_field_list: + options_string = "erpnext." + frappe.get_value("DocType", doc.doctype_name, "module") + "." + options.get("options") + doc["imports"].append(options_string) + + return json.dumps(doc_list) diff --git a/csf_tz/csftz_hooks/item_reposting.py b/csf_tz/csftz_hooks/item_reposting.py new file mode 100644 index 0000000..1ca799a --- /dev/null +++ b/csf_tz/csftz_hooks/item_reposting.py @@ -0,0 +1,83 @@ +import frappe +from frappe import _ +from frappe.utils import getdate, get_time, today +from erpnext.stock.stock_ledger import update_entries_after +from erpnext.accounts.utils import update_gl_entries_after +from frappe.utils.background_jobs import enqueue + +def execute(): + for doctype in ('repost_item_valuation', 'stock_entry_detail', 'purchase_receipt_item', + 'purchase_invoice_item', 'delivery_note_item', 'sales_invoice_item', 'packed_item'): + frappe.reload_doc('stock', 'doctype', doctype) + frappe.reload_doc('buying', 'doctype', 'purchase_receipt_item_supplied') + + sle_gle_reposting_start_date = frappe.get_value("CSF TZ Settings", "CSF TZ Settings", "sle_gle_reposting_start_date") + if not sle_gle_reposting_start_date: + frappe.throw(_("SLE GLE Reposting Start Date not set in {0}").format(frappe.utils.get_url_to_form("CSF TZ Settings", "CSF TZ Settings"))) + reposting_project_deployed_on = sle_gle_reposting_start_date + " 00:00:00" + posting_date = sle_gle_reposting_start_date + posting_time = '00:00:00' + + if posting_date == today(): + return + + frappe.clear_cache() + frappe.flags.warehouse_account_map = {} + + company_list = [] + + data = frappe.db.sql(''' + SELECT + name, item_code, warehouse, voucher_type, voucher_no, posting_date, posting_time, company + FROM + `tabStock Ledger Entry` + WHERE + creation > %s + and is_cancelled = 0 + ORDER BY timestamp(posting_date, posting_time) asc, creation asc + ''', reposting_project_deployed_on, as_dict=1) + + frappe.db.auto_commit_on_many_writes = 1 + print("Reposting Stock Ledger Entries...") + total_sle = len(data) + i = 0 + for d in data: + if d.company not in company_list: + company_list.append(d.company) + + update_entries_after({ + "item_code": d.item_code, + "warehouse": d.warehouse, + "posting_date": d.posting_date, + "posting_time": d.posting_time, + "voucher_type": d.voucher_type, + "voucher_no": d.voucher_no, + "sle_id": d.name + }, allow_negative_stock=True) + + i += 1 + if i%100 == 0: + print(i, "/", total_sle) + + + print("Reposting General Ledger Entries...") + + if data: + for row in frappe.get_all('Company', filters= {'enable_perpetual_inventory': 1}): + if row.name in company_list: + update_gl_entries_after(posting_date, posting_time, company=row.name) + + frappe.db.auto_commit_on_many_writes = 0 + +def get_creation_time(): + return frappe.db.sql(''' SELECT create_time FROM + INFORMATION_SCHEMA.TABLES where TABLE_NAME = "tabRepost Item Valuation" ''', as_list=1)[0][0] + +@frappe.whitelist() +def enqueue_reposting_sle_gle(): + sle_gle_reposting_start_date = frappe.get_value("CSF TZ Settings", "CSF TZ Settings", "sle_gle_reposting_start_date") + if not sle_gle_reposting_start_date: + frappe.throw(_("SLE GLE Reposting Start Date not set in {0}").format(frappe.utils.get_url_to_form("CSF TZ Settings", "CSF TZ Settings"))) + frappe.msgprint(_("Reposting of SLE and GLE started"), alert=True) + enqueue(method=execute, + queue='long', timeout=10000, is_async=True) diff --git a/csf_tz/csftz_hooks/items_revaluation.py b/csf_tz/csftz_hooks/items_revaluation.py new file mode 100644 index 0000000..d43b5da --- /dev/null +++ b/csf_tz/csftz_hooks/items_revaluation.py @@ -0,0 +1,88 @@ +import frappe +from frappe import _ +from frappe.utils import flt + + +@frappe.whitelist() +def get_data(filters): + filters = frappe._dict(filters) + data = get_stock_ledger_entries(filters) + itewise_balance_qty = {} + + for row in data: + key = (row.item_code, row.warehouse) + itewise_balance_qty.setdefault(key, []).append(row) + + res = validate_data(itewise_balance_qty) + return res + + +def validate_data(itewise_balance_qty): + res = [] + for key, data in itewise_balance_qty.items(): + row = get_incorrect_data(data) + if row: + res.append(row) + + return res + + +def get_incorrect_data(data): + balance_qty = 0.0 + for row in data: + balance_qty += row.actual_qty + if row.voucher_type == "Stock Reconciliation" and not row.batch_no: + balance_qty = flt(row.qty_after_transaction) + + row.expected_balance_qty = balance_qty + if abs(flt(row.expected_balance_qty) - flt(row.qty_after_transaction)) > 0.5: + row.differnce = abs( + flt(row.expected_balance_qty) - flt(row.qty_after_transaction) + ) + return row + + +def get_stock_ledger_entries(report_filters): + filters = {"is_cancelled": 0} + fields = [ + "name", + "voucher_type", + "voucher_no", + "item_code", + "actual_qty", + "posting_date", + "posting_time", + "company", + "warehouse", + "qty_after_transaction", + "batch_no", + ] + + for field in ["warehouse", "item_code", "company"]: + if report_filters.get(field): + filters[field] = report_filters.get(field) + + return frappe.get_all( + "Stock Ledger Entry", + fields=fields, + filters=filters, + order_by="timestamp(posting_date, posting_time) asc, creation asc", + ) + + +def process_incorrect_balance_qty(): + data = get_data({}) + if len(data) > 0: + rec = frappe._dict(data[0]) + doc = frappe.new_doc("Repost Item Valuation") + doc.based_on = "Transaction" + doc.voucher_type = rec.voucher_type + doc.voucher_no = rec.voucher_no + doc.posting_date = rec.posting_date + doc.posting_time = rec.posting_time + doc.company = rec.company + doc.warehouse = rec.warehouse + doc.allow_negative_stock = 1 + doc.docstatus = 1 + doc.insert(ignore_permissions=True) + frappe.db.commit() diff --git a/csf_tz/csftz_hooks/landed_cost_voucher.py b/csf_tz/csftz_hooks/landed_cost_voucher.py new file mode 100644 index 0000000..c3aac11 --- /dev/null +++ b/csf_tz/csftz_hooks/landed_cost_voucher.py @@ -0,0 +1,32 @@ +from __future__ import unicode_literals +import frappe +from frappe import _ +import frappe +import os +from frappe.utils.background_jobs import enqueue +from frappe.utils.pdf import get_pdf, cleanup +from PyPDF2 import PdfFileWriter +from csf_tz import console + + +@frappe.whitelist() +def get_landed_cost_expenses(import_file=None): + if not import_file: + return + + je_landed_cost = frappe.db.sql("""SELECT jea.account as 'expense_account', je.title as 'description', jea.debit as 'amount' + FROM `tabJournal Entry` je + INNER JOIN `tabJournal Entry Account` jea + ON jea.parent = je.name + WHERE je.import_file = %s + AND je.docstatus = 1 + AND jea.debit > 0""", import_file, as_dict=1) + # frappe.db.sql("""update `tabSales Order Item` set delivered_qty = 0 + # where parent = %s""", so.name) + pinv_landed_cost = frappe.db.sql("""SELECT pii.expense_account as 'expense_account', pi.title as 'description', pii.base_net_amount as 'amount' + FROM `tabPurchase Invoice` pi + INNER JOIN `tabPurchase Invoice Item` pii + ON pii.parent = pi.name + WHERE pi.import_file = %s + AND pi.docstatus = 1;""", import_file, as_dict=1) + return je_landed_cost + pinv_landed_cost diff --git a/csf_tz/csftz_hooks/payment_entry.py b/csf_tz/csftz_hooks/payment_entry.py new file mode 100644 index 0000000..5ae8289 --- /dev/null +++ b/csf_tz/csftz_hooks/payment_entry.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, Aakvatech Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import json +from frappe import _ +from frappe.utils import nowdate, getdate +from erpnext.accounts.utils import get_outstanding_invoices, get_account_currency +from erpnext.setup.utils import get_exchange_rate +from erpnext.controllers.accounts_controller import get_supplier_block_status +from erpnext.accounts.doctype.payment_entry.payment_entry import ( + get_orders_to_be_billed, + get_negative_outstanding_invoices, +) + +from six import string_types + + +@frappe.whitelist() +def get_outstanding_reference_documents(args): + + if isinstance(args, string_types): + args = json.loads(args) + + if args.get("party_type") == "Member": + return + + # confirm that Supplier is not blocked + if args.get("party_type") == "Supplier": + supplier_status = get_supplier_block_status(args["party"]) + if supplier_status["on_hold"]: + if supplier_status["hold_type"] == "All": + return [] + elif supplier_status["hold_type"] == "Payments": + if ( + not supplier_status["release_date"] + or getdate(nowdate()) <= supplier_status["release_date"] + ): + return [] + + party_account_currency = get_account_currency(args.get("party_account")) + company_currency = frappe.get_cached_value( + "Company", args.get("company"), "default_currency" + ) + + # Get positive outstanding sales /purchase invoices/ Fees + condition = "" + if args.get("voucher_type") and args.get("voucher_no"): + condition = " and voucher_type={0} and voucher_no={1}".format( + frappe.db.escape(args["voucher_type"]), frappe.db.escape(args["voucher_no"]) + ) + + # Add cost center condition + # Remarked MPC_TZ 2021-11-12 05:30:32 to avoid cost center filter + # if args.get("cost_center"): + # condition += " and cost_center='%s'" % args.get("cost_center") + + date_fields_dict = { + "posting_date": ["from_posting_date", "to_posting_date"], + "due_date": ["from_due_date", "to_due_date"], + } + + for fieldname, date_fields in date_fields_dict.items(): + if args.get(date_fields[0]) and args.get(date_fields[1]): + condition += " and {0} between '{1}' and '{2}'".format( + fieldname, args.get(date_fields[0]), args.get(date_fields[1]) + ) + + if args.get("company"): + condition += " and company = {0}".format(frappe.db.escape(args.get("company"))) + + outstanding_invoices = get_outstanding_invoices( + args.get("party_type"), + args.get("party"), + args.get("party_account"), + filters=args, + condition=condition, + ) + + for d in outstanding_invoices: + d["exchange_rate"] = 1 + if party_account_currency != company_currency: + if d.voucher_type in ("Sales Invoice", "Purchase Invoice", "Expense Claim"): + d["exchange_rate"] = frappe.db.get_value( + d.voucher_type, d.voucher_no, "conversion_rate" + ) + elif d.voucher_type == "Journal Entry": + d["exchange_rate"] = get_exchange_rate( + party_account_currency, company_currency, d.posting_date + ) + if d.voucher_type in ("Purchase Invoice"): + d["bill_no"] = frappe.db.get_value(d.voucher_type, d.voucher_no, "bill_no") + + # Get all SO / PO which are not fully billed or aginst which full advance not paid + orders_to_be_billed = [] + + # Get negative outstanding sales /purchase invoices + negative_outstanding_invoices = [] + if args.get("party_type") not in ["Student", "Employee"] and not args.get("voucher_no"): + negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"), args.get("party"), + args.get("party_account"), args.get("company"), party_account_currency, company_currency, condition=condition) + + if args.get("party_type") != "Student": + orders_to_be_billed = get_orders_to_be_billed( + args.get("posting_date"), + args.get("party_type"), + args.get("party"), + args.get("company"), + party_account_currency, + company_currency, + filters=args, + ) + + data = negative_outstanding_invoices + outstanding_invoices + orders_to_be_billed + + if not data: + frappe.msgprint( + _( + "No outstanding invoices found for the {0} {1} which qualify the filters you have specified." + ).format(args.get("party_type").lower(), frappe.bold(args.get("party"))), + alert=True, + ) + + return data diff --git a/csf_tz/csftz_hooks/payroll.py b/csf_tz/csftz_hooks/payroll.py new file mode 100644 index 0000000..62ab0ab --- /dev/null +++ b/csf_tz/csftz_hooks/payroll.py @@ -0,0 +1,126 @@ +from __future__ import unicode_literals +import frappe +from frappe import _ +import frappe +import os +from frappe.utils.background_jobs import enqueue +from frappe.utils.pdf import get_pdf, cleanup +from PyPDF2 import PdfFileWriter +from csf_tz import console + + +@frappe.whitelist() +def update_slips(payroll_entry): + ss_list = frappe.get_all("Salary Slip", filters={ + "payroll_entry": payroll_entry}) + count = 0 + for salary in ss_list: + ss_doc = frappe.get_doc("Salary Slip", salary.name) + if ss_doc.docstatus != 0: + continue + ss_doc.earnings = [] + ss_doc.deductions = [] + ss_doc.save() + count += 1 + + frappe.msgprint(_("{0} Salary Slips is updated".format(count))) + return count + + +@frappe.whitelist() +def update_slip(salary_slip): + ss_doc = frappe.get_doc("Salary Slip", salary_slip) + if ss_doc.docstatus != 0: + return + ss_doc.earnings = [] + ss_doc.deductions = [] + ss_doc.save() + frappe.msgprint(_("Salary Slips is updated")) + return "True" + + +@frappe.whitelist() +def print_slips(payroll_entry): + enqueue(method=enqueue_print_slips, queue='short', timeout=100000, + is_async=True, job_name="print_salary_slips", kwargs=payroll_entry) + + +def enqueue_print_slips(kwargs): + console("Start Printing") + payroll_entry = kwargs + ss_data = frappe.get_all("Salary Slip", filters={ + "payroll_entry": payroll_entry}) + ss_list = [] + for i in ss_data: + ss_list.append(i.name) + doctype = dict( + {"Salary Slip": ss_list} + ) + print_format = "" + default_print_format = frappe.db.get_value('Property Setter', dict( + property='default_print_format', doc_type="Salary Slip"), "value") + if default_print_format: + print_format = default_print_format + else: + print_format = "Standard" + + pdf = download_multi_pdf(doctype, payroll_entry, + format=print_format, no_letterhead=0) + if pdf: + ret = frappe.get_doc({ + "doctype": "File", + "attached_to_doctype": "Payroll Entry", + "attached_to_name": payroll_entry, + "folder": "Home/Attachments", + "file_name": payroll_entry + ".pdf", + "file_url": "/files/" + payroll_entry + ".pdf", + "content": pdf + }) + ret.save(ignore_permissions=1) + console("Printing Finished", "The PDF file is ready in attatchments") + return ret + + +def download_multi_pdf(doctype, name, format=None, no_letterhead=0): + output = PdfFileWriter() + if isinstance(doctype, dict): + for doctype_name in doctype: + for doc_name in doctype[doctype_name]: + try: + console(doc_name) + output = frappe.get_print( + doctype_name, doc_name, format, as_pdf=True, output=output, no_letterhead=no_letterhead) + except Exception: + frappe.log_error("Permission Error on doc {} of doctype {}".format( + doc_name, doctype_name)) + frappe.local.response.filename = "{}.pdf".format(name) + + return read_multi_pdf(output) + + +def read_multi_pdf(output): + fname = os.path.join( + "/tmp", "frappe-pdf-{0}.pdf".format(frappe.generate_hash())) + output.write(open(fname, "wb")) + + with open(fname, "rb") as fileobj: + filedata = fileobj.read() + + return filedata + +@frappe.whitelist() +def create_journal_entry(payroll_entry): + payroll_entry_doc = frappe.get_doc("Payroll Entry", payroll_entry) + if payroll_entry_doc.docstatus != 1 or payroll_entry_doc.salary_slips_submitted == 1: + return + draft_slips_count = frappe.db.count("Salary Slip", filters={ + "payroll_entry": payroll_entry, "docstatus": 0}) + + if draft_slips_count > 0: + frappe.throw(_("Salary Slips are not submitted")) + else: + jv_name = payroll_entry_doc.make_accrual_jv_entry() + jv_url = frappe.utils.get_url_to_form("Journal Entry", jv_name) + si_msgprint = _("Journal Entry Created {1}").format(jv_url,jv_name) + frappe.msgprint(si_msgprint) + return "True" \ No newline at end of file diff --git a/csf_tz/csftz_hooks/program_enrollment.py b/csf_tz/csftz_hooks/program_enrollment.py new file mode 100644 index 0000000..335c957 --- /dev/null +++ b/csf_tz/csftz_hooks/program_enrollment.py @@ -0,0 +1,53 @@ +from __future__ import unicode_literals +import frappe +from frappe import _ +from erpnext.education.doctype.program_enrollment.program_enrollment import ProgramEnrollment +# from csf_tz import console + + +def create_course_enrollments(self): + student = frappe.get_doc("Student", self.student) + program = frappe.get_doc("Program", self.program) + course_list = [course.course for course in program.courses] + for course_name in course_list: + student.enroll_in_course( + course_name=course_name, program_enrollment=self.name) + + +def create_course_enrollments_override(doc, method): + ProgramEnrollment.create_course_enrollments = create_course_enrollments + + +@frappe.whitelist() +def get_fee_schedule(program, academic_year, academic_term=None, student_category=None): + """Returns Fee Schedule. + + :param program: Program. + :param student_category: Student Category + :param academic_year + :param academic_term + """ + fs = frappe.get_list("Program Fee", fields=["academic_term", "fee_structure", "due_date", "amount"], + filters={"parent": program, "student_category": student_category}, order_by="idx") + + fees_list = [] + for i in fs: + fs_academic_year = frappe.get_value( + "Fee Structure", i["fee_structure"], "academic_year") or "" + fs_academic_term = "False" + if academic_term: + fs_academic_term = frappe.get_value( + "Fee Structure", i["fee_structure"], "academic_term") or "" + if fs_academic_term != "False": + if fs_academic_term == academic_term and fs_academic_year == academic_year: + fees_list.append(i) + else: + if fs_academic_year == academic_year: + fees_list.append(i) + + return fees_list + + +def validate_submit_program_enrollment(doc, method): + if not doc.student_category: + frappe.throw(_("Please set Student Category")) diff --git a/csf_tz/csftz_hooks/query_report.py b/csf_tz/csftz_hooks/query_report.py new file mode 100644 index 0000000..2c2e0d2 --- /dev/null +++ b/csf_tz/csftz_hooks/query_report.py @@ -0,0 +1,19 @@ +import frappe + +from frappe.desk.query_report import get_script as old_get_script + +@frappe.whitelist() +def get_script(report_name): + result = old_get_script(report_name) + + if not frappe.db.exists("AV Report Extension", report_name): + return result + + av_report_extension_doc = frappe.get_doc("AV Report Extension", report_name) + if av_report_extension_doc.active: + if av_report_extension_doc.script: + result["script"] = av_report_extension_doc.script + if av_report_extension_doc.html_format: + result["html_format"] = av_report_extension_doc.html_format + + return result diff --git a/csf_tz/csftz_hooks/stock.py b/csf_tz/csftz_hooks/stock.py new file mode 100644 index 0000000..e27b4c8 --- /dev/null +++ b/csf_tz/csftz_hooks/stock.py @@ -0,0 +1,22 @@ +from __future__ import unicode_literals +import frappe +from erpnext.stock.doctype.stock_entry.stock_entry import StockEntry + + +def validate_with_material_request(self): + bypass_material_request_validation = frappe.get_value("Company", self.company,"bypass_material_request_validation") or 0 + if bypass_material_request_validation: + return + for item in self.get("items"): + if item.material_request: + mreq_item = frappe.db.get_value("Material Request Item", + {"name": item.material_request_item, "parent": item.material_request}, + ["item_code", "warehouse", "idx"], as_dict=True) + if mreq_item.item_code != item.item_code or \ + mreq_item.warehouse != (item.s_warehouse if self.purpose== "Material Issue" else item.t_warehouse): + frappe.throw(_("Item or Warehouse for row {0} does not match Material Request").format(item.idx), + frappe.MappingMismatchError) + + +def validate_with_material_request_override(doc, method): + StockEntry.validate_with_material_request = validate_with_material_request diff --git a/csf_tz/csftz_hooks/student_applicant.py b/csf_tz/csftz_hooks/student_applicant.py new file mode 100644 index 0000000..7ad9aba --- /dev/null +++ b/csf_tz/csftz_hooks/student_applicant.py @@ -0,0 +1,56 @@ +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe.utils import today +from frappe import _ +from csf_tz.custom_api import print_out +# from frappe.utils import from frappe.utils import today, format_datetime, now, nowdate, getdate, get_url, get_host_name, format_datetime, now, nowdate, getdate, get_url, get_host_name + + +def make_student_applicant_fees(doc, method): + if doc.docstatus != 1: + return + if doc.application_status != "Awaiting Registration Fees" or doc.student_applicant_fee: + return + fee_structure = frappe.get_doc("Fee Structure", doc.fee_structure) + student_name = doc.first_name + if doc.middle_name: + student_name += " " + doc.middle_name + if doc.last_name: + student_name += " " + doc.last_name + + fee_doc =frappe.get_doc ({ + 'doctype': 'Student Applicant Fees', + 'student': doc.name, + 'student_name': student_name, + 'fee_schedule': None, + 'company': fee_structure.company, + 'posting_date': today(), + 'due_date': today(), + 'program_enrollment': doc.program_enrollment, + 'program': fee_structure.program, + 'student_batch': None, + 'student_email': doc.student_email_id, + 'student_category': fee_structure.student_category, + 'academic_term': fee_structure.academic_term, + 'academic_year': fee_structure.academic_year, + 'currency': frappe.get_value("Company", fee_structure.company, "default_currency"), + 'fee_structure': doc.fee_structure, + 'grand_total': fee_structure.total_amount, + 'receivable_account': fee_structure.receivable_account, + 'income_account': fee_structure.income_account, + 'cost_center': fee_structure.cost_center, + }) + + fee_doc.flags.ignore_permissions = True + frappe.flags.ignore_account_permission = True + fee_doc.save() + callback_token = fee_doc.callback_token + doc.bank_reference = fee_doc.bank_reference or "None" + doc.student_applicant_fee = fee_doc.name or "None" + doc.db_update() + fee_doc.reload() + fee_doc.callback_token = callback_token + fee_doc.bank_reference = doc.bank_reference + fee_doc.db_update() + fee_doc.submit() \ No newline at end of file diff --git a/csf_tz/custom_api.py b/csf_tz/custom_api.py new file mode 100644 index 0000000..d9e9664 --- /dev/null +++ b/csf_tz/custom_api.py @@ -0,0 +1,1764 @@ +from __future__ import unicode_literals +from erpnext.setup.utils import get_exchange_rate +import frappe +from frappe import _ +import frappe.permissions +import frappe.share +import traceback +import pyqrcode +import io +import base64 +from frappe.utils import flt, cint, getdate, get_datetime, nowdate, nowtime, add_days +from frappe.model.mapper import get_mapped_doc +from frappe.desk.form.linked_with import get_linked_docs, get_linked_doctypes +from erpnext.stock.utils import get_stock_balance, get_latest_stock_qty +from erpnext.stock.doctype.batch.batch import get_batch_qty +from erpnext.accounts.utils import get_account_currency +import csf_tz +from csf_tz import console +import json + + +@frappe.whitelist() +def generate_qrcode(qrcode_data): + c = pyqrcode.create(qrcode_data) + s = io.BytesIO() + c.png(s, scale=3) + encoded = "data:image/png;base64," + base64.b64encode(s.getvalue()).decode("ASCII") + return encoded + + +@frappe.whitelist() +def app_error_log(title, error): + frappe.log(traceback.format_exc()) + + +@frappe.whitelist() +def getInvoiceExchangeRate(date, currency): + try: + exchange_rate = get_exchange_rate( + currency, frappe.defaults.get_global_default("currency"), str(date) + ) + return exchange_rate + + except Exception as e: + error_log = app_error_log(frappe.session.user, str(e)) + + +@frappe.whitelist() +def getInvoice(currency, name): + try: + doc = frappe.get_doc("Open Invoice Exchange Rate Revaluation", name) + # company_currency = frappe.get_value("Company",doc.company,"default_currency") + sinv_details = frappe.get_all( + "Sales Invoice", + filters=[ + ["Sales Invoice", "currency", "=", str(currency)], + ["Sales Invoice", "party_account_currency", "!=", str(currency)], + ["Sales Invoice", "company", "=", doc.company], + ["Sales Invoice", "status", "in", ["Unpaid", "Overdue"]], + ], + fields=[ + "name", + "grand_total", + "conversion_rate", + "currency", + "party_account_currency", + "customer", + ], + ) + pinv_details = frappe.get_all( + "Purchase Invoice", + filters=[ + ["Purchase Invoice", "currency", "=", str(currency)], + ["Purchase Invoice", "party_account_currency", "!=", str(currency)], + ["Purchase Invoice", "company", "=", doc.company], + ["Purchase Invoice", "status", "in", ["Unpaid", "Overdue"]], + ], + fields=[ + "name", + "grand_total", + "conversion_rate", + "currency", + "party_account_currency", + "supplier", + ], + ) + doc.inv_err_detail = [] + doc.save() + if sinv_details: + count = 1 + for sinv in sinv_details: + if not flt(sinv.conversion_rate) == flt( + doc.exchange_rate_to_company_currency + ): + addChildItem( + name, + sinv.name, + "Sales Invoice", + sinv.conversion_rate, + sinv.currency, + sinv.grand_total, + doc.exchange_rate_to_company_currency, + count, + ) + count += 1 + if pinv_details: + for pinv in pinv_details: + if not flt(pinv.conversion_rate) == flt( + doc.exchange_rate_to_company_currency + ): + addChildItem( + name, + pinv.name, + "Purchase Invoice", + pinv.conversion_rate, + pinv.currency, + pinv.grand_total, + doc.exchange_rate_to_company_currency, + count, + ) + count += 1 + return sinv_details + + except Exception as e: + app_error_log(frappe.session.user, str(e)) + + +def addChildItem( + name, + inv_no, + invoice_type, + invoice_exchange_rate, + invoice_currency, + invoice_amount, + current_exchange, + idx, +): + gain_loss = (flt(invoice_amount) * flt(invoice_exchange_rate)) - ( + flt(invoice_amount) * flt(current_exchange) + ) + child_doc = frappe.get_doc( + dict( + doctype="Inv ERR Detail", + parent=name, + parenttype="Open Invoice Exchange Rate Revaluation", + parentfield="inv_err_detail", + invoice_number=inv_no, + invoice_type=invoice_type, + invoice_exchange_rate=invoice_exchange_rate, + invoice_currency=invoice_currency, + invoice_gain_or_loss=gain_loss, + invoice_amount=invoice_amount, + idx=idx, + ) + ).insert() + + +@frappe.whitelist() +def print_out(message, alert=False, add_traceback=False, to_error_log=False): + if not message: + return + + def out(mssg): + if message: + frappe.errprint(str(mssg)) + if to_error_log: + frappe.log_error(str(mssg)) + if add_traceback: + if len(frappe.utils.get_traceback()) > 20: + frappe.errprint(frappe.utils.get_traceback()) + if alert: + frappe.msgprint(str(mssg)) + + def check_msg(msg): + if isinstance(msg, str): + msg = str(msg) + + elif isinstance(msg, int): + msg = str(msg) + + elif isinstance(msg, float): + msg = str(msg) + + elif isinstance(msg, dict): + msg = frappe._dict(msg) + + elif isinstance(msg, list): + for item in msg: + check_msg(item) + msg = "" + + elif isinstance(msg, object): + msg = str(msg.__dict__) + + else: + msg = str(msg) + out(msg) + + check_msg(message) + + +def get_stock_ledger_entries(item_code): + if get_version() == 12: + conditions = " and sle.item_code = '%s'" % item_code + else: + conditions = " and sle.is_cancelled = 0 and sle.item_code = '%s'" % item_code + return frappe.db.sql( + """ + select sle.batch_no, sle.item_code, sle.warehouse, sle.qty_after_transaction as actual_qty + from `tabStock Ledger Entry` sle + inner join ( + SELECT IF(batch_no IS NULL, '', batch_no) as batch_no, item_code, warehouse, max(TIMESTAMP(posting_date, posting_time)) as timestamp + from `tabStock Ledger Entry` + group by IF(batch_no IS NULL, '', batch_no), item_code, warehouse) as sle_max + on sle.batch_no = sle_max.batch_no + and sle.item_code = sle_max.item_code + and sle.warehouse = sle_max.warehouse + and TIMESTAMP(sle.posting_date, sle.posting_time) = sle_max.timestamp + where sle.docstatus = 1 %s + order by sle.warehouse, sle.item_code, sle.batch_no""" + % conditions, + as_dict=1, + ) + + +def get_version(): + branch_name = get_app_branch("erpnext") + if "12" in branch_name: + return 12 + elif "13" in branch_name: + return 13 + else: + return 13 + + +def get_app_branch(app): + """Returns branch of an app""" + import subprocess + + try: + branch = subprocess.check_output( + "cd ../apps/{0} && git rev-parse --abbrev-ref HEAD".format(app), shell=True + ) + branch = branch.decode("utf-8") + branch = branch.strip() + return branch + except Exception: + return "" + + +@frappe.whitelist() +def get_item_info(item_code): + sle = get_stock_ledger_entries(item_code) + iwb_map = {} + float_precision = cint(frappe.db.get_default("float_precision")) or 3 + + for d in sle: + iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, {}).setdefault( + d.batch_no, frappe._dict({"bal_qty": 0.0}) + ) + qty_dict = iwb_map[d.item_code][d.warehouse][d.batch_no] + + expiry_date_unicode = frappe.db.get_value("Batch", d.batch_no, "expiry_date") + + if expiry_date_unicode: + qty_dict.expires_on = expiry_date_unicode + exp_date = frappe.utils.data.getdate(expiry_date_unicode) + qty_dict.expires_on = exp_date + expires_in_days = (exp_date - frappe.utils.datetime.date.today()).days + if expires_in_days > 0: + qty_dict.expiry_status = expires_in_days + else: + qty_dict.expiry_status = 0 + + qty_dict.actual_qty = flt(qty_dict.actual_qty, float_precision) + flt( + d.actual_qty, float_precision + ) + + iwd_list = [] + for key1, value1 in iwb_map.items(): + for key2, value2 in value1.items(): + for key3, value3 in value2.items(): + lin_dict = {"item_code": key1, "warehouse": key2, "batch_no": key3} + lin_dict.update(value3) + iwd_list.append(lin_dict) + return iwd_list + + +@frappe.whitelist() +def get_item_prices(item_code, currency, customer=None, company=None): + item_code = "'{0}'".format(item_code) + currency = "'{0}'".format(currency) + unique_records = int(frappe.db.get_value("CSF TZ Settings", None, "unique_records")) + prices_list = [] + unique_price_list = [] + max_records = frappe.db.get_value("Company", company, "max_records_in_dialog") or 20 + if customer: + conditions = " and SI.customer = '%s'" % customer + else: + conditions = "" + + query = """ SELECT SI.name, SI.posting_date, SI.customer, SIT.item_code, SIT.qty, SIT.rate + FROM `tabSales Invoice` AS SI + INNER JOIN `tabSales Invoice Item` AS SIT ON SIT.parent = SI.name + WHERE + SIT.item_code = {0} + AND SIT.parent = SI.name + AND SI.docstatus=%s + AND SI.currency = {2} + AND SI.is_return != 1 + AND SI.company = '{3}' + {1} + ORDER by SI.posting_date DESC""".format( + item_code, conditions, currency, company + ) % ( + 1 + ) + + items = frappe.db.sql(query, as_dict=True) + for item in items: + item_dict = { + "name": item.item_code, + "item_code": item.item_code, + "price": item.rate, + "date": item.posting_date, + "invoice": item.name, + "customer": item.customer, + "qty": item.qty, + } + if ( + unique_records == 1 + and item.rate not in unique_price_list + and len(prices_list) <= max_records + ): + unique_price_list.append(item.rate) + prices_list.append(item_dict) + elif unique_records != 1 and item.rate and len(prices_list) <= max_records: + prices_list.append(item_dict) + return prices_list + + +@frappe.whitelist() +def get_item_prices_custom(*args): + filters = args[5] + start = args[3] + limit = args[4] + unique_records = int(frappe.db.get_value("CSF TZ Settings", None, "unique_records")) + if "customer" in filters: + customer = filters["customer"] + else: + customer = "" + company = filters["company"] + item_code = "'{0}'".format(filters["item_code"]) + currency = "'{0}'".format(filters["currency"]) + prices_list = [] + unique_price_list = [] + max_records = int(start) + int(limit) + conditions = "" + if "posting_date" in filters: + posting_date = filters["posting_date"] + from_date = "'{from_date}'".format(from_date=posting_date[1][0]) + to_date = "'{to_date}'".format(to_date=posting_date[1][1]) + conditions += "AND DATE(SI.posting_date) BETWEEN {start} AND {end}".format( + start=from_date, end=to_date + ) + if customer: + conditions += " AND SI.customer = '%s'" % customer + + query = """ SELECT SI.name, SI.posting_date, SI.customer, SIT.item_code, SIT.qty, SIT.rate + FROM `tabSales Invoice` AS SI + INNER JOIN `tabSales Invoice Item` AS SIT ON SIT.parent = SI.name + WHERE + SIT.item_code = {0} + AND SIT.parent = SI.name + AND SI.docstatus= 1 + AND SI.currency = {2} + AND SI.is_return != 1 + AND SI.company = '{3}' + {1} + ORDER by SI.posting_date DESC""".format( + item_code, conditions, currency, company + ) + + items = frappe.db.sql(query, as_dict=True) + for item in items: + item_dict = { + "name": item.item_code, + "item_code": item.item_code, + "rate": item.rate, + "posting_date": item.posting_date, + "invoice": item.name, + "customer": item.customer, + "qty": item.qty, + } + if ( + unique_records == 1 + and item.rate not in unique_price_list + and len(prices_list) <= max_records + ): + unique_price_list.append(item.rate) + prices_list.append(item_dict) + elif unique_records != 1 and item.rate and len(prices_list) <= max_records: + prices_list.append(item_dict) + return prices_list + + +@frappe.whitelist() +def get_repack_template(template_name, qty): + template_doc = frappe.get_doc("Repack Template", template_name) + rows = [] + rows.append( + { + "item_code": template_doc.item_code, + "item_uom": template_doc.item_uom, + "qty": cint(qty), + "item_template": 1, + "s_warehouse": template_doc.default_warehouse, + } + ) + for i in template_doc.repack_template_details: + rows.append( + { + "item_code": i.item_code, + "item_uom": i.item_uom, + "qty": cint(float(i.qty / template_doc.qty) * float(qty)), + "item_template": 0, + "t_warehouse": i.default_target_warehouse, + } + ) + return rows + + +@frappe.whitelist() +def create_delivery_note(doc=None, method=None, doc_name=None): + if not doc: + doc = frappe.get_doc("Sales Invoice", doc_name) + if not doc: + frappe.throw("Sales Invoice doc required") + if not doc.enabled_auto_create_delivery_notes: + return + if doc.update_stock: + return + from_delivery_note = False + i = 0 + msg = "" + warehouses_list = [] + space = "
" + for item in doc.items: + pending_qty = flt(item.stock_qty) - get_delivery_note_item_count( + item.name, item.parent + ) + if ( + item.warehouse not in warehouses_list + and check_item_is_maintain(item.item_code) + and pending_qty != 0 + ): + warehouses_list.append(item.warehouse) + if item.delivery_note or item.delivered_by_supplier: + from_delivery_note = True + if check_item_is_maintain(item.item_code): + i += 1 + if from_delivery_note or i == 0: + return + + for warehouse in warehouses_list: + if not doc.is_new(): + check = get_list_pending_sales_invoice(doc.name, warehouse) + if warehouse and len(check) == 0: + return + delivery_doc = frappe.get_doc(make_delivery_note(doc.name, None, warehouse)) + delivery_doc.set_warehouse = warehouse + delivery_doc.form_sales_invoice = doc.name + delivery_doc.flags.ignore_permissions = True + delivery_doc.flags.ignore_account_permission = True + delivery_doc.save() + if method: + url = frappe.utils.get_url_to_form(delivery_doc.doctype, delivery_doc.name) + msgprint = "Delivery Note Created as Draft at {1}".format( + url, delivery_doc.name + ) + frappe.msgprint( + _(msgprint), title="Delivery Note Created", indicator="green" + ) + + +def check_item_is_maintain(item_name): + is_stock_item = frappe.get_value("Item", item_name, "is_stock_item") + if is_stock_item != 1: + return False + else: + return True + + +@frappe.whitelist() +def make_delivery_note(source_name, target_doc=None, set_warehouse=None): + def warehouse_condition(doc): + if set_warehouse: + return doc.warehouse == set_warehouse + else: + return True + + def set_missing_values(source, target): + target.ignore_pricing_rule = 1 + target.run_method("set_missing_values") + target.run_method("calculate_taxes_and_totals") + + def get_qty(source_doc): + delivery_note_item_count = get_delivery_note_item_count( + source_doc.name, source_doc.parent + ) + return flt(source_doc.stock_qty) - delivery_note_item_count + + def update_item(source_doc, target_doc, source_parent): + target_doc.stock_qty = get_qty(source_doc) + target_doc.qty = target_doc.stock_qty / flt(source_doc.conversion_factor) + target_doc.base_amount = target_doc.qty * flt(source_doc.base_rate) + target_doc.amount = target_doc.qty * flt(source_doc.rate) + + doclist = get_mapped_doc( + "Sales Invoice", + source_name, + { + "Sales Invoice": { + "doctype": "Delivery Note", + "validation": {"docstatus": ["=", 1]}, + }, + "Sales Invoice Item": { + "doctype": "Delivery Note Item", + "field_map": { + "name": "si_detail", + "parent": "against_sales_invoice", + "serial_no": "serial_no", + "sales_order": "against_sales_order", + "so_detail": "so_detail", + "cost_center": "cost_center", + "Warehouse": "warehouse", + }, + "postprocess": update_item, + "condition": lambda doc: check_item_is_maintain(doc.item_code), + "condition": lambda doc: warehouse_condition(doc), + }, + "Sales Taxes and Charges": { + "doctype": "Sales Taxes and Charges", + "add_if_empty": True, + }, + "Sales Team": { + "doctype": "Sales Team", + "field_map": {"incentives": "incentives"}, + "add_if_empty": True, + }, + }, + target_doc, + set_missing_values, + ignore_permissions=True, + ) + + items_list = [] + for it in doclist.items: + if float(it.qty) != 0.0 and check_item_is_maintain(it.item_code): + items_list.append(it) + doclist.items = items_list + + return doclist + + +def create_indirect_expense_item(doc, method=None): + if ( + not doc.parent_account + or doc.is_group + or not check_expenses_in_parent_accounts(doc.name) + or not doc.company + ): + return + if ( + not doc.parent_account + and not check_expenses_in_parent_accounts(doc.account_name) + and doc.item + ): + doc.item = "" + return + indirect_expenses_group = frappe.db.exists("Item Group", "Indirect Expenses") + if not indirect_expenses_group: + indirect_expenses_group = frappe.get_doc( + dict( + doctype="Item Group", + item_group_name="Indirect Expenses", + ) + ) + indirect_expenses_group.flags.ignore_permissions = True + frappe.flags.ignore_account_permission = True + indirect_expenses_group.save() + item = frappe.db.exists("Item", doc.account_name) + if item: + item = frappe.get_doc("Item", doc.account_name) + doc.item = item.name + company_list = [] + for i in item.item_defaults: + if doc.company not in company_list: + if i.company == doc.company: + company_list.append(doc.company) + if i.expense_account != doc.name: + i.expense_account == doc.name + item.save() + if doc.company not in company_list: + row = item.append("item_defaults", {}) + row.company = doc.company + row.expense_account = doc.name + item.save() + company_list.append(doc.company) + doc.db_update() + return item.name + new_item = frappe.get_doc( + dict( + doctype="Item", + item_code=doc.account_name, + item_group="Indirect Expenses", + is_stock_item=0, + is_sales_item=0, + stock_uom="Nos", + include_item_in_manufacturing=0, + item_defaults=[ + { + "company": doc.company, + "expense_account": doc.name, + "default_warehouse": "", + } + ], + ) + ) + new_item.flags.ignore_permissions = True + frappe.flags.ignore_account_permission = True + new_item.save() + if new_item.name: + url = frappe.utils.get_url_to_form(new_item.doctype, new_item.name) + msgprint = "New Item is Created {1}".format( + url, new_item.name + ) + frappe.msgprint(_(msgprint)) + doc.item = new_item.name + doc.db_update() + return new_item.name + + +def check_expenses_in_parent_accounts(account_name): + parent_account_1 = frappe.get_value("Account", account_name, "parent_account") + if "Indirect Expenses" in str(parent_account_1): + return True + else: + parent_account_2 = frappe.get_value( + "Account", parent_account_1, "parent_account" + ) + if "Indirect Expenses" in str(parent_account_2): + return True + else: + parent_account_3 = frappe.get_value( + "Account", parent_account_2, "parent_account" + ) + if "Indirect Expenses" in str(parent_account_3): + return True + else: + return False + return False + + +@frappe.whitelist() +def add_indirect_expense_item(account_name): + account = frappe.get_doc("Account", account_name) + return create_indirect_expense_item(account) + + +def get_linked_docs_info(doctype, docname): + linkinfo = get_linked_doctypes(doctype) + linked_doc = get_linked_docs(doctype, docname, linkinfo) + linked_doc_list = [] + if linked_doc: + for key, value in linked_doc.items(): + if key != "Activity Log": + for val in value: + dco_info = { + "doctype": key, + "docname": val.name, + "docstatus": val.docstatus, + } + linked_doc_list.append(dco_info) + return linked_doc_list + + +def cancle_linked_docs(doc_list): + for doc_info in doc_list: + if doc_info["docstatus"] == 1: + linked_doc_list = get_linked_docs_info( + doc_info["doctype"], doc_info["docname"] + ) + if len(linked_doc_list) > 0: + cancle_linked_docs(linked_doc_list) + cancel_doc(doc_info["doctype"], doc_info["docname"]) + + +def delete_linked_docs(doc_list): + for doc_info in doc_list: + linked_doc_list = get_linked_docs_info(doc_info["doctype"], doc_info["docname"]) + if len(linked_doc_list) > 0: + delete_linked_docs(linked_doc_list) + delete_doc(doc_info["doctype"], doc_info["docname"]) + + +def cancel_doc(doctype, docname): + doc = frappe.get_doc(doctype, docname) + if doc.docstatus == 1: + doc.flags.ignore_permissions = True + doc.cancel() + doc = frappe.get_doc(doctype, docname) + if doc.docstatus == 2: + frappe.msgprint(_("{0} {1} is Canceled").format("Stock Entry", doc.name)) + else: + frappe.msgprint( + _("{0} {1} is Not Canceled").format("Stock Entry", doc.name) + ) + + +def delete_doc(doctype, docname): + doc = frappe.get_doc(doctype, docname) + if doc.docstatus == 1: + doc.flags.ignore_permissions = True + doc.cancel() + doc = frappe.get_doc(doctype, docname) + if doc.docstatus == 2: + frappe.msgprint(_("{0} {1} is Canceled").format("Stock Entry", doc.name)) + doc.flags.ignore_permissions = True + doc.delete() + frappe.db.commit() + frappe.msgprint(_("{0} {1} is Deleted").format("Stock Entry", doc.name)) + else: + frappe.msgprint( + _("{0} {1} is Not Canceled").format("Stock Entry", doc.name) + ) + elif doc.docstatus == 0 or doc.docstatus == 2: + doc.flags.ignore_permissions = True + doc.delete() + frappe.db.commit() + frappe.msgprint(_("{0} {1} is Deleted").format("Stock Entry", doc.name)) + + +def get_pending_si_delivery_item_count(item_code, company, warehouse): + query = """SELECT SUM(SII.delivered_qty) as delivered_count ,SUM(SII.stock_qty) as sold_count + FROM `tabSales Invoice` AS SI + INNER JOIN `tabSales Invoice Item` AS SII ON SI.name = SII.parent + WHERE + SII.item_code = '%s' + AND SII.parent = SI.name + AND SI.docstatus= 1 + AND SI.company = '%s' + AND SII.warehouse = '%s' + AND SII.so_detail IS NULL + AND (SII.so_detail IS NOT NULL AND SII.delivery_note IS NOT NULL) + AND SI.update_stock = 0 + AND SII.is_ignored_in_pending_qty != 1 + AND SII.delivered_qty != SII.stock_qty + """ % ( + item_code, + company, + warehouse, + ) + + counts = frappe.db.sql(query, as_dict=True) + if len(counts) > 0: + if not counts[0]["sold_count"]: + counts[0]["sold_count"] = 0 + if not counts[0]["delivered_count"]: + counts[0]["delivered_count"] = 0 + return counts[0]["sold_count"] - counts[0]["delivered_count"] + + +def get_pending_delivery_item_count(item_code, company, warehouse): + query = """ SELECT SUM(SOI.delivered_qty) as delivered_count ,SUM(SOI.stock_qty) as sold_count + FROM `tabSales Order` AS SO + INNER JOIN `tabSales Order Item` AS SOI ON SO.name = SOI.parent + WHERE + SOI.item_code = '%s' + AND SOI.parent = SO.name + AND SO.docstatus= 1 + AND SO.company = '%s' + AND SOI.warehouse = '%s' + AND SO.status NOT IN ('Closed', 'On Hold', 'Cancelled', 'Completed') + """ % ( + item_code, + company, + warehouse, + ) + + counts = frappe.db.sql(query, as_dict=True) + if len(counts) > 0: + if not counts[0]["sold_count"]: + counts[0]["sold_count"] = 0 + if not counts[0]["delivered_count"]: + counts[0]["delivered_count"] = 0 + return counts[0]["sold_count"] - counts[0]["delivered_count"] + else: + return 0 + + +def get_item_balance(item_code, company, warehouse=None): + if company and not warehouse: + warehouse = frappe.get_all( + "Warehouse", filters={"company": company, "lft": 1}, fields=["name"] + )[0]["name"] + values, condition = [item_code], "" + if warehouse: + lft, rgt, is_group = frappe.db.get_value( + "Warehouse", warehouse, ["lft", "rgt", "is_group"] + ) + + if is_group: + values.extend([lft, rgt]) + condition += "and exists (\ + select name from `tabWarehouse` wh where wh.name = tabBin.warehouse\ + and wh.lft >= %s and wh.rgt <= %s)" + + else: + values.append(warehouse) + condition += " AND warehouse = %s" + + actual_qty = frappe.db.sql( + """select sum(actual_qty) from tabBin + where item_code=%s {0}""".format( + condition + ), + values, + )[0][0] + + return actual_qty + + +@frappe.whitelist() +def validate_item_remaining_qty( + item_code, company, warehouse=None, stock_qty=None, so_detail=None +): + if not warehouse or not stock_qty: + return + if frappe.db.get_single_value("Stock Settings", "allow_negative_stock"): + return + is_stock_item = frappe.get_value("Item", item_code, "is_stock_item") + if is_stock_item == 1: + item_balance = get_item_balance(item_code, company, warehouse) or 0 + if not item_balance: + frappe.throw( + _( + "{0} item balance is ZERO. Cannot proceed unless Allow Over Sell" + ).format(item_code) + ) + pending_delivery_item_count = ( + get_pending_delivery_item_count(item_code, company, warehouse) or 0 + ) + pending_si = ( + get_pending_si_delivery_item_count(item_code, company, warehouse) or 0 + ) + # The float(stock_qty) is removed to allow ignore the item itself + if so_detail: + if pending_delivery_item_count > float(stock_qty): + qty_to_reduce = pending_delivery_item_count + else: + qty_to_reduce = float(stock_qty) + else: + qty_to_reduce = pending_delivery_item_count + float(stock_qty) + + item_remaining_qty = item_balance - qty_to_reduce - pending_si + if item_remaining_qty < 0: + if not frappe.db.get_single_value("CSF TZ Settings", "item_qty_poppup_message"): + frappe.msgprint( + _( + "Item Balance: '{2}'
Pending Sales Order: '{3}'
Pending Direct Sales Invoice: {5}
Current request is {4}
Results into balance Qty for '{0}' to '{1}'".format( + item_code, + item_remaining_qty, + item_balance, + pending_delivery_item_count, + float(stock_qty), + pending_si, + ) + ), alert=True + ) + + else: + frappe.throw( + _( + "Item Balance: '{2}'
Pending Sales Order: '{3}'
Pending Direct Sales Invoice: {5}
Current request is {4}
Results into balance Qty for '{0}' to '{1}'".format( + item_code, + item_remaining_qty, + item_balance, + pending_delivery_item_count, + float(stock_qty), + pending_si, + ) + ) + ) + + +def validate_items_remaining_qty(doc, method): + for item in doc.items: + if not item.allow_over_sell and not (item.so_detail and item.delivery_note): + validate_item_remaining_qty( + item.item_code, + doc.company, + item.warehouse, + item.stock_qty, + item.so_detail, + ) + + +def on_cancel_fees(doc, method): + from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries + + unlink_ref_doc_from_payment_entries(doc) + from csf_tz.bank_api import cancel_invoice + + cancel_invoice(doc, "before_cancel") + + +def check_validate_delivery_note(doc=None, method=None, doc_name=None): + if not doc and doc_name: + doc = frappe.get_doc("Sales Invoice", doc_name) + doc.to_save = True + else: + doc.to_save = False + if doc.docstatus != 2: + doc.delivery_status = "Not Delivered" + else: + doc.to_save = False + if doc.update_stock: + return + + part_delivery = False + # full_delivery = False + items_qty = 0 + items_delivered_qty = 0 + i = 0 + for item in doc.items: + if doc.is_new(): + item.delivery_status = "Not Delivered" + item.delivered_qty = 0 + items_qty += item.stock_qty + if item.delivery_note or item.delivered_by_supplier: + part_delivery = True + i += 1 + if item.delivered_qty: + if item.stock_qty == item.delivered_qty: + item.delivery_status = "Delivered" + elif item.stock_qty < item.delivered_qty: + item.delivery_status = "Over Delivered" + elif item.stock_qty > item.delivered_qty and item.delivered_qty > 0: + item.delivery_status = "Part Delivered" + items_delivered_qty += item.delivered_qty + if i == len(doc.items): + doc.delivery_status = "Delivered" + elif doc.to_save and items_delivered_qty >= items_qty: + doc.delivery_status = "Delivered" + elif doc.to_save and items_delivered_qty <= items_qty and items_delivered_qty > 0: + doc.delivery_status = "Part Delivered" + elif part_delivery: + doc.delivery_status = "Part Delivered" + else: + doc.delivery_status = "Not Delivered" + if doc.to_save: + doc.flags.ignore_permissions = True + doc.save() + + +def check_submit_delivery_note(doc, method): + if doc.update_stock: + doc.db_set("delivery_status", "Delivered", commit=True) + for item in doc.items: + item.db_set("delivered_qty", item.stock_qty, commit=True) + item.db_set("delivery_status", "Delivered", commit=True) + else: + part_deivery = False + for item in doc.items: + if not check_item_is_maintain(item.item_code): + item.db_set("delivered_qty", item.stock_qty, commit=True) + item.db_set("delivery_status", "Delivered", commit=True) + part_deivery = True + if part_deivery: + doc.db_set("delivery_status", "Part Delivered", commit=True) + + +def check_cancel_delivery_note(doc, method): + if not doc.update_stock: + doc.db_set("delivery_status", "Not Delivered", commit=True) + for item in doc.items: + item.db_set("delivered_qty", 0, commit=True) + item.db_set("delivery_status", "Not Delivered", commit=True) + + +def update_delivery_on_sales_invoice(doc, method): + sales_invoice_list = [] + for item in doc.items: + if ( + item.against_sales_invoice + and item.against_sales_invoice not in sales_invoice_list + ): + sales_invoice_list.append(item.against_sales_invoice) + for invoice in sales_invoice_list: + check_validate_delivery_note(None, None, invoice) + + +def get_delivery_note_item_count(item_row_name, sales_invoice): + query = """ SELECT SUM(stock_qty) as cont + FROM `tabDelivery Note Item` + WHERE + si_detail = '%s' + AND docstatus != 2 + AND against_sales_invoice = '%s' + """ % ( + item_row_name, + sales_invoice, + ) + + counts = frappe.db.sql(query, as_dict=True) + if len(counts) > 0 and counts[0]["cont"]: + return float(counts[0]["cont"]) + else: + return 0 + + +@frappe.whitelist() +def get_pending_sales_invoice(*args): + filters = args[5] + start = cint(args[3]) + page_length = cint(args[4]) + conditions = "" + if args[1] != "": + conditions += " AND SI.name = '%s'" % args[1] + if "posting_date" in filters: + posting_date = filters["posting_date"] + from_date = "'{from_date}'".format(from_date=posting_date[1][0]) + to_date = "'{to_date}'".format(to_date=posting_date[1][1]) + conditions += "AND DATE(SI.posting_date) BETWEEN {start} AND {end}".format( + start=from_date, end=to_date + ) + if "customer" in filters: + conditions += " AND SI.customer = '%s'" % filters["customer"] + if "company" in filters: + conditions += " AND SI.company = '%s'" % filters["company"] + if "set_warehouse" in filters: + conditions += " AND SIT.warehouse = '%s'" % filters["set_warehouse"] + query = """ + WITH CTE AS( + SELECT + SIT.stock_qty, + SIT.delivered_qty, + SIT.warehouse AS set_warehouse, + COALESCE (SUM(DNI.stock_qty), 0) As DNI_sum_stock_qty, + SI.name AS name, + SI.posting_date AS posting_date, + SI.customer As customer, + ROW_NUMBER()OVER(PARTITION BY SI.name ORDER BY SI.name) AS RN + FROM `tabSales Invoice` AS SI + INNER JOIN `tabSales Invoice Item` AS SIT ON SIT.parent = SI.name + INNER JOIN `tabItem` AS IT ON IT.name = SIT.item_code and IT.is_stock_item = 1 + LEFT OUTER JOIN `tabDelivery Note Item` as DNI on DNI.si_detail = SIT.name AND DNI.docstatus < 2 + WHERE + SIT.parent = SI.name + AND SI.docstatus= 1 + AND SI.update_stock != 1 + AND SI.is_return = 0 + AND SI.status NOT IN ("Credit Note Issued", "Internal Transfer") + AND SIT.stock_qty != SIT.delivered_qty + %s + GROUP BY SI.name, SIT.name + HAVING SIT.stock_qty > DNI_sum_stock_qty + ) + SELECT * FROM `CTE` WHERE RN = 1 + LIMIT %s + OFFSET %s + """ % ( + conditions, + page_length, + start, + ) + data = frappe.db.sql(query, as_dict=True) + return data + + +def get_list_pending_sales_invoice(invoice_name=None, warehouse=None): + conditions = "" + if invoice_name: + conditions += " AND SI.name = '%s'" % invoice_name + if warehouse: + conditions += " AND SIT.warehouse = '%s'" % warehouse + query = """ + WITH CTE AS( + SELECT + SIT.stock_qty, + SIT.delivered_qty, + COALESCE (SUM(DNI.stock_qty), 0) As DNI_sum_stock_qty, + SI.name AS name, + SI.posting_date AS posting_date, + SI.customer As customer, + SI.company As company, + SI.enabled_auto_create_delivery_notes as enabled_auto_create_delivery_notes, + ROW_NUMBER()OVER(PARTITION BY SI.name ORDER BY SI.name) AS RN + FROM `tabSales Invoice` AS SI + INNER JOIN `tabSales Invoice Item` AS SIT ON SIT.parent = SI.name + INNER JOIN `tabItem` AS IT ON IT.name = SIT.item_code and IT.is_stock_item = 1 + LEFT OUTER JOIN `tabDelivery Note Item` as DNI on DNI.si_detail = SIT.name AND DNI.docstatus < 2 + WHERE + SIT.parent = SI.name + AND SI.docstatus= 1 + AND SI.update_stock != 1 + AND SIT.stock_qty != SIT.delivered_qty + AND SI.enabled_auto_create_delivery_notes = 1 + %s + GROUP BY SI.name, SIT.name + HAVING SIT.stock_qty > DNI_sum_stock_qty + ) + SELECT * FROM `CTE` WHERE RN = 1 + """ % ( + conditions + ) + data = frappe.db.sql(query, as_dict=True) + return data + + +def create_delivery_note_for_all_pending_sales_invoice(doc=None, method=None): + company_list = frappe.get_all( + "Company", fiters={"enabled_auto_create_delivery_notes": 1}, pluck="name" + ) + invoices = get_list_pending_sales_invoice() + for i in invoices: + if i.company not in company_list: + continue + invoice = frappe.get_doc("Sales Invoice", i.name) + create_delivery_note(invoice) + + +def get_pending_material_request(): + mat_req_list = frappe.get_all( + "Material Request", + filters=[["Material Request", "status", "in", ["Pending"]]], + fields=["name"], + ) + return mat_req_list + + +def make_stock_reconciliation(items, company): + stock_rec_doc = frappe.get_doc( + { + "doctype": "Stock Reconciliation", + "company": company, + "purpose": "Stock Reconciliation", + "Posting Date": getdate(), + "items": items, + } + ) + if stock_rec_doc: + stock_rec_doc.flags.ignore_permissions = True + stock_rec_doc.flags.ignore_account_permission = True + stock_rec_doc.run_method("set_missing_values") + stock_rec_doc.save() + url = frappe.utils.get_url_to_form(stock_rec_doc.doctype, stock_rec_doc.name) + msgprint = ( + "Stock Reconciliation Created as Draft at {1}".format( + url, stock_rec_doc.name + ) + ) + frappe.msgprint(_(msgprint)) + return stock_rec_doc.name + + +def get_stock_balance_for( + item_code, + warehouse, + posting_date=None, + posting_time=None, + batch_no=None, + with_valuation_rate=True, +): + # frappe.has_permission("Stock Reconciliation", "write", throw = True) + if not posting_date: + posting_date = nowdate() + if not posting_time: + posting_time = nowtime() + item_dict = frappe.db.get_value( + "Item", item_code, ["has_serial_no", "has_batch_no"], as_dict=1 + ) + + serial_nos = "" + with_serial_no = True if item_dict.get("has_serial_no") else False + data = get_stock_balance( + item_code, + warehouse, + posting_date, + posting_time, + with_valuation_rate=with_valuation_rate, + with_serial_no=with_serial_no, + ) + + if with_serial_no: + qty, rate, serial_nos = data + else: + qty, rate = data + + if item_dict.get("has_batch_no"): + qty = get_batch_qty(batch_no, warehouse) or 0 + + return {"qty": qty, "rate": rate, "serial_nos": serial_nos} + + +@frappe.whitelist() +def make_stock_reconciliation_for_all_pending_material_request(*args): + mat_req_list = get_pending_material_request() + data = {} + + for i in mat_req_list: + mat_req_doc = frappe.get_doc("Material Request", i["name"]) + + if not data.get(mat_req_doc.company): + data[mat_req_doc.company] = {} + + for item in mat_req_doc.items: + if not check_item_is_maintain(item.item_code): + continue + if ( + not data.get(mat_req_doc.company).get(item.warehouse) + and not item.stock_reconciliation + ): + data[mat_req_doc.company][item.warehouse] = [] + item_dict = get_stock_balance_for(item.item_code, item.warehouse) + item.valuation_rate = item_dict.get("rate") + item_dict = { + "item_code": item.item_code, + "warehouse": item.warehouse, + "valuation_rate": item_dict.get("rate"), + "batch_no": "", + "qty": item_dict.get("qty") + item.stock_qty, + "material_request": i["name"], + "company": mat_req_doc.company, + "row_name": item.name, + } + data[mat_req_doc.company][item.warehouse].append(item_dict) + + for key, value in data.items(): + for key1, value1 in value.items(): + if len(value1) > 0: + items_list = [] + items = [] + for item in value1: + if item["item_code"] not in items_list: + items.append(item) + items_list.append(item["item_code"]) + if len(items) > 0: + stock_rec_name = make_stock_reconciliation(value1, key) + if stock_rec_name: + for item in items: + frappe.db.set_value( + "Material Request Item", + item["row_name"], + "stock_reconciliation", + stock_rec_name, + update_modified=False, + ) + + +def calculate_price_reduction(doc, method): + price_reduction = 0 + for item in doc.items: + price_reduction += item.qty * item.discount_amount + doc.price_reduction = price_reduction + + +def calculate_total_net_weight(doc, method): + if doc.meta.get_field("total_net_weight"): + doc.total_net_weight = 0.0 + for d in doc.items: + if d.total_weight: + doc.total_net_weight += d.total_weight + + +@frappe.whitelist() +def get_warehouse_options(company): + warehouses = frappe.get_all( + "Warehouse", + filters=[ + ["Warehouse", "company", "=", company], + ["Warehouse", "is_group", "=", 0], + ], + fields=["name"], + ) + warehouses_list = [] + for warehouse in warehouses: + warehouses_list.append(warehouse["name"]) + return warehouses_list + + +def validate_net_rate(doc, method): + def throw_message(idx, item_name, rate, ref_rate_field): + frappe.throw( + _( + """Row #{}: Net Selling rate for item {} is lower than its {}. Net Selling rate should be atleast above {}""" + ).format(idx, item_name, ref_rate_field, rate) + ) + + if not frappe.db.get_single_value("CSF TZ Settings", "validate_net_rate"): + return + + if hasattr(doc, "is_return") and doc.is_return: + return + + for it in doc.get("items"): + if not it.item_code or it.allow_override_net_rate: + continue + + last_purchase_rate, is_stock_item = frappe.get_cached_value( + "Item", it.item_code, ["last_purchase_rate", "is_stock_item"] + ) + last_purchase_rate_in_sales_uom = last_purchase_rate / ( + it.conversion_factor or 1 + ) + if flt(it.net_rate) < flt(last_purchase_rate_in_sales_uom): + throw_message( + it.idx, + frappe.bold(it.item_name), + last_purchase_rate_in_sales_uom, + "last purchase rate", + ) + + last_valuation_rate = frappe.db.sql( + """ + SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s + AND warehouse = %s AND valuation_rate > 0 + ORDER BY posting_date DESC, posting_time DESC, creation DESC LIMIT 1 + """, + (it.item_code, it.warehouse), + ) + if last_valuation_rate: + last_valuation_rate_in_sales_uom = last_valuation_rate[0][0] / ( + it.conversion_factor or 1 + ) + if ( + is_stock_item + and flt(it.net_rate) < flt(last_valuation_rate_in_sales_uom) + and not doc.get("is_internal_customer") + ): + throw_message( + it.idx, + frappe.bold(it.item_name), + last_valuation_rate_in_sales_uom, + "valuation rate", + ) + + +@frappe.whitelist() +def make_withholding_tax_gl_entries_for_purchase(doc, method): + if method == "From Front End": + doc = frappe.get_doc(json.loads(doc)) + + ( + withholding_payable_account, + default_currency, + auto_create_for_purchase_withholding, + ) = frappe.get_value( + "Company", + doc.company, + [ + "default_withholding_payable_account", + "default_currency", + "auto_create_for_purchase_withholding", + ], + ) + if not auto_create_for_purchase_withholding: + return + float_precision = cint(frappe.db.get_default("float_precision")) or 3 + withholding_payable_account, default_currency = frappe.get_value( + "Company", + doc.company, + ["default_withholding_payable_account", "default_currency"], + ) + if not withholding_payable_account: + frappe.throw( + _("Please Setup Withholding Payable Account in Company " + str(doc.company)) + ) + for item in doc.items: + if not item.withholding_tax_rate > 0 or item.csf_tz_wtax_jv_created == 1: + continue + withholding_payable_account_type = ( + frappe.get_value("Account", withholding_payable_account, "account_type") + or "" + ) + if withholding_payable_account_type != "Payable": + frappe.msgprint(_("Withholding Payable Account type not 'Payable'")) + if doc.party_account_currency == default_currency: + exchange_rate = 1 + else: + exchange_rate = doc.conversion_rate + creditor_amount = flt( + item.base_net_rate + * item.qty + * item.withholding_tax_rate + / 100 + / exchange_rate, + float_precision, + ) + wtax_base_amount = creditor_amount * exchange_rate + + jl_rows = [] + debit_row = dict( + account=doc.credit_to, + party_type="Supplier", + party=doc.supplier, + debit_in_account_currency=creditor_amount, + exchange_rate=exchange_rate, + cost_center=item.cost_center, + reference_type="Purchase Invoice", + reference_name=doc.name, + ) + jl_rows.append(debit_row) + credit_row = dict( + account=withholding_payable_account, + party_type="Supplier" + if withholding_payable_account_type == "Payable" + else "", + party=doc.supplier if withholding_payable_account_type == "Payable" else "", + credit_in_account_currency=wtax_base_amount, + cost_center=item.cost_center, + account_curremcy=default_currency, + ) + jl_rows.append(credit_row) + user_remark = ( + "Withholding Tax Payable Against Item " + + item.item_code + + " in " + + doc.doctype + + " " + + doc.name + + " of amount " + + str(flt(item.net_amount, 2)) + + " " + + doc.currency + + " with exchange rate of " + + str(doc.conversion_rate) + ) + jv_doc = frappe.get_doc( + dict( + doctype="Journal Entry", + voucher_type="Contra Entry", + posting_date=doc.posting_date, + accounts=jl_rows, + company=doc.company, + multi_currency=0 + if doc.party_account_currency == default_currency + else 1, + user_remark=user_remark, + ) + ) + console(jl_rows) + jv_doc.flags.ignore_permissions = True + frappe.flags.ignore_account_permission = True + jv_doc.save() + if ( + frappe.get_value( + "Company", doc.company, "auto_submit_for_purchase_withholding" + ) + or False + ): + jv_doc.submit() + + if jv_doc.get("name"): + item.withholding_tax_entry = jv_doc.get("name") + item.csf_tz_wtax_jv_created = 1 + item.db_update() + + jv_url = frappe.utils.get_url_to_form(jv_doc.doctype, jv_doc.name) + si_msgprint = ( + "Journal Entry Created for Withholding Tax {1}".format( + jv_url, jv_doc.name + ) + ) + frappe.msgprint(_(si_msgprint)) + + +@frappe.whitelist() +def set_fee_abbr(doc=None, method=None): + doc.company = frappe.get_value("Fee Structure", doc.fee_structure, "company") + send_fee_details_to_bank = ( + frappe.get_value("Company", doc.company, "send_fee_details_to_bank") or 0 + ) + if not send_fee_details_to_bank: + return + doc.abbr = frappe.get_value("Company", doc.company, "abbr") + + +@frappe.whitelist() +def enroll_all_students(self): + """Enrolls students or applicants. + + :param self: Program Enrollment Tool + + This is created to allow enqueue of students creation. + The default enroll process fails when there are too many enrollments to do at a go + """ + import json + + self = json.loads(self) + self = frappe.get_doc(dict(self)) + + if self.get_students_from == "Student Applicant": + frappe.msgprint("Remove student applicants that are already created") + + if len(self.students) > 30: + frappe.enqueue("csf_tz.custom_api.enroll_students", self=self) + return "queued" + else: + enroll_students(self=self) + return len(self.students) + + +@frappe.whitelist() +def enroll_students(self): + """Enrolls students or applicants. + + :param self: Program Enrollment Tool + + This is a copy of InfluxERP function meant to allow loading from custom doctypes and frappe.enqueue + Used in csf_tz.custom_api.enroll_students + """ + from erpnext.education.api import enroll_student + + total = len(self.students) + for i, stud in enumerate(self.students): + frappe.publish_realtime( + "program_enrollment_tool", + dict(progress=[i + 1, total]), + user=frappe.session.user, + ) + if stud.student: + prog_enrollment = frappe.new_doc("Program Enrollment") + prog_enrollment.student = stud.student + prog_enrollment.student_name = stud.student_name + prog_enrollment.program = self.new_program + prog_enrollment.academic_year = self.new_academic_year + prog_enrollment.academic_term = self.new_academic_term + prog_enrollment.student_batch_name = ( + stud.student_batch_name + if stud.student_batch_name + else self.new_student_batch + ) + prog_enrollment.save() + elif stud.student_applicant: + prog_enrollment = enroll_student(stud.student_applicant) + prog_enrollment.academic_year = self.academic_year + prog_enrollment.academic_term = self.academic_term + prog_enrollment.student_batch_name = ( + stud.student_batch_name + if stud.student_batch_name + else self.new_student_batch + ) + prog_enrollment.save() + + +@frappe.whitelist() +def get_tax_category(doc_type, company): + fetch_default_tax_category = ( + frappe.db.get_value("CSF TZ Settings", None, "fetch_default_tax_category") or 0 + ) + if int(fetch_default_tax_category) != 1: + return "" + sales_list_types = ["Sales Order", "Sales Invoice", "Delivery Note", "Quotation"] + Puchase_list_types = ["Purchase Order", "Purchase Invoice", "Purchase Receipt"] + tax_category = [] + if doc_type in sales_list_types: + tax_category = frappe.get_all( + "Sales Taxes and Charges Template", + filters=[ + ["Sales Taxes and Charges Template", "company", "=", company], + ["Sales Taxes and Charges Template", "is_default", "=", 1], + ], + fields=["name", "tax_category"], + ) + elif doc_type in Puchase_list_types: + tax_category = frappe.get_all( + "Purchase Taxes and Charges Template", + filters=[ + ["Purchase Taxes and Charges Template", "company", "=", company], + ["Purchase Taxes and Charges Template", "is_default", "=", 1], + ], + fields=["name", "tax_category"], + ) + return tax_category[0]["tax_category"] if len(tax_category) > 0 else [""] + + +@frappe.whitelist() +def make_withholding_tax_gl_entries_for_sales(doc, method): + if method == "From Front End": + doc = frappe.get_doc(json.loads(doc)) + + ( + withholding_receivable_account, + default_currency, + auto_create_for_sales_withholding, + ) = frappe.get_value( + "Company", + doc.company, + [ + "default_withholding_receivable_account", + "default_currency", + "auto_create_for_sales_withholding", + ], + ) + if not auto_create_for_sales_withholding: + return + float_precision = cint(frappe.db.get_default("float_precision")) or 3 + if not withholding_receivable_account: + frappe.throw( + _( + "Please Setup Withholding Receivable Account in Company " + + str(doc.company) + ) + ) + for item in doc.items: + if not item.withholding_tax_rate > 0 or item.csf_tz_wtax_jv_created == 1: + continue + withholding_receivable_account_type = ( + frappe.get_value("Account", withholding_receivable_account, "account_type") + or "" + ) + if withholding_receivable_account_type != "Receivable": + frappe.msgprint(_("Withholding Receivable Account type not 'Receivable'")) + if doc.party_account_currency == default_currency: + exchange_rate = 1 + else: + exchange_rate = doc.conversion_rate + debtor_amount = flt( + item.base_net_rate + * item.qty + * item.withholding_tax_rate + / 100 + / exchange_rate, + float_precision, + ) + wtax_base_amount = debtor_amount * exchange_rate + jl_rows = [] + credit_row = dict( + account=doc.debit_to, + party_type="customer", + party=doc.customer, + credit_in_account_currency=debtor_amount, + account_curremcy=default_currency + if doc.party_account_currency == default_currency + else doc.currency, + exchange_rate=exchange_rate, + cost_center=item.cost_center, + reference_type="Sales Invoice", + reference_name=doc.name, + ) + jl_rows.append(credit_row) + + debit_row = dict( + account=withholding_receivable_account, + party_type="customer" + if withholding_receivable_account_type == "Receivable" + else "", + party=doc.customer + if withholding_receivable_account_type == "Receivable" + else "", + debit_in_account_currency=wtax_base_amount, + cost_center=item.cost_center, + account_curremcy=default_currency, + ) + jl_rows.append(debit_row) + + user_remark = ( + "Withholding Tax Receivable Against Item " + + item.item_code + + " in " + + doc.doctype + + " " + + doc.name + + " of amount " + + str(flt(item.net_amount, 2)) + + " " + + doc.currency + + " with exchange rate of " + + str(doc.conversion_rate) + ) + jv_doc = frappe.get_doc( + dict( + doctype="Journal Entry", + voucher_type="Contra Entry", + posting_date=doc.posting_date, + accounts=jl_rows, + company=doc.company, + multi_currency=0 + if doc.party_account_currency == default_currency + else 1, + user_remark=user_remark, + ) + ) + jv_doc.flags.ignore_permissions = True + frappe.flags.ignore_account_permission = True + jv_doc.save() + if ( + frappe.get_value( + "Company", doc.company, "auto_submit_for_sales_withholding" + ) + or False + ): + jv_doc.submit() + + if jv_doc.get("name"): + item.withholding_tax_entry = jv_doc.get("name") + item.csf_tz_wtax_jv_created = 1 + item.db_update() + + jv_url = frappe.utils.get_url_to_form(jv_doc.doctype, jv_doc.name) + si_msgprint = ( + "Journal Entry Created for Withholding Tax {1}".format( + jv_url, jv_doc.name + ) + ) + frappe.msgprint(_(si_msgprint)) + + +# Email Salary Slip +@frappe.whitelist() +def get_payroll_employees(payroll_entry): + employees = frappe.db.sql( + f""" SELECT employee FROM `tabPayroll Employee Detail` WHERE parent='{payroll_entry}' """, + as_dict=True, + ) + return employees + + +@frappe.whitelist() +def validate_payroll_entry_field(payroll_entry): + payroll_entry = frappe.get_doc("Payroll Entry", payroll_entry) + if payroll_entry.docstatus != 1: + return False + + +def auto_close_dn(): + """ + Mark delivery note as closed per customer, depending on the days specified on customer + + This routine will run every day 3:30am at night + """ + + dn_list = [] + + customer_details = frappe.get_all("Customer", filters={"csf_tz_is_auto_close_dn": 1}, fields=["name", "csf_tz_close_dn_after"]) + + if not customer_details: + return + + for customer in customer_details: + filters = { + "docstatus": 1, + "customer": customer.name, + "status": ["!=", "Closed"], + "posting_date": ["<", add_days(nowdate(), days=(-1 * customer.csf_tz_close_dn_after))], + } + dn_list += frappe.get_all("Delivery Note", filters=filters, fields=["name"], pluck="name") + + for dn in dn_list: + frappe.db.set_value("Delivery Note", dn, "status", "Closed") + + frappe.db.commit() \ No newline at end of file diff --git a/csf_tz/fixtures/custom_field.json b/csf_tz/fixtures/custom_field.json new file mode 100644 index 0000000..c69700f --- /dev/null +++ b/csf_tz/fixtures/custom_field.json @@ -0,0 +1,1786 @@ +[ + { + "doctype": "Custom Field", + "dt": "Vehicle Service", + "fieldname": "spare_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Spare Name", + "modified": "2020-09-03 21:04:45.705267", + "name": "Vehicle Service-spare_name" + }, + { + "doctype": "Custom Field", + "dt": "Delivery Note", + "fieldname": "form_sales_invoice", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "patient_name", + "label": "Form Sales Invoice", + "modified": "2020-06-28 22:15:11.257297", + "name": "Delivery Note-form_sales_invoice", + "options": "Sales Invoice", + "read_only": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Fees", + "fieldname": "callback_token", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "healthcare_practitioner", + "label": "Callback Token", + "modified": "2020-08-10 17:17:36.137062", + "name": "Fees-callback_token", + "read_only": 1, + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "delivery_status", + "fieldtype": "Select", + "in_list_view": 0, + "in_standard_filter": 1, + "insert_after": "pos_total_qty", + "label": "Delivery Status", + "modified": "2020-06-19 18:16:07.249867", + "name": "Sales Invoice-delivery_status", + "options": "\nNot Delivered\nPart Delivered\nDelivered\nOver Delivered", + "read_only": 1, + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "POS Profile", + "fieldname": "electronic_fiscal_device", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "is_not_vfd_invoice", + "label": "Electronic Fiscal Device", + "modified": "2020-03-05 19:37:44.325865", + "name": "POS Profile-electronic_fiscal_device", + "options": "Electronic Fiscal Device", + "reqd": 1 + }, + { + "doctype": "Custom Field", + "dt": "Fees", + "fieldname": "from_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "vehicle", + "label": "From Date", + "modified": "2020-08-18 13:10:14.387470", + "name": "Fees-from_date" + }, + { + "doctype": "Custom Field", + "dt": "Vehicle Service", + "fieldname": "quantity", + "fieldtype": "Float", + "in_list_view": 1, + "insert_after": "spare_name", + "label": "Quantity", + "modified": "2020-09-03 21:04:45.981769", + "name": "Vehicle Service-quantity", + "precision": "2" + }, + { + "doctype": "Custom Field", + "dt": "Custom DocPerm", + "fieldname": "dependent", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "parent", + "label": "Dependent", + "modified": "2021-03-19 23:25:35.897256", + "name": "Custom DocPerm-dependent" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fieldname": "is_ignored_in_pending_qty", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "item_code", + "label": "Is Ignored In Pending Qty", + "modified": "2021-09-23 23:33:08.695837", + "name": "Sales Invoice Item-is_ignored_in_pending_qty", + "permlevel": 2, + "precision": null + }, + { + "allow_on_submit": 1, + "columns": 2, + "doctype": "Custom Field", + "dt": "Sales Invoice Payment", + "fieldname": "payment_reference", + "fieldtype": "Data", + "in_list_view": 1, + "insert_after": "amount", + "label": "Payment Reference", + "modified": "2021-03-24 10:13:38.606282", + "name": "Sales Invoice Payment-payment_reference", + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Fee Structure", + "fieldname": "default_fee_category", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "student_category", + "label": "Default Fee Category", + "modified": "2020-07-31 12:20:15.767419", + "name": "Fee Structure-default_fee_category", + "options": "Fee Category" + }, + { + "doctype": "Custom Field", + "dt": "POS Profile", + "fieldname": "column_break_1", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "disabled", + "label": null, + "modified": "2020-03-05 19:37:44.023203", + "name": "POS Profile-column_break_1" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Vehicle Service", + "fieldname": "invoice", + "fieldtype": "Link", + "in_list_view": 1, + "insert_after": "type", + "label": "Invoice", + "modified": "2020-09-03 21:04:46.285638", + "name": "Vehicle Service-invoice", + "options": "Purchase Invoice" + }, + { + "doctype": "Custom Field", + "dt": "Journal Entry", + "fieldname": "expense_record", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "naming_series", + "label": "Expense Record", + "modified": "2020-06-18 00:24:05.285565", + "name": "Journal Entry-expense_record", + "options": "Expense Record", + "read_only": 1 + }, + { + "default": "0", + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fieldname": "allow_over_sell", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "customer_item_code", + "label": "Allow Over Sell", + "modified": "2020-06-19 17:42:30.386345", + "name": "Sales Invoice Item-allow_over_sell" + }, + { + "doctype": "Custom Field", + "dt": "Program Fee", + "fetch_from": "fee_structure.default_fee_category", + "fieldname": "default_fee_category", + "fieldtype": "Link", + "in_list_view": 1, + "insert_after": "due_date", + "label": "Default Fee Category", + "modified": "2020-07-31 12:32:27.126255", + "name": "Program Fee-default_fee_category", + "options": "Fee Category" + }, + { + "bold": 1, + "doctype": "Custom Field", + "dt": "Supplier", + "fieldname": "vrn", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "tax_id", + "label": "VRN", + "modified": "2019-01-04 10:14:48.458823", + "name": "Supplier-vrn", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Program", + "fieldname": "fees", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "courses", + "label": "Fees", + "modified": "2020-07-31 09:39:52.330874", + "name": "Program-fees" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Fees", + "fieldname": "bank_reference", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "send_payment_request", + "label": "Bank Reference", + "modified": "2020-08-10 17:13:35.213803", + "name": "Fees-bank_reference", + "read_only": 1, + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Student Applicant", + "fieldname": "student_applicant_fee", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "paid", + "label": "Student Applicant Fee", + "modified": "2020-09-08 18:39:21.143298", + "name": "Student Applicant-student_applicant_fee", + "read_only": 1, + "translatable": 1 + }, + { + "default": "1", + "doctype": "Custom Field", + "dt": "Print Settings", + "fieldname": "compact_item_print", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "with_letterhead", + "label": "Compact Item Print", + "modified": "2020-04-29 12:32:28.701703", + "name": "Print Settings-compact_item_print" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Vehicle Fine Record", + "fieldname": "fully_paid", + "fieldtype": "Check", + "in_list_view": 1, + "insert_after": "offence", + "label": "FULLY PAID", + "modified": "2020-12-10 10:50:48.832611", + "name": "Vehicle Fine Record-fully_paid" + }, + { + "doctype": "Custom Field", + "dt": "Program", + "fieldname": "program_fee", + "fieldtype": "Table", + "in_list_view": 0, + "insert_after": "fees", + "label": "Program Fee", + "modified": "2020-07-31 09:39:52.739333", + "name": "Program-program_fee", + "options": "Program Fee" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Student Applicant", + "fieldname": "bank_reference", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "student_applicant_fee", + "label": "Bank Reference", + "modified": "2020-09-08 18:39:21.460847", + "name": "Student Applicant-bank_reference", + "read_only": 1, + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Reconciliation Item", + "fieldname": "material_request", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "amount", + "label": "Material Request", + "modified": "2020-06-24 22:55:04.777565", + "name": "Stock Reconciliation Item-material_request", + "options": "Material Request", + "read_only": 1 + }, + { + "depends_on": "eval:doc.docstatus == 0", + "doctype": "Custom Field", + "dt": "Stock Reconciliation", + "fieldname": "sort_items", + "fieldtype": "Button", + "in_list_view": 0, + "insert_after": "items", + "label": "Sort Items", + "modified": "2020-07-17 23:53:18.064909", + "name": "Stock Reconciliation-sort_items" + }, + { + "doctype": "Custom Field", + "dt": "Fees", + "fetch_from": "company.abbr", + "fieldname": "abbr", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "company", + "label": "Abbr", + "modified": "2020-07-22 13:06:42.155142", + "name": "Fees-abbr", + "read_only": 1, + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Item", + "fieldname": "witholding_tax_rate_on_purchase", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "stock_uom", + "label": "Withholding Tax Rate on Purchase", + "modified": "2020-05-05 12:33:29.224597", + "name": "Item-witholding_tax_rate_on_purchase" + }, + { + "doctype": "Custom Field", + "dt": "Landed Cost Voucher", + "fieldname": "import_file", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "sec_break1", + "label": "Import File", + "modified": "2021-01-20 20:26:59.420718", + "name": "Landed Cost Voucher-import_file", + "options": "Import File" + }, + { + "doctype": "Custom Field", + "dt": "Payment Entry Reference", + "fieldname": "section_break_9", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "exchange_rate", + "label": null, + "modified": "2019-12-20 19:23:11.532502", + "name": "Payment Entry Reference-section_break_9" + }, + { + "doctype": "Custom Field", + "dt": "Item", + "fieldname": "withholding_tax_rate_on_sales", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "witholding_tax_rate_on_purchase", + "label": "Withholding Tax Rate on Sales", + "modified": "2020-08-06 01:17:58.305162", + "name": "Item-withholding_tax_rate_on_sales" + }, + { + "allow_on_submit": 1, + "depends_on": "eval: !in_list(frappe.user_roles, \"Healthcare Receptionist\")", + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "previous_invoice_number", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "is_return", + "label": "Previous Invoice Number", + "modified": "2020-08-05 14:33:05.352542", + "name": "Sales Invoice-previous_invoice_number", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Employee", + "fieldname": "old_employee_id", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "image", + "label": "Old Employee ID", + "modified": "2020-09-24 11:29:02.966955", + "name": "Employee-old_employee_id", + "translatable": 1 + }, + { + "columns": 1, + "doctype": "Custom Field", + "dt": "Payment Entry Reference", + "fetch_from": "reference_name.posting_date", + "fieldname": "posting_date", + "fieldtype": "Date", + "in_list_view": 1, + "insert_after": "section_break_9", + "label": "Posting Date", + "modified": "2019-12-20 19:23:23.225925", + "name": "Payment Entry Reference-posting_date" + }, + { + "doctype": "Custom Field", + "dt": "Vehicle Log", + "fieldname": "column_break_11", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "odometer", + "label": null, + "modified": "2020-08-20 16:46:46.909608", + "name": "Vehicle Log-column_break_11" + }, + { + "default": "Today", + "doctype": "Custom Field", + "dt": "Purchase Order", + "fieldname": "posting_date", + "fieldtype": "Date", + "hidden": 1, + "in_list_view": 0, + "insert_after": "transaction_date", + "label": "Posting Date", + "modified": "2020-03-13 16:59:13.689530", + "name": "Purchase Order-posting_date" + }, + { + "doctype": "Custom Field", + "dt": "BOM", + "fieldname": "warehouses", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "image", + "label": "Warehouses", + "modified": "2021-01-21 06:42:52.549662", + "name": "BOM-warehouses" + }, + { + "doctype": "Custom Field", + "dt": "Payment Entry Reference", + "fetch_from": "reference_name.from_date", + "fieldname": "start_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "posting_date", + "label": "Start Date", + "modified": "2019-12-20 19:23:57.230372", + "name": "Payment Entry Reference-start_date" + }, + { + "doctype": "Custom Field", + "dt": "Vehicle Log", + "fieldname": "trip_destination", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "insert_after": "column_break_11", + "label": "Trip Destination", + "modified": "2020-08-20 16:46:47.646836", + "name": "Vehicle Log-trip_destination", + "reqd": 1 + }, + { + "doctype": "Custom Field", + "dt": "Sales Order", + "fieldname": "posting_date", + "fieldtype": "Date", + "hidden": 1, + "in_list_view": 0, + "insert_after": "transaction_date", + "label": "Posting Date", + "modified": "2020-03-13 17:00:30.266085", + "name": "Sales Order-posting_date" + }, + { + "doctype": "Custom Field", + "dt": "Operation", + "fieldname": "image", + "fieldtype": "Attach Image", + "hidden": 1, + "in_list_view": 0, + "insert_after": "description", + "label": "Image", + "modified": "2020-10-17 02:40:39.330498", + "name": "Operation-image" + }, + { + "doctype": "Custom Field", + "dt": "Student Applicant", + "fieldname": "fee_structure", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "application_date", + "label": "Fee Structure", + "modified": "2020-09-08 18:38:13.430256", + "name": "Student Applicant-fee_structure", + "options": "Fee Structure", + "reqd": 1 + }, + { + "doctype": "Custom Field", + "dt": "BOM", + "fieldname": "source_warehouse", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "warehouses", + "label": "Source Warehouse", + "modified": "2021-01-21 06:54:48.841522", + "name": "BOM-source_warehouse", + "options": "Warehouse" + }, + { + "doctype": "Custom Field", + "dt": "Payment Entry Reference", + "fetch_from": "reference_name.to_date", + "fieldname": "end_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "start_date", + "label": "End Date", + "modified": "2019-12-20 19:23:36.497233", + "name": "Payment Entry Reference-end_date" + }, + { + "doctype": "Custom Field", + "dt": "Vehicle Log", + "fieldname": "destination_description", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "trip_destination", + "label": "Destination Description", + "modified": "2020-08-20 16:46:48.115791", + "name": "Vehicle Log-destination_description", + "translatable": 1 + }, + { + "depends_on": "eval:doc.purpose==\"Repack\"", + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "repack_template", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "purchase_receipt_no", + "label": "Repack Template", + "modified": "2020-05-29 11:40:04.831550", + "name": "Stock Entry-repack_template", + "options": "Repack Template" + }, + { + "doctype": "Custom Field", + "dt": "Student Applicant", + "fieldname": "program_enrollment", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "fee_structure", + "label": "Program Enrollment", + "modified": "2020-09-08 21:42:34.633789", + "name": "Student Applicant-program_enrollment", + "options": "Program Enrollment" + }, + { + "default": "0", + "doctype": "Custom Field", + "dt": "Print Settings", + "fieldname": "print_taxes_with_zero_amount", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "allow_print_for_cancelled", + "label": "Print taxes with zero amount", + "modified": "2020-04-29 12:32:28.864970", + "name": "Print Settings-print_taxes_with_zero_amount" + }, + { + "doctype": "Custom Field", + "dt": "BOM", + "fieldname": "fg_warehouse", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "source_warehouse", + "label": "Target Warehouse", + "modified": "2021-01-21 06:44:08.776914", + "name": "BOM-fg_warehouse", + "options": "Warehouse" + }, + { + "depends_on": "eval:doc.purpose==\"Repack\"", + "doctype": "Custom Field", + "dt": "Stock Entry", + "fetch_from": "repack_template.item_uom", + "fieldname": "item_uom", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "repack_template", + "label": "Item UOM", + "modified": "2020-05-29 12:22:24.669156", + "name": "Stock Entry-item_uom", + "read_only": 1, + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Address", + "fieldname": "tax_category", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "fax", + "label": "Tax Category", + "modified": "2018-12-28 22:29:21.828090", + "name": "Address-tax_category", + "options": "Tax Category" + }, + { + "doctype": "Custom Field", + "dt": "BOM", + "fieldname": "column_break_15", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "fg_warehouse", + "label": null, + "modified": "2021-01-21 06:55:01.821947", + "name": "BOM-column_break_15" + }, + { + "depends_on": "eval:doc.purpose==\"Repack\"", + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "repack_qty", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "item_uom", + "label": "Repack Qty", + "modified": "2020-05-29 11:40:05.783365", + "name": "Stock Entry-repack_qty" + }, + { + "doctype": "Custom Field", + "dt": "Item", + "fieldname": "excisable_item", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "is_stock_item", + "label": "Excisable Item", + "modified": "2021-03-06 07:27:57.882935", + "name": "Item-excisable_item" + }, + { + "doctype": "Custom Field", + "dt": "BOM", + "fieldname": "wip_warehouse", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "column_break_15", + "label": "Work-in-Progress Warehouse", + "modified": "2021-01-21 06:42:52.960942", + "name": "BOM-wip_warehouse", + "options": "Warehouse" + }, + { + "doctype": "Custom Field", + "dt": "Purchase Invoice", + "fieldname": "expense_record", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "amended_from", + "label": "Expense Record", + "modified": "2020-06-17 22:59:39.964707", + "name": "Purchase Invoice-expense_record", + "options": "Expense Record", + "read_only": 1 + }, + { + "bold": 1, + "description": "Value Added Tax Registration Number (VAT RN = VRN)", + "doctype": "Custom Field", + "dt": "Customer", + "fieldname": "vrn", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "tax_id", + "label": "VRN", + "modified": "2019-12-20 19:21:41.980276", + "name": "Customer-vrn", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "BOM", + "fieldname": "scrap_warehouse", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "wip_warehouse", + "label": "Scrap Warehouse", + "modified": "2021-01-21 06:44:09.157050", + "name": "BOM-scrap_warehouse", + "options": "Warehouse" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "default_item_tax_template", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "default_in_transit_warehouse", + "label": "Default Item Tax Template", + "modified": "2021-03-31 08:45:00.684605", + "name": "Company-default_item_tax_template", + "options": "Item Tax Template" + }, + { + "default": "0", + "doctype": "Custom Field", + "dt": "Address", + "fieldname": "is_your_company_address", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "linked_with", + "label": "Is Your Company Address", + "modified": "2020-10-14 17:41:40.878179", + "name": "Address-is_your_company_address" + }, + { + "doctype": "Custom Field", + "dt": "Student", + "fieldname": "bank", + "fieldtype": "Select", + "in_list_view": 0, + "insert_after": "student_applicant", + "label": "Bank", + "modified": "2020-07-21 02:47:58.927966", + "name": "Student-bank", + "options": "\n NMB Bank", + "translatable": 1 + }, + { + "depends_on": "", + "doctype": "Custom Field", + "dt": "Account", + "fieldname": "item", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "include_in_gross", + "label": "Expense Item", + "modified": "2020-06-16 00:19:13.785448", + "name": "Account-item", + "options": "Item" + }, + { + "doctype": "Custom Field", + "dt": "Contact", + "fieldname": "is_billing_contact", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "is_primary_contact", + "label": "Is Billing Contact", + "modified": "2019-12-02 11:00:03.432994", + "name": "Contact-is_billing_contact" + }, + { + "default": "0", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "max_records_in_dialog", + "fieldtype": "Int", + "in_list_view": 0, + "insert_after": "sales_monthly_history", + "label": "Max records in Dialog", + "modified": "2020-05-07 08:55:04.364472", + "name": "Company-max_records_in_dialog" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry Detail", + "fieldname": "item_weight_details", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "sample_quantity", + "label": "Item Weight Details", + "modified": "2020-06-30 15:34:01.228484", + "name": "Stock Entry Detail-item_weight_details" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry Detail", + "fetch_from": "item_code.weight_per_unit", + "fieldname": "weight_per_unit", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "item_weight_details", + "label": "Weight Per Unit", + "modified": "2020-06-30 15:34:01.669365", + "name": "Stock Entry Detail-weight_per_unit", + "read_only": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Journal Entry", + "fieldname": "import_file", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "clearance_date", + "label": "Import File", + "modified": "2021-01-20 13:50:31.424897", + "name": "Journal Entry-import_file", + "options": "Import File" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry Detail", + "fieldname": "total_weight", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "weight_per_unit", + "label": "Total Weight", + "modified": "2020-06-30 15:34:02.259714", + "name": "Stock Entry Detail-total_weight", + "read_only": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry Detail", + "fieldname": "column_break_32", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "total_weight", + "label": null, + "modified": "2020-06-30 15:34:02.814827", + "name": "Stock Entry Detail-column_break_32" + }, + { + "depends_on": "eval: !in_list(frappe.user_roles, \"Healthcare Receptionist\")", + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "statutory_details", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "po_date", + "label": "Statutory Details", + "modified": "2019-12-20 19:25:08.716714", + "name": "Sales Invoice-statutory_details" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry Detail", + "fetch_from": "item_code.weight_uom", + "fieldname": "weight_uom", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "column_break_32", + "label": "Weight UOM", + "modified": "2020-06-30 15:34:03.282211", + "name": "Stock Entry Detail-weight_uom", + "options": "UOM", + "read_only": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "tra_control_number", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "statutory_details", + "label": "TRA Control Number", + "modified": "2019-12-20 19:24:51.344893", + "name": "Sales Invoice-tra_control_number", + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "witholding_tax_certificate_number", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "tra_control_number", + "label": "Witholding Tax Certificate Number", + "modified": "2019-12-20 19:23:45.693752", + "name": "Sales Invoice-witholding_tax_certificate_number", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fetch_from": "item_code.withholding_tax_rate_on_sales", + "fieldname": "withholding_tax_rate", + "fieldtype": "Percent", + "in_list_view": 0, + "insert_after": "item_tax_template", + "label": "Withholding Tax Rate", + "modified": "2019-12-20 00:57:44.450609", + "name": "Sales Invoice Item-withholding_tax_rate" + }, + { + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "column_break_29", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "witholding_tax_certificate_number", + "label": null, + "modified": "2019-12-20 19:24:28.702495", + "name": "Sales Invoice-column_break_29" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Purchase Invoice Item", + "fetch_from": "item_code.witholding_tax_rate_on_purchase", + "fetch_if_empty": 1, + "fieldname": "withholding_tax_rate", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "item_tax_template", + "label": "Withholding Tax Rate", + "modified": "2020-07-17 01:03:26.025362", + "name": "Purchase Invoice Item-withholding_tax_rate" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fieldname": "withholding_tax_entry", + "fieldtype": "Data", + "ignore_user_permissions": 1, + "in_list_view": 0, + "insert_after": "withholding_tax_rate", + "label": "Withholding Tax Entry", + "modified": "2020-08-06 01:34:59.329482", + "name": "Sales Invoice Item-withholding_tax_entry", + "read_only": 1, + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fetch_from": "pos_profile.electronic_fiscal_device", + "fetch_if_empty": 1, + "fieldname": "electronic_fiscal_device", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "column_break_29", + "label": "Electronic Fiscal Device", + "modified": "2020-03-05 16:05:01.332647", + "name": "Sales Invoice-electronic_fiscal_device", + "options": "Electronic Fiscal Device" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Purchase Invoice Item", + "fieldname": "withholding_tax_entry", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "withholding_tax_rate", + "label": "Withholding Tax Entry", + "modified": "2020-07-17 16:37:56.527525", + "name": "Purchase Invoice Item-withholding_tax_entry", + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "efd_z_report", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "electronic_fiscal_device", + "label": "EFD Z Report", + "modified": "2019-12-20 19:24:07.925266", + "name": "Sales Invoice-efd_z_report", + "options": "EFD Z Report" + }, + { + "depends_on": "eval: doc.stock_entry_type == \"Send to Warehouse\"", + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "final_destination", + "fieldtype": "Select", + "in_list_view": 0, + "insert_after": "target_address_display", + "label": "Final Destination", + "modified": "2020-06-29 18:07:10.893479", + "name": "Stock Entry-final_destination", + "options": "", + "translatable": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Material Request Item", + "fieldname": "stock_reconciliation", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "lead_time_date", + "label": "Stock Reconciliation", + "modified": "2020-06-24 22:47:46.584890", + "name": "Material Request Item-stock_reconciliation", + "options": "Stock Reconciliation", + "read_only": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "total_net_weight", + "fieldtype": "Float", + "in_list_view": 0, + "insert_after": "section_break_19", + "label": "Total Net Weight", + "modified": "2020-06-30 14:59:16.406735", + "name": "Stock Entry-total_net_weight", + "read_only": 1 + }, + { + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fieldname": "allow_override_net_rate", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "net_rate", + "label": "Allow Override Net Rate", + "modified": "2020-07-02 17:20:45.022013", + "name": "Sales Invoice Item-allow_override_net_rate", + "permlevel": 1 + }, + { + "doctype": "Custom Field", + "dt": "Fees", + "fieldname": "to_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "from_date", + "label": "To Date", + "modified": "2020-08-18 13:10:14.889080", + "name": "Fees-to_date" + }, + { + "doctype": "Custom Field", + "dt": "Employee", + "fieldname": "heslb_f4_index_number", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "national_identity", + "label": "HESLB F4 Index Number", + "modified": "2021-08-16 17:52:02.294599", + "name": "Employee-heslb_f4_index_number", + "precision": null, + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Sales Order", + "fieldname": "default_item_discount", + "fieldtype": "Percent", + "in_list_view": 0, + "insert_after": "scan_barcode", + "label": "Default Item Discount", + "modified": "2021-02-04 08:16:47.825862", + "name": "Sales Order-default_item_discount" + }, + { + "doctype": "Custom Field", + "dt": "Employee", + "fieldname": "employee_salary_component_limits", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "heslb_f4_index_number", + "label": "Employee Salary Component Limits", + "modified": "2021-07-25 21:03:21.031697", + "name": "Employee-employee_salary_component_limits" + }, + { + "doctype": "Custom Field", + "dt": "Employee", + "fieldname": "employee_salary_component_limit", + "fieldtype": "Table", + "in_list_view": 0, + "insert_after": "employee_salary_component_limits", + "label": "Employee Salary Component Limit", + "modified": "2021-07-25 21:03:21.895844", + "name": "Employee-employee_salary_component_limit", + "options": "Employee Salary Component Limit" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "withholding_section", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "default_expense_claim_payable_account", + "label": "Withholding", + "modified": "2020-08-05 22:35:42.216333", + "name": "Company-withholding_section" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "default_withholding_payable_account", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "withholding_section", + "label": "Default Withholding Payable Account", + "modified": "2020-07-17 00:37:50.184521", + "name": "Company-default_withholding_payable_account", + "options": "Account" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "auto_create_for_purchase_withholding", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "default_withholding_payable_account", + "label": "Auto Create For Purchase Withholding", + "modified": "2020-09-01 23:21:15.437803", + "name": "Company-auto_create_for_purchase_withholding" + }, + { + "default": "0", + "depends_on": "auto_create_for_purchase_withholding", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "auto_submit_for_purchase_withholding", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "auto_create_for_purchase_withholding", + "label": "Auto Submit For Purchase Withholding", + "modified": "2020-08-05 22:48:17.854167", + "name": "Company-auto_submit_for_purchase_withholding" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "column_break_55", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "auto_submit_for_purchase_withholding", + "label": null, + "modified": "2020-08-05 22:48:18.181399", + "name": "Company-column_break_55" + }, + { + "doctype": "Custom Field", + "dt": "Journal Entry", + "fieldname": "from_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "auto_repeat", + "label": "From Date", + "modified": "2019-12-20 19:22:47.765536", + "name": "Journal Entry-from_date" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "default_withholding_receivable_account", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "column_break_55", + "label": "Default Withholding Receivable Account", + "modified": "2020-08-05 22:48:18.477944", + "name": "Company-default_withholding_receivable_account", + "options": "Account" + }, + { + "doctype": "Custom Field", + "dt": "Journal Entry", + "fieldname": "to_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "from_date", + "label": "To Date", + "modified": "2019-12-20 19:22:38.720845", + "name": "Journal Entry-to_date" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "auto_create_for_sales_withholding", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "default_withholding_receivable_account", + "label": "Auto Create For Sales Withholding", + "modified": "2020-09-01 23:21:15.814351", + "name": "Company-auto_create_for_sales_withholding" + }, + { + "default": "0", + "depends_on": "auto_create_for_sales_withholding", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "auto_submit_for_sales_withholding", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "auto_create_for_sales_withholding", + "label": "Auto Submit For Sales Withholding", + "modified": "2020-08-05 22:48:18.789116", + "name": "Company-auto_submit_for_sales_withholding" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "education_section", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "auto_submit_for_sales_withholding", + "label": "Education", + "modified": "2020-08-18 15:46:30.057666", + "name": "Company-education_section" + }, + { + "default": "0", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "send_fee_details_to_bank", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "education_section", + "label": "Send Fee details to Bank", + "modified": "2020-08-18 15:46:30.517510", + "name": "Company-send_fee_details_to_bank" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "fee_bank_account", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "send_fee_details_to_bank", + "label": "Fee Bank Account", + "modified": "2020-09-01 01:35:36.035810", + "name": "Company-fee_bank_account", + "options": "Account" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "student_applicant_fees_revenue_account", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "fee_bank_account", + "label": "Student Applicant Fees Revenue Account", + "modified": "2020-09-01 01:36:24.342359", + "name": "Company-student_applicant_fees_revenue_account", + "options": "Account" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "column_break_60", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "student_applicant_fees_revenue_account", + "label": null, + "modified": "2020-08-18 15:47:26.978439", + "name": "Company-column_break_60" + }, + { + "depends_on": "send_fee_details_to_bank", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "nmb_series", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "column_break_60", + "label": "NMB Series", + "modified": "2020-08-10 16:10:54.189754", + "name": "Company-nmb_series", + "translatable": 1 + }, + { + "depends_on": "send_fee_details_to_bank", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "nmb_username", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "nmb_series", + "label": "NMB User Name", + "modified": "2020-07-28 03:54:27.672291", + "name": "Company-nmb_username", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "transporter_info", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "letter_head", + "label": "Transporter Info", + "modified": "2020-06-23 16:43:00.237708", + "name": "Stock Entry-transporter_info" + }, + { + "depends_on": "send_fee_details_to_bank", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "nmb_password", + "fieldtype": "Password", + "in_list_view": 0, + "insert_after": "nmb_username", + "label": "NMB Password", + "modified": "2020-07-28 03:54:28.347794", + "name": "Company-nmb_password" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "transporter", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "transporter_info", + "label": "Transporter", + "modified": "2020-06-23 16:43:00.755674", + "name": "Stock Entry-transporter", + "options": "Supplier" + }, + { + "depends_on": "eval: !in_list(frappe.user_roles, \"Healthcare Receptionist\")", + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "default_item_discount", + "fieldtype": "Percent", + "in_list_view": 0, + "insert_after": "update_stock", + "label": "Default Item Discount", + "modified": "2021-01-09 19:30:39.855293", + "name": "Sales Invoice-default_item_discount" + }, + { + "depends_on": "send_fee_details_to_bank", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "nmb_url", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "nmb_password", + "label": "NMb URL", + "modified": "2020-08-10 16:11:58.119081", + "name": "Company-nmb_url", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "driver", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "transporter", + "label": "Driver", + "modified": "2020-06-23 16:43:01.308481", + "name": "Stock Entry-driver", + "options": "Driver" + }, + { + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fetch_from": "company.default_item_tax_template", + "fetch_if_empty": 1, + "fieldname": "default_item_tax_template", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "default_item_discount", + "label": "Default Item Tax Template", + "modified": "2021-02-08 22:50:03.490542", + "name": "Sales Invoice-default_item_tax_template", + "options": "Item Tax Template" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "transport_receipt_no", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "driver", + "label": "Transport Receipt No", + "modified": "2020-06-23 16:43:01.837481", + "name": "Stock Entry-transport_receipt_no", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "section_break_80", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "default_item_tax_template", + "label": null, + "modified": "2021-02-08 22:50:04.586234", + "name": "Sales Invoice-section_break_80" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "vehicle_no", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "transport_receipt_no", + "label": "Vehicle No", + "modified": "2020-06-23 16:43:02.364744", + "name": "Stock Entry-vehicle_no", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "column_break_69", + "fieldtype": "Column Break", + "in_list_view": 0, + "insert_after": "vehicle_no", + "label": null, + "modified": "2020-06-23 16:43:02.892782", + "name": "Stock Entry-column_break_69" + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "transporter_name", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "column_break_69", + "label": "Transporter Name", + "modified": "2020-06-23 16:43:03.373538", + "name": "Stock Entry-transporter_name", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fetch_from": "driver.full_name", + "fieldname": "driver_name", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "transporter_name", + "label": "Driver Name", + "modified": "2020-06-23 16:43:03.900970", + "name": "Stock Entry-driver_name", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Stock Entry", + "fieldname": "transport_receipt_date", + "fieldtype": "Date", + "in_list_view": 0, + "insert_after": "driver_name", + "label": "Transport Receipt Date", + "modified": "2020-06-23 16:43:04.427622", + "name": "Stock Entry-transport_receipt_date" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "bypass_material_request_validation", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "stock_adjustment_account", + "label": "Bypass Material Request validation on Stock Entry", + "modified": "2020-09-10 16:46:34.320822", + "name": "Company-bypass_material_request_validation" + }, + { + "default": "1", + "description": "For Sales Invoices", + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "enabled_auto_create_delivery_notes", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "column_break_32", + "label": "Enabled Auto Create Delivery Notes", + "modified": "2020-07-17 22:30:49.037893", + "name": "Company-enabled_auto_create_delivery_notes" + }, + { + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "price_reduction", + "fieldtype": "Currency", + "in_list_view": 0, + "insert_after": "base_net_total", + "label": "Total Price Reduction Amount", + "modified": "2020-06-28 02:56:42.240626", + "name": "Sales Invoice-price_reduction", + "read_only": 1 + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice Item", + "fieldname": "delivery_status", + "fieldtype": "Select", + "in_list_view": 0, + "insert_after": "sales_order", + "label": "Delivery Status", + "modified": "2020-06-19 18:17:11.595366", + "name": "Sales Invoice Item-delivery_status", + "options": "\nNot Delivered\nPart Delivered\nDelivered\nOver Delivered", + "read_only": 1, + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "", + "fieldname": "default_tax_template", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "item_tax_section_break", + "label": "Default Tax Template", + "modified": "2021-03-10 12:04:59.499730", + "name": "Item-default_tax_template", + "options": "Item Tax Template" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "vrn", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "website", + "label": "VRN", + "modified": "2019-12-20 19:22:02.995304", + "name": "Company-vrn", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "tin", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "vrn", + "label": "TIN", + "modified": "2019-12-20 19:22:10.324100", + "name": "Company-tin", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "p_o_box", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "tin", + "label": "P O Box", + "modified": "2020-05-07 17:49:19.841962", + "name": "Company-p_o_box", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "city", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "p_o_box", + "label": "City", + "modified": "2020-05-07 17:49:20.430328", + "name": "Company-city", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "plot_number", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "city", + "label": "Plot Number", + "modified": "2020-05-07 13:58:31.627080", + "name": "Company-plot_number", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "block_number", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "plot_number", + "label": "Block Number", + "modified": "2020-05-07 13:58:32.111317", + "name": "Company-block_number", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "street", + "fieldtype": "Data", + "in_list_view": 0, + "insert_after": "block_number", + "label": "Street", + "modified": "2020-05-07 13:58:32.664481", + "name": "Company-street", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "section_break_12", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "company_description", + "label": "", + "modified": "2019-12-20 19:22:27.862997", + "name": "Company-section_break_12" + }, + { + "doctype": "Custom Field", + "dt": "Company", + "fieldname": "company_bank_details", + "fieldtype": "Text", + "in_list_view": 0, + "insert_after": "section_break_12", + "label": "Company Bank Details", + "modified": "2019-12-20 19:22:19.201911", + "name": "Company-company_bank_details", + "translatable": 1 + }, + { + "doctype": "Custom Field", + "dt": "Purchase Invoice", + "fieldname": "reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "insert_after": "language", + "label": "Reference", + "modified": "2021-01-20 13:49:43.238770", + "name": "Purchase Invoice-reference" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Purchase Invoice", + "fieldname": "import_file", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": "reference", + "label": "Import File", + "modified": "2021-01-20 13:49:43.767414", + "name": "Purchase Invoice-import_file", + "options": "Import File" + }, + { + "allow_on_submit": 1, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fieldname": "excise_duty_applicable", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "col_break23", + "label": "Excise Duty Applicable", + "modified": "2021-03-06 07:42:46.718597", + "name": "Sales Invoice-excise_duty_applicable" + }, + { + "default": "1", + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fetch_from": "", + "fieldname": "enabled_auto_create_delivery_notes", + "fieldtype": "Check", + "in_list_view": 0, + "insert_after": "delivery_status", + "label": "Enabled Auto Create Delivery Notes", + "modified": "2020-08-13 18:32:53.375956", + "name": "Sales Invoice-enabled_auto_create_delivery_notes" + }, + { + "doctype": "Custom Field", + "dt": "Custom Field", + "fetch_from": "", + "fieldname": "module_def", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": null, + "label": "Module Def", + "modified": "2020-08-13 18:32:53.375956", + "name": "Custom Field-module_def", + "options": "Module Def" + }, + { + "doctype": "Custom Field", + "dt": "Property Setter", + "fetch_from": "", + "fieldname": "module_def", + "fieldtype": "Link", + "in_list_view": 0, + "insert_after": null, + "label": "Module Def", + "name": "Property Setter-module_def", + "options": "Module Def" + }, + { + "name": "Journal Entry-referance_doctype", + "owner": "Administrator", + "modified": "2022-03-08 23:23:52.276124", + "dt": "Journal Entry", + "label": "Referance DocType", + "fieldname": "referance_doctype", + "insert_after": "payment_order", + "fieldtype": "Link", + "options": "DocType", + "doctype": "Custom Field", + "module_def": "CSF TZ" + }, + { + "name": "Journal Entry-referance_docname", + "owner": "Administrator", + "modified": "2022-03-08 23:24:03.811966", + "dt": "Journal Entry", + "label": "Referance DocName", + "fieldname": "referance_docname", + "insert_after": "referance_doctype", + "fieldtype": "Dynamic Link", + "options": "referance_doctype", + "doctype": "Custom Field", + "module_def": "CSF TZ" + }, + { + "name": "Vehicle-csf_tz_acquisition_odometer", + "modified_by": "Administrator", + "module_def": "CSF TZ", + "dt": "Vehicle", + "label": "Acquisition Odometer", + "fieldname": "csf_tz_acquisition_odometer", + "insert_after": "acquisition_date", + "fieldtype": "Int", + "doctype": "Custom Field" + }, + { + "name": "Vehicle-csf_tz_year", + "owner": "Administrator", + "modified": "2022-07-09 03:26:47.982299", + "modified_by": "Administrator", + "module_def": "CSF TZ", + "dt": "Vehicle", + "label": "Manufacturing Year", + "fieldname": "csf_tz_year", + "insert_after": "model", + "fieldtype": "Int", + "doctype": "Custom Field" + }, + { + "name": "Vehicle-csf_tz_engine_number", + "modified": "2022-07-09 11:27:38.710494", + "module_def": "CSF TZ", + "dt": "Vehicle", + "label": "Engine Number", + "fieldname": "csf_tz_engine_number", + "insert_after": "chassis_no", + "fieldtype": "Data", + "doctype": "Custom Field" + } +] diff --git a/csf_tz/fixtures/property_setter.json b/csf_tz/fixtures/property_setter.json new file mode 100644 index 0000000..eafaf60 --- /dev/null +++ b/csf_tz/fixtures/property_setter.json @@ -0,0 +1,1331 @@ +[ + { + "default_value": null, + "doc_type": "Supplier", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "tax_id", + "modified": "2019-01-04 10:14:48.444498", + "name": "Supplier-tax_id-label", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "label", + "property_type": "Data", + "row_name": null, + "value": "TIN" + }, + { + "default_value": null, + "doc_type": "Supplier", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2019-01-07 16:37:11.289992", + "name": "Supplier-read_only_onload", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "read_only_onload", + "property_type": "Check", + "row_name": null, + "value": null + }, + { + "default_value": null, + "doc_type": "Supplier", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "tax_id", + "modified": "2019-01-07 16:37:11.313295", + "name": "Supplier-tax_id-bold", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "bold", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Journal Entry Account", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "accounting_dimensions_section", + "modified": "2020-07-24 18:04:15.054077", + "name": "Journal Entry Account-accounting_dimensions_section-collapsible", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "collapsible", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2020-08-05 14:33:48.734096", + "name": "Sales Invoice-search_fields", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "search_fields", + "property_type": "Data", + "row_name": null, + "value": "posting_date, due_date, customer, base_grand_total, outstanding_amount" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "cost_center", + "modified": "2020-08-07 16:40:53.785368", + "name": "Sales Invoice Item-cost_center-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "item_code", + "modified": "2020-08-07 16:41:21.622965", + "name": "Sales Invoice Item-item_code-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "3" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "qty", + "modified": "2020-08-07 16:41:42.007046", + "name": "Sales Invoice Item-qty-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "warehouse", + "modified": "2020-08-07 16:42:02.700105", + "name": "Sales Invoice Item-warehouse-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "batch_no", + "modified": "2020-08-07 16:42:16.034139", + "name": "Sales Invoice Item-batch_no-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "cost_center", + "modified": "2020-08-07 16:42:34.442289", + "name": "Sales Invoice Item-cost_center-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "license_plate", + "modified": "2020-08-20 16:49:41.440717", + "name": "Vehicle Log-license_plate-in_standard_filter", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_standard_filter", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "employee", + "modified": "2020-09-03 14:15:31.974335", + "name": "Vehicle Log-employee-fetch_from", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_from", + "property_type": "Small Text", + "row_name": null, + "value": "license_plate.driver" + }, + { + "default_value": null, + "doc_type": "Vehicle Service", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "service_item", + "modified": "2020-09-03 21:04:45.543760", + "name": "Vehicle Service-service_item-options", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "options", + "property_type": "Text", + "row_name": null, + "value": "NOT SELECTED\nBrake Oil\nBrake Pad\nClutch Plate\nEngine Oil\nOil Change\nWheels" + }, + { + "default_value": null, + "doc_type": "Vehicle Service", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "service_item", + "modified": "2020-09-03 21:04:45.589149", + "name": "Vehicle Service-service_item-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Vehicle Service", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "type", + "modified": "2020-09-03 21:04:45.617241", + "name": "Vehicle Service-type-options", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "options", + "property_type": "Text", + "row_name": null, + "value": "Repair\nInspection\nService\nChange" + }, + { + "default_value": null, + "doc_type": "Vehicle Service", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "frequency", + "modified": "2020-09-03 21:04:45.647207", + "name": "Vehicle Service-frequency-options", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "options", + "property_type": "Text", + "row_name": null, + "value": "NOT SELECTED\nMileage\nMonthly\nQuarterly\nHalf Yearly\nYearly" + }, + { + "default_value": null, + "doc_type": "Vehicle Service", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "frequency", + "modified": "2020-09-03 21:04:45.677056", + "name": "Vehicle Service-frequency-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2020-09-03 21:08:10.695514", + "name": "Vehicle Log-quick_entry", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "quick_entry", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "employee", + "modified": "2020-09-10 13:54:12.155829", + "name": "Vehicle Log-employee-fetch_if_empty", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_if_empty", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Account", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2020-10-03 13:04:54.173393", + "name": "Account-search_fields", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "search_fields", + "property_type": "Data", + "row_name": null, + "value": "account_number, root_type, account_type" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "date", + "modified": "2020-10-13 18:44:38.846941", + "name": "Vehicle Log-date-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "date", + "modified": "2020-10-13 18:44:38.895541", + "name": "Vehicle Log-date-default", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "default", + "property_type": "Text", + "row_name": null, + "value": "Today" + }, + { + "default_value": null, + "doc_type": "Vehicle Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "odometer", + "modified": "2020-10-13 18:44:38.924641", + "name": "Vehicle Log-odometer-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Purchase Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "cost_center", + "modified": "2020-11-22 11:49:55.643779", + "name": "Purchase Invoice Item-cost_center-default", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "default", + "property_type": "Text", + "row_name": null, + "value": "" + }, + { + "default_value": null, + "doc_type": "Journal Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "accounts", + "modified": "2020-12-04 15:28:53.260034", + "name": "Journal Entry-accounts-allow_bulk_edit", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "allow_bulk_edit", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Journal Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "total_debit", + "modified": "2020-12-04 15:33:03.203805", + "name": "Journal Entry-total_debit-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Journal Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "total_amount", + "modified": "2020-12-04 15:33:03.254063", + "name": "Journal Entry-total_amount-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Report", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "javascript", + "modified": "2020-12-21 10:56:45.014398", + "name": "Report-javascript-depends_on", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "depends_on", + "property_type": "Text", + "row_name": null, + "value": null + }, + { + "default_value": null, + "doc_type": "Journal Entry Account", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "reference_name", + "modified": "2020-12-25 12:55:10.271358", + "name": "Journal Entry Account-reference_name-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Journal Entry Account", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "account", + "modified": "2020-12-25 12:58:00.768014", + "name": "Journal Entry Account-account-width", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "width", + "property_type": "Data", + "row_name": null, + "value": "" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "item_tax_template", + "modified": "2021-01-08 12:03:56.549439", + "name": "Sales Invoice Item-item_tax_template-fetch_if_empty", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_if_empty", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Sales Invoice Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "item_tax_template", + "modified": "2021-01-08 12:07:47.457811", + "name": "Sales Invoice Item-item_tax_template-default", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "default", + "property_type": "Text", + "row_name": null, + "value": "" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "letter_head", + "modified": "2021-02-10 15:30:25.788142", + "name": "Sales Invoice-letter_head-fetch_from", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_from", + "property_type": "Small Text", + "row_name": null, + "value": "company.default_letter_head" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "letter_head", + "modified": "2021-02-10 15:30:26.450449", + "name": "Sales Invoice-letter_head-fetch_if_empty", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_if_empty", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Purchase Order", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "letter_head", + "modified": "2021-02-16 14:57:07.312256", + "name": "Purchase Order-letter_head-fetch_from", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_from", + "property_type": "Small Text", + "row_name": null, + "value": "" + }, + { + "default_value": null, + "doc_type": "Item Price", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "brand", + "modified": "2021-03-04 15:42:16.780100", + "name": "Item Price-brand-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Item Price", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "price_list", + "modified": "2021-03-04 15:42:16.967129", + "name": "Item Price-price_list-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Delivery Note", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "items", + "modified": "2021-03-19 02:15:59.510868", + "name": "Delivery Note-items-allow_bulk_edit", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "allow_bulk_edit", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Item Price", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "valid_from", + "modified": "2021-03-24 12:27:10.550024", + "name": "Item Price-valid_from-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "letter_head", + "modified": "2021-04-01 18:03:47.034941", + "name": "Payment Entry-letter_head-fetch_from", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_from", + "property_type": "Small Text", + "row_name": null, + "value": "company.default_letter_head" + }, + { + "default_value": null, + "doc_type": "Piecework Type", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-02-12 13:14:23.468895", + "name": "Piecework Type-search_fields", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "search_fields", + "property_type": "Data", + "row_name": null, + "value": "task_name" + }, + { + "default_value": null, + "doc_type": "Document Attachment", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "attachment", + "modified": "2020-10-26 15:43:41.704785", + "name": "Document Attachment-attachment-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Operation", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2020-10-17 02:40:39.006951", + "name": "Operation-image_field", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "image_field", + "property_type": "Data", + "row_name": null, + "value": "image" + }, + { + "default_value": null, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "payment_accounts_section", + "modified": "2019-01-07 16:30:11.505408", + "name": "Payment Entry-payment_accounts_section-collapsible", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "collapsible", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "section_break_12", + "modified": "2019-02-04 16:02:42.315910", + "name": "Payment Entry-section_break_12-collapsible", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "collapsible", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Bank Reconciliation Detail", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "payment_entry", + "modified": "2019-12-06 09:49:57.146453", + "name": "Bank Reconciliation Detail-payment_entry-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Bank Reconciliation Detail", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "posting_date", + "modified": "2019-12-06 09:50:14.703149", + "name": "Bank Reconciliation Detail-posting_date-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Bank Reconciliation Detail", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "posting_date", + "modified": "2019-12-06 09:50:38.578267", + "name": "Bank Reconciliation Detail-posting_date-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "tax_id", + "modified": "2019-12-06 10:07:41.251289", + "name": "Customer-tax_id-label", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "label", + "property_type": "Data", + "row_name": null, + "value": "TIN" + }, + { + "default_value": null, + "doc_type": "Payment Entry Reference", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "due_date", + "modified": "2019-12-06 10:31:31.992236", + "name": "Payment Entry Reference-due_date-width", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "width", + "property_type": "Data", + "row_name": null, + "value": "23" + }, + { + "default_value": null, + "doc_type": "Payment Entry Reference", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "due_date", + "modified": "2019-12-06 10:31:56.965709", + "name": "Payment Entry Reference-due_date-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Payment Entry Reference", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "reference_doctype", + "modified": "2019-12-06 10:32:26.831812", + "name": "Payment Entry Reference-reference_doctype-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Payment Entry Reference", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "reference_name", + "modified": "2019-12-06 12:12:18.979443", + "name": "Payment Entry Reference-reference_name-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "3" + }, + { + "default_value": null, + "doc_type": "Payment Entry Reference", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "reference_doctype", + "modified": "2019-12-06 12:12:35.564887", + "name": "Payment Entry Reference-reference_doctype-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Payment Reconciliation Payment", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "posting_date", + "modified": "2019-12-06 14:53:06.273025", + "name": "Payment Reconciliation Payment-posting_date-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Payment Reconciliation Payment", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "posting_date", + "modified": "2019-12-06 14:53:38.910392", + "name": "Payment Reconciliation Payment-posting_date-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "is_pos", + "modified": "2019-12-06 14:58:23.980385", + "name": "Sales Invoice-is_pos-in_standard_filter", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_standard_filter", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "posting_date", + "modified": "2019-12-06 15:02:23.144783", + "name": "Sales Invoice-posting_date-in_list_view", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_list_view", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "pos_profile", + "modified": "2019-12-06 15:02:39.589803", + "name": "Sales Invoice-pos_profile-in_standard_filter", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "in_standard_filter", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Stock Entry", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "from_warehouse", + "modified": "2020-06-23 16:15:02.913991", + "name": "Stock Entry-from_warehouse-fetch_from", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "fetch_from", + "property_type": "Small Text", + "row_name": null, + "value": "repack_template.default_warehouse" + }, + { + "default_value": null, + "doc_type": "Student Applicant", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "application_status", + "modified": "2020-09-08 19:22:45.547824", + "name": "Student Applicant-application_status-options", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "options", + "property_type": "Text", + "row_name": null, + "value": "Applied\nApproved\nRejected\nAdmitted\nAwaiting Registration Fees" + }, + { + "default_value": null, + "doc_type": "Student Applicant", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "application_status", + "modified": "2020-09-08 19:26:19.746716", + "name": "Student Applicant-application_status-read_only", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "read_only", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Payment Schedule", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "payment_amount", + "modified": "2021-03-15 23:02:28.863728", + "name": "Payment Schedule-payment_amount-options", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "options", + "property_type": "Small Text", + "row_name": null, + "value": "Company:company:default_currency" + }, + { + "default_value": null, + "doc_type": "Journal Entry Account", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "party", + "modified": "2019-01-06 22:08:42.766126", + "name": "Journal Entry Account-party-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "2" + }, + { + "default_value": null, + "doc_type": "Journal Entry Account", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "party_type", + "modified": "2020-03-13 16:16:22.025623", + "name": "Journal Entry Account-party_type-columns", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "columns", + "property_type": "Int", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Budget", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "budget_against", + "modified": "2021-03-27 03:13:53.747161", + "name": "Budget-budget_against-options", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "options", + "property_type": "Text", + "row_name": null, + "value": "\nCost Center\nProject\nDepartment\nVehicle\nHealthcare Practitioner\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit\nHealthcare Practitioner\nHealthcare Service Unit" + }, + { + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2020-12-17 17:22:41.701685", + "name": "Customer-main-search_fields", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "search_fields", + "property_type": "Data", + "row_name": null, + "value": "customer_name,customer_group,territory, mobile_no" + }, + { + "default_value": null, + "doc_type": "Energy Point Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:30:51.429700", + "name": "Energy Point Log-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Route History", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:31:33.202495", + "name": "Route History-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Notification Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:32:06.172746", + "name": "Notification Log-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Scheduled Job Log", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:32:15.991855", + "name": "Scheduled Job Log-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Healthcare Service Order", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:32:35.254411", + "name": "Healthcare Service Order-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Healthcare Insurance Claim", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:32:44.284568", + "name": "Healthcare Insurance Claim-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Comment", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:32:58.637177", + "name": "Comment-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Workflow Action", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocType", + "field_name": null, + "modified": "2021-04-07 20:35:49.034969", + "name": "Workflow Action-main-track_changes", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "track_changes", + "property_type": "Check", + "row_name": null, + "value": "0" + }, + { + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "loyalty_points_redemption", + "modified": "2021-05-08 17:53:22.550140", + "name": "Sales Invoice-loyalty_points_redemption-depends_on", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "depends_on", + "property_type": "Data", + "row_name": null, + "value": "eval: !in_list(frappe.user_roles, \"Healthcare Receptionist\")" + }, + { + "name": "Sales Invoice Item-discount_percentage-precision", + "doctype_or_field": "DocField", + "doc_type": "Sales Invoice Item", + "field_name": "discount_percentage", + "property": "precision", + "property_type": "Select", + "value": "6", + "doctype": "Property Setter" + }, + { + "name": "Purchase Invoice Item-discount_percentage-precision", + "doctype_or_field": "DocField", + "doc_type": "Purchase Invoice Item", + "field_name": "discount_percentage", + "property": "precision", + "property_type": "Select", + "value": "6", + "doctype": "Property Setter" + } +] diff --git a/csf_tz/fleet_management/__init__.py b/csf_tz/fleet_management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/__init__.py b/csf_tz/fleet_management/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/air_system_checklist/__init__.py b/csf_tz/fleet_management/doctype/air_system_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/air_system_checklist/air_system_checklist.json b/csf_tz/fleet_management/doctype/air_system_checklist/air_system_checklist.json new file mode 100644 index 0000000..162ef48 --- /dev/null +++ b/csf_tz/fleet_management/doctype/air_system_checklist/air_system_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:54:25.467036", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Part", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 15:10:20.588901", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Air System Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/air_system_checklist/air_system_checklist.py b/csf_tz/fleet_management/doctype/air_system_checklist/air_system_checklist.py new file mode 100644 index 0000000..88d15d0 --- /dev/null +++ b/csf_tz/fleet_management/doctype/air_system_checklist/air_system_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AirSystemChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/air_system_details/__init__.py b/csf_tz/fleet_management/doctype/air_system_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/air_system_details/air_system_details.json b/csf_tz/fleet_management/doctype/air_system_details/air_system_details.json new file mode 100644 index 0000000..6373605 --- /dev/null +++ b/csf_tz/fleet_management/doctype/air_system_details/air_system_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:53:56.833180", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "parts", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Parts", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 15:03:01.075684", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Air System Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/air_system_details/air_system_details.py b/csf_tz/fleet_management/doctype/air_system_details/air_system_details.py new file mode 100644 index 0000000..911953f --- /dev/null +++ b/csf_tz/fleet_management/doctype/air_system_details/air_system_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AirSystemDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/assigned_transport_details/__init__.py b/csf_tz/fleet_management/doctype/assigned_transport_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.js b/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.js new file mode 100644 index 0000000..cd4128a --- /dev/null +++ b/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.js @@ -0,0 +1,22 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Assigned Transport Details', { + refresh: function(frm) { + + }, + + assigned_driver: function(frm){ + frappe.call({ + 'method': 'frappe.client.get', + args: { + doctype: 'Employee', + name: frm.doc.assigned_driver + }, + callback: function(data){ + frm.set_value("passport_number", data.message.passport_number); + //alert(data.message.passport_number); + } + }); + } +}); diff --git a/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.json b/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.json new file mode 100644 index 0000000..8202e6b --- /dev/null +++ b/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.json @@ -0,0 +1,406 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-02-27 17:37:54.451518", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "container_number", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Number", + "length": 0, + "no_copy": 0, + "options": "cargo.container_number", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assigned_vehicle", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Assigned Vehicle", + "length": 0, + "no_copy": 0, + "options": "Vehicle", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assigned_trailer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Assigned Trailer", + "length": 0, + "no_copy": 0, + "options": "Trailer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assigned_driver", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Assigned Driver", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "driver_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Driver Name", + "length": 0, + "no_copy": 0, + "options": "assigned_driver.employee_name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "passport_number", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Driver Passport No", + "length": 0, + "no_copy": 0, + "options": "assigned_driver.passport_number", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Doctype", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Docname", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lodge_permit", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge Permit Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "dispatch_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dispatch Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-04-17 20:25:03.085046", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Assigned Transport Details", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.py b/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.py new file mode 100644 index 0000000..4d99c60 --- /dev/null +++ b/csf_tz/fleet_management/doctype/assigned_transport_details/assigned_transport_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AssignedTransportDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/assigned_transport_details/test_assigned_transport_details.py b/csf_tz/fleet_management/doctype/assigned_transport_details/test_assigned_transport_details.py new file mode 100644 index 0000000..33ea8c8 --- /dev/null +++ b/csf_tz/fleet_management/doctype/assigned_transport_details/test_assigned_transport_details.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Assigned Transport Details') + +class TestAssignedTransportDetails(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/brake_checklist/__init__.py b/csf_tz/fleet_management/doctype/brake_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.js b/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.js new file mode 100644 index 0000000..7dbd3d8 --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Brake Checklist', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.json b/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.json new file mode 100644 index 0000000..f78084d --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.json @@ -0,0 +1,131 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 15:47:52.983614", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_system", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Brake System", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_remarks", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-08-29 11:01:42.782018", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Brake Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.py b/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.py new file mode 100644 index 0000000..cba9479 --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_checklist/brake_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BrakeChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/brake_checklist/test_brake_checklist.js b/csf_tz/fleet_management/doctype/brake_checklist/test_brake_checklist.js new file mode 100644 index 0000000..895d491 --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_checklist/test_brake_checklist.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Brake Checklist", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Brake Checklist + () => frappe.tests.make('Brake Checklist', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/brake_checklist/test_brake_checklist.py b/csf_tz/fleet_management/doctype/brake_checklist/test_brake_checklist.py new file mode 100644 index 0000000..3afa61e --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_checklist/test_brake_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestBrakeChecklist(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/brake_system_details/__init__.py b/csf_tz/fleet_management/doctype/brake_system_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/brake_system_details/brake_system_details.json b/csf_tz/fleet_management/doctype/brake_system_details/brake_system_details.json new file mode 100644 index 0000000..fe5f50d --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_system_details/brake_system_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 17:20:00.313201", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Vehicle Part", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-25 17:24:20.267197", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Brake System Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/brake_system_details/brake_system_details.py b/csf_tz/fleet_management/doctype/brake_system_details/brake_system_details.py new file mode 100644 index 0000000..900b481 --- /dev/null +++ b/csf_tz/fleet_management/doctype/brake_system_details/brake_system_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BrakeSystemDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/delivery_note_template/__init__.py b/csf_tz/fleet_management/doctype/delivery_note_template/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.js b/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.js new file mode 100644 index 0000000..1bc7cef --- /dev/null +++ b/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Delivery Note Template', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.json b/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.json new file mode 100644 index 0000000..f673eea --- /dev/null +++ b/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.json @@ -0,0 +1,92 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-08-24 20:35:40.062778", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "delivery_note_design", + "fieldtype": "Code", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Delivery Note Design", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2017-08-24 20:37:34.278991", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Delivery Note Template", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.py b/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.py new file mode 100644 index 0000000..8f9bc21 --- /dev/null +++ b/csf_tz/fleet_management/doctype/delivery_note_template/delivery_note_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class DeliveryNoteTemplate(Document): + pass diff --git a/csf_tz/fleet_management/doctype/delivery_note_template/test_delivery_note_template.js b/csf_tz/fleet_management/doctype/delivery_note_template/test_delivery_note_template.js new file mode 100644 index 0000000..8a43bb4 --- /dev/null +++ b/csf_tz/fleet_management/doctype/delivery_note_template/test_delivery_note_template.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Delivery Note Template", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Delivery Note Template + () => frappe.tests.make('Delivery Note Template', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/electrical_checklist/__init__.py b/csf_tz/fleet_management/doctype/electrical_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/electrical_checklist/electrical_checklist.json b/csf_tz/fleet_management/doctype/electrical_checklist/electrical_checklist.json new file mode 100644 index 0000000..dee65fd --- /dev/null +++ b/csf_tz/fleet_management/doctype/electrical_checklist/electrical_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 13:47:40.595867", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electrical_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Electrical ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:03:36.710845", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Electrical Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/electrical_checklist/electrical_checklist.py b/csf_tz/fleet_management/doctype/electrical_checklist/electrical_checklist.py new file mode 100644 index 0000000..0275284 --- /dev/null +++ b/csf_tz/fleet_management/doctype/electrical_checklist/electrical_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ElectricalChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/electrical_details/__init__.py b/csf_tz/fleet_management/doctype/electrical_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/electrical_details/electrical_details.json b/csf_tz/fleet_management/doctype/electrical_details/electrical_details.json new file mode 100644 index 0000000..e689a1a --- /dev/null +++ b/csf_tz/fleet_management/doctype/electrical_details/electrical_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 13:46:24.313916", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electrical_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Electrical", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:03:33.171789", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Electrical Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/electrical_details/electrical_details.py b/csf_tz/fleet_management/doctype/electrical_details/electrical_details.py new file mode 100644 index 0000000..0e9510e --- /dev/null +++ b/csf_tz/fleet_management/doctype/electrical_details/electrical_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ElectricalDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/electronics_checklist/__init__.py b/csf_tz/fleet_management/doctype/electronics_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/electronics_checklist/electronics_checklist.json b/csf_tz/fleet_management/doctype/electronics_checklist/electronics_checklist.json new file mode 100644 index 0000000..381a371 --- /dev/null +++ b/csf_tz/fleet_management/doctype/electronics_checklist/electronics_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 13:12:13.543802", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electronics_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Electronics", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 13:46:52.772581", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Electronics Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/electronics_checklist/electronics_checklist.py b/csf_tz/fleet_management/doctype/electronics_checklist/electronics_checklist.py new file mode 100644 index 0000000..de07664 --- /dev/null +++ b/csf_tz/fleet_management/doctype/electronics_checklist/electronics_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ElectronicsChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/electronics_details/__init__.py b/csf_tz/fleet_management/doctype/electronics_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/electronics_details/electronics_details.json b/csf_tz/fleet_management/doctype/electronics_details/electronics_details.json new file mode 100644 index 0000000..661e84a --- /dev/null +++ b/csf_tz/fleet_management/doctype/electronics_details/electronics_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 13:12:56.556089", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electronic_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Electronics", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 13:43:27.499244", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Electronics Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/electronics_details/electronics_details.py b/csf_tz/fleet_management/doctype/electronics_details/electronics_details.py new file mode 100644 index 0000000..7c32aba --- /dev/null +++ b/csf_tz/fleet_management/doctype/electronics_details/electronics_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ElectronicsDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/engine_checklist/__init__.py b/csf_tz/fleet_management/doctype/engine_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/engine_checklist/engine_checklist.json b/csf_tz/fleet_management/doctype/engine_checklist/engine_checklist.json new file mode 100644 index 0000000..a04807d --- /dev/null +++ b/csf_tz/fleet_management/doctype/engine_checklist/engine_checklist.json @@ -0,0 +1,131 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 15:56:37.931062", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "engine_system", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Engine ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "engine_remarks", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-08-29 11:02:10.282933", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Engine Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/engine_checklist/engine_checklist.py b/csf_tz/fleet_management/doctype/engine_checklist/engine_checklist.py new file mode 100644 index 0000000..397163d --- /dev/null +++ b/csf_tz/fleet_management/doctype/engine_checklist/engine_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class EngineChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/engine_details/__init__.py b/csf_tz/fleet_management/doctype/engine_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/engine_details/engine_details.json b/csf_tz/fleet_management/doctype/engine_details/engine_details.json new file mode 100644 index 0000000..fce131a --- /dev/null +++ b/csf_tz/fleet_management/doctype/engine_details/engine_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 17:25:07.127543", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "criteria", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Criteria", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-25 17:39:23.766763", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Engine Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/engine_details/engine_details.py b/csf_tz/fleet_management/doctype/engine_details/engine_details.py new file mode 100644 index 0000000..b717f70 --- /dev/null +++ b/csf_tz/fleet_management/doctype/engine_details/engine_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class EngineDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/equipment_set/__init__.py b/csf_tz/fleet_management/doctype/equipment_set/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/equipment_set/equipment_set.js b/csf_tz/fleet_management/doctype/equipment_set/equipment_set.js new file mode 100644 index 0000000..8b03538 --- /dev/null +++ b/csf_tz/fleet_management/doctype/equipment_set/equipment_set.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Equipment Set', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/equipment_set/equipment_set.json b/csf_tz/fleet_management/doctype/equipment_set/equipment_set.json new file mode 100644 index 0000000..f7ef661 --- /dev/null +++ b/csf_tz/fleet_management/doctype/equipment_set/equipment_set.json @@ -0,0 +1,119 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:set_name", + "beta": 0, + "creation": "2017-04-12 19:10:21.912631", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "set_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Equipment Set Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Equipments in Set", + "fieldname": "equipments", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Equipment Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-04-12 19:14:39.613374", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Equipment Set", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/equipment_set/equipment_set.py b/csf_tz/fleet_management/doctype/equipment_set/equipment_set.py new file mode 100644 index 0000000..64c4760 --- /dev/null +++ b/csf_tz/fleet_management/doctype/equipment_set/equipment_set.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class EquipmentSet(Document): + pass diff --git a/csf_tz/fleet_management/doctype/equipment_set/test_equipment_set.py b/csf_tz/fleet_management/doctype/equipment_set/test_equipment_set.py new file mode 100644 index 0000000..5df8499 --- /dev/null +++ b/csf_tz/fleet_management/doctype/equipment_set/test_equipment_set.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Equipment Set') + +class TestEquipmentSet(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/equipment_table/__init__.py b/csf_tz/fleet_management/doctype/equipment_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/equipment_table/equipment_table.json b/csf_tz/fleet_management/doctype/equipment_table/equipment_table.json new file mode 100644 index 0000000..325da53 --- /dev/null +++ b/csf_tz/fleet_management/doctype/equipment_table/equipment_table.json @@ -0,0 +1,96 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-12 19:08:20.864835", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "equipment", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Equipment", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quantity", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-04-12 19:14:19.144110", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Equipment Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/equipment_table/equipment_table.py b/csf_tz/fleet_management/doctype/equipment_table/equipment_table.py new file mode 100644 index 0000000..38b3b9e --- /dev/null +++ b/csf_tz/fleet_management/doctype/equipment_table/equipment_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class EquipmentTable(Document): + pass diff --git a/csf_tz/fleet_management/doctype/expense/__init__.py b/csf_tz/fleet_management/doctype/expense/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/expense/expense.js b/csf_tz/fleet_management/doctype/expense/expense.js new file mode 100644 index 0000000..04ebd10 --- /dev/null +++ b/csf_tz/fleet_management/doctype/expense/expense.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Expense', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/expense/expense.json b/csf_tz/fleet_management/doctype/expense/expense.json new file mode 100644 index 0000000..8089b83 --- /dev/null +++ b/csf_tz/fleet_management/doctype/expense/expense.json @@ -0,0 +1,120 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:description", + "beta": 0, + "creation": "2017-04-12 19:31:03.657227", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expense Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fixed_value", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Fixed Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-04-12 19:31:03.657227", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Expense", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "description", + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "description", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/expense/expense.py b/csf_tz/fleet_management/doctype/expense/expense.py new file mode 100644 index 0000000..ad6644f --- /dev/null +++ b/csf_tz/fleet_management/doctype/expense/expense.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Expense(Document): + pass diff --git a/csf_tz/fleet_management/doctype/expense/test_expense.py b/csf_tz/fleet_management/doctype/expense/test_expense.py new file mode 100644 index 0000000..45babf3 --- /dev/null +++ b/csf_tz/fleet_management/doctype/expense/test_expense.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Expense') + +class TestExpense(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/fixed_expense/__init__.py b/csf_tz/fleet_management/doctype/fixed_expense/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.js b/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.js new file mode 100644 index 0000000..ad3a318 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Fixed Expense', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.json b/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.json new file mode 100644 index 0000000..a1b1456 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.json @@ -0,0 +1,157 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:description", + "beta": 0, + "creation": "2017-04-12 19:31:03.657227", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expense Description", + "length": 0, + "no_copy": 0, + "options": "Fixed Expense", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fixed_value", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Fixed Value", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-06 16:13:41.148993", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fixed Expense", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "description", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "description", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.py b/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.py new file mode 100644 index 0000000..7f263c8 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense/fixed_expense.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FixedExpense(Document): + pass diff --git a/csf_tz/fleet_management/doctype/fixed_expense/test_fixed_expense.js b/csf_tz/fleet_management/doctype/fixed_expense/test_fixed_expense.js new file mode 100644 index 0000000..0e61a4f --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense/test_fixed_expense.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Fixed Expense", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Fixed Expense + () => frappe.tests.make('Fixed Expense', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/fixed_expense/test_fixed_expense.py b/csf_tz/fleet_management/doctype/fixed_expense/test_fixed_expense.py new file mode 100644 index 0000000..ceb09d0 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense/test_fixed_expense.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Fixed Expense') + +class TestFixedExpense(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/fixed_expense_table/__init__.py b/csf_tz/fleet_management/doctype/fixed_expense_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/fixed_expense_table/fixed_expense_table.json b/csf_tz/fleet_management/doctype/fixed_expense_table/fixed_expense_table.json new file mode 100644 index 0000000..cd939ba --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense_table/fixed_expense_table.json @@ -0,0 +1,134 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-12 20:21:36.041750", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expense", + "length": 0, + "no_copy": 0, + "options": "Fixed Expense", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-06-06 19:43:49.023104", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fixed Expense Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/fixed_expense_table/fixed_expense_table.py b/csf_tz/fleet_management/doctype/fixed_expense_table/fixed_expense_table.py new file mode 100644 index 0000000..07c9dcb --- /dev/null +++ b/csf_tz/fleet_management/doctype/fixed_expense_table/fixed_expense_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FixedExpenseTable(Document): + pass diff --git a/csf_tz/fleet_management/doctype/fuel_request/__init__.py b/csf_tz/fleet_management/doctype/fuel_request/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/fuel_request/fuel_request.js b/csf_tz/fleet_management/doctype/fuel_request/fuel_request.js new file mode 100644 index 0000000..101f0ba --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request/fuel_request.js @@ -0,0 +1,149 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Fuel Request', { + onload: function (frm) { + //Load the approve and reject buttons + var html = ' '; + html += '' + $(frm.fields_dict.approve_buttons.wrapper).html(html); + + }, + + refresh: function (frm,cdt, cdn) { + frm.events.show_hide_sections(frm); + console.log(frm); + + //if (cur_frm.doc.status === "Fully Processed") { + //frappe.msgprint(locals[][].status); + //var row = frm.fields_dict['approved_requests'].grid.grid_rows_by_docname[cdn]; + + //if (row.doc.status == "Approved") { + + cur_frm.add_custom_button(__('Purchase Order'), function () { + frm.events.make_purchase_order(frm) + }, __("Make")); + cur_frm.add_custom_button(__('Issue Fuel'), function () { + frm.events.make_stock_entry(frm) + }, __("Make")); + //} + //} + }, + + show_hide_sections: function (frm) { + frm.toggle_display(['approve_buttons', 'section_requested_fuel'], (frm.doc.requested_fuel.length > 0)); + }, + + show_hide_request_fields: function (frm, cdt, cdn) { + var row = frm.fields_dict['approved_requests'].grid.grid_rows_by_docname[cdn]; + if (row.doc.status == "Approved") { + row.toggle_editable('disburcement_type', (row.doc.receipt_date == null)); + row.toggle_editable('supplier', (row.doc.receipt_date == null && row.doc.disburcement_type == "From Supplier")) + row.toggle_editable('receipt_date', ((row.doc.disburcement_type == "From Supplier" && row.doc.supplier) || (row.doc.disburcement_type == "Cash"))) + row.toggle_editable('receipt_time', ((row.doc.disburcement_type == "From Supplier" && row.doc.supplier) || (row.doc.disburcement_type == "Cash"))) + } + }, + make_purchase_order: function (frm) { + frappe.model.open_mapped_doc({ + method: "fleet_management.fleet_management.doctype.fuel_request.fuel_request.make_purchase_order", + frm: cur_frm + }) + }, + make_stock_entry: function (frm) { + frappe.model.open_mapped_doc({ + method: "fleet_management.fleet_management.doctype.fuel_request.fuel_request.make_stock_entry", + frm: cur_frm + }) + }, +}); + + + +frappe.ui.form.on('Fuel Request Table', { + form_render: function (frm, cdt, cdn) { + frm.events.show_hide_request_fields(frm, cdt, cdn); + }, + + disburcement_type: function (frm, cdt, cdn) { + frm.events.show_hide_request_fields(frm, cdt, cdn); + }, + + supplier: function (frm, cdt, cdn) { + frm.events.show_hide_request_fields(frm, cdt, cdn); + }, + + receipt_date: function (frm, cdt, cdn) { + frm.events.show_hide_request_fields(frm, cdt, cdn); + locals[cdt][cdn].received_by = frappe.session.user; + }, + + receipt_time: function (frm, cdt, cdn) { + frm.events.show_hide_request_fields(frm, cdt, cdn); + }, +}); + + +//For approve button +cur_frm.cscript.approve_request = function (frm) { + var selected = cur_frm.get_selected(); + if (selected['requested_fuel']) { + frappe.confirm( + 'Confirm: Approve selected requests?', + function () { + $.each(selected['requested_fuel'], function (index, value) { + frappe.call({ + method: "fleet_management.fleet_management.doctype.fuel_request.fuel_request.approve_request", + freeze: true, + args: { + request_doctype: "Fuel Request Table", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function (data) { + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function () { + //Do nothing + } + ); + } else { + show_alert("Error: Please select requests to process."); + } +} + +//For reject button +cur_frm.cscript.reject_request = function (frm) { + //cur_frm.cscript.populate_child(cur_frm.doc.reference_doctype, cur_frm.doc.reference_docname); + var selected = cur_frm.get_selected(); + if (selected['requested_fuel']) { + frappe.confirm( + 'Confirm: Reject selected requests?', + function () { + $.each(selected['requested_fuel'], function (index, value) { + frappe.call({ + method: "fleet_management.fleet_management.doctype.fuel_request.fuel_request.reject_request", + freeze: true, + args: { + request_doctype: "Fuel Request Table", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function (data) { + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function () { + //Do nothing + } + ); + } else { + show_alert("Error: Please select requests to process."); + } +} diff --git a/csf_tz/fleet_management/doctype/fuel_request/fuel_request.json b/csf_tz/fleet_management/doctype/fuel_request/fuel_request.json new file mode 100644 index 0000000..a6447e2 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request/fuel_request.json @@ -0,0 +1,610 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "FREQ.###", + "beta": 0, + "creation": "2017-09-22 18:34:50.811573", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Vehicle Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "main_route", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Route", + "length": 0, + "no_copy": 0, + "options": "Trip Route", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "main_approved_fuel", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Route Approved Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "return_route", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Route", + "length": 0, + "no_copy": 0, + "options": "Trip Route", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "return_approved_fuel", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Route Approved Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_requested_fuel", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Fuel", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_fuel", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Fuel", + "length": 0, + "no_copy": 0, + "options": "Fuel Request Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approve_buttons", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approve Buttons", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_approved_requests", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved/Rejected Requests", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_requests", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved/Rejected Requests", + "length": 0, + "no_copy": 0, + "options": "Fuel Request Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_references", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Module", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Requested From", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Waiting Approval", + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "Waiting Approval\nPartially Processed\nFully Processed", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transaction_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transaction Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-10-16 16:02:59.121871", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fuel Request", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/fuel_request/fuel_request.py b/csf_tz/fleet_management/doctype/fuel_request/fuel_request.py new file mode 100644 index 0000000..b301eb8 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request/fuel_request.py @@ -0,0 +1,229 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import time +import datetime +from frappe.model.document import Document +from frappe import _ +from frappe.model.mapper import get_mapped_doc +from frappe import msgprint + + + +class FuelRequest(Document): + def onload(self): + trip = frappe.get_doc(self.reference_doctype, self.reference_docname) + #Load approved fuel for main trip + if trip.main_route and trip.vehicle: + consumption = frappe.db.get_value("Vehicle", trip.vehicle, "fuel_consumption") + route = frappe.db.get_value("Trip Route", trip.main_route, "total_distance") + approved_fuel = consumption * route + self.set("main_route", trip.main_route) + self.set("main_approved_fuel", str(approved_fuel) + " Litres") + + #Load approved fuel for return trip + if trip.return_route and trip.vehicle: + consumption = frappe.db.get_value("Vehicle", trip.vehicle, "fuel_consumption") + route = frappe.db.get_value("Trip Route", trip.return_route, "total_distance") + approved_fuel = consumption * route + self.set("return_route", trip.return_route) + self.set("return_approved_fuel", str(approved_fuel) + " Litres") + + def get_all_children(self, parenttype=None): + #For getting children + return [] + + def update_children(self): + '''update child tables''' + + + def before_save(self): + for row in self.approved_requests: + doc = frappe.get_doc("Fuel Request Table", row.name) + doc.db_set("disburcement_type", row.disburcement_type) + doc.db_set("supplier", row.supplier) + doc.db_set("receipt_date", row.receipt_date) + doc.db_set("receipt_time", row.receipt_time) + doc.db_set("received_by", row.received_by) + + + + def load_from_db(self): + """Load document and children from database and create properties + from fields""" + if not getattr(self, "_metaclass", False) and self.meta.issingle: + single_doc = frappe.db.get_singles_dict(self.doctype) + if not single_doc: + single_doc = frappe.new_doc(self.doctype).as_dict() + single_doc["name"] = self.doctype + del single_doc["__islocal"] + + super(Document, self).__init__(single_doc) + self.init_valid_columns() + self._fix_numeric_types() + + else: + d = frappe.db.get_value(self.doctype, self.name, "*", as_dict=1) + if not d: + frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError) + + super(Document, self).__init__(d) + + if self.name=="DocType" and self.doctype=="DocType": + from frappe.model.meta import doctype_table_fields + table_fields = doctype_table_fields + else: + table_fields = self.meta.get_table_fields() + + for df in table_fields: + if df.fieldname == "approved_requests": + #Load approved or rejected requests + children_main_approved = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'main_fuel_request', "status": "Approved"}, + "*", as_dict=True, order_by="idx asc") + children_main_rejected = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'main_fuel_request', "status": "Rejected"}, + "*", as_dict=True, order_by="idx asc") + children_return_approved = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'return_fuel_request', "status": "Approved"}, + "*", as_dict=True, order_by="idx asc") + children_return_rejected = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'return_fuel_request', "status": "Rejected"}, + "*", as_dict=True, order_by="idx asc") + children = children_main_approved + children_main_rejected + children_return_approved + children_return_rejected + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + elif df.fieldname == "requested_fuel": + #Load requests which are not approved nor rejected + children_main_requested = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'main_fuel_request', "status": "Requested"}, + "*", as_dict=True, order_by="idx asc") + children_return_requested = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'return_fuel_request', "status": "Requested"}, + "*", as_dict=True, order_by="idx asc") + children = children_main_requested + children_return_requested + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + + # sometimes __setup__ can depend on child values, hence calling again at the end + if hasattr(self, "__setup__"): + self.__setup__() + +def set_status(doc): + parent_doc_name = frappe.db.get_value('Fuel Request Table', doc, 'parent') + fuel_requests = frappe.db.sql('''SELECT name, status FROM `tabFuel Request Table` WHERE parent = %(parent_name)s''', {'parent_name': parent_doc_name}, as_dict=1) + + processed_requests = 0 + status = 'Fully Processed' + + for request in fuel_requests: + if request.status not in ['Approved', 'Rejected']: + status = 'Partially Processed' + else: + processed_requests = processed_requests + 1 + + parent_request_name = frappe.db.get_value('Fuel Request', {'reference_docname': parent_doc_name}) + parent_request_doc = frappe.get_doc('Fuel Request', parent_request_name) + if 0 == processed_requests: + parent_request_doc.db_set('status', 'Waiting Approval') + else: + parent_request_doc.db_set('status', status) + + +@frappe.whitelist(allow_guest=True) +def approve_request(**args): + args = frappe._dict(args) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + doc = frappe.get_doc("Fuel Request Table", args.request_docname) + doc.db_set("status", "Approved") + doc.db_set("approved_by", args.user) + doc.db_set("approved_date", timestamp) + set_status(args.request_docname) + return "Request Updated" + +@frappe.whitelist(allow_guest=True) +def reject_request(**args): + args = frappe._dict(args) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + doc = frappe.get_doc("Fuel Request Table", args.request_docname) + doc.db_set("status", "Rejected") + doc.db_set("approved_by", args.user) + doc.db_set("approved_date", timestamp) + set_status(args.request_docname) + return "Request Updated" + +@frappe.whitelist() +def make_purchase_order(source_name, target_doc=None): + + doc = get_mapped_doc("Fuel Request", source_name, { + "Fuel Request": { + "doctype": "Purchase Order", + "field_map": { + + }, + "validation": { + "docstatus": ["=", 0], + } + }, + "Fuel Request Table": { + "doctype": "Purchase Order Item", + "field_map": { + "name": "fuel_request_table", + "parent":"fuel_request", + "item_code":"item_code", + #"total_cost":"amount", + "quantity": "qty", + #"cost_per_litre": "rate", + source_name:"fuel_request" + }, + + }, + }, target_doc) + + return doc + + + + +@frappe.whitelist() +def make_stock_entry(source_name, target_doc=None): + doc = get_mapped_doc("Fuel Request", source_name, { + "Fuel Request": { + "doctype": "Stock Entry", + "field_map": { + + }, + "validation": { + "docstatus": ["=", 0], + } + }, + "Fuel Request Table": { + "doctype": "Stock Entry Detail", + "field_map": { + "name": "fuel_request_table", + "parent": "fuel_request", + #"total_cost": "basic_amount", + "quantity": "qty", + source_name:"fuel_request", + #"cost_per_litre": "basic_rate", + }, + + }, + }, target_doc) + return doc + diff --git a/csf_tz/fleet_management/doctype/fuel_request/test_fuel_request.js b/csf_tz/fleet_management/doctype/fuel_request/test_fuel_request.js new file mode 100644 index 0000000..5e0e1d4 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request/test_fuel_request.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Fuel Request", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Fuel Request + () => frappe.tests.make('Fuel Request', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/fuel_request/test_fuel_request.py b/csf_tz/fleet_management/doctype/fuel_request/test_fuel_request.py new file mode 100644 index 0000000..a578268 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request/test_fuel_request.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestFuelRequest(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/fuel_request_table/__init__.py b/csf_tz/fleet_management/doctype/fuel_request_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/fuel_request_table/fuel_request_table.json b/csf_tz/fleet_management/doctype/fuel_request_table/fuel_request_table.json new file mode 100644 index 0000000..8418a46 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request_table/fuel_request_table.json @@ -0,0 +1,649 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-09-22 17:52:10.466143", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Fuel Type", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "item_code.item_name", + "fetch_if_empty": 0, + "fieldname": "item_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Fuel Name", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_description", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "item_code.description", + "fetch_if_empty": 0, + "fieldname": "description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_5", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "quantity", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quantity (Litres)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "disburcement_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Disburcement Type", + "length": 0, + "no_copy": 0, + "options": "From Supplier\nCash", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supplier", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cost_per_litre", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Cost Per Litre", + "length": 0, + "no_copy": 0, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "total_cost", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Cost", + "length": 0, + "no_copy": 0, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "item_code.stock_uom", + "fetch_if_empty": 0, + "fieldname": "uom", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Stock UOM", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "approved_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved/Rejected By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "approved_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approval/Rejection Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "receipt_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Receipt Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "receipt_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Receipt Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Received By", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transaction_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transaction Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2020-02-21 11:55:18.837822", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fuel Request Table", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/fuel_request_table/fuel_request_table.py b/csf_tz/fleet_management/doctype/fuel_request_table/fuel_request_table.py new file mode 100644 index 0000000..41932dd --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_request_table/fuel_request_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FuelRequestTable(Document): + pass diff --git a/csf_tz/fleet_management/doctype/fuel_system_checklist/__init__.py b/csf_tz/fleet_management/doctype/fuel_system_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/fuel_system_checklist/fuel_system_checklist.json b/csf_tz/fleet_management/doctype/fuel_system_checklist/fuel_system_checklist.json new file mode 100644 index 0000000..ef64ee3 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_system_checklist/fuel_system_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 16:07:54.421837", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fuel_system", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Fuel System ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 12:08:49.812495", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fuel System Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/fuel_system_checklist/fuel_system_checklist.py b/csf_tz/fleet_management/doctype/fuel_system_checklist/fuel_system_checklist.py new file mode 100644 index 0000000..43aaa61 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_system_checklist/fuel_system_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FuelSystemChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/fuel_system_details/__init__.py b/csf_tz/fleet_management/doctype/fuel_system_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/fuel_system_details/fuel_system_details.json b/csf_tz/fleet_management/doctype/fuel_system_details/fuel_system_details.json new file mode 100644 index 0000000..a4d4a81 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_system_details/fuel_system_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 17:39:40.586536", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fuel_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Vehicle Part", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 12:08:42.525014", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fuel System Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/fuel_system_details/fuel_system_details.py b/csf_tz/fleet_management/doctype/fuel_system_details/fuel_system_details.py new file mode 100644 index 0000000..26412a8 --- /dev/null +++ b/csf_tz/fleet_management/doctype/fuel_system_details/fuel_system_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FuelSystemDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/lighting_checklist/__init__.py b/csf_tz/fleet_management/doctype/lighting_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/lighting_checklist/lighting_checklist.json b/csf_tz/fleet_management/doctype/lighting_checklist/lighting_checklist.json new file mode 100644 index 0000000..ce95491 --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist/lighting_checklist.json @@ -0,0 +1,131 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 15:12:37.003334", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_check_item", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Lighting", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_remarks", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Remarks", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-08-29 11:01:08.851975", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Lighting Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/lighting_checklist/lighting_checklist.py b/csf_tz/fleet_management/doctype/lighting_checklist/lighting_checklist.py new file mode 100644 index 0000000..a6b8848 --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist/lighting_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class LightingChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/lighting_checklist_details/__init__.py b/csf_tz/fleet_management/doctype/lighting_checklist_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.js b/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.js new file mode 100644 index 0000000..c815192 --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Lighting Checklist Details', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.json b/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.json new file mode 100644 index 0000000..3798200 --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 17:13:19.066798", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Vehicle Part", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-25 18:21:16.196497", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Lighting Checklist Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.py b/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.py new file mode 100644 index 0000000..e920830 --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist_details/lighting_checklist_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class LightingChecklistDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/lighting_checklist_details/test_lighting_checklist_details.js b/csf_tz/fleet_management/doctype/lighting_checklist_details/test_lighting_checklist_details.js new file mode 100644 index 0000000..16275ba --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist_details/test_lighting_checklist_details.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Lighting Checklist Details", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Lighting Checklist Details + () => frappe.tests.make('Lighting Checklist Details', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/lighting_checklist_details/test_lighting_checklist_details.py b/csf_tz/fleet_management/doctype/lighting_checklist_details/test_lighting_checklist_details.py new file mode 100644 index 0000000..be17417 --- /dev/null +++ b/csf_tz/fleet_management/doctype/lighting_checklist_details/test_lighting_checklist_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestLightingChecklistDetails(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/power_train_checklist/__init__.py b/csf_tz/fleet_management/doctype/power_train_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/power_train_checklist/power_train_checklist.json b/csf_tz/fleet_management/doctype/power_train_checklist/power_train_checklist.json new file mode 100644 index 0000000..bcd4559 --- /dev/null +++ b/csf_tz/fleet_management/doctype/power_train_checklist/power_train_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 12:44:12.846745", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "power_train_checklist", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Power Train", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 13:11:32.015921", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Power Train Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/power_train_checklist/power_train_checklist.py b/csf_tz/fleet_management/doctype/power_train_checklist/power_train_checklist.py new file mode 100644 index 0000000..31038a4 --- /dev/null +++ b/csf_tz/fleet_management/doctype/power_train_checklist/power_train_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PowerTrainChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/power_train_details/__init__.py b/csf_tz/fleet_management/doctype/power_train_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/power_train_details/power_train_details.json b/csf_tz/fleet_management/doctype/power_train_details/power_train_details.json new file mode 100644 index 0000000..16e98e7 --- /dev/null +++ b/csf_tz/fleet_management/doctype/power_train_details/power_train_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 12:45:36.311967", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "power_train_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Power Train ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 13:12:18.161665", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Power Train Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/power_train_details/power_train_details.py b/csf_tz/fleet_management/doctype/power_train_details/power_train_details.py new file mode 100644 index 0000000..277654b --- /dev/null +++ b/csf_tz/fleet_management/doctype/power_train_details/power_train_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PowerTrainDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/route_steps_table/__init__.py b/csf_tz/fleet_management/doctype/route_steps_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/route_steps_table/route_steps_table.json b/csf_tz/fleet_management/doctype/route_steps_table/route_steps_table.json new file mode 100644 index 0000000..f4fa794 --- /dev/null +++ b/csf_tz/fleet_management/doctype/route_steps_table/route_steps_table.json @@ -0,0 +1,552 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-18 18:51:14.305423", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location", + "length": 0, + "no_copy": 0, + "options": "Trip Location", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_dates", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dates", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "arrival_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "departure_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "offloading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": "", + "columns": 0, + "fieldname": "border_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "documents_from_driver", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents received from driver", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "doc_submitted_to_agent", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents submitted to agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_13", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "doc_received_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Documents received by", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "crossing_time", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Crossing date and time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_extra", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Additional Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-09-16 15:53:36.582568", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Route Steps Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/route_steps_table/route_steps_table.py b/csf_tz/fleet_management/doctype/route_steps_table/route_steps_table.py new file mode 100644 index 0000000..e83604a --- /dev/null +++ b/csf_tz/fleet_management/doctype/route_steps_table/route_steps_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class RouteStepsTable(Document): + pass diff --git a/csf_tz/fleet_management/doctype/steering_checklist/__init__.py b/csf_tz/fleet_management/doctype/steering_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/steering_checklist/steering_checklist.json b/csf_tz/fleet_management/doctype/steering_checklist/steering_checklist.json new file mode 100644 index 0000000..421720c --- /dev/null +++ b/csf_tz/fleet_management/doctype/steering_checklist/steering_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:11:40.788312", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "steering_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Steering ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:24:33.007357", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Steering Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/steering_checklist/steering_checklist.py b/csf_tz/fleet_management/doctype/steering_checklist/steering_checklist.py new file mode 100644 index 0000000..e3498ea --- /dev/null +++ b/csf_tz/fleet_management/doctype/steering_checklist/steering_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SteeringChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/steering_details/__init__.py b/csf_tz/fleet_management/doctype/steering_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/steering_details/steering_details.json b/csf_tz/fleet_management/doctype/steering_details/steering_details.json new file mode 100644 index 0000000..8ee699f --- /dev/null +++ b/csf_tz/fleet_management/doctype/steering_details/steering_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:12:24.339233", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "steering_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Criteria", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:23:57.304426", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Steering Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/steering_details/steering_details.py b/csf_tz/fleet_management/doctype/steering_details/steering_details.py new file mode 100644 index 0000000..0ddf454 --- /dev/null +++ b/csf_tz/fleet_management/doctype/steering_details/steering_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SteeringDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/subtrips_table/__init__.py b/csf_tz/fleet_management/doctype/subtrips_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/subtrips_table/subtrips_table.json b/csf_tz/fleet_management/doctype/subtrips_table/subtrips_table.json new file mode 100644 index 0000000..c1dad79 --- /dev/null +++ b/csf_tz/fleet_management/doctype/subtrips_table/subtrips_table.json @@ -0,0 +1,181 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-18 19:14:12.313339", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "source_location", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Source Location", + "length": 0, + "no_copy": 0, + "options": "Trip Location", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "destination_location", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Destination ", + "length": 0, + "no_copy": 0, + "options": "Trip Location", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approximate_distance", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Approximate Distance (km)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "source_departure", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Departure from Source", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "destination_arrival", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Arrival at Destination", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-04-18 19:16:12.801932", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Subtrips Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/subtrips_table/subtrips_table.py b/csf_tz/fleet_management/doctype/subtrips_table/subtrips_table.py new file mode 100644 index 0000000..ea80738 --- /dev/null +++ b/csf_tz/fleet_management/doctype/subtrips_table/subtrips_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SubtripsTable(Document): + pass diff --git a/csf_tz/fleet_management/doctype/suspension_checklist/__init__.py b/csf_tz/fleet_management/doctype/suspension_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/suspension_checklist/suspension_checklist.json b/csf_tz/fleet_management/doctype/suspension_checklist/suspension_checklist.json new file mode 100644 index 0000000..a673e41 --- /dev/null +++ b/csf_tz/fleet_management/doctype/suspension_checklist/suspension_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:39:11.316038", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Suspension ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:54:09.707834", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Suspension Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/suspension_checklist/suspension_checklist.py b/csf_tz/fleet_management/doctype/suspension_checklist/suspension_checklist.py new file mode 100644 index 0000000..660392c --- /dev/null +++ b/csf_tz/fleet_management/doctype/suspension_checklist/suspension_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SuspensionChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/suspension_details/__init__.py b/csf_tz/fleet_management/doctype/suspension_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/suspension_details/suspension_details.json b/csf_tz/fleet_management/doctype/suspension_details/suspension_details.json new file mode 100644 index 0000000..f5a1ab3 --- /dev/null +++ b/csf_tz/fleet_management/doctype/suspension_details/suspension_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:38:44.667380", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "parts", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Criteria", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:52:39.044599", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Suspension Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/suspension_details/suspension_details.py b/csf_tz/fleet_management/doctype/suspension_details/suspension_details.py new file mode 100644 index 0000000..0cb78ee --- /dev/null +++ b/csf_tz/fleet_management/doctype/suspension_details/suspension_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SuspensionDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/tire_checklist/__init__.py b/csf_tz/fleet_management/doctype/tire_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/tire_checklist/tire_checklist.json b/csf_tz/fleet_management/doctype/tire_checklist/tire_checklist.json new file mode 100644 index 0000000..24d5acf --- /dev/null +++ b/csf_tz/fleet_management/doctype/tire_checklist/tire_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 16:57:29.149228", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tire_position", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Tire Position", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 12:43:27.331625", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Tire Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/tire_checklist/tire_checklist.py b/csf_tz/fleet_management/doctype/tire_checklist/tire_checklist.py new file mode 100644 index 0000000..bb81946 --- /dev/null +++ b/csf_tz/fleet_management/doctype/tire_checklist/tire_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TireChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/tire_details/__init__.py b/csf_tz/fleet_management/doctype/tire_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/tire_details/tire_details.json b/csf_tz/fleet_management/doctype/tire_details/tire_details.json new file mode 100644 index 0000000..e74adb7 --- /dev/null +++ b/csf_tz/fleet_management/doctype/tire_details/tire_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 17:51:55.389457", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tire_part", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Tire Part", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 12:44:34.832953", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Tire Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/tire_details/tire_details.py b/csf_tz/fleet_management/doctype/tire_details/tire_details.py new file mode 100644 index 0000000..f33bd30 --- /dev/null +++ b/csf_tz/fleet_management/doctype/tire_details/tire_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TireDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/tires_checklist/__init__.py b/csf_tz/fleet_management/doctype/tires_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/tires_checklist/tires_checklist.json b/csf_tz/fleet_management/doctype/tires_checklist/tires_checklist.json new file mode 100644 index 0000000..9fcbc2c --- /dev/null +++ b/csf_tz/fleet_management/doctype/tires_checklist/tires_checklist.json @@ -0,0 +1,101 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:25:31.990583", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "criteria", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Tires ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:38:06.274516", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Tires Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/tires_checklist/tires_checklist.py b/csf_tz/fleet_management/doctype/tires_checklist/tires_checklist.py new file mode 100644 index 0000000..4679a34 --- /dev/null +++ b/csf_tz/fleet_management/doctype/tires_checklist/tires_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TiresChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/tires_details/__init__.py b/csf_tz/fleet_management/doctype/tires_details/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/tires_details/tires_details.json b/csf_tz/fleet_management/doctype/tires_details/tires_details.json new file mode 100644 index 0000000..c4f82d4 --- /dev/null +++ b/csf_tz/fleet_management/doctype/tires_details/tires_details.json @@ -0,0 +1,71 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-26 14:24:25.783159", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "criteria", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Criteria", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-26 14:38:03.626198", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Tires Details", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/tires_details/tires_details.py b/csf_tz/fleet_management/doctype/tires_details/tires_details.py new file mode 100644 index 0000000..426083b --- /dev/null +++ b/csf_tz/fleet_management/doctype/tires_details/tires_details.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TiresDetails(Document): + pass diff --git a/csf_tz/fleet_management/doctype/trailer/__init__.py b/csf_tz/fleet_management/doctype/trailer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/trailer/test_trailer.js b/csf_tz/fleet_management/doctype/trailer/test_trailer.js new file mode 100644 index 0000000..d2bc819 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trailer/test_trailer.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Trailer", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Trailer + () => frappe.tests.make('Trailer', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/trailer/test_trailer.py b/csf_tz/fleet_management/doctype/trailer/test_trailer.py new file mode 100644 index 0000000..7c3ac3f --- /dev/null +++ b/csf_tz/fleet_management/doctype/trailer/test_trailer.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Trailer') + +class TestTrailer(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/trailer/trailer.js b/csf_tz/fleet_management/doctype/trailer/trailer.js new file mode 100644 index 0000000..1439b4c --- /dev/null +++ b/csf_tz/fleet_management/doctype/trailer/trailer.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Trailer', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/trailer/trailer.json b/csf_tz/fleet_management/doctype/trailer/trailer.json new file mode 100644 index 0000000..51c1447 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trailer/trailer.json @@ -0,0 +1,304 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:number_plate", + "beta": 0, + "creation": "2017-03-03 18:29:32.299741", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "number_plate", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Number Plate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 1 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "chassis_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Chassis Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "make", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trailer Make", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "year", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Year", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "axles", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Axles", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_trailer_documents", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trailer Documents", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "trailer_documents", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Vehicle Documents", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-05-11 21:08:35.417168", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Trailer", + "name_case": "UPPER CASE", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "number_plate, chassis_number, make", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "number_plate", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/trailer/trailer.py b/csf_tz/fleet_management/doctype/trailer/trailer.py new file mode 100644 index 0000000..1e194be --- /dev/null +++ b/csf_tz/fleet_management/doctype/trailer/trailer.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Trailer(Document): + pass diff --git a/csf_tz/fleet_management/doctype/transport_assignment/__init__.py b/csf_tz/fleet_management/doctype/transport_assignment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/transport_assignment/test_transport_assignment.js b/csf_tz/fleet_management/doctype/transport_assignment/test_transport_assignment.js new file mode 100644 index 0000000..bd89ae9 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_assignment/test_transport_assignment.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Transport Assignment", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Transport Assignment + () => frappe.tests.make('Transport Assignment', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/transport_assignment/test_transport_assignment.py b/csf_tz/fleet_management/doctype/transport_assignment/test_transport_assignment.py new file mode 100644 index 0000000..7c288f3 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_assignment/test_transport_assignment.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Transport Assignment') + +class TestTransportAssignment(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.js b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.js new file mode 100644 index 0000000..9fa3101 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.js @@ -0,0 +1,140 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Transport Assignment', { + onload: function(frm){ + + }, + + refresh: function(frm) { + frm.toggle_display('section_extra'); + console.log(cur_frm.fields_dict); + + //Show/Hide according to cargo + if(frm.doc.cargo) + { + frm.toggle_display('cargo', true); + frm.toggle_display('container_number', true); + frm.toggle_display('amount', false); + frm.toggle_display('units', false); + } + else + { + frm.toggle_display('cargo', false); + frm.toggle_display('container_number', false); + frm.toggle_display('amount', true); + frm.toggle_display('units', true); + } + + + //Show/Hide according to transporter_type + if(frm.doc.transporter_type == 'Sub-Contractor' || frm.doc.transporter_type == 'Self Drive') + { + frm.toggle_display('assigned_vehicle', false); + frm.toggle_display('assigned_trailer', false); + frm.toggle_display('assigned_driver', false); + } + else + { + frm.toggle_display('assigned_vehicle', true); + frm.toggle_display('assigned_trailer', true); + frm.toggle_display('assigned_driver', true); + } + + //Disable editing of entries + frm.toggle_enable(['cargo', 'amount', 'expected_loading_date', 'container_number', 'units', 'transporter_type', 'sub_contractor', 'assigned_vehicle'], false); + frm.toggle_enable(['vehicle_plate_number', 'assigned_trailer', 'trailer_plate_number', 'assigned_driver', 'driver_name', 'passport_number', 'route', 'vehicle_status'], false); + frm.toggle_enable(['vehicle_trip', 'status', 'loading_date', 'lodge_permit', 'dispatch_date', 'cargo_type', 'file_number'], false); + + + /* + * + * Set vehicle status for determining if it is main or return cargo + * hidden_status == 0 (Vehicle Available) + * hidden_status == 1 (Vehicle Booked) + * hidden_status == 2 (Vehicle En Route - Main Trip) + * hidden_status == 3 (Vehicle Offloaded - Main Trip) + * hidden_status == 4 (Vehicle En Route - Return Trip) + * hidden_status == 5 (Vehicle Offloaded - Return Trip) + * + * + */ + + //Create vehicle trip + frm.add_custom_button(__("Create Vehicle Trip Record"), function(){ + if(frm.doc.vehicle_status == 2 || frm.doc.vehicle_status == 4) //If en route on trip and not offloaded + { + frappe.msgprint('The assigned vehicle is En Route on another trip and has not offloaded. Please offload the current cargo before starting new trip.', 'Not Allowed'); + } + else if(frm.doc.vehicle_status == 3) + { + frappe.confirm( + 'The vehicle is En Route on another trip. Set as return cargo? If you select no, a new trip will be created', + function(){ + frappe.call({ + method: "fleet_management.fleet_management.doctype.vehicle_trip.vehicle_trip.create_return_trip", + args: { + reference_doctype: "Transport Assignment", + reference_docname: cur_frm.doc.name, + vehicle: cur_frm.doc.assigned_vehicle, + transporter: cur_frm.doc.transporter_type, + vehicle_trip: cur_frm.doc.vehicle_trip + }, + callback: function(data){ + console.log(data); + //cur_frm.set_value('status', 'Processed'); + //cur_frm.save_or_update(); + frappe.set_route('Form', data.message.doctype, data.message.name); + } + }) + }, + function(){ + frappe.call({ + method: "fleet_management.fleet_management.doctype.vehicle_trip.vehicle_trip.create_vehicle_trip", + args: { + reference_doctype: "Transport Assignment", + reference_docname: cur_frm.doc.name, + vehicle: frm.doc.assigned_vehicle, + transporter: frm.doc.transporter_type + }, + callback: function(data){ + console.log(data); + //frm.set_value('status', 'Processed'); + //frm.save_or_update(); + frappe.set_route('Form', data.message.doctype, data.message.name); + } + }) + } + ); + } + else + { + frappe.call({ + method: "fleet_management.fleet_management.doctype.vehicle_trip.vehicle_trip.create_vehicle_trip", + args: { + reference_doctype: "Transport Assignment", + reference_docname: cur_frm.doc.name, + vehicle: frm.doc.assigned_vehicle, + transporter: frm.doc.transporter_type + }, + callback: function(data){ + console.log(data); + //frm.set_value('status', 'Processed'); + //frm.save_or_update(); + frappe.set_route('Form', data.message.doctype, data.message.name); + } + }) + } + }); + }, + + transporter_type: function(frm){ + if(frm.doc.transporter_type == "Sub-Contractor") + { + frm.toggle_display("sub_contractor", true); + frm.toggle_display("assigned_vehicle", false); + frm.toggle_display("sub_contractor", true); + frm.set_df_property("vehicle_plate_number", "read_only", false); + } + } +}); diff --git a/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.json b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.json new file mode 100644 index 0000000..c362bf0 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.json @@ -0,0 +1,1592 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "ASSIGN.###", + "beta": 0, + "creation": "2017-04-17 20:17:01.114822", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Container", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expected_loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expected Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "container_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Container Number", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "units", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Units", + "length": 0, + "no_copy": 0, + "options": "Unit of Measure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_transporter_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "TRANPORT DETAILS", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transporter_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transporter", + "length": 0, + "no_copy": 0, + "options": "\nBravo\nSub-Contractor\nSelf Drive", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "sub_contractor", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Sub-Contractor", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "assigned_vehicle", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Vehicle", + "length": 0, + "no_copy": 0, + "options": "Vehicle", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Vehicle Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "assigned_trailer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Trailer", + "length": 0, + "no_copy": 0, + "options": "Trailer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trailer_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Trailer Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_18", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "assigned_driver", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assigned Driver", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driver_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Driver Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "passport_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Driver Passport", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driver_licence", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Driver Licence", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driver_contact", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Driver Phone Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_route", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Route Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "route", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trip Route", + "length": 0, + "no_copy": 0, + "options": "Trip Route", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle_status", + "fieldtype": "Int", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle_trip", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Previous Trip", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_21", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Not Processed", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "\nNot Processed\nProcessed", + "permlevel": 1, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "created_trip", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Created Trip", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_extra", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra Info", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "lodge_permit", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lodge Permit Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "dispatch_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dispatch Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "cargo_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_vehicle_attachments", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Attachments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attach_1", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachment 1", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attach_2", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachment 2", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attach_3", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachment 3", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attach_4", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attachment 4", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attach_column", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "description_1", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description 1", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "description_2", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description 2", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "description_3", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description 3", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "description_4", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description 4", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_file_reference", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "import", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Import Reference", + "length": 0, + "no_copy": 0, + "options": "Import", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_43", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "export", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Export Reference", + "length": 0, + "no_copy": 0, + "options": "Export", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-03 22:01:13.496962", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Transport Assignment", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.py b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.py new file mode 100644 index 0000000..a2bde78 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TransportAssignment(Document): + def onload(self): + if self.transporter_type == 'Bravo': + previous_trips = frappe.db.sql('''SELECT name, hidden_status FROM `tabVehicle Trip` WHERE vehicle=%s AND transporter_type='Bravo' ORDER BY creation DESC LIMIT 20''', self.assigned_vehicle, as_dict=True) + if previous_trips: + self.set("vehicle_status", previous_trips[0].hidden_status) + self.set("vehicle_trip", previous_trips[0].name) + +@frappe.whitelist(allow_guest=True) +def change_assignment_status(**args): + args = frappe._dict(args) + doc = frappe.get_doc("Transport Assignment", args.assignment_docname) + doc.db_set('status', 'Not Processed') diff --git a/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment_list.js b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment_list.js new file mode 100644 index 0000000..99d2215 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_assignment/transport_assignment_list.js @@ -0,0 +1,6 @@ +frappe.listview_settings['Transport Assignment'] = { + add_fields: ["name", "status"], + get_indicator: function(doc) { + + } +}; diff --git a/csf_tz/fleet_management/doctype/transport_request/__init__.py b/csf_tz/fleet_management/doctype/transport_request/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/transport_request/test_transport_request.js b/csf_tz/fleet_management/doctype/transport_request/test_transport_request.js new file mode 100644 index 0000000..9a1bf4e --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_request/test_transport_request.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Transport Request", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Transport Request + () => frappe.tests.make('Transport Request', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/transport_request/test_transport_request.py b/csf_tz/fleet_management/doctype/transport_request/test_transport_request.py new file mode 100644 index 0000000..8a1fa2c --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_request/test_transport_request.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Transport Request') + +class TestTransportRequest(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/transport_request/transport_request.js b/csf_tz/fleet_management/doctype/transport_request/transport_request.js new file mode 100644 index 0000000..167c4fb --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_request/transport_request.js @@ -0,0 +1,646 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Transport Request', { + onload: function(frm){ + //Load the buttons + var html = ' '; + $(frm.fields_dict.html1.wrapper).html(html); + }, + + refresh: function(frm) { + console.log(frm); + + //Fix assignement details + frm.events.check_assignment_table(frm); + + //If request is from module, disable save, else enable save + //If the request is from other module, load data from that module + if(frm.doc.reference_docname) + { + cur_frm.cscript.populate_child(frm.doc.reference_doctype, frm.doc.reference_docname); + frm.page.clear_indicator(); + } + frm.events.calculate_total_assigned(frm); + frm.events.hide_show_cargo(frm); + }, + + + //Fix for bug which did copy cargo details in cargo. + check_assignment_table: function(frm){ + if(frm.doc.cargo_type == 'Container') + { + var to_save = false; + frm.doc.assign_transport.forEach(function(row){ + if(!row.cargo || row.cargo.toUpperCase().indexOf('NEW') > -1) + { + //Find the cargo details + frm.doc.cargo.forEach(function(cargo_row){ + if(cargo_row.container_number == row.container_number) + { + frappe.model.set_value('Transport Assignment', row.name, 'cargo', cargo_row.name); + } + }) + to_save = true; + } + }); + if(to_save) + { + frappe.after_ajax(function(){ + frm.save_or_update(); + }) + } + } + }, + + show_submit_button: function(frm){ + /*//If request is from module, save has been disabled hence need to save manually + if(frm.doc.reference_docname) + { + //Show the not saved label in indicator + frm.page.set_indicator('Not Saved', 'orange'); + + //Activate the submit button (The label has been changed to save) + frm.page.set_primary_action(__("Save"), function() { + //First validate vehicle assign table + if(frm.events.validate_assignment(frm)) + { + cur_frm.doc.assign_transport.forEach(function(row){ + frappe.call({ + method: "fleet_management.fleet_management.doctype.transport_request.transport_request.assign_vehicle", + freeze: true, + args: { + reference_doctype: cur_frm.doc.reference_doctype, + reference_docname: cur_frm.doc.reference_docname, + cargo_docname: row.cargo, + //cargo_idx: locals['Cargo Details'][row.cargo].idx, + assigned_vehicle: row.assigned_vehicle, + assigned_trailer: row.assigned_trailer, + assigned_driver: row.assigned_driver, + assigned_idx: row.idx, + amount: row.amount, + expected_loading_date: row.expected_loading_date, + container_number: row.container_number, + units: row.units, + transporter_type: row.transporter_type, + sub_contractor: row.sub_contractor, + vehicle_plate_number: row.vehicle_plate_number, + trailer_plate_number: row.trailer_plate_number, + driver_name: row.driver_name, + passport_number: row.passport_number, + route: row.route, + }, + callback: function(data){ + console.log(data.message); + } + }); + }); + cur_frm.page.clear_indicator(); + } + else + { + //If not all data has been entered + msgprint("Please fill all required fields in assigned vehicle table", "Error"); + } + }); + }*/ + }, + + show_hide_assignment: function(frm, cdt, cdn){ + //Processed row + var row = frm.fields_dict['assign_transport'].grid.grid_rows_by_docname[cdn]; + + //Show/hide container specific information + if(frm.doc.cargo_type == 'Container') + { + row.toggle_display('cargo', false); + row.toggle_display('container_number', true); + row.toggle_display('amount', false); + row.toggle_display('units', false); + } + else + { + row.toggle_display('cargo', false); + row.toggle_display('container_number', false); + row.toggle_display('amount', true); + row.toggle_display('units', true); + } + + //Make editable according to request origin + if(frm.doc.reference_docname) + { + row.toggle_editable('cargo', false); + row.toggle_editable('container_number', false); + row.toggle_editable('expected_loading_date', false); + + } + + //Hide the extra info section + row.toggle_display('section_extra', false); + + //Show, hide and enable entries according to the transporter type + if(locals[cdt][cdn].transporter_type == "Sub-Contractor" || locals[cdt][cdn].transporter_type == "Self Drive") + { + //Show the sub-contractor select box + row.toggle_display("sub_contractor", (locals[cdt][cdn].transporter_type == "Sub-Contractor")); + //Enter vehicle details + row.toggle_display("assigned_vehicle", false); + row.toggle_editable("vehicle_plate_number", true); + //Vehicle Documents + //row.toggle_display("section_vehicle_attachments", true); + for(var i = 1; i < 5; i++) + { + row.toggle_editable("attach_" + i, true); + row.toggle_editable("description_" + i, true); + } + //Trailor Details + row.toggle_display("assigned_trailer", false); + row.toggle_editable("trailer_plate_number", (locals[cdt][cdn].transporter_type == "Sub-Contractor")); + //Driver Details + row.toggle_display("assigned_driver", false); + row.toggle_editable("driver_name", true); + row.toggle_editable("passport_number", true); + row.toggle_editable("driver_licence", true); + row.toggle_editable("driver_contact", true); + } + else if(locals[cdt][cdn].transporter_type == "Bravo") + { + //Hide the sub-contractor select box + row.toggle_display("sub_contractor", false); + //Enter vehicle details + row.toggle_display("assigned_vehicle", true); + row.toggle_editable("assigned_vehicle", true); + row.toggle_editable("vehicle_plate_number", false); + //Vehicle Documents + //row.toggle_display("section_vehicle_attachments", true); + for(var i = 1; i < 5; i++) + { + row.toggle_editable("attach_" + i, false); + row.toggle_editable("description_" + i, false); + } + //Trailor Details + row.toggle_display("assigned_trailer", true); + row.toggle_editable("assigned_trailer", true); + row.toggle_editable("trailer_plate_number", false); + //Driver Details + row.toggle_display("assigned_driver", true); + row.toggle_editable("assigned_driver", true); + row.toggle_editable("driver_name", false); + row.toggle_editable("passport_number", false); + row.toggle_editable("driver_licence", true); + row.toggle_editable("driver_contact", true); + } + else + { + //Hide the sub-contractor select box + row.toggle_display("sub_contractor", false); + //Enter vehicle details + row.toggle_display("assigned_vehicle", true); + row.toggle_editable("assigned_vehicle", true); + row.toggle_editable("vehicle_plate_number", false); + //Vehicle Documents + for(var i = 1; i < 5; i++) + { + row.toggle_editable("attach_" + i, false); + row.toggle_editable("description_" + i, false); + } + //Trailor Details + row.toggle_display("assigned_trailer", true); + row.toggle_editable("assigned_trailer", true); + //Driver Details + row.toggle_display("assigned_driver", true); + row.toggle_editable("assigned_driver", true); + } + }, + + cargo_type: function(frm){ + frm.events.hide_show_cargo(frm); + }, + + hide_show_cargo: function(frm){ + if(frm.doc.cargo_type == "") + { + frm.toggle_display('cargo', false); + frm.toggle_display('amount', false); + frm.toggle_display('unit', false); + frm.toggle_display('number_of_vehicles', false); + frm.toggle_display('html1', false); + frm.toggle_display('goods_description', false); + frm.toggle_display('cargo_description', false); + frm.toggle_display('section_vehicle_assignment', false); + } + else if(frm.doc.cargo_type == "Container") + { + frm.toggle_display('cargo', true); + frm.toggle_display('amount', false); + frm.toggle_display('unit', false); + frm.toggle_display('number_of_vehicles', false); + frm.toggle_display('html1', true); + frm.toggle_display('goods_description', true); + frm.toggle_display('cargo_description', true); + frm.toggle_display('section_vehicle_assignment', true); + } + else + { + frm.toggle_display('cargo', false); + frm.toggle_display('amount', true); + frm.toggle_display('unit', true); + frm.toggle_display('number_of_vehicles', true); + frm.toggle_display('html1', false); + frm.toggle_display('goods_description', true); + frm.toggle_display('cargo_description', true); + frm.toggle_display('section_vehicle_assignment', true); + } + }, + + validate: function(frm){ + if(!frm.events.validate_assignment(frm)) + { + frappe.msgprint("Please enter all required fields in vehicle assignement table."); + frappe.validated = false; + } + }, + + validate_assignment: function(frm){ + var valid = true; + //Validate that all required entries are entered in vehicle assignment table + console.log(frm.doc.assign_transport.length); + frm.doc.assign_transport.forEach(function(row){ + if(frm.doc.cargo_type == 'Container') + { + if(row.cargo && row.route) //Check cargo and route entered + { + if(row.transporter_type == "Sub-Contractor") + { + if(row.vehicle_plate_number && row.trailer_plate_number && row.driver_name && row.passport_number) + { + //Its all good, go to the next row + } + else + { + valid = false; + return false; + } + } + else if(row.transporter_type == "Self Drive") + { + if(row.vehicle_plate_number && row.driver_name && row.passport_number) + { + //Its all good, go to the next row + } + else + { + valid = false; + return false; + } + } + else + { + if(row.assigned_vehicle && row.assigned_trailer && row.assigned_driver) + { + //Its all good, go to the next row + } + else + { + valid = false; + return false; + } + } + } + else + { + valid = false; + return false; + } + } + else + { + if(row.amount > 0 && row.units && row.route) //Check cargo and route entered + { + if(row.transporter_type == "Sub-Contractor") + { + if(row.vehicle_plate_number && row.trailer_plate_number && row.driver_name && row.passport_number) + { + //Its all good, go to the next row + } + else + { + valid = false; + return false; + } + } + else if(row.transporter_type == "Self Drive") + { + if(row.vehicle_plate_number && row.driver_name && row.passport_number) + { + //Its all good, go to the next row + } + else + { + valid = false; + return false; + } + } + else + { + if(row.assigned_vehicle && row.assigned_trailer && row.assigned_driver) + { + //Its all good, go to the next row + } + else + { + valid = false; + return false; + } + } + } + else + { + valid = false; + return false; + } + } + }); + + //If the process is not interrupted, then all is well and return true + if(valid == true) + { + return true; + } + else + { + return false; + } + }, + + calculate_total_assigned: function(frm){ + if(frm.doc.cargo_type == 'Loose Cargo' && frm.doc.assign_transport.length > 0) + { + frm.toggle_display('total_assigned', true); + var total = 0; + frm.doc.assign_transport.forEach(function(row){ + total = total + row.amount; + }); + frm.set_value('total_assigned', total + ' ' + frm.doc.unit); + } + else + { + frm.toggle_display('total_assigned', false); + } + } +}); + + +frappe.ui.form.on("Transport Assignment", { + form_render: function(frm, cdt, cdn){ + frm.events.show_hide_assignment(frm, cdt, cdn); + locals[cdt][cdn].units = frm.doc.unit; + }, + + before_assign_transport_remove: function(frm, cdt, cdn){ + if(locals[cdt][cdn].status && locals[cdt][cdn].status == "Processed") + { + frappe.throw("You cannot delete a processed assignment"); + } + }, + + before_assign_transport_add: function(frm, cdt, cdn){ + if(cur_frm.doc.cargo_type == "Container") + { + frappe.throw('Please use the assign vehicle button to assign vehicles.'); + } + }, + + assign_transport_add: function(frm, cdt, cdn){ + if(cur_frm.doc.cargo_type != "Container") + { + locals[cdt][cdn].container_number = 'NIL'; + locals[cdt][cdn].cargo_type = frm.doc.cargo_type + locals[cdt][cdn].file_number = frm.doc.file_number; + //If units are set, copy units to the assignment + if(frm.doc.unit) + { + locals[cdt][cdn].units = frm.doc.unit; + } + } + }, + + amount: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + frm.events.calculate_total_assigned(frm); + }, + + expected_loading_date: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, + + transporter_type: function(frm, cdt, cdn){ + frm.events.show_hide_assignment(frm, cdt, cdn); + }, + + sub_contractor: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, + + assigned_vehicle: function(frm, cdt, cdn){ + //Automatically enter the plate number, trailer and driver + //For future reference on how to do this the frappe way. FOr some reason I cant get it to work on child table on first value change + //cur_frm.add_fetch('assigned_vehicle', 'number_plate', 'vehicle_plate_number'); + frappe.call({ + method:"frappe.client.get_value", + args: { + doctype:"Vehicle", + filters: { + name: locals[cdt][cdn].assigned_vehicle + }, + fieldname:["number_plate", "driver", "default_trailer"] + }, + callback: function(data) { + // set the returned values in cooresponding fields + frappe.model.set_value(cdt, cdn, 'vehicle_plate_number', data.message.number_plate); + frappe.model.set_value(cdt, cdn, 'assigned_trailer', data.message.default_trailer); + frappe.model.set_value(cdt, cdn, 'assigned_driver', data.message.driver); + } + }) + + //For vehicle documents + frappe.model.with_doc('Vehicle', locals[cdt][cdn].assigned_vehicle, function(){ + var ref_vehicle = frappe.model.get_doc('Vehicle', locals[cdt][cdn].assigned_vehicle); + var i = 1; + ref_vehicle.vehicle_documents.forEach(function(row){ + //Fill in the attachments and their descriptions. + frappe.model.set_value(cdt, cdn, 'attach_' + i, row.attachment); + frappe.model.set_value(cdt, cdn, 'description_' + i, row.description); + i++; + }); + }); + + + frm.events.show_submit_button(frm); + frappe.after_ajax(function(row){ + frm.events.show_hide_assignment(frm, cdt, cdn); + }); + }, + + vehicle_plate_number: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, + + assigned_trailer: function(frm, cdt, cdn){ + frappe.call({ + method:"frappe.client.get_value", + args: { + doctype:"Trailer", + filters: { + name: locals[cdt][cdn].assigned_trailer + }, + fieldname:["number_plate"] + }, + callback: function(data) { + // set the returned values in cooresponding fields + frappe.model.set_value(cdt, cdn, 'trailer_plate_number', data.message.number_plate); + } + }) + frm.events.show_submit_button(frm); + }, + + trailer_plate_number: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, + + assigned_driver: function(frm, cdt, cdn){ + frappe.call({ + method:"frappe.client.get_value", + args: { + doctype:"Employee", + filters: { + name: locals[cdt][cdn].assigned_driver + }, + fieldname:["employee_name", "passport_number", "cell_number", "driving_licence_number"] + }, + callback: function(data) { + // set the returned values in cooresponding fields + frappe.model.set_value(cdt, cdn, 'driver_name', data.message.employee_name); + frappe.model.set_value(cdt, cdn, 'passport_number', data.message.passport_number); + frappe.model.set_value(cdt, cdn, 'driver_licence', data.message.driving_licence_number); + frappe.model.set_value(cdt, cdn, 'driver_contact', data.message.cell_number); + } + }) + frm.events.show_submit_button(frm); + }, + + driver_name: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, + + passport_number: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, + + route: function(frm, cdt, cdn){ + frm.events.show_submit_button(frm); + }, +}); + +//For filtering the driver options in the assign_transport table to only show drivers +cur_frm.set_query("assigned_driver", "assign_transport", function(doc, cdt, cdn){ + return{ + filters: [ + ['Employee', 'designation', '=', 'Driver'] + ] + } +}); + +cur_frm.cscript.assign_transport = function(frm){ + //For setting indicator message + //cur_frm.page.set_indicator("Unsubmitted Changes", "orange"); + //cur_frm.page.clear_indicator(); + + //If it is container based cargo + if(cur_frm.doc.cargo_type == "Container") + { + //Add selected rows to assign table + var selected = cur_frm.get_selected(); + if(selected['cargo']) + { + $.each(selected['cargo'], function(index, cargo_nm){ + var container_number = locals["Cargo Details"][cargo_nm].container_number; + var exists = $('[data-fieldname="assign_transport"]:contains("' + container_number + '")'); + console.log(exists); + if(exists.length > 0) + { + msgprint('Container No. ' + container_number + ' has already been processed.', 'Error') + } + else + { + var new_row = cur_frm.add_child("assign_transport"); + new_row.cargo_type = cur_frm.doc.cargo_type; + new_row.cargo = locals["Cargo Details"][cargo_nm].name; + new_row.container_number = container_number; + new_row.expected_loading_date = cur_frm.doc.loading_date; + new_row.file_number = cur_frm.doc.file_number; + if(cur_frm.doc.reference_doctype == 'Import'){ + new_row['import'] = cur_frm.doc.reference_docname; + } + else if(cur_frm.reference_doctype == 'Export'){ + new_row['export'] = cur_frm.doc.reference_docname; + } + cur_frm.refresh_field("assign_transport"); + } + }); + } + else + { + show_alert("Error: Please select cargo to process."); + } + } +} + +cur_frm.cscript.populate_child = function(reference_doctype, reference_docname){ + if(reference_doctype == "Import") + { + frappe.model.with_doc(reference_doctype, reference_docname, function(){ + var request_total_amount = null; + var reference_doc = frappe.get_doc(reference_doctype, reference_docname); + + //Load data and set as read only + cur_frm.set_value('request_received', cur_frm.meta.creation.substr(0, 10)); + cur_frm.set_value('customer', reference_doc.customer); + cur_frm.set_value('consignee', reference_doc.consignee); + cur_frm.set_value('shipper', reference_doc.shipper); + cur_frm.set_value('cargo_location_city', reference_doc.port_of_discharge); + cur_frm.set_value('loading_date', reference_doc.ata); + cur_frm.set_value('cargo_destination_country', reference_doc.cargo_destination_country); + cur_frm.set_value('cargo_destination_city', reference_doc.cargo_destination_city); + cur_frm.set_value('border1_clearing_agent', reference_doc.clearing_agent_border_1); + cur_frm.set_value('border2_clearing_agent', reference_doc.clearing_agent_border_2); + cur_frm.set_value('border3_clearing_agent', reference_doc.clearing_agent_border_3); + cur_frm.set_value('special_instructions_to_transporter', reference_doc.special_instructions_to_transporter); + cur_frm.set_value('cargo_type', 'Container'); + cur_frm.set_value('goods_description', reference_doc.cargo); + cur_frm.set_value('cargo_description', reference_doc.cargo_description); + cur_frm.set_value('file_number', reference_doc.reference_file_number); + + //Set as read only + cur_frm.toggle_enable(['request_received', 'customer', 'cargo_location_city', 'loading_date', 'cargo_destination_city', + 'cargo_destination_country', 'cargo_type', 'goods_description', 'cargo_description', 'file_number', + 'consignee', 'shipper', 'special_instructions_to_transporter'], 0); + cur_frm.toggle_enable(['border1_clearing_agent', 'border2_clearing_agent', 'border3_clearing_agent', 'cargo_location_country', 'transport_type', 'cargo'], 0); + + //Get port country + frappe.model.with_doc('Port', reference_doc.port_of_discharge, function(frm){ + cur_frm.set_value('cargo_location_country', frappe.model.get_doc('Port', reference_doc.port_of_discharge).country); + }); + + if(reference_doc.import_type == "Local") + { + cur_frm.set_value('transport_type', 'Internal'); + } + else if(reference_doc.import_type == "Transit") + { + cur_frm.set_value('transport_type', 'Cross Border'); + } + }); + return "done"; + } +}; diff --git a/csf_tz/fleet_management/doctype/transport_request/transport_request.json b/csf_tz/fleet_management/doctype/transport_request/transport_request.json new file mode 100644 index 0000000..e7734ec --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_request/transport_request.json @@ -0,0 +1,1219 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "TREQ.##", + "beta": 0, + "creation": "2017-02-27 16:28:12.882787", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_received", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Request/Order Received", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "loading_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expected Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "transport_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Transport Type", + "length": 0, + "no_copy": 0, + "options": "Cross Border\nInternal\n", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_location_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Location Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_location_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Location City", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_destination_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_destination_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Destination City", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_consignee_shipper", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee and Shipper", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "consignee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipper", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipper", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_border_clearance", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border and Transport Instructions", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border1_clearing_agent", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent Border 1", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border2_clearing_agent", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent Border 2", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "border3_clearing_agent", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Agent Border 3", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_13", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "special_instructions_to_transporter", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Special Instructions to Transporter", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_cargo_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "options": "\nContainer\nLoose Cargo", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "goods_description", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Category", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amount", + "fieldtype": "Float", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "unit", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Unit", + "length": 0, + "no_copy": 0, + "options": "Unit of Measure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo", + "fieldtype": "Table", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "html1", + "fieldtype": "HTML", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_vehicle_assignment", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Assignment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "assign_transport", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assign Vehicle", + "length": 0, + "no_copy": 0, + "options": "Transport Assignment", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_assigned", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Assigned Cargo", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_reference", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Request Origin", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Requested From", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_18", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cargo_name", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Waiting Assignment", + "fieldname": "assignment_status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Assignment Status", + "length": 0, + "no_copy": 0, + "options": "Waiting Assignment\nPartially Assigned\nFully Assigned", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "version", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Version", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-10-27 18:34:38.018041", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Transport Request", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/transport_request/transport_request.py b/csf_tz/fleet_management/doctype/transport_request/transport_request.py new file mode 100644 index 0000000..8892cc6 --- /dev/null +++ b/csf_tz/fleet_management/doctype/transport_request/transport_request.py @@ -0,0 +1,254 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import time +import datetime +from frappe.model.document import Document +from frappe import _ + +class TransportRequest(Document): + def before_save(self): + #For assignment status + if not self.assign_transport: + self.set('assignment_status', 'Waiting Assignment') + elif self.cargo_type == 'Container': + assigned_containers = [] + for row in self.assign_transport: + assigned_containers.append(row.container_number) + + for row in self.cargo: + if row.container_number not in assigned_containers: + self.set('assignment_status', 'Partially Assigned') + else: + self.set('assignment_status', 'Fully Assigned') + elif self.cargo_type == 'Loose Cargo': + total_assigned = 0; + for row in self.assign_transport: + total_assigned = total_assigned + row.get('amount', 0) + + if self.amount > total_assigned: + self.set('assignment_status', 'Partially Assigned') + else: + self.set('assignment_status', 'Fully Assigned') + + def get_all_children(self, parenttype=None): + #If reference doctype is set + if self.get('reference_docname'): + return self.get('assign_transport') + else: + """Returns all children documents from **Table** type field in a list.""" + ret = [] + + for df in self.meta.get("fields", {"fieldtype": "Table"}): + if parenttype: + if df.options==parenttype: + return self.get(df.fieldname) + value = self.get(df.fieldname) + if isinstance(value, list): + ret.extend(value) + return ret + + + def update_children(self): + #update child tables + #If reference doctype is set + if self.get('reference_docname'): + self.update_child_table('assign_transport') + else: + for df in self.meta.get_table_fields(): + self.update_child_table(df.fieldname, df) + + + '''def set_parent_in_children(self): + """Updates `parent` and `parenttype` property in all children.""" + #If reference doctype is set + if self.get('reference_docname'): + for d in self.get_all_children(): + d.parent = self.get('reference_docname') + d.parenttype = self.get('reference_doctype') + if self.get('reference_doctype') == "Import": + d.parentfield = "assign_transport" + else: + for d in self.get_all_children(): + d.parent = self.name + d.parenttype = self.doctype''' + + + #Custom load method for loading child tables data from imports and exports request + def load_from_db(self): + """Load document and children from database and create properties + from fields""" + if not getattr(self, "_metaclass", False) and self.meta.issingle: + single_doc = frappe.db.get_singles_dict(self.doctype) + if not single_doc: + single_doc = frappe.new_doc(self.doctype).as_dict() + single_doc["name"] = self.doctype + del single_doc["__islocal"] + + super(Document, self).__init__(single_doc) + self.init_valid_columns() + self._fix_numeric_types() + + else: + d = frappe.db.get_value(self.doctype, self.name, "*", as_dict=1) + if not d: + frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError) + + super(Document, self).__init__(d) + + if self.name=="DocType" and self.doctype=="DocType": + from frappe.model.meta import doctype_table_fields + table_fields = doctype_table_fields + else: + table_fields = self.meta.get_table_fields() + + # + # For table fields load from request origin(if there is) else load normal + # Also add back compatibiilty for when transport assignements were being loaded from import + # + for df in table_fields: + if d.reference_doctype and d.reference_docname: + #Fieldname depending on if it's Export or Import + if d.reference_doctype == "Import" and df.fieldname == "cargo": + fieldname = "cargo_information" + elif d.reference_doctype == "Import" and df.fieldname == "assign_transport": + fieldname = "assign_transport" + + if df.fieldname == "assign_transport" and self.get('version') == 2: + children = frappe.db.get_values(df.options, + {"parent": self.name, "parenttype": self.doctype, "parentfield": 'assign_transport'}, + "*", as_dict=True, order_by="idx asc") + else: + children = frappe.db.get_values(df.options, + {"parent": d.reference_docname, "parenttype": d.reference_doctype, "parentfield": fieldname}, + "*", as_dict=True, order_by="idx asc") + + + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + else: + children = frappe.db.get_values(df.options, + {"parent": self.name, "parenttype": self.doctype, "parentfield": df.fieldname}, + "*", as_dict=True, order_by="idx asc") + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + + # sometimes __setup__ can depend on child values, hence calling again at the end + if hasattr(self, "__setup__"): + self.__setup__() + + +@frappe.whitelist(allow_guest=True) +def transport_request_scheduler(): + #Create requests for imports less than 10 days to eta + for row in frappe.db.sql("""SELECT name, eta, reference_file_number FROM `tabImport` WHERE (status <> 'Closed' OR status IS NULL) AND `eta` < timestampadd(day, -10, now())""", as_dict=1): + create_transport_request(reference_doctype="Import", reference_docname=row.name, file_number=row.reference_file_number) + + + +@frappe.whitelist(allow_guest=True) +def create_transport_request(**args): + args = frappe._dict(args) + + existing_transport_request = frappe.db.get_value("Transport Request", + {"file_number": args.file_number}) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + if not existing_transport_request: + request = frappe.new_doc("Transport Request") + request.update({ + "reference_doctype":args.reference_doctype, + "reference_docname": args.reference_docname, + "file_number": args.file_number, + "request_received": args.request_received, + "customer": args.customer, + "consignee": args.consignee, + "shipper": args.shipper, + "cargo_location_country": args.cargo_location_country, + "cargo_location_city": args.cargo_location_city, + "cargo_destination_country": args.cargo_destination_country, + "cargo_destination_city": args.cargo_destination_city, + "transport_type": args.transport_type, + "version": 2 + }) + request.insert(ignore_permissions=True) + return request.name + else: + return existing_transport_request + +@frappe.whitelist(allow_guest=True) +def assign_vehicle(**args): + args = frappe._dict(args) + + #Change cargo status to assigned (1) + #doc = frappe.get_doc("Cargo Details", args.cargo_docname) + #doc.db_set("transport_status", "0", False) + #doc.db_set("idx", args.cargo_idx, False) + + #Add/Update assigned transport details + existing_transport_details = frappe.db.get_value("Transport Assignment", + {"cargo": args.cargo_docname}) + + if existing_transport_details: + #Update the transport details + doc = frappe.get_doc("Transport Assignment", existing_transport_details) + doc.assigned_vehicle = args.assigned_vehicle + doc.assigned_trailer = args.assigned_trailer + doc.assigned_driver = args.assigned_driver + doc.cargo = args.cargo_docname + doc.amount = args.amount + doc.expected_loading_date = args.expected_loading_date + doc.container_number = args.container_number + doc.units = args.units + doc.transporter_type = args.transporter_type + doc.sub_contractor = args.sub_contractor + doc.vehicle_plate_number = args.vehicle_plate_number + doc.trailer_plate_number = args.trailer_plate_number + doc.driver_name = args.driver_name + doc.passport_number = args.passport_number + doc.route = args.route + doc.idx = args.assigned_idx + doc.save() + else: + request = frappe.new_doc("Transport Assignment") + request.update({ + "cargo": args.cargo_docname, + "amount": args.amount, + "expected_loading_date": args.expected_loading_date, + "container_number": args.container_number, + "units": args.units, + "transporter_type": args.transporter_type, + "sub_contractor": args.sub_contractor, + "vehicle_plate_number": args.vehicle_plate_number, + "trailer_plate_number": args.trailer_plate_number, + "driver_name": args.driver_name, + "passport_number": args.passport_number, + "route": args.route, + "parent": args.reference_docname, + "parenttype": args.reference_doctype, + "parentfield": "assign_transport", + "assigned_vehicle": args.assigned_vehicle, + "assigned_trailer": args.assigned_trailer, + "assigned_driver": args.assigned_driver, + "idx": args.assigned_idx + }) + request.insert(ignore_permissions=True) + + #Edit vehicle status + + '''vehicle = frappe.get_doc("Vehicle", args.assigned_vehicle) + if vehicle.status == 'Available': + vehicle.status = "Booked" + vehicle.save()''' + return "success" + diff --git a/csf_tz/fleet_management/doctype/trip_location/__init__.py b/csf_tz/fleet_management/doctype/trip_location/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/trip_location/test_trip_location.js b/csf_tz/fleet_management/doctype/trip_location/test_trip_location.js new file mode 100644 index 0000000..0a4d7c7 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location/test_trip_location.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Trip Location", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Trip Location + () => frappe.tests.make('Trip Location', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/trip_location/test_trip_location.py b/csf_tz/fleet_management/doctype/trip_location/test_trip_location.py new file mode 100644 index 0000000..953718e --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location/test_trip_location.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Trip Location') + +class TestTripLocation(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/trip_location/trip_location.js b/csf_tz/fleet_management/doctype/trip_location/trip_location.js new file mode 100644 index 0000000..fcf06c1 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location/trip_location.js @@ -0,0 +1,22 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Trip Location', { + refresh: function(frm) { + + }, + + is_local_border: function(frm){ + if(frm.doc.is_local_border && frm.doc.is_local_border == 1) + { + frm.set_value('is_international_border', 0); + } + }, + + is_international_border: function(frm){ + if(frm.doc.is_international_border && frm.doc.is_international_border == 1) + { + frm.set_value('is_local_border', 0); + } + } +}); diff --git a/csf_tz/fleet_management/doctype/trip_location/trip_location.json b/csf_tz/fleet_management/doctype/trip_location/trip_location.json new file mode 100644 index 0000000..476c153 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location/trip_location.json @@ -0,0 +1,183 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:description", + "beta": 0, + "creation": "2017-04-11 23:42:13.642259", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Location (Latitude, Longitude)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_local_border", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Local Border", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_international_border", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is International Border", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-06 12:31:18.914307", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Trip Location", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/trip_location/trip_location.py b/csf_tz/fleet_management/doctype/trip_location/trip_location.py new file mode 100644 index 0000000..a9d8b51 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location/trip_location.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TripLocation(Document): + pass diff --git a/csf_tz/fleet_management/doctype/trip_location_type/__init__.py b/csf_tz/fleet_management/doctype/trip_location_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/trip_location_type/test_trip_location_type.js b/csf_tz/fleet_management/doctype/trip_location_type/test_trip_location_type.js new file mode 100644 index 0000000..cc46bdd --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location_type/test_trip_location_type.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Trip Location Type", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Trip Location Type + () => frappe.tests.make('Trip Location Type', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/trip_location_type/test_trip_location_type.py b/csf_tz/fleet_management/doctype/trip_location_type/test_trip_location_type.py new file mode 100644 index 0000000..630e6c6 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location_type/test_trip_location_type.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Trip Location Type') + +class TestTripLocationType(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.js b/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.js new file mode 100644 index 0000000..f6004e1 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Trip Location Type', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.json b/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.json new file mode 100644 index 0000000..d2e31d5 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.json @@ -0,0 +1,272 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:location_type", + "beta": 0, + "creation": "2017-04-12 16:51:22.056811", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Information to Capture", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "arrival_date", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "departure_date", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Departure Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "loading_date", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Loading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "offloading_date", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-09-16 16:09:45.734183", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Trip Location Type", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.py b/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.py new file mode 100644 index 0000000..67e99d4 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_location_type/trip_location_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TripLocationType(Document): + pass diff --git a/csf_tz/fleet_management/doctype/trip_route/__init__.py b/csf_tz/fleet_management/doctype/trip_route/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/trip_route/test_trip_route.js b/csf_tz/fleet_management/doctype/trip_route/test_trip_route.js new file mode 100644 index 0000000..5f8c76d --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_route/test_trip_route.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Trip Route", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Trip Route + () => frappe.tests.make('Trip Route', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/trip_route/test_trip_route.py b/csf_tz/fleet_management/doctype/trip_route/test_trip_route.py new file mode 100644 index 0000000..02e856a --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_route/test_trip_route.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Trip Route') + +class TestTripRoute(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/trip_route/trip_route.js b/csf_tz/fleet_management/doctype/trip_route/trip_route.js new file mode 100644 index 0000000..0cd677e --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_route/trip_route.js @@ -0,0 +1,93 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Trip Route', { + refresh: function (frm) { + //console.log(frm); + }, + + + + + validate: function (frm) { + //Check not more than two local borders + var local_border = 0; + for (var key in locals['Trip Steps Table']) { + if (1 == locals['Trip Steps Table'][key].is_local_border) { + local_border++; + } + } + if (local_border > 2) { + msgprint('You cannot have more than two local borders in a route.', 'Error'); + validated = false; + } + }, + + calculate_total_expenses: function (frm) { + var totals = { + "USD": 0, + "TZS": 0 + }; + frm.doc.fixed_expenses.forEach(function (row) { + if (row.currency && row.amount) { + totals[row.currency] += row.amount; + } + }); + + frm.set_value('total_usd', totals['USD']); + frm.set_value('total_tzs', totals['TZS']); + } +}); + + +frappe.ui.form.on('Trip Steps Table', { + location: function (frm, cdt, cdn) { + if (locals[cdt][cdn].location != "") { + frappe.model.with_doc('Trip Location', locals[cdt][cdn].location, function () { + reference_doc = frappe.model.get_doc('Trip Location', locals[cdt][cdn].location); + if (1 == reference_doc.is_local_border) { + frappe.model.set_value(cdt, cdn, 'is_local_border', 1); + frappe.model.set_value(cdt, cdn, 'is_international_border', 0); + } else if (1 == reference_doc.is_international_border) { + frappe.model.set_value(cdt, cdn, 'is_international_border', 1); + frappe.model.set_value(cdt, cdn, 'is_local_border', 0); + } else { + frappe.model.set_value(cdt, cdn, 'is_local_border', 0); + frappe.model.set_value(cdt, cdn, 'is_international_border', 0); + } + }); + } + }, +}); + + + + +frappe.ui.form.on('Fixed Expense Table', { + expense: function (frm, cdt, cdn) { + if (locals[cdt][cdn].expense && locals[cdt][cdn].expense != '') { + frappe.call({ + method: "frappe.client.get_value", + args: { + doctype: "Fixed Expense", + fieldname: ["currency", "fixed_value"], + filters: { + name: ["=", locals[cdt][cdn].expense] + } + }, + callback: function (data) { + frappe.model.set_value(cdt, cdn, 'currency', data.message.currency); + frappe.model.set_value(cdt, cdn, 'amount', data.message.fixed_value); + } + }); + } + }, + + currency: function (frm, cdt, cdn) { + frm.events.calculate_total_expenses(frm); + }, + + amount: function (frm, cdt, cdn) { + frm.events.calculate_total_expenses(frm); + } +}); diff --git a/csf_tz/fleet_management/doctype/trip_route/trip_route.json b/csf_tz/fleet_management/doctype/trip_route/trip_route.json new file mode 100644 index 0000000..5bfd918 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_route/trip_route.json @@ -0,0 +1,308 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:route_name", + "beta": 0, + "creation": "2017-04-12 20:25:11.245694", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "route_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Route Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_distance", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Total Distance (km)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_steps", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Route Steps", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "trip_steps", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Trip Steps Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_fixed_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Fixed Expenses", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fixed_expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Fixed Expense Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_tzs", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total TZS", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "description": "", + "fieldname": "total_usd", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total USD", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-06 16:02:57.252582", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Trip Route", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/trip_route/trip_route.py b/csf_tz/fleet_management/doctype/trip_route/trip_route.py new file mode 100644 index 0000000..4db1b59 --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_route/trip_route.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + + +class TripRoute(Document): + def validate(self): + self.before_save(); + + + + def before_save(self): + for d in self.get('trip_steps'): + if d.idx==1 and d.location_type!='Loading Point': + frappe.throw("Set 1st location type to LOADING POINT") + break + if d.idx == len(self.get('trip_steps')) and d.location_type != 'Offloading Point': + frappe.throw("Set last location type to OFFLOADING POINT") + break + + + + + + diff --git a/csf_tz/fleet_management/doctype/trip_steps_table/__init__.py b/csf_tz/fleet_management/doctype/trip_steps_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/trip_steps_table/trip_steps_table.json b/csf_tz/fleet_management/doctype/trip_steps_table/trip_steps_table.json new file mode 100644 index 0000000..3f6f35c --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_steps_table/trip_steps_table.json @@ -0,0 +1,193 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-04-12 20:15:10.664163", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location", + "length": 0, + "no_copy": 0, + "options": "Trip Location", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "distance", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Distance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location Type", + "length": 0, + "no_copy": 0, + "options": "Trip Location Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_local_border", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Is Local Border", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_international_border", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Is International Border", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-03-02 19:36:58.016889", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Trip Steps Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/trip_steps_table/trip_steps_table.py b/csf_tz/fleet_management/doctype/trip_steps_table/trip_steps_table.py new file mode 100644 index 0000000..a57a6dd --- /dev/null +++ b/csf_tz/fleet_management/doctype/trip_steps_table/trip_steps_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class TripStepsTable(Document): + pass diff --git a/csf_tz/fleet_management/doctype/unit_of_measure/__init__.py b/csf_tz/fleet_management/doctype/unit_of_measure/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/unit_of_measure/test_unit_of_measure.js b/csf_tz/fleet_management/doctype/unit_of_measure/test_unit_of_measure.js new file mode 100644 index 0000000..311bba5 --- /dev/null +++ b/csf_tz/fleet_management/doctype/unit_of_measure/test_unit_of_measure.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Unit of Measure", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Unit of Measure + () => frappe.tests.make('Unit of Measure', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/unit_of_measure/test_unit_of_measure.py b/csf_tz/fleet_management/doctype/unit_of_measure/test_unit_of_measure.py new file mode 100644 index 0000000..b683131 --- /dev/null +++ b/csf_tz/fleet_management/doctype/unit_of_measure/test_unit_of_measure.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Unit of Measure') + +class TestUnitofMeasure(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.js b/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.js new file mode 100644 index 0000000..3c55f37 --- /dev/null +++ b/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Unit of Measure', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.json b/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.json new file mode 100644 index 0000000..bfd239f --- /dev/null +++ b/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.json @@ -0,0 +1,93 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:unit_name", + "beta": 0, + "creation": "2017-04-20 21:28:46.261737", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "unit_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-06 12:33:11.340729", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Unit of Measure", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.py b/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.py new file mode 100644 index 0000000..d2345f1 --- /dev/null +++ b/csf_tz/fleet_management/doctype/unit_of_measure/unit_of_measure.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class UnitofMeasure(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_checklist/__init__.py b/csf_tz/fleet_management/doctype/vehicle_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_checklist/test_vehicle_checklist.js b/csf_tz/fleet_management/doctype/vehicle_checklist/test_vehicle_checklist.js new file mode 100644 index 0000000..d483e81 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_checklist/test_vehicle_checklist.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Checklist", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Checklist + () => frappe.tests.make('Vehicle Checklist', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_checklist/test_vehicle_checklist.py b/csf_tz/fleet_management/doctype/vehicle_checklist/test_vehicle_checklist.py new file mode 100644 index 0000000..f737220 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_checklist/test_vehicle_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestVehicleChecklist(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.js b/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.js new file mode 100644 index 0000000..378c397 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Checklist', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.json b/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.json new file mode 100644 index 0000000..2bbc8a0 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.json @@ -0,0 +1,220 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 15:12:37.003334", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_check_item", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Lighting", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_mark", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_system", + "fieldtype": "Heading", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Brake System", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_check_item", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_mark", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Mark", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-07-25 15:41:22.659341", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.py b/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.py new file mode 100644 index 0000000..d89ad24 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_checklist/vehicle_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_documents/__init__.py b/csf_tz/fleet_management/doctype/vehicle_documents/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_documents/vehicle_documents.json b/csf_tz/fleet_management/doctype/vehicle_documents/vehicle_documents.json new file mode 100644 index 0000000..75dc8b2 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents/vehicle_documents.json @@ -0,0 +1,192 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-05-01 10:34:36.523614", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "options": "Vehicle Documents Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reference Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "issue_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Issue Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expire_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expire Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "attachment", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Attachment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-05-01 10:49:48.054666", + "modified_by": "info@aakvatech.com", + "module": "Fleet Management", + "name": "Vehicle Documents", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/vehicle_documents/vehicle_documents.py b/csf_tz/fleet_management/doctype/vehicle_documents/vehicle_documents.py new file mode 100644 index 0000000..238c8b5 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents/vehicle_documents.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleDocuments(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_documents_type/__init__.py b/csf_tz/fleet_management/doctype/vehicle_documents_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_documents_type/test_vehicle_documents_type.js b/csf_tz/fleet_management/doctype/vehicle_documents_type/test_vehicle_documents_type.js new file mode 100644 index 0000000..ec47346 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents_type/test_vehicle_documents_type.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Documents Type", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Documents Type + () => frappe.tests.make('Vehicle Documents Type', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_documents_type/test_vehicle_documents_type.py b/csf_tz/fleet_management/doctype/vehicle_documents_type/test_vehicle_documents_type.py new file mode 100644 index 0000000..f0e9df1 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents_type/test_vehicle_documents_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestVehicleDocumentsType(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.js b/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.js new file mode 100644 index 0000000..b3b1470 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Documents Type', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.json b/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.json new file mode 100644 index 0000000..27ff96a --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.json @@ -0,0 +1,93 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:description", + "beta": 0, + "creation": "2017-05-01 10:30:15.592754", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-06 12:33:58.675340", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Documents Type", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.py b/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.py new file mode 100644 index 0000000..6d0036b --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_documents_type/vehicle_documents_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleDocumentsType(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection/__init__.py b/csf_tz/fleet_management/doctype/vehicle_inspection/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection/test_vehicle_inspection.js b/csf_tz/fleet_management/doctype/vehicle_inspection/test_vehicle_inspection.js new file mode 100644 index 0000000..cfcf4c1 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection/test_vehicle_inspection.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Inspection", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Inspection + () => frappe.tests.make('Vehicle Inspection', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection/test_vehicle_inspection.py b/csf_tz/fleet_management/doctype/vehicle_inspection/test_vehicle_inspection.py new file mode 100644 index 0000000..ee95a5e --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection/test_vehicle_inspection.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestVehicleInspection(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.js b/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.js new file mode 100644 index 0000000..77d7c6c --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.js @@ -0,0 +1,160 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Inspection', { + + //function to load pre-entered checklist of inspection routine checklist + vehicle_type: function (frm) { + frappe.model.with_doc("Vehicle Inspection Template", frm.doc.vehicle_type, function () { + var ref_doc = frappe.get_doc("Vehicle Inspection Template", frm.doc.vehicle_type); + console.log(ref_doc); + + //for Lighting checklist + if (ref_doc.lighting_checklist_details && ref_doc.lighting_checklist_details.length > 0) { + + frm.clear_table("lighting_checklist"); + + ref_doc.lighting_checklist_details.forEach(function (row) { + var new_row = frm.add_child("lighting_checklist"); + new_row.lighting_check_item = row.vehicle_part; + }) + } + + //for brake system checklist + if (ref_doc.brake_system_checklist_details && ref_doc.brake_system_checklist_details.length > 0) { + + frm.clear_table("brake_checklist"); + + ref_doc.brake_system_checklist_details.forEach(function (row) { + var new_row = frm.add_child("brake_checklist"); + new_row.brake_system = row.vehicle_part; + }) + } + + //for Engine checklist + if (ref_doc.engine_checklist_details && ref_doc.engine_checklist_details.length > 0) { + + frm.clear_table("engine_checklist"); + + ref_doc.engine_checklist_details.forEach(function (row) { + var new_row = frm.add_child("engine_checklist"); + new_row.engine_system = row.criteria; + }) + } + + //for fuel system checklist + if (ref_doc.fuel_system_checklist_details && ref_doc.fuel_system_checklist_details.length > 0) { + + frm.clear_table("fuel_system_checklist"); + + ref_doc.fuel_system_checklist_details.forEach(function (row) { + var new_row = frm.add_child("fuel_system_checklist"); + new_row.fuel_system = row.fuel_part; + }) + } + + //for tire status and pressure + if (ref_doc.tire_checklist_details && ref_doc.tire_checklist_details.length > 0) { + + frm.clear_table("tire_checklist"); + + ref_doc.tire_checklist_details.forEach(function (row) { + var new_row = frm.add_child("tire_checklist"); + new_row.tire_position = row.tire_part; + }) + } + //for power train checklist + if (ref_doc.power_train_details && ref_doc.power_train_details.length > 0) { + + frm.clear_table("power_train_checklist"); + + ref_doc.power_train_details.forEach(function (row) { + var new_row = frm.add_child("power_train_checklist"); + new_row.power_train_checklist = row.power_train_part; + }) + } + + //for electronics checklist + if (ref_doc.electronics_details && ref_doc.electronics_details.length > 0) { + + frm.clear_table("electronics_checklist"); + + ref_doc.electronics_details.forEach(function (row) { + var new_row = frm.add_child("electronics_checklist"); + new_row.electronics_part = row.electronic_part; + }) + } + + //for electrical checklist + if (ref_doc.electrical_details && ref_doc.electrical_details.length > 0) { + + frm.clear_table("electrical_checklist"); + + ref_doc.electrical_details.forEach(function (row) { + var new_row = frm.add_child("electrical_checklist"); + new_row.electrical_part = row.electrical_part; + }) + } + + //for steering checklist + if (ref_doc.steering_details && ref_doc.steering_details.length > 0) { + + frm.clear_table("steering_checklist"); + + ref_doc.steering_details.forEach(function (row) { + var new_row = frm.add_child("steering_checklist"); + new_row.steering_part = row.steering_part; + }) + } + + //for tires checklist + if (ref_doc.tires_details && ref_doc.tires_details.length > 0) { + + frm.clear_table("tires_checklist"); + + ref_doc.tires_details.forEach(function (row) { + var new_row = frm.add_child("tires_checklist"); + new_row.criteria = row.criteria; + }) + } + + //for suspension checklist + if (ref_doc.suspension_details && ref_doc.suspension_details.length > 0) { + + frm.clear_table("suspension_checklist"); + + ref_doc.suspension_details.forEach(function (row) { + var new_row = frm.add_child("suspension_checklist"); + new_row.part = row.parts; + }) + } + + + //for air system/others checklist + if (ref_doc.air_system_details && ref_doc.air_system_details.length > 0) { + + frm.clear_table("air_system_checklist"); + + ref_doc.air_system_details.forEach(function (row) { + var new_row = frm.add_child("air_system_checklist"); + new_row.part = row.parts; + }) + } + + + + }); + frappe.after_ajax(function () { + //list of table_names_fields from Vehicle Inspection to Update Values + var field_lists = ["lighting_checklist", "brake_checklist", "engine_checklist", "fuel_system_checklist", "tire_checklist", "power_train_checklist", "electronics_checklist", "electrical_checklist", "steering_checklist", "tires_checklist", "suspension_checklist", "air_system_checklist"]; + field_lists.forEach(function (row) { + frm.refresh_field(row); + }) + + }) + }, + refresh: function (frm) { + + + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.json b/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.json new file mode 100644 index 0000000..70b4a19 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.json @@ -0,0 +1,1116 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "VI.######", + "beta": 0, + "creation": "2019-07-25 12:19:20.374769", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "driver_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Driver", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Plate No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "trailer_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trailer No", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_5", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mileage", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Mileage", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "checklist_section_break", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Routine Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Type", + "length": 0, + "no_copy": 0, + "options": "Vehicle Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_12", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lighting Checklist", + "length": 0, + "no_copy": 0, + "options": "Lighting Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_14", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Brake System Checklist", + "length": 0, + "no_copy": 0, + "options": "Brake Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_15", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "engine_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Engine Checklist", + "length": 0, + "no_copy": 0, + "options": "Engine Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_18", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fuel_system_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Fuel System Checklist", + "length": 0, + "no_copy": 0, + "options": "Fuel System Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_18", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "power_train_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Power Train Checklist", + "length": 0, + "no_copy": 0, + "options": "Power Train Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_20", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electronics_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Electronics Checklist", + "length": 0, + "no_copy": 0, + "options": "Electronics Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_22", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electrical_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Electrical Checklist", + "length": 0, + "no_copy": 0, + "options": "Electrical Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_24", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "steering_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Steering Checklist", + "length": 0, + "no_copy": 0, + "options": "Steering Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_28", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tires_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tires Checklist", + "length": 0, + "no_copy": 0, + "options": "Tires Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_30", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "suspension_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Suspension Checklist", + "length": 0, + "no_copy": 0, + "options": "Suspension Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_32", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "air_system_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Air System/Others Checklist", + "length": 0, + "no_copy": 0, + "options": "Air System Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_34", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_tires_status_and_pressure_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Tires Status and Pressure", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "image_upload", + "fieldtype": "Attach Image", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Upload Respective Vehicle Image", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_20", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tire_checklist", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tire Checklist", + "length": 0, + "no_copy": 0, + "options": "Tire Checklist", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-10-31 15:51:03.117365", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Inspection", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "trip_reference,vehicle_type,driver_name,vehicle_plate_number", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "timeline_field": "", + "title_field": "vehicle_plate_number", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.py b/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.py new file mode 100644 index 0000000..684e0fd --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection/vehicle_inspection.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleInspection(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection_template/__init__.py b/csf_tz/fleet_management/doctype/vehicle_inspection_template/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection_template/test_vehicle_inspection_template.js b/csf_tz/fleet_management/doctype/vehicle_inspection_template/test_vehicle_inspection_template.js new file mode 100644 index 0000000..5929cf9 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection_template/test_vehicle_inspection_template.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Inspection Template", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Inspection Template + () => frappe.tests.make('Vehicle Inspection Template', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection_template/test_vehicle_inspection_template.py b/csf_tz/fleet_management/doctype/vehicle_inspection_template/test_vehicle_inspection_template.py new file mode 100644 index 0000000..9fa9f81 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection_template/test_vehicle_inspection_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestVehicleInspectionTemplate(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.js b/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.js new file mode 100644 index 0000000..6bad946 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Inspection Template', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.json b/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.json new file mode 100644 index 0000000..1c931c5 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.json @@ -0,0 +1,814 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:vehicle_type", + "beta": 0, + "creation": "2019-07-25 17:10:11.308387", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Type", + "length": 0, + "no_copy": 0, + "options": "Vehicle Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lighting Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lighting_checklist_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Lighting Checklist Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_system_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Brake System Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brake_system_checklist_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Brake System Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "engine_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Engine Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "engine_checklist_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Engine Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fuel_system_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Fuel System Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fuel_system_checklist_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Fuel System Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "power_train_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Power Train Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "power_train_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Power Train Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electronics_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Electronics Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electronics_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Electronics Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electrical_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Electrical Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "electrical_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Electrical Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "steering_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Steering Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "steering_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Steering Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_18", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tires Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tires_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Tires Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "suspension_checklist", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Suspension Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "suspension_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Suspension Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_22", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Air System/Others Checklist", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "air_system_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Air System Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tire_status_and_pressure_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Tire Status and Pressure", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tire_checklist_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Tire Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-07-26 15:10:34.012666", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Inspection Template", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.py b/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.py new file mode 100644 index 0000000..b78b6fd --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_inspection_template/vehicle_inspection_template.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleInspectionTemplate(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_log/__init__.py b/csf_tz/fleet_management/doctype/vehicle_log/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_log/test_vehicle_log.js b/csf_tz/fleet_management/doctype/vehicle_log/test_vehicle_log.js new file mode 100644 index 0000000..5dbd395 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_log/test_vehicle_log.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Log", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Log + () => frappe.tests.make('Vehicle Log', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_log/test_vehicle_log.py b/csf_tz/fleet_management/doctype/vehicle_log/test_vehicle_log.py new file mode 100644 index 0000000..03772ef --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_log/test_vehicle_log.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest +from frappe.utils import nowdate,flt, cstr,random_string +# test_records = frappe.get_test_records('Vehicle Log') +class TestVehicleLog(unittest.TestCase): + def test_make_vehicle_log(self): + license_plate=random_string(10).upper() + employee_id=frappe.db.sql("""select name from `tabEmployee` order by modified desc limit 1""")[0][0] + vehicle = frappe.get_doc({ + "doctype": "Vehicle", + "license_plate": cstr(license_plate), + "make": "Maruti", + "model": "PCM", + "last_odometer":5000, + "acquisition_date":frappe.utils.nowdate(), + "location": "Mumbai", + "chassis_no": "1234ABCD", + "vehicle_value":frappe.utils.flt(500000) + }) + try: + vehicle.insert() + except frappe.DuplicateEntryError: + pass + vehicle_log = frappe.get_doc({ + "doctype": "Vehicle Log", + "license_plate": cstr(license_plate), + "employee":employee_id, + "date":frappe.utils.nowdate(), + "odometer":5010, + "fuel_qty":frappe.utils.flt(50), + "price": frappe.utils.flt(500) + }) + vehicle_log.insert() + vehicle_log.submit() \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.js b/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.js new file mode 100644 index 0000000..bc7b894 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.js @@ -0,0 +1,33 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on("Vehicle Log", { + refresh: function(frm,cdt,cdn) { + vehicle_log=frappe.model.get_doc(cdt,cdn); + if (vehicle_log.license_plate) { + frappe.call({ + method: "erpnext.hr.doctype.vehicle_log.vehicle_log.get_make_model", + args: { + license_plate: vehicle_log.license_plate + }, + callback: function(r) { + frappe.model.set_value(cdt, cdn, ("model"), r.message[0]); + frappe.model.set_value(cdt, cdn, ("make"), r.message[1]); + } + }) + } + }, + expense_claim: function(frm){ + frappe.call({ + method: "erpnext.hr.doctype.vehicle_log.vehicle_log.make_expense_claim", + args:{ + docname: frm.doc.name + }, + callback: function(r){ + var doc = frappe.model.sync(r.message); + frappe.set_route('Form', 'Expense Claim', r.message.name); + } + }) + } +}); + diff --git a/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.json b/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.json new file mode 100644 index 0000000..1667845 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.json @@ -0,0 +1,904 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2016-09-03 14:14:51.788550", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "fa fa-user", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 1, + "options": "VLOG.", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "license_plate", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "License Plate", + "length": 0, + "no_copy": 0, + "options": "Vehicle", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "employee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Employee", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "model", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Model", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "make", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Make", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "odometer_reading", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Odometer Reading", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "odometer", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Odometer", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "refuelling_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Refuelling Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "fuel_qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Fuel Qty", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "price", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Fuel Price", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_15", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supplier", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "invoice", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Invoice Ref", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "service_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Service_Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service_detail", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Service Detail", + "length": 0, + "no_copy": 0, + "options": "Vehicle Service", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_20", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.docstatus==1", + "fieldname": "expense_claim", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Make Expense Claim", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Vehicle Log", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_return_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "return_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "return_reason", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return reason", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "odometer_on_return", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Odometer Reading on Return", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_27", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "return_condition", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Condition", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-05-04 11:34:33.049918", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Log", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Fleet Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.py b/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.py new file mode 100644 index 0000000..74525b9 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_log/vehicle_log.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.utils import flt, cstr +from frappe.model.mapper import get_mapped_doc +from frappe.model.document import Document + +class VehicleLog(Document): + def validate(self): + last_odometer=frappe.db.get_value("Vehicle", self.license_plate, "last_odometer") + if flt(self.odometer) < flt(last_odometer): + frappe.throw(_("Current Odometer reading entered should be greater than initial Vehicle Odometer {0}").format(last_odometer)) + for service_detail in self.service_detail: + if (service_detail.service_item or service_detail.type or service_detail.frequency or service_detail.expense_amount): + if not (service_detail.service_item and service_detail.type and service_detail.frequency and service_detail.expense_amount): + frappe.throw(_("Service Item,Type,frequency and expense amount are required")) + + def on_submit(self): + frappe.db.sql("update `tabVehicle` set last_odometer=%s where license_plate=%s", + (self.odometer, self.license_plate)) + +@frappe.whitelist() +def get_make_model(license_plate): + vehicle=frappe.get_doc("Vehicle",license_plate) + return (vehicle.make,vehicle.model) + +@frappe.whitelist() +def make_expense_claim(docname): + def check_exp_claim_exists(): + exp_claim = frappe.db.sql("""select name from `tabExpense Claim` where vehicle_log=%s""",vehicle_log.name) + return exp_claim[0][0] if exp_claim else "" + def calc_service_exp(): + total_exp_amt=0 + exp_claim = check_exp_claim_exists() + if exp_claim: + frappe.throw(_("Expense Claim {0} already exists for the Vehicle Log").format(exp_claim)) + for serdetail in vehicle_log.service_detail: + total_exp_amt = total_exp_amt + serdetail.expense_amount + return total_exp_amt + + vehicle_log = frappe.get_doc("Vehicle Log", docname) + exp_claim = frappe.new_doc("Expense Claim") + exp_claim.employee=vehicle_log.employee + exp_claim.vehicle_log=vehicle_log.name + exp_claim.remark=_("Expense Claim for Vehicle Log {0}").format(vehicle_log.name) + fuel_price=vehicle_log.price + total_claim_amt=calc_service_exp() + fuel_price + exp_claim.append("expenses",{ + "expense_date":vehicle_log.date, + "description":_("Vehicle Expenses"), + "claim_amount":total_claim_amt + }) + return exp_claim.as_dict() diff --git a/csf_tz/fleet_management/doctype/vehicle_routine_checklist/__init__.py b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_routine_checklist/test_vehicle_routine_checklist.js b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/test_vehicle_routine_checklist.js new file mode 100644 index 0000000..1d14e19 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/test_vehicle_routine_checklist.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Routine Checklist", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Routine Checklist + () => frappe.tests.make('Vehicle Routine Checklist', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_routine_checklist/test_vehicle_routine_checklist.py b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/test_vehicle_routine_checklist.py new file mode 100644 index 0000000..3143dbd --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/test_vehicle_routine_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestVehicleRoutineChecklist(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.js b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.js new file mode 100644 index 0000000..b2bdaff --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Routine Checklist', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.json b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.json new file mode 100644 index 0000000..631e7fd --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.json @@ -0,0 +1,91 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-07-25 15:33:20.688701", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "data_1", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-07-25 15:33:20.688701", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Routine Checklist", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.py b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.py new file mode 100644 index 0000000..624a741 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_routine_checklist/vehicle_routine_checklist.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleRoutineChecklist(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_service/__init__.py b/csf_tz/fleet_management/doctype/vehicle_service/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_service/vehicle_service.json b/csf_tz/fleet_management/doctype/vehicle_service/vehicle_service.json new file mode 100644 index 0000000..d034e1e --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_service/vehicle_service.json @@ -0,0 +1,153 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2016-09-03 19:20:14.561962", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service_item", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Service Item", + "length": 0, + "no_copy": 0, + "options": "\nBrake Oil\nBrake Pad\nClutch Plate\nEngine Oil\nOil Change\nWheels", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Type", + "length": 0, + "no_copy": 0, + "options": "\nInspection\nService\nChange", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "frequency", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Frequency", + "length": 0, + "no_copy": 0, + "options": "\nMileage\nMonthly\nQuarterly\nHalf Yearly\nYearly", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expense_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Expense", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-01-09 11:10:29.476907", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Service", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/vehicle_service/vehicle_service.py b/csf_tz/fleet_management/doctype/vehicle_service/vehicle_service.py new file mode 100644 index 0000000..a63ff6e --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_service/vehicle_service.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleService(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/__init__.py b/csf_tz/fleet_management/doctype/vehicle_trip/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/test_vehicle_trip.js b/csf_tz/fleet_management/doctype/vehicle_trip/test_vehicle_trip.js new file mode 100644 index 0000000..ec4675c --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip/test_vehicle_trip.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Trip", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Trip + () => frappe.tests.make('Vehicle Trip', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/test_vehicle_trip.py b/csf_tz/fleet_management/doctype/vehicle_trip/test_vehicle_trip.py new file mode 100644 index 0000000..9d5dcde --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip/test_vehicle_trip.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Vehicle Trip') + +class TestVehicleTrip(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.js b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.js new file mode 100644 index 0000000..b778d01 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.js @@ -0,0 +1,1064 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt + + +//Global variable for delivery note print +var main_parenttype = '', + main_parent_frm = null; +var return_parenttype = '', + return_parent_frm = null; +var first_reload = true; +var return_cancelled = false; +var return_assignment = null; +var main_loading_date = null; +var return_loading_date = null; + +frappe.ui.form.on('Vehicle Trip', { + //added function for the form to load template + onload: function (frm) { + //frm.events.open_close_buttons(frm); + + + if (first_reload == false) { + return; + } + //Load data from the linked assignment + //For main trip + frappe.model.with_doc(frm.doc.reference_doctype, frm.doc.reference_docname, function () { + var reference_doc = frappe.get_doc(frm.doc.reference_doctype, frm.doc.reference_docname); + + //File number + frm.set_value('main_file_number', reference_doc.file_number); + + //Vehicle, driver and trailer assignment + frm.set_value('transporter_type', reference_doc.transporter_type); + frm.set_value('main_route', reference_doc.route); + if (reference_doc.transporter_type == 'Sub-Contractor' || reference_doc.transporter_type == "Self Drive") { + if (reference_doc.transporter_type == "Sub-Contractor") { + frm.set_value('sub_contractor', reference_doc.sub_contractor); + frm.set_value('trailer_plate_number', reference_doc.trailer_plate_number); + } + frm.set_value('vehicle_plate_number', reference_doc.vehicle_plate_number); + frm.set_value('driver_name', reference_doc.driver_name); + frm.set_value('passport_number', reference_doc.passport_number); + frm.toggle_display('vehicle', false); + frm.toggle_display('driver', false); + frm.toggle_display('trailer', false); + } else { + frm.set_value('vehicle', reference_doc.assigned_vehicle); + frm.set_value('trailer', reference_doc.assigned_trailer); + frm.set_value('driver', reference_doc.assigned_driver); + frm.set_value('vehicle_plate_number', reference_doc.vehicle_plate_number); + frm.set_value('trailer_plate_number', reference_doc.trailer_plate_number); + frm.set_value('driver_name', reference_doc.driver_name); + frm.set_value('passport_number', reference_doc.passport_number); + frm.toggle_display('vehicle', true); + frm.toggle_display('driver', true); + frm.toggle_display('trailer', true); + frm.toggle_display('sub_contractor', false); + } + + //If phone number is not entered + if (!frm.doc.phone_number) { + frm.set_value('phone_number', reference_doc.driver_contact); + } + + //If driving licence is not entered + if (!frm.doc.driving_licence_no) { + frm.set_value('driving_licence_no', reference_doc.driver_licence); + } + + + //Temp solution for import reference files + var is_import = false; + var import_reference = null; + frappe.model.with_doc('Files', reference_doc.file_number, function(){ + var reference_file = frappe.get_doc('Files', reference_doc.file_number); + if (reference_file.requested_service == 'Importation-Transit' || reference_file.requested_service == 'Importation-Local'){ + is_import = true; + import_reference = reference_file.import_reference; + } + }) + + //Customer & cargo details from import module + if (is_import) { + frm.set_value('main_cargo_type', 'Container'); + frappe.model.with_doc('Import', import_reference, function () { + var reference_parent = frappe.get_doc(reference_doc.parenttype, reference_doc.parent); + //Set the global variables + main_parenttype = "Import"; + main_parent_frm = reference_parent; + + frm.set_value('main_customer', reference_parent.customer); + frm.set_value('main_consignee', reference_parent.consignee); + frm.set_value('main_shipper', reference_parent.shipper); + frm.set_value("main_shipment_ref_no", reference_parent.bl_number); + frm.set_value("main_special_instructions_transporter", reference_parent.special_instructions_to_transporter); + + //Set the file number manually + frm.set_value('main_file_number', reference_parent.reference_file_number); + + //Cargo Location, destination + frm.set_value('main_cargo_location_country', 'Tanzania'); + frm.set_value('main_cargo_location_city', reference_parent.port_of_discharge); + frm.set_value('main_cargo_destination_country', reference_parent.cargo_destination_country); + frm.set_value('main_cargo_destination_city', reference_parent.cargo_destination_city); + if (!reference_parent.icd) { + frm.set_value('main_loading_point', reference_parent.terminal); + } else { + frm.set_value('main_loading_point', reference_parent.icd); + } + frm.set_value('main_offloading_point', reference_parent.cargo_destination); + + //Load border clearing agents + frm.set_value('main_border1_clearing', reference_parent.clearing_agent_border_1); + frm.set_value('main_border2_clearing', reference_parent.clearing_agent_border_2); + frm.set_value('main_border3_clearing', reference_parent.clearing_agent_border_3); + + //Load cargo Information + frm.set_value('main_cargo_category', reference_parent.cargo); + frm.set_value('main_goods_description', reference_parent.cargo_description); + reference_parent.cargo_information.forEach(function (row) { + if(row.name == reference_doc.cargo) + { + var new_row = null + //If there is already cargo data, update it, else insert new row + if (frm.doc.main_cargo.length > 0) { + new_row = frm.doc.main_cargo[0]; + } else { + new_row = frm.add_child('main_cargo'); + } + new_row.container_number = row.container_number; + new_row.container_size = row.container_size; + new_row.seal_number = row.seal_number; + new_row.cargo_status = row.cargo_status; + new_row.no_of_packages = row.no_of_packages; + new_row.goods_description = row.goods_description; + new_row.gross_weight = row.gross_weight; + new_row.net_weight = row.net_weight; + new_row.tare_weight = row.tare_weight; + frm.refresh_field('main_cargo'); + } + }); + }); + + } else if (reference_doc.parenttype == "Export") //Customer & cargo details from export + { + frappe.model.with_doc(reference_doc.parenttype, reference_doc.parent, function () { + var reference_parent = frappe.get_doc(reference_doc.parenttype, reference_doc.parent); + //Set the global variables + main_parenttype = "Export"; + main_parent_frm = reference_parent; + + frm.set_value('main_customer', reference_parent.client); + }); + } else if (reference_doc.parenttype == "Transport Request") //Customer & cargo details from transport request + { + frappe.model.with_doc(reference_doc.parenttype, reference_doc.parent, function () { + var reference_parent = frappe.get_doc(reference_doc.parenttype, reference_doc.parent); + //Set the global variables + main_parenttype = "Transport Request"; + main_parent_frm = reference_parent; + + frm.set_value('main_customer', reference_parent.customer); + if (reference_parent.consignee) { + frm.set_value('main_consignee', reference_parent.consignee); + } + if (reference_parent.shipper) { + frm.set_value('main_shipper', reference_parent.shipper); + } + frm.set_value("main_shipment_ref_no", reference_parent.file_number); + + + frm.set_value('main_cargo_type', reference_parent.cargo_type); + frm.set_value('main_cargo_category', reference_parent.goods_description); + frm.set_value('main_goods_description', reference_parent.cargo_description); + frm.set_value("main_special_instructions_transporter", reference_parent.special_instructions_to_transporter); + + //Cargo Location, destination and route + frm.set_value('main_cargo_location_country', reference_parent.cargo_location_country); + frm.set_value('main_cargo_location_city', reference_parent.cargo_location_city); + frm.set_value('main_cargo_destination_country', reference_parent.cargo_destination_country); + frm.set_value('main_cargo_destination_city', reference_parent.cargo_destination_city); + + //Load border clearing agents + frm.set_value('main_border1_clearing', reference_parent.border1_clearing_agent); + frm.set_value('main_border2_clearing', reference_parent.border2_clearing_agent); + frm.set_value('main_border3_clearing', reference_parent.border3_clearing_agent); + + + if (reference_parent.cargo_type == "Container") { + reference_parent.cargo.forEach(function (row) { + if (row.container_number == reference_doc.container_number) { + var new_row = null + //If there is already cargo data, update it, else insert new row + if (frm.doc.main_cargo.length > 0) { + new_row = frm.doc.main_cargo[0]; + } else { + new_row = frm.add_child('main_cargo'); + } + new_row.container_number = row.container_number; + new_row.container_size = row.container_size; + new_row.seal_number = row.seal_number; + new_row.cargo_status = row.cargo_status; + new_row.no_of_packages = row.no_of_packages; + new_row.goods_description = row.goods_description; + new_row.gross_weight = row.gross_weight; + new_row.net_weight = row.net_weight; + new_row.tare_weight = row.tare_weight; + frm.refresh_field('main_cargo'); + } + }); + } else { + frm.set_value('main_amount', reference_doc.amount); + frm.set_value('main_unit', reference_doc.units); + } + }); + } + + //For route steps + if (frm.doc.main_route && frm.doc.main_route_steps.length == 0) { + frm.events.load_route_details(frm); + } + }); + + /* + * + * For return trip + * + */ + if (frm.doc.return_reference_doctype && frm.doc.return_reference_docname) { + frappe.model.with_doc(frm.doc.return_reference_doctype, frm.doc.return_reference_docname, function () { + var reference_doc = frappe.get_doc(frm.doc.return_reference_doctype, frm.doc.return_reference_docname); + console.log(reference_doc); + + //File number + frm.set_value('return_file_number', reference_doc.file_number); + + //Return route + frm.set_value('return_route', reference_doc.route); + //Customer details from import module + if (reference_doc.parenttype == "Import") { + frm.set_value('return_cargo_type', 'Container'); + frappe.model.with_doc(reference_doc.parenttype, reference_doc.parent, function () { + var reference_parent = frappe.get_doc(reference_doc.parenttype, reference_doc.parent); + //Set the global variables + return_parenttype = "Import"; + return_parent_frm = reference_parent; + + frm.set_value('return_customer', reference_parent.customer); + frm.set_value('return_consignee', reference_parent.consignee); + frm.set_value('return_shipper', reference_parent.shipper); + frm.set_value("return_shipment_ref_no", reference_parent.bl_number); + + //Set the file number manually + frm.set_value('return_file_number', reference_parent.file_number); + + //Cargo Location, destination and route + frm.set_value('return_cargo_location_country', 'Tanzania'); + frm.set_value('return_cargo_location_city', reference_parent.port_of_discharge); + frm.set_value('return_cargo_destination_country', reference_parent.cargo_destination_country); + frm.set_value('return_cargo_destination_city', reference_parent.cargo_destination_city); + + if (!reference_parent.icd) { + frm.set_value('return_loading_point', reference_parent.terminal); + } else { + frm.set_value('return_loading_point', reference_parent.icd); + } + frm.set_value('return_offloading_point', reference_parent.cargo_destination); + frm.set_value('return_route', reference_doc.route); + frm.set_value("return_special_instructions_transporter", reference_parent.special_instructions_to_transporter); + + //Load border clearing agents + frm.set_value('return_border1_clearing', reference_parent.clearing_agent_border_1); + frm.set_value('return_border2_clearing', reference_parent.clearing_agent_border_2); + frm.set_value('return_border3_clearing', reference_parent.clearing_agent_border_3); + + //Load cargo Information + reference_parent.cargo_information.forEach(function (row) { + if (row.name == reference_doc.cargo) { + var new_row = null + //If there is already cargo data, update it, else insert new row + if (frm.doc.return_cargo.length > 0) { + new_row = frm.doc.return_cargo[0]; + } else { + new_row = frm.add_child('return_cargo'); + } + new_row.container_number = row.container_number; + new_row.container_size = row.container_size; + new_row.seal_number = row.seal_number; + new_row.cargo_status = row.cargo_status; + new_row.no_of_packages = row.no_of_packages; + new_row.goods_description = row.goods_description; + new_row.gross_weight = row.gross_weight; + new_row.net_weight = row.net_weight; + new_row.tare_weight = row.tare_weight; + frm.refresh_field('return_cargo'); + } + }); + }); + + } else if (reference_doc.parenttype == "Export") //Customer details from export + { + frappe.model.with_doc(reference_doc.parenttype, reference_doc.parent, function () { + var reference_parent = frappe.get_doc(reference_doc.parenttype, reference_doc.parent); + //Set the global variables + return_parenttype = "Export"; + return_parent_frm = reference_parent; + + frm.set_value('return_customer', reference_parent.client); + }); + } else if (reference_doc.parenttype == "Transport Request") //Customer & cargo details from transport request + { + frappe.model.with_doc(reference_doc.parenttype, reference_doc.parent, function () { + var reference_parent = frappe.get_doc(reference_doc.parenttype, reference_doc.parent); + //Set the global variables + return_parenttype = "Transport Request"; + return_parent_frm = reference_parent; + + frm.set_value('return_customer', reference_parent.customer); + if (reference_parent.consignee) { + frm.set_value('return_consignee', reference_parent.consignee); + } + if (reference_parent.shipper) { + frm.set_value('return_shipper', reference_parent.shipper); + } + frm.set_value("return_shipment_ref_no", reference_parent.file_number); + + frm.set_value('return_cargo_type', reference_parent.cargo_type); + frm.set_value('return_cargo_category', reference_parent.goods_description); + frm.set_value('return_goods_description', reference_parent.cargo_description); + frm.set_value("return_special_instructions_transporter", reference_parent.special_instructions_to_transporter); + + //Cargo Location, destination and route + frm.set_value('return_cargo_location_country', reference_parent.cargo_location_country); + frm.set_value('return_cargo_location_city', reference_parent.cargo_location_city); + frm.set_value('return_cargo_destination_country', reference_parent.cargo_destination_country); + frm.set_value('return_cargo_destination_city', reference_parent.cargo_destination_city); + + //Load border clearing agents + frm.set_value('return_border1_clearing', reference_parent.border1_clearing_agent); + frm.set_value('return_border2_clearing', reference_parent.border2_clearing_agent); + frm.set_value('return_border3_clearing', reference_parent.border3_clearing_agent); + + + if (reference_parent.cargo_type == "Container") { + reference_parent.cargo.forEach(function (row) { + if (row.container_number == reference_doc.container_number) { + var new_row = null + //If there is already cargo data, update it, else insert new row + if (frm.doc.main_cargo.length > 0) { + new_row = frm.doc.main_cargo[0]; + } else { + new_row = frm.add_child('return_cargo'); + } + new_row.container_number = row.container_number; + new_row.container_size = row.container_size; + new_row.seal_number = row.seal_number; + new_row.cargo_status = row.cargo_status; + new_row.no_of_packages = row.no_of_packages; + new_row.goods_description = row.goods_description; + new_row.gross_weight = row.gross_weight; + new_row.net_weight = row.net_weight; + new_row.tare_weight = row.tare_weight; + frm.refresh_field('return_cargo'); + } + }); + } else { + frm.set_value('return_amount', reference_doc.amount); + frm.set_value('return_unit', reference_doc.units); + } + }); + } + + //For route steps + if (frm.doc.return_route && frm.doc.return_route_steps.length == 0) { + frm.events.load_return_route_steps(frm); + } + }); + } + + //Main loading date for GPS update + if (frm.doc.main_route_steps && frm.doc.main_route_steps.length > 0) { + frm.doc.main_route_steps.forEach(function (row) { + if (row.location_type.toUpperCase() == 'LOADING POINT') { + main_loading_date = locals['Route Steps Table'][row.name].loading_date; + } + }) + } + + //Return loading date for GPS update + if (frm.doc.return_route_steps && frm.doc.return_route_steps.length > 0) { + frm.doc.return_route_steps.forEach(function (row) { + if (row.location_type.toUpperCase() == 'LOADING POINT') { + return_loading_date = locals['Route Steps Table'][row.name].loading_date; + } + }) + } + + + first_reload = false; + + frappe.after_ajax(function () { + frm.events.render_address_and_contact(frm); + frm.save_or_update(); + }); + }, + + + + + + open_close_buttons: function (frm) { + if (frm.doc.status == "Main Trip Offloaded" || frm.doc.status == "Return Trip Offloaded") { + frm.add_custom_button(__("Close"), function () { + if (frm.events.validate_close(frm)) { + frm.set_value("status", "Closed"); + frm.save(); + } + }, "fa fa-check", "btn-success"); + } + /*if (!frm.doc.__islocal) { + //if(frm.doc.status=="Open") { + frm.add_custom_button(__("Close"), function() { + if(frm.events.validate_close(frm)) + { + frm.set_value("status", "Closed"); + frm.save(); + } + }, "fa fa-check", "btn-success"); + + */ + /* //Cancel Button + frm.add_custom_button(__("Cancel Export"), function() { + frm.set_value("status", "Cancelled"); + frm.save(); + frm.events.booking_cancellation(frm); + //frm.refresh_fields(); + console.log("its cancelled"); + }, "fa fa-check", "btn-success");*/ + /* + //} + */ + /* else { + frm.add_custom_button(__("Re-open"), function() { + frm.set_value("status", "Open"); + + // clear table for container + // frm.clear_table("cargo_information"); + // frm.refresh_fields('cargo_information'); + + frm.save(); + + }, null, "btn-default"); + }*/ + /* + }*/ + }, + + + refresh: function (frm) { + //Show or hide return trip section + frm.events.show_hide_sections(frm); + + //close trip + frm.events.open_close_buttons(frm); + + + + //call function for return or main trip offloaded + if (cur_frm.doc.status == "Main Trip Offloaded" || cur_frm.doc.status == "Return Trip Offloaded") { + cur_frm.add_custom_button(__('Vehicle Inspection'), function () { + frm.events.make_vehicle_inspection(frm) + }, __("Make")); + } + + //Button for cancelling return trip + if (frm.doc.return_reference_doctype && frm.doc.return_reference_docname) { + frm.add_custom_button(__("Cancel Return Trip"), function () { + frm.events.cancel_return_trip(frm); + }) + } + + frm.events.location_buttons(frm); + + //Check if there are unsent fund requests + frm.events.new_fund_request(frm); + frappe.after_ajax(function () { + console.log(cur_frm); + }) + }, + + show_hide_sections: function (frm) { + frm.toggle_display(['section_return_trip', 'section_return_details', 'section_return_cargo', 'section_return_details', 'section_return_route'], (frm.doc.return_reference_doctype && frm.doc.return_reference_docname)); + frm.toggle_display(['section_return_delivery_note_information', 'section_return_requested_funds', 'section_return_expenses', 'section_return_fuel_request'], (frm.doc.return_reference_doctype && frm.doc.return_reference_docname)); + frm.toggle_display('section_main_expenses', (frm.doc.main_requested_funds && frm.doc.main_requested_funds.length > 0)); + frm.toggle_display('section_return_expenses', (frm.doc.return_requested_funds && frm.doc.return_requested_funds.length > 0)) + frm.toggle_display(['main_amount', 'main_unit', 'main_loose_no_of_packages', 'main_loose_gross_weight', 'main_loose_net_weight'], ('Loose Cargo' == frm.doc.main_cargo_type)); + frm.toggle_display('section_main_container_cargo', ('Container' == frm.doc.main_cargo_type)); + frm.toggle_display(['return_amount', 'return_unit', 'return_loose_no_of_packages', 'return_loose_gross_weight', 'return_loose_net_weight'], ('Loose Cargo' == frm.doc.return_cargo_type)); + frm.toggle_display('section_return_cargo', ('Container' == frm.doc.return_cargo_type)); + }, + + validate_close: function (frm) { + var excluded_fields = ['return_requested_funds', 'main_requested_funds', 'attachments', 'main_reporting_status', 'subtrips', 'return_reporting_status', 'main_location_update', 'return_location_update', 'return_expenses', 'main_expenses', 'main_fuel_request', 'main_cargo', 'main_customer_address_html', 'main_shipper_address_html', 'main_consignee_address_html']; + + if (frm.doc.status == 'Main Trip Offloaded') { + excluded_fields.push('return_cargo_type', + 'return_cargo_category', + 'return_goods_description', + 'return_amount', 'return_unit', + 'return_loose_no_of_packages', + 'return_loose_gross_weight', + 'return_loose_net_weight', + 'return_customer_address_html', + 'return_cargo', 'return_shipper', + 'return_shipper_address_html', + 'return_consignee', + 'return_consignee_address_html', + 'return_cargo_location_country', + 'return_trip_fuel_request', + 'return_start_date', + 'return_customer', + 'return_fuel_request', + 'return_route_steps'); + } else if (frm.doc.status == 'Return Trip Offloaded') { + excluded_fields.push() + } + if (frm.doc.main_cargo_type && frm.doc.main_cargo_type == 'Container') + + { + excluded_fields.push('main_amount', 'main_unit', 'main_loose_no_of_packages', 'main_loose_gross_weight', 'main_loose_net_weight'); + } else if (frm.doc.main_cargo_type && frm.doc.main_cargo_type == 'Loose Cargo') { + //excluded_fields.push(""); + } + if (frm.doc.transporter_type == 'Sub-Contractor') { + excluded_fields.push('driver', 'trailer', 'vehicle'); + } else if (frm.doc.transporter_type == 'Bravo') { + excluded_fields.push('passport_number'); + } + + var excluded_field_type = ["Table", "Section Break", "Column Break"] + var error_fields = []; + frm.meta.fields.forEach(function (field) { + if (!(excluded_field_type.indexOf(field.fieldtype) > -1) && !(excluded_fields.indexOf(field.fieldname) > -1) && !(field.fieldname in frm.doc)) { + error_fields.push(field.label); + return false; + } + + if (field.fieldtype == "Table" && !(excluded_fields.indexOf(field.fieldname) > -1) && frm.doc[field.fieldname].length == 0) { + error_fields.push(field.label); + return false; + } + }) + + if (error_fields.length > 0) { + var error_msg = "Mandatory fields required before closing
    "; + error_fields.forEach(function (error_field) { + error_msg = error_msg + "
  • " + error_field + "
  • "; + }) + error_msg = error_msg + "
"; + frappe.msgprint(error_msg, "Missing Fields"); + return false; + } else { + return true; + } + }, + + + + + + show_on_map: function (frm) { + if (frm.doc.main_location_update && frm.doc.main_location_update.length > 0) { + frm.doc.main_location_update.forEach(function (row) { + if (row.latitude && row.longitude) { + var html = 'View on Map'; + row.view_on_map = html; + } + }) + } + frm.refresh_field('main_location_update'); + }, + + render_address_and_contact: function (frm) { + // render address + if (frm.fields_dict['main_customer_address_html'] && frm.doc.__onload && "main_addr_list" in frm.doc.__onload) { + $(frm.fields_dict['main_customer_address_html'].wrapper) + .html(frappe.render_template("address_list", + cur_frm.doc.__onload.main_addr_list)) + .find(".btn-address").hide(); + + //For delivery note printing + if (frm.doc.__onload.main_addr_list.addr_list && frm.doc.__onload.main_addr_list.addr_list.length > 0) { + frm.set_value('main_address_display', frm.doc.__onload.main_addr_list.addr_list[0].display); + } + } + + if (frm.fields_dict['main_consignee_address_html'] && frm.doc.__onload && "main_consignee_addr_list" in frm.doc.__onload) { + + $(frm.fields_dict['main_consignee_address_html'].wrapper) + .html(frappe.render_template("address_list", + cur_frm.doc.__onload.main_consignee_addr_list)) + .find(".btn-address").hide(); + + //For delivery note printing + if (frm.doc.__onload.main_consignee_addr_list.addr_list && frm.doc.__onload.main_consignee_addr_list.addr_list.length > 0) { + frm.set_value('main_consignee_display', frm.doc.__onload.main_consignee_addr_list.addr_list[0].display); + } + } + + if (frm.fields_dict['main_shipper_address_html'] && frm.doc.__onload && "main_shipper_addr_list" in frm.doc.__onload) { + $(frm.fields_dict['main_shipper_address_html'].wrapper) + .html(frappe.render_template("address_list", + cur_frm.doc.__onload.main_shipper_addr_list)) + .find(".btn-address").hide(); + + //For delivery note printing + if (frm.doc.__onload.main_shipper_addr_list.addr_list && frm.doc.__onload.main_shipper_addr_list.addr_list.length > 0) { + frm.set_value('main_shipper_display', frm.doc.__onload.main_shipper_addr_list.addr_list[0].display); + } + } + + //For return + if (frm.fields_dict['return_customer_address_html'] && frm.doc.__onload && "return_addr_list" in frm.doc.__onload) { + $(frm.fields_dict['return_customer_address_html'].wrapper) + .html(frappe.render_template("address_list", + cur_frm.doc.__onload.return_addr_list)) + .find(".btn-address").hide(); + + //For delivery note printing + frm.set_value('return_address_display', frm.doc.__onload.return_addr_list.addr_list[0].display); + } + + if (frm.fields_dict['return_consignee_address_html'] && frm.doc.__onload && "return_consignee_addr_list" in frm.doc.__onload) { + + $(frm.fields_dict['return_consignee_address_html'].wrapper) + .html(frappe.render_template("address_list", + cur_frm.doc.__onload.return_consignee_addr_list)) + .find(".btn-address").hide(); + + //For delivery note printing + if (frm.doc.__onload.return_consignee_addr_list.addr_list && frm.doc.__onload.return_consignee_addr_list.addr_list.length > 0) { + frm.set_value('return_consignee_display', frm.doc.__onload.return_consignee_addr_list.addr_list[0].display); + } + } + + if (frm.fields_dict['return_shipper_address_html'] && frm.doc.__onload && "return_shipper_addr_list" in frm.doc.__onload) { + $(frm.fields_dict['return_shipper_address_html'].wrapper) + .html(frappe.render_template("address_list", + cur_frm.doc.__onload.return_shipper_addr_list)) + .find(".btn-address").hide(); + + //For delivery note printing + if (frm.doc.__onload.return_shipper_addr_list.addr_list && frm.doc.__onload.return_shipper_addr_list.addr_list.length > 0) { + frm.set_value('return_shipper_display', frm.doc.__onload.return_shipper_addr_list.addr_list[0].display); + } + } + }, + + location_test: function (frm) { + frappe.call({ + method: 'fleet_management.fleet_management.gps_connector.get_last_location', + callback: function (data) { + console.log(data); + } + }) + }, + + cancel_return_trip: function (frm) { + frappe.confirm( + "Are you sure you want to cancel the return trip?", + function () { + //Check that there are no approved funds + frm.doc.return_requested_funds.forEach(function (row) { + if (row.request_status == 'Approved') { + frappe.throw("Cannot cancel return trip with Approved funds."); + } + }) + return_cancelled = frm.doc.return_reference_docname; + frm.meta.fields.forEach(function (field) { + if (!(['Section', 'Column Break', 'Table'].indexOf(field.fieldtype) > -1) && field.fieldname.startsWith('return')) { + frm.set_value(field.fieldname, ''); + if (frm.doc[field.fieldname]) { + delete frm.doc[field.fieldname] + } + } else if (field.fieldtype == 'Table') { + frm.clear_table(field.fieldtype && field.fieldname.startsWith('return')); + } + }) + frm.set_value('status', 'Main Trip Offloaded'); + frm.set_value('hidden_status', 3); + frappe.after_ajax(function () { + frm.save_or_update(); + }) + }, + function () { + //If no + } + ); + }, + + main_cargo_type: function (frm) { + frm.events.show_hide_sections(frm); + }, + + return_cargo_type: function (frm) { + frm.events.show_hide_sections(frm); + }, + + main_route: function (frm) { + if (frm.doc.main_route) { + frm.events.load_route_details(frm); + } + }, + + return_route: function (frm) { + if (frm.doc.return_route && frm.doc.return_route != "") { + frm.events.load_return_route_steps(frm); + } + }, + + load_route_details: function (frm) { + frappe.model.with_doc('Trip Route', frm.doc.main_route, function (frm) { + var reference_route = frappe.model.get_doc('Trip Route', cur_frm.doc.main_route); + cur_frm.clear_table('main_route_steps'); + reference_route.trip_steps.forEach(function (row) { + var new_row = cur_frm.add_child('main_route_steps'); + new_row.location = row.location; + new_row.location_type = row.location_type; + }); + + //For expenses + if (cur_frm.doc.main_requested_funds && cur_frm.doc.main_requested_funds.length == 0) { + if (reference_route.fixed_expenses.length > 0) { + reference_route.fixed_expenses.forEach(function (row) { + var aday = new Date(); + var new_row = cur_frm.add_child('main_requested_funds'); + new_row.request_date = aday.toISOString().split('T')[0]; + new_row.request_amount = row.amount; + new_row.request_currency = row.currency; + new_row.request_description = row.expense; + new_row.request_status = 'Pre-Approved'; + }); + } + } + + cur_frm.refresh_field('main_requested_funds'); + cur_frm.refresh_field('main_route_steps'); + }); + }, + + load_return_route_steps: function (frm) { + frappe.model.with_doc('Trip Route', frm.doc.return_route, function (frm) { + var reference_route = frappe.model.get_doc('Trip Route', cur_frm.doc.return_route); + cur_frm.clear_table('return_route_steps'); + reference_route.trip_steps.forEach(function (row) { + var new_row = cur_frm.add_child('return_route_steps'); + new_row.location = row.location; + new_row.location_type = row.location_type; + }); + cur_frm.refresh_field('return_route_steps'); + }); + }, + + route_steps_options: function (frm, cdt, cdn) { + //Processed row + var row = frm.fields_dict['main_route_steps'].grid.grid_rows_by_docname[cdn]; + if (!row) //If its return route table + { + row = frm.fields_dict['return_route_steps'].grid.grid_rows_by_docname[cdn]; + } + + + //Get trip location type options + frappe.model.with_doc('Trip Location Type', row.doc.location_type, function (frm) { + var reference = frappe.model.get_doc('Trip Location Type', row.doc.location_type); + row.toggle_display("border_details", row.doc.location_type == 'Border'); + row.toggle_editable('arrival_date', true); + row.toggle_editable('departure_date', (reference.departure_date == 1)); + row.toggle_editable('loading_date', (reference.loading_date == 1)); + row.toggle_editable('offloading_date', (reference.offloading_date == 1)); + row.toggle_editable('border_details', (reference.border_details == 1)); + + /*row.toggle_editable('documents_from_driver', (reference.documents_from_driver == 1)); + row.toggle_editable('doc_submitted_to_agent', (reference.doc_submitted_to_agent == 1)); + row.toggle_editable('doc_received_by', (reference.doc_received_by == 1)); + row.toggle_editable('crossing_time', (reference.crossing_time == 1));*/ + row.refresh(); + }); + }, + + //Load delivery note template + load_delivery_note_template: function (frm) { + frappe.call({ + method: 'frappe.client.get_value', + args: { + 'doctype': 'Delivery Note Template', + 'filters': { + 'name': 'Delivery Note Template' + }, + 'fieldname': ['delivery_note_design'] + }, + callback: function (data) { + frm.doc.delivery_note_template = data.message.delivery_note_design; + } + }); + }, + + //For requesting funds + new_fund_request: function (frm) { + //For main trip + var new_main_request = false + if (frm.doc.main_requested_funds && frm.doc.main_requested_funds.length > 0) { + frm.doc.main_requested_funds.forEach(function (row) { + if (row.request_status == "open" || (row.request_status == "Pre-Approved" && row.request_hidden_status != 'Sent')) { + new_main_request = true + } + }) + if (new_main_request == true) { + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.request_funds", + args: { + reference_doctype: "Vehicle Trip", + reference_docname: cur_frm.doc.name, + company: cur_frm.doc.company + }, + callback: function (data) { + console.log(data); + first_reload = false; + //frm.reload_doc(); + } + }) + } + } + + //For return trip + var new_return_request = false + if (frm.doc.return_requested_funds && frm.doc.return_requested_funds.length > 0) { + frm.doc.return_requested_funds.forEach(function (row) { + if (row.request_status == "open" || (row.request_status == "Pre-Approved" && row.request_hidden_status != 'Sent')) { + new_return_request = true + } + }) + if (new_return_request == true) { + frappe.call({ + method: "csf_tz.after_sales_services.doctype.requested_payments.requested_payments.request_funds", + args: { + reference_doctype: "Vehicle Trip", + reference_docname: cur_frm.doc.name, + company: cur_frm.doc.company + }, + callback: function (data) { + console.log(data); + first_reload = false; + //frm.reload_doc(); + } + }) + } + } + }, + + after_save: function (frm) { + var to_save = false; + var vehicle_status = null; + var vehicle_hidden_status = null; + var offloaded = false; + first_reload = false; + //If return trip has been cancelled + if (return_cancelled) { + frappe.call({ + method: 'fleet_management.fleet_management.doctype.transport_assignment.transport_assignment.change_assignment_status', + args: { + assignment_docname: return_cancelled + }, + freeze: true, + callback: function (data) { + console.log('Assignemnt Cancelled'); + } + }); + } + + //Check if main trip offloaded + if (frm.doc.main_route_steps && frm.doc.main_route_steps.length > 0) { + frm.doc.main_route_steps.forEach(function (row) { + if (row.offloading_date != null && cur_frm.doc.hidden_status != null && cur_frm.doc.hidden_status < 3) //Status above 3 means either offloaded or on return trip + { + //add here + offloaded = true; + cur_frm.set_value('hidden_status', 3); + cur_frm.set_value('status', 'Main Trip Offloaded'); + vehicle_status = 'En Route'; + vehicle_hidden_status = 3; + to_save = true; + console.log(frm); + } + }); + } + + //Check if return trip offloaded + if (frm.doc.return_route_steps && frm.doc.return_route_steps.length > 0) { + frm.doc.return_route_steps.forEach(function (row) { + if (row.offloading_date != null && cur_frm.doc.hidden_status != null && cur_frm.doc.hidden_status < 5) //Status above 4 means either offloaded or trip closed + { + offloaded = true; + cur_frm.set_value('hidden_status', 5); + cur_frm.set_value('status', 'Return Trip Offloaded'); + vehicle_status = 'En Route'; + vehicle_hidden_status = 5; + to_save = true; + } + }); + } + + if (to_save) { + //Update vehicle status if is not subcontractor vehicle + if (['Sub-Contractor', 'Self Drive'].indexOf(frm.doc.transporter_type) == -1) { + frappe.call({ + method: 'fleet_management.fleet_management.doctype.vehicle.vehicle.change_status', + args: { + 'vehicle': cur_frm.doc.vehicle, + 'status': vehicle_status, + 'hiden_status': vehicle_hidden_status + }, + callback: function (data) { + console.log(data.message) + } + }); + } + + //Save document + frappe.after_ajax(function () { + frm.save_or_update(); + }); + } + + //Check if main loading date changed + if (['Sub-Contractor', 'Self Drive'].indexOf(frm.doc.transporter_type) == -1 && (frm.doc.main_route_steps && frm.doc.main_route_steps.length > 0)) { + frm.doc.main_route_steps.forEach(function (row) { + if (row.location_type.toUpperCase() == 'LOADING POINT' && locals['Route Steps Table'][row.name].loading_date != main_loading_date) { + frappe.call({ + "method": "fleet_management.fleet_management.gps_connector.load_cargo", + "args": { + 'vehicle_plate_number': frm.doc.vehicle_plate_number, + 'loading_date': locals['Route Steps Table'][row.name].loading_date, + 'cargo': frm.doc.main_goods_description, + 'destination': frm.doc.main_cargo_destination_city + }, + "freeze": true, + "freeze_message": "Updating GPS Data", + "callback": function (data) { + console.log(data); + } + }) + } + }) + } + + //Check if return loading date changed + if (['Sub-Contractor', 'Self Drive'].indexOf(frm.doc.transporter_type) == -1 && (frm.doc.return_route_steps && frm.doc.return_route_steps.length > 0)) { + frm.doc.return_route_steps.forEach(function (row) { + if (row.location_type.toUpperCase() == 'LOADING POINT' && locals['Route Steps Table'][row.name].loading_date != return_loading_date) { + frappe.call({ + "method": "fleet_management.fleet_management.gps_connector.load_cargo", + "args": { + 'vehicle_plate_number': frm.doc.vehicle_plate_number, + 'loading_date': locals['Route Steps Table'][row.name].loading_date, + 'cargo': frm.doc.return_goods_description, + 'destination': frm.doc.return_cargo_destination_city + }, + "freeze": true, + "freeze_message": "Updating GPS Data", + "callback": function (data) { + console.log(data); + } + }) + } + }) + } + + //Offload in GTT + if (offloaded && ['Sub-Contractor', 'Self Drive'].indexOf(frm.doc.transporter_type) == -1) { + frappe.call({ + "method": "fleet_management.fleet_management.gps_connector.offload_cargo", + "args": { + 'vehicle_plate_number': frm.doc.vehicle_plate_number + }, + "freeze": true, + "freeze_message": "Updating GPS Data", + "callback": function (data) { + console.log(data); + } + }) + } + }, + + location_buttons: function (frm) { + if (frm.doc.vehicle_plate_number && frm.doc.transporter_type != 'Sub-Contractor' && frm.doc.status == 'En Route') { + frm.fields_dict['main_location_update'].grid.add_custom_button('Get Latest Location', function () { + frappe.call({ + "method": "fleet_management.fleet_management.gps_connector.get_last_location", + "args": { + 'vehicle_plate_no': frm.doc.vehicle_plate_number + }, + "freeze": true, + "callback": function (data) { + console.log(data); + if (data.message) { + frappe.msgprint(data.message); + } + } + }); + }); + } else if (frm.doc.vehicle_plate_number && frm.doc.transporter_type != 'Sub-Contractor' && frm.doc.status == 'En Route Returning') { + frm.fields_dict['return_location_update'].grid.add_custom_button('Get Latest Location', function () { + frappe.call({ + "method": "fleet_management.fleet_management.gps_connector.get_last_location", + "args": { + 'vehicle_plate_no': frm.doc.vehicle_plate_number + }, + "freeze": true, + "callback": function (data) { + console.log(data); + if (data.message) { + frappe.msgprint(data.message); + } + } + }); + }); + } + }, + //Product Inspection function + make_vehicle_inspection: function () { + frappe.model.open_mapped_doc({ + method: "fleet_management.fleet_management.doctype.vehicle_trip.vehicle_trip.make_vehicle_inspection", + frm: cur_frm + }) + + }, +}); + +frappe.ui.form.on('Route Steps Table', { + form_render: function (frm, cdt, cdn) { + frm.events.route_steps_options(frm, cdt, cdn); + } +}); + +frappe.ui.form.on('Vehicle Trip Location Update', { + view_on_map: function (frm, cdt, cdn) { + if (locals[cdt][cdn].latitude & locals[cdt][cdn].longitude) { + var url = 'https://www.google.com/maps/search/?api=1&query=' + locals[cdt][cdn].latitude + ',' + locals[cdt][cdn].longitude; + var win = window.open(url, '_blank'); + win.focus(); + } + } +}); + +frappe.ui.form.on('Fuel Request Table', { + cost_per_litre: function (frm, cdt, cdn) { + if (locals[cdt][cdn].cost_per_litre && locals[cdt][cdn].quantity) { + var total = locals[cdt][cdn].cost_per_litre * locals[cdt][cdn].quantity + frappe.model.set_value(cdt, cdn, 'total_cost', total); + } + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.json b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.json new file mode 100644 index 0000000..d8b122a --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.json @@ -0,0 +1,5096 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "TRIP.###", + "beta": 0, + "creation": "2017-04-18 02:06:03.433433", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "transporter_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Transporter", + "length": 0, + "no_copy": 0, + "options": "\nBravo\nSub-Contractor\nSelf Drive", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "sub_contractor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Sub-Contractor", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle", + "length": 0, + "no_copy": 0, + "options": "Vehicle", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "vehicle_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Vehicle Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trailer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trailer", + "length": 0, + "no_copy": 0, + "options": "Trailer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trailer_plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trailer Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driver", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Driver", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driver_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Driver Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "passport_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Passport Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "driving_licence_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Driving Licence No", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "phone_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Phone Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_trip", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "start_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Start Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Main Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_customer_address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Customer Address HTML", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_cargo_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "options": "\nContainer\nLoose Cargo", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_cargo_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Category", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_goods_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_17", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_unit", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Units", + "length": 0, + "no_copy": 0, + "options": "Unit of Measure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_loose_no_of_packages", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "No of Packages", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_loose_gross_weight", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Gross Weight (kg)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_loose_net_weight", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_container_cargo", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Section", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Main Cargo", + "fetch_if_empty": 0, + "fieldname": "main_cargo", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_consignee_shipper", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipper and Consignee", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_shipper", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipper", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_shipper_address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Shipper Address", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_29", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_consignee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_consignee_address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Consignee Address", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_cargo_location_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Location (Country)", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_cargo_location_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Location (City)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_loading_point", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Loading Point", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_26", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_cargo_destination_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Destination (Country)", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_cargo_destination_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Destination (City)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_offloading_point", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Cargo Offloading Point", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_route", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_eta", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ETA at Destination", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_route", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Route", + "length": 0, + "no_copy": 0, + "options": "Trip Route", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Main Route Steps", + "fetch_if_empty": 0, + "fieldname": "main_route_steps", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Route Steps", + "length": 0, + "no_copy": 0, + "options": "Route Steps Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Location Update", + "fetch_if_empty": 0, + "fieldname": "main_location_update", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Location Update", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip Location Update", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_delivery_note", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Delivery Note Information (Main Trip)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_shipment_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipment Ref No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_client_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Client Ref No.", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_border1_clearing", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 1 Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_border2_clearing", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 2 Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_border3_clearing", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 3 Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_86", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_special_instructions_transporter", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Special Instructions to Transporter", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_special_instructions_to_driver", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Special Instructions to Driver", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_delivery_note", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Signed Delivery Note", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_offloading_report", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Report", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_offloading_weight", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_fuel_request", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Fuel Request", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_approved_fuel", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Pre-Approved Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_fuel_request", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Fuel Request", + "length": 0, + "no_copy": 0, + "options": "Fuel Request Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_reporting", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_reporting_status", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Reporting Status", + "length": 0, + "no_copy": 0, + "options": "Reporting Status Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_requested_funds", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Requested Funds", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Funds for Main Trip", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_main_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_trip", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_start_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Start Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Return Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_cargo_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Type", + "length": 0, + "no_copy": 0, + "options": "\nContainer\nLoose Cargo", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_cargo_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Category", + "length": 0, + "no_copy": 0, + "options": "Cargo Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_goods_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Cargo Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_38", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_unit", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Unit", + "length": 0, + "no_copy": 0, + "options": "Unit of Measure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_loose_no_of_packages", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "No of Packages", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_loose_gross_weight", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Gross Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_loose_net_weight", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_cargo", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_customer_address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Customer Address HTML", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Return Cargo", + "fetch_if_empty": 0, + "fieldname": "return_cargo", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo", + "length": 0, + "no_copy": 0, + "options": "Cargo Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_consignee_shipper", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Shipper and Consignee", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_shipper", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipper", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_shipper_address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Shipper Address", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_81", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_consignee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Consignee", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_consignee_address_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Consignee Address", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_cargo_location_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo Location (Country)", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_cargo_location_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo Location (City)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_loading_point", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo Loading Point", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_46", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_cargo_destination_country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo Destination (Country)", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_cargo_destination_city", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo Destination (City)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_offloading_point", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Cargo Offloading Point", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_route", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_eta", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ETA at Destination", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_route", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Returning Route", + "length": 0, + "no_copy": 0, + "options": "Trip Route", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Return Route Steps", + "fetch_if_empty": 0, + "fieldname": "return_route_steps", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Route Steps", + "length": 0, + "no_copy": 0, + "options": "Route Steps Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Location Update", + "fetch_if_empty": 0, + "fieldname": "return_location_update", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Location Update", + "length": 0, + "no_copy": 0, + "options": "Vehicle Trip Location Update", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_delivery_note_information", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Delivery Note Information (Return Trip)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_shipment_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipment Ref No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_client_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Client Ref No.", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_border1_clearing", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 1 Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_border2_clearing", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 2 Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_border3_clearing", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Border 3 Clearing Agent", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_94", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_special_instructions_transporter", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Special Instructions to Transporter", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_special_instructions_driver", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Special Instructions to Driver", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_delivery_note", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Signed Delivery Note", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_offloading_report", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Report", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_offloading_weight", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Offloading Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_fuel_request", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Fuel Request", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_approved_fuel", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Pre-Approved Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_fuel_request", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Fuel Request", + "length": 0, + "no_copy": 0, + "options": "Fuel Request Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_reporting", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reporting", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_reporting_status", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Reporting Status", + "length": 0, + "no_copy": 0, + "options": "Reporting Status Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_requested_funds", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Requested Funds", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_requested_funds", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Requested Funds", + "length": 0, + "no_copy": 0, + "options": "Requested Funds Details", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_return_expenses", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Expenses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_expenses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Expenses", + "length": 0, + "no_copy": 0, + "options": "Expenses", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_subtrips", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Subtrips", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "subtrips", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Subtrips Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_attachments", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trip Attachments", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "attachments", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trip Attachments", + "length": 0, + "no_copy": 0, + "options": "File Attachment", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_references", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Doctype", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Document", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_import", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Import Reference", + "length": 0, + "no_copy": 0, + "options": "Import", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_export", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Export Reference", + "length": 0, + "no_copy": 0, + "options": "Export", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_35", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Reference Doctype", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Retrun Reference Document", + "length": 0, + "no_copy": 0, + "options": "return_reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_file_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip File Number", + "length": 0, + "no_copy": 0, + "options": "Files", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_import", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Import Reference", + "length": 0, + "no_copy": 0, + "options": "Import", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_export", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Export Reference", + "length": 0, + "no_copy": 0, + "options": "Export", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_trip_status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trip Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Trip Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Trip Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_74", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "depends_on": "eval:doc.profile == 'System Manager'", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.profile == 'System Manager'", + "fetch_if_empty": 0, + "fieldname": "hidden_status", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hidden Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_address_display", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Address Display", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_consignee_display", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Consignee Display", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "main_shipper_display", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Main Shipper Display", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_consignee_display", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Consignee Display", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_shipper_display", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Shipper Display", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "return_address_display", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Return Address Display", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-12-03 23:35:17.915685", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Trip", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Clearing Agent", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.py b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.py new file mode 100644 index 0000000..337bf2e --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip.py @@ -0,0 +1,450 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import time +import datetime +from frappe.model.document import Document +from frappe.model.mapper import get_mapped_doc +import json +from frappe.utils import encode, cstr, cint, flt, comma_or +from frappe import _ +from csf_tz.after_sales_services.doctype.requested_payments.requested_payments import ( + validate_requested_funds, +) + + +class VehicleTrip(Document): + from csf_tz.after_sales_services.doctype.reference_payment_table.reference_payment_table import ( + update_child_table, + ) + + def onload(self): + # Load approved fuel for main trip + if self.transporter_type not in ["Sub-Contractor", "Self Drive"] and self.get( + "main_route" + ): + consumption = frappe.db.get_value( + "Vehicle", self.get("vehicle"), "fuel_consumption" + ) + route = frappe.db.get_value( + "Trip Route", self.get("main_route"), "total_distance" + ) + approved_fuel = consumption * route + self.set("main_approved_fuel", str(approved_fuel) + " Litres") + + # Load approved fuel for return trip + if self.transporter_type not in ["Sub-Contractor", "Self Drive"] and self.get( + "return_route" + ): + consumption = frappe.db.get_value( + "Vehicle", self.get("vehicle"), "fuel_consumption" + ) + route = frappe.db.get_value( + "Trip Route", self.get("return_route"), "total_distance" + ) + approved_fuel = consumption * route + self.set("return_approved_fuel", str(approved_fuel) + " Litres") + + self.load_customer_contacts() + + if not self.company: + self.company = frappe.defaults.get_user_default( + "Company" + ) or frappe.defaults.get_global_default("company") + + def validate(self): + self.validate_fuel_requests() + + def before_save(self): + # validate_requested_funds(self) + self.validate_main_route_inputs() + self.validate_return_route_inputs() + + def validate_fuel_requests(self): + make_request = False + + # Check main trip + for request in self.get("main_fuel_request"): + if request.status == "Open": + make_request = True + + # Check return trip + for request in self.get("return_fuel_request"): + if request.status == "Open": + make_request = True + + if make_request: + existing_fuel_request = frappe.db.get_value( + "Fuel Request", + {"reference_doctype": "Vehicle Trip", "reference_docname": self.name}, + ) + + # Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime( + "%Y-%m-%d %H:%M:%S" + ) + + if existing_fuel_request: + doc = frappe.get_doc("Fuel Request", existing_fuel_request) + doc.db_set("modified", timestamp) + if "Fully Processed" == doc.status: + doc.db_set("status", "Partially Processed") + else: + fuel_request = frappe.new_doc("Fuel Request") + fuel_request.update( + { + "vehicle_plate_number": self.get("vehicle_plate_number"), + "reference_doctype": "Vehicle Trip", + "reference_docname": self.name, + "status": "Waiting Approval", + } + ) + fuel_request.insert(ignore_permissions=True) + + # Mark the requests as open + for request in self.get("main_fuel_request"): + if request.status == "Open": + request.set("status", "Requested") + + for request in self.get("return_fuel_request"): + if request.status == "Open": + request.set("status", "Requested") + + def validate_main_route_inputs(self): + loading_date = None + offloading_date = None + + steps = self.get("main_route_steps") + for step in steps: + if step.location_type == "Loading Point": + loading_date = step.loading_date + if step.location_type == "Offloading Point": + offloading_date = step.offloading_date + if offloading_date and not loading_date: + frappe.throw("Loading Date must be set before Offloading Date") + + def validate_return_route_inputs(self): + # Check return trip + loading_date = None + offloading_date = None + + steps = self.get("return_route_steps") + for step in steps: + if step.location_type == "Loading Point": + loading_date = step.loading_date + if step.location_type == "Offloading Point": + offloading_date = step.offloading_date + if offloading_date and not loading_date: + frappe.throw("Loading Date must be set before Offloading Date") + + def load_customer_contacts(self): + """Loads address list and contact list in `__onload`""" + from frappe.contacts.doctype.address.address import get_address_display + + if self.main_customer: + filters = [ + ["Dynamic Link", "link_doctype", "=", "Customer"], + ["Dynamic Link", "link_name", "=", self.main_customer], + ["Dynamic Link", "parenttype", "=", "Address"], + ] + address_list = frappe.get_all("Address", filters=filters, fields=["*"]) + + address_list = [ + a.update({"display": get_address_display(a)}) for a in address_list + ] + + address_list = sorted( + address_list, + lambda a, b: (int(a.is_primary_address - b.is_primary_address)) + or (1 if a.modified - b.modified else 0), + reverse=True, + ) + + self.set_onload("main_addr_list", {"addr_list": address_list}) + + if self.main_consignee: + filters = [ + ["Dynamic Link", "link_doctype", "=", "Customer"], + ["Dynamic Link", "link_name", "=", self.main_consignee], + ["Dynamic Link", "parenttype", "=", "Address"], + ] + address_list = frappe.get_all("Address", filters=filters, fields=["*"]) + + address_list = [ + a.update({"display": get_address_display(a)}) for a in address_list + ] + + address_list = sorted( + address_list, + lambda a, b: (int(a.is_primary_address - b.is_primary_address)) + or (1 if a.modified - b.modified else 0), + reverse=True, + ) + + self.set_onload("main_consignee_addr_list", {"addr_list": address_list}) + + if self.main_shipper: + filters = [ + ["Dynamic Link", "link_doctype", "=", "Customer"], + ["Dynamic Link", "link_name", "=", self.main_shipper], + ["Dynamic Link", "parenttype", "=", "Address"], + ] + address_list = frappe.get_all("Address", filters=filters, fields=["*"]) + + address_list = [ + a.update({"display": get_address_display(a)}) for a in address_list + ] + + address_list = sorted( + address_list, + lambda a, b: (int(a.is_primary_address - b.is_primary_address)) + or (1 if a.modified - b.modified else 0), + reverse=True, + ) + + self.set_onload("main_shipper_addr_list", {"addr_list": address_list}) + + if self.return_customer: + filters = [ + ["Dynamic Link", "link_doctype", "=", "Customer"], + ["Dynamic Link", "link_name", "=", self.return_customer], + ["Dynamic Link", "parenttype", "=", "Address"], + ] + address_list = frappe.get_all("Address", filters=filters, fields=["*"]) + + address_list = [ + a.update({"display": get_address_display(a)}) for a in address_list + ] + + address_list = sorted( + address_list, + lambda a, b: (int(a.is_primary_address - b.is_primary_address)) + or (1 if a.modified - b.modified else 0), + reverse=True, + ) + + self.set_onload("return_addr_list", {"addr_list": address_list}) + + if self.return_consignee: + filters = [ + ["Dynamic Link", "link_doctype", "=", "Customer"], + ["Dynamic Link", "link_name", "=", self.main_consignee], + ["Dynamic Link", "parenttype", "=", "Address"], + ] + address_list = frappe.get_all("Address", filters=filters, fields=["*"]) + + address_list = [ + a.update({"display": get_address_display(a)}) for a in address_list + ] + + address_list = sorted( + address_list, + lambda a, b: (int(a.is_primary_address - b.is_primary_address)) + or (1 if a.modified - b.modified else 0), + reverse=True, + ) + + self.set_onload("return_consignee_addr_list", {"addr_list": address_list}) + + if self.return_shipper: + filters = [ + ["Dynamic Link", "link_doctype", "=", "Customer"], + ["Dynamic Link", "link_name", "=", self.main_shipper], + ["Dynamic Link", "parenttype", "=", "Address"], + ] + address_list = frappe.get_all("Address", filters=filters, fields=["*"]) + + address_list = [ + a.update({"display": get_address_display(a)}) for a in address_list + ] + + address_list = sorted( + address_list, + lambda a, b: (int(a.is_primary_address - b.is_primary_address)) + or (1 if a.modified - b.modified else 0), + reverse=True, + ) + + self.set_onload("return_shipper_addr_list", {"addr_list": address_list}) + + +@frappe.whitelist(allow_guest=True) +def create_vehicle_trip(**args): + + args = frappe._dict(args) + + existing_vehicle_trip = frappe.db.get_value( + "Vehicle Trip", + { + "reference_doctype": args.reference_doctype, + "reference_docname": args.reference_docname, + }, + ) + + existing_return_trip = frappe.db.get_value( + "Vehicle Trip", + { + "return_reference_doctype": args.reference_doctype, + "return_reference_docname": args.reference_docname, + }, + ) + + if existing_vehicle_trip: + # Mark the request as open and update modified time + trip = frappe.get_doc("Vehicle Trip", existing_vehicle_trip) + # doc.db_set("request_status", "open") + # doc.db_set("modified", timestamp) + return trip + elif existing_return_trip: + trip = frappe.get_doc("Vehicle Trip", existing_vehicle_trip) + return trip + else: + trip = frappe.new_doc("Vehicle Trip") + trip.update( + { + "reference_doctype": args.reference_doctype, + "reference_docname": args.reference_docname, + "status": "En Route", + "hidden_status": 2, + } + ) + trip.insert(ignore_permissions=True) + + # Update transport assignment + doc = frappe.get_doc(args.reference_doctype, args.reference_docname) + doc.created_trip = trip.name + doc.status = "Processed" + doc.save() + + # If company vehicle, update vehicle status + if args.transporter == "Bravo": + vehicle = frappe.get_doc("Vehicle", args.vehicle) + vehicle.status = "En Route" + vehicle.hidden_status = 2 + vehicle.current_trip = trip.name + vehicle.save() + return trip + + +@frappe.whitelist(allow_guest=True) +def create_return_trip(**args): + args = frappe._dict(args) + + existing_vehicle_trip = frappe.db.get_value( + "Vehicle Trip", + { + "reference_doctype": args.reference_doctype, + "reference_docname": args.reference_docname, + }, + ) + + existing_return_trip = frappe.db.get_value( + "Vehicle Trip", + { + "return_reference_doctype": args.reference_doctype, + "return_reference_docname": args.reference_docname, + }, + ) + + if existing_vehicle_trip: + # Mark the request as open and update modified time + trip = frappe.get_doc("Vehicle Trip", existing_vehicle_trip) + # doc.db_set("request_status", "open") + # doc.db_set("modified", timestamp) + return trip + elif existing_return_trip: + trip = frappe.get_doc("Vehicle Trip", existing_return_trip) + return trip + else: + # If internal tranport + if args.transporter == "Bravo": + vehicle = frappe.get_doc("Vehicle", args.vehicle) + vehicle.status = "En Route - Returning" + vehicle.hidden_status = 4 + + doc = frappe.get_doc("Vehicle Trip", args.vehicle_trip) + doc.return_reference_doctype = args.reference_doctype + doc.return_reference_docname = args.reference_docname + doc.status = "En Route - Returning" + doc.hidden_status = 4 + doc.save() + # for vehicle + vehicle.current_trip = doc.name + vehicle.save() + return doc + + +@frappe.whitelist() +def make_vehicle_inspection(source_name, target_doc=None, ignore_permissions=False): + + docs = get_mapped_doc( + "Vehicle Trip", + source_name, + { + "Vehicle Trip": { + "doctype": "Vehicle Inspection", + "field_map": { + "driver_name": "driver_name", + "vehicle_plate_number": "vehicle_plate_number", + "name": "trip_reference", + }, + "validation": { + "docstatus": ["=", 0], + }, + } + }, + target_doc, + postprocess=None, + ignore_permissions=ignore_permissions, + ) + + return docs + + +@frappe.whitelist(allow_guest=True) +def check_trip_status(**args): + args = frappe._dict(args) + frappe.msgprint("ok") + + # get trip + # existing_trip = frappe.db.get_value("Vehicle Trip", + # {"main_file_number": args.file_number}) + # frappe.msgprint("got") + + # get trip + existing_trip = frappe.db.get_value( + "Vehicle Trip", {"main_file_number": args.file_number} + ) + if existing_trip: + doc = frappe.get_doc("Vehicle Trip", existing_trip) + status = doc.status + frappe.msgprint(status) + if status != "Closed": + frappe.msgprint( + "Cannot Close the File because it's Trip is not closed,Please Create the Trip" + ) + else: + return status + else: + frappe.msgprint( + "Cannot Close because Trip has not been created yet for the current file" + ) + + +"""@frappe.whitelist(allow_guest=True) +def validate_route_inputs(**args): + args = frappe._dict(args) + + frappe.msgprint("OOOOOKKKK") + + #trip = frappe.db.get_value("Vehicle Trip", {"name": args.name}) + #docs = frappe.get_doc("Vehicle Trip", trip) + #steps=docs.main_route_steps + + if args.offloading_date and not args.loading_date: + frappe.msgprint("Loading Steps must be filled before offloading",raise_exeption==True) +""" diff --git a/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip_dashboard.py b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip_dashboard.py new file mode 100644 index 0000000..d987760 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip/vehicle_trip_dashboard.py @@ -0,0 +1,24 @@ +from frappe import _ + +def get_data(): + return { + 'fieldname': 'purchase_invoice', + 'non_standard_fieldnames': { + 'Requested Payments': 'reference_docname', + 'Fuel Request':'reference_docname', + 'Transport Assignment' :'vehicle_trip' + }, + 'internal_links': { + #'Purchase Order': ['items', 'purchase_order'], + #'Purchase Receipt': ['items', 'purchase_receipt'], + }, + 'transactions': [ + + { + 'label': _('Reference'), + 'items': ['Requested Payments','Fuel Request','Transport Assignment'] + }, + + ] + } + \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_trip_location_update/__init__.py b/csf_tz/fleet_management/doctype/vehicle_trip_location_update/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_trip_location_update/vehicle_trip_location_update.json b/csf_tz/fleet_management/doctype/vehicle_trip_location_update/vehicle_trip_location_update.json new file mode 100644 index 0000000..067889b --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip_location_update/vehicle_trip_location_update.json @@ -0,0 +1,254 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-08-26 10:35:47.790753", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "timestamp", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "location", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Location", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "longitude", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Longitude", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "latitude", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Latitude", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "comment", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Comment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Manual Update", + "fieldname": "type_of_update", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Type of Update", + "length": 0, + "no_copy": 0, + "options": "Manual Update\nGPS Update", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "view_on_map", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "View on Map", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "" + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-02-19 21:02:16.209180", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Trip Location Update", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/fleet_management/doctype/vehicle_trip_location_update/vehicle_trip_location_update.py b/csf_tz/fleet_management/doctype/vehicle_trip_location_update/vehicle_trip_location_update.py new file mode 100644 index 0000000..cffcc36 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_trip_location_update/vehicle_trip_location_update.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleTripLocationUpdate(Document): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_type/__init__.py b/csf_tz/fleet_management/doctype/vehicle_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/doctype/vehicle_type/test_vehicle_type.js b/csf_tz/fleet_management/doctype/vehicle_type/test_vehicle_type.js new file mode 100644 index 0000000..b97feaa --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_type/test_vehicle_type.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Vehicle Type", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Vehicle Type + () => frappe.tests.make('Vehicle Type', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_type/test_vehicle_type.py b/csf_tz/fleet_management/doctype/vehicle_type/test_vehicle_type.py new file mode 100644 index 0000000..0457f0d --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_type/test_vehicle_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestVehicleType(unittest.TestCase): + pass diff --git a/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.js b/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.js new file mode 100644 index 0000000..362ae7f --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Vehicle Type', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.json b/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.json new file mode 100644 index 0000000..2530a53 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.json @@ -0,0 +1,93 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:vehicle_type", + "beta": 0, + "creation": "2019-07-25 14:46:28.040192", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "vehicle_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Vehicle Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-07-25 14:53:17.594531", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Type", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.py b/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.py new file mode 100644 index 0000000..1aa4687 --- /dev/null +++ b/csf_tz/fleet_management/doctype/vehicle_type/vehicle_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class VehicleType(Document): + pass diff --git a/csf_tz/fleet_management/gps_connector.py b/csf_tz/fleet_management/gps_connector.py new file mode 100644 index 0000000..c28eb00 --- /dev/null +++ b/csf_tz/fleet_management/gps_connector.py @@ -0,0 +1,121 @@ +from __future__ import unicode_literals +import frappe +import sys +import psycopg2 +from datetime import datetime + +def connect_to_server(): + conn = None + try: + conn = 'test' + except ex: + print('Unable to connect the database: ' + str(ex)) + sys.exit(1) + + return conn + +def record_vehicle_position(vehicle_plate_no, gps_timestamp, location, longitude, latitude): + if vehicle_plate_no: + existing_main_trip = frappe.db.get_value("Vehicle Trip", + {"vehicle_plate_number": vehicle_plate_no, "status": "En Route" }) + existing_return_trip = frappe.db.get_value("Vehicle Trip", + {"vehicle_plate_number": vehicle_plate_no, "status": "En Route - Returning" }) + if existing_main_trip: + trip = frappe.get_doc('Vehicle Trip', existing_main_trip) + last_location_date = frappe.db.sql('''SELECT timestamp FROM `tabVehicle Trip Location Update` WHERE parent = %(parent)s AND parenttype = %(parenttype)s AND parentfield='main_location_update' ORDER BY timestamp DESC LIMIT 1''', + {"parent": trip.name, "parenttype": 'Vehicle Trip'}, as_dict=1) + if not last_location_date: + trip.append('main_location_update', {"timestamp": gps_timestamp, + "location": location, + "longitude": longitude, + "latitude": latitude, + "type_of_update": "GPS Update"}) + trip.save(ignore_permissions=True) + elif last_location_date[0].timestamp and str(gps_timestamp) > str(last_location_date[0].timestamp): + trip.append('main_location_update', {"timestamp": gps_timestamp, + "location": location, + "longitude": longitude, + "latitude": latitude, + "type_of_update": "GPS Update"}) + trip.save(ignore_permissions=True) + else: + return "Trip location update is more current" + elif existing_return_trip: + trip = frappe.get_doc('Vehicle Trip', existing_return_trip) + last_location_date = frappe.db.sql('''SELECT timestamp FROM `tabVehicle Trip Location Update` WHERE parent = %(parent)s AND parenttype = %(parenttype)s AND parentfield='return_location_update' ORDER BY timestamp DESC LIMIT 1''', + {"parent": trip.name, "parenttype": 'Vehicle Trip'}, as_dict=1) + if not last_location_date: + trip.append('return_location_update', {"timestamp": gps_timestamp, + "location": location, + "longitude": longitude, + "latitude": latitude, + "type_of_update": "GPS Update"}) + trip.save(ignore_permissions=True) + elif last_location_date[0].timestamp and str(gps_timestamp) > str(last_location_date[0].timestamp): + trip.append('return_location_update', {"timestamp": gps_timestamp, + "location": location, + "longitude": longitude, + "latitude": latitude, + "type_of_update": "GPS Update"}) + trip.save(ignore_permissions=True) + else: + return "Trip location update is more current" + + +@frappe.whitelist(allow_guest=True) +def get_last_location(vehicle_plate_no): + if vehicle_plate_no and vehicle_plate_no != '': + connection = connect_to_server() + if connection: + curs = connection.cursor() + curs.execute("SELECT gdlatitude, gdlongitude, gdlocation, gdtimestamp, gdhorseplateno FROM gps_devices WHERE UPPER(gdhorseplateno) = UPPER('" + vehicle_plate_no + "')") + result = [] + for row in curs: + clean_row = {} + i = 0 + for column in row: + clean_row.update({curs.description[i][0]: str(column)}) + i = i + 1 + result.append(clean_row) + + if result: + record_vehicle_position(vehicle_plate_no, result[0]['gdtimestamp'], result[0]['gdlocation'], result[0]['gdlongitude'], result[0]['gdlatitude']) + else: + return "There is no tracking data." + + +@frappe.whitelist(allow_guest=True) +def load_cargo(**args): + args = frappe._dict(args) + vehicle_plate_number = args.vehicle_plate_number + loading_date = args.loading_date + cargo = args.cargo + destination = args.destination + if vehicle_plate_number and vehicle_plate_number != '' and loading_date and loading_date != '': + connection = connect_to_server() + if connection: + curs = connection.cursor() + curs.execute("""UPDATE gps_devices SET gdactive = TRUE, gdcargo = 'COTTON', gdloaded = %s, gddestination = %s WHERE UPPER(gdhorseplateno) = UPPER(%s)""", (loading_date, destination, vehicle_plate_number)) + connection.commit() + +@frappe.whitelist(allow_guest=True) +def offload_cargo(**args): + args = frappe._dict(args) + vehicle_plate_number = args.vehicle_plate_number + if vehicle_plate_number and vehicle_plate_number != '': + connection = connect_to_server() + if connection: + curs = connection.cursor() + curs.execute("""UPDATE gps_devices SET gdactive = FALSE, gdcargo = '', gdloaded = NULL, gddestination = '' WHERE UPPER(gdhorseplateno) = UPPER(%s)""", (vehicle_plate_number,)) + connection.commit() + + +@frappe.whitelist(allow_guest=True) +def loop_through_vehicles(**args): + print("Executed: " + str(datetime.now())) + args = frappe._dict(args) + vehicle_list = frappe.get_all('Vehicle', fields=['name', 'number_plate']) + if vehicle_list: + for vehicle in vehicle_list: + get_last_location(vehicle.number_plate) + diff --git a/csf_tz/fleet_management/print_format/__init__.py b/csf_tz/fleet_management/print_format/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/print_format/customs_road_manifest___main_trip/__init__.py b/csf_tz/fleet_management/print_format/customs_road_manifest___main_trip/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/print_format/customs_road_manifest___main_trip/customs_road_manifest___main_trip.json b/csf_tz/fleet_management/print_format/customs_road_manifest___main_trip/customs_road_manifest___main_trip.json new file mode 100644 index 0000000..1032424 --- /dev/null +++ b/csf_tz/fleet_management/print_format/customs_road_manifest___main_trip/customs_road_manifest___main_trip.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 1, + "creation": "2018-06-14 15:06:59.812538", + "custom_format": 0, + "disabled": 0, + "doc_type": "Vehicle Trip", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\n\\t\\t\\t\\t\\t\\n\\t

CUSTOMS ROAD FREIGHT MANIFEST
{{ doc.name }} - M

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"

\\nTransporter              \\n{% if 'Bravo' == doc.transporter_type %}\\n\\tBravo Logistics\\n{% elif 'Sub-Contractor' == doc.transporter_type %}\\n\\t{{ doc.sub_contractor }}\\n{% endif %}\\n

\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"fieldname\": \"vehicle_plate_number\", \"label\": \"Vehicle Plate Number\"}, {\"print_hide\": 0, \"fieldname\": \"trailer_plate_number\", \"label\": \"Trailer Plate Number\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"driver_name\", \"label\": \"Driver Name\"}, {\"print_hide\": 0, \"fieldname\": \"driving_licence_no\", \"align\": \"left\", \"label\": \"Licence No\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\", \"align\": \"left\", \"label\": \"Loading Date\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"\\n{% set no_of_packages, method_of_packing, container_no, gross_weight, nett_weight, seal_number, remarks = [0], [''], [''], [0], [0], [''], [''] %}\\n{% if 'Container' == doc.main_cargo_type %}\\n\\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Containerized') %}\\n\\t{% if doc.main_cargo[0] is defined %}\\n\\t\\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.main_cargo[0].no_of_packages) %}\\n\\t\\t{% set _ = container_no.append(container_no.pop() + doc.main_cargo[0].container_number) %}\\n\\t\\t{% set _ = gross_weight.append(gross_weight.pop() + doc.main_cargo[0].gross_weight) %}\\n\\t\\t{% set _ = nett_weight.append(nett_weight.pop() + doc.main_cargo[0].net_weight) %}\\n\\t\\t{% set _ = seal_number.append(seal_number.pop() + doc.main_cargo[0].seal_number|str) %}\\n\\t\\t{% set _ = remarks.append(remarks.pop() + doc.main_cargo[0].extra_details|str) %}\\n\\t{% endif %}\\n{% elif 'Loose Cargo' == doc.main_cargo_type %}\\n\\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Loose Cargo') %}\\n\\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.main_loose_no_of_packages.no_of_packages|int) %}\\n\\t{% set _ = gross_weight.append(gross_weight.pop() + doc.main_loose_gross_weight|int) %}\\n\\t{% set _ = nett_weight.append(nett_weight.pop() + doc.main_loose_net_weight|int) %}\\n{% endif %}\\n\\n\\n\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\n\\t\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\n\\t\\n
Packages No. & TypeWeightDescription of GoodsConsignorConsigneeClearing AgentsBill of Entry No. and Date
\\n\\t\\t\\t\\t{{ method_of_packing[0] }}
\\n\\t\\t\\t\\t{{ no_of_packages[0] }} Packages\\n\\t\\t\\t
\\n\\t\\t\\t\\tGross:  {{ gross_weight[0] }} kg
\\n\\t\\t\\t\\tNet:    {{ nett_weight[0] }} kg\\n\\t\\t\\t
\\n\\t\\t\\t\\t{{ doc.main_goods_description }}\\n\\t\\t\\t\\n\\t\\t\\t\\t{{ doc.main_shipper }}
\\n\\t\\t\\t\\t{% if doc.main_shipper_display is defined and doc.main_shipper_display != None %}\\n\\t\\t\\t\\t\\t{{ doc.main_shipper_display }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t
\\n\\t\\t\\t\\t{{ doc.main_consignee }}
\\n\\t\\t\\t\\t{{ doc.main_consignee_display }}\\n\\t\\t\\t
\\n\\t\\t\\t\\t{% if doc.main_border1_clearing is defined and doc.main_border1_clearing != None %}\\n\\t\\t\\t\\t\\t{{ doc.main_border1_clearing }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t\\t{% if doc.main_border2_clearing is defined and doc.main_border2_clearing != None %}\\n\\t\\t\\t\\t\\t{{ doc.main_border2_clearing }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t\\t{% if doc.main_border3_clearing is defined and doc.main_border3_clearing != None %}\\n\\t\\t\\t\\t\\t{{ doc.main_border3_clearing }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\n
\\n\\t\\t\\tI hereby certify that the particulars shown on this manifest are a true reflection of all the goods carried on the above-mentioned vehicle(S).\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t\\n\\t\\t\\t
Carrier Signature & Stamp\\n\\t\\t\\t                             \\n\\t\\t\\tManifest Issued On: {{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }}\\n\\t\\t
\\n\\t\\t\\t
FOR CUSTOMS USE
\\n\\t\\t
\\n\\t\\t\\t
CUSTOMS STAMP - EXIT
\\n\\t\\t
\\n\\t\\t\\t
CUSTOMS STAMP - ENTRY
\\n\\t\\t
\\n
\\nInstructions: \\nThis manifest is to be completed at least in triplicate by the transporter or licensed Remover of goods in bond.\\nThis manifest and a copy of the appropriate Bill(s) of Entry / Transit Declarations(s) must accompany the load carrying vehicle at all times.\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}]", + "idx": 0, + "line_breaks": 0, + "modified": "2018-06-14 18:40:28.647984", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Customs Road Manifest - Main Trip", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/fleet_management/print_format/customs_road_manifest___return_trip/__init__.py b/csf_tz/fleet_management/print_format/customs_road_manifest___return_trip/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/print_format/customs_road_manifest___return_trip/customs_road_manifest___return_trip.json b/csf_tz/fleet_management/print_format/customs_road_manifest___return_trip/customs_road_manifest___return_trip.json new file mode 100644 index 0000000..ea196ad --- /dev/null +++ b/csf_tz/fleet_management/print_format/customs_road_manifest___return_trip/customs_road_manifest___return_trip.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 1, + "creation": "2018-06-14 17:53:22.268051", + "custom_format": 0, + "disabled": 0, + "doc_type": "Vehicle Trip", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\n\\t\\t\\t\\t\\t\\n\\t

CUSTOMS ROAD FREIGHT MANIFEST
{{ doc.name }} - R

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"

\\nTransporter              \\n{% if 'Bravo' == doc.transporter_type %}\\n\\tBravo Logistics\\n{% elif 'Sub-Contractor' == doc.transporter_type %}\\n\\t{{ doc.sub_contractor }}\\n{% endif %}\\n

\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"print_hide\": 0, \"fieldname\": \"vehicle_plate_number\", \"label\": \"Vehicle Plate Number\"}, {\"print_hide\": 0, \"fieldname\": \"trailer_plate_number\", \"label\": \"Trailer Plate Number\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"driver_name\", \"label\": \"Driver Name\"}, {\"print_hide\": 0, \"fieldname\": \"driving_licence_no\", \"align\": \"left\", \"label\": \"Licence No\"}, {\"print_hide\": 0, \"fieldname\": \"return_start_date\", \"align\": \"left\", \"label\": \"Loading Date\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"\\n{% set no_of_packages, method_of_packing, container_no, gross_weight, nett_weight, seal_number, remarks = [0], [''], [''], [0], [0], [''], [''] %}\\n{% if 'Container' == doc.return_cargo_type %}\\n\\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Containerized') %}\\n\\t{% if doc.return_cargo[0] is defined %}\\n\\t\\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.return_cargo[0].no_of_packages) %}\\n\\t\\t{% set _ = container_no.append(container_no.pop() + doc.return_cargo[0].container_number) %}\\n\\t\\t{% set _ = gross_weight.append(gross_weight.pop() + doc.return_cargo[0].gross_weight) %}\\n\\t\\t{% set _ = nett_weight.append(nett_weight.pop() + doc.return_cargo[0].net_weight) %}\\n\\t\\t{% set _ = seal_number.append(seal_number.pop() + doc.return_cargo[0].seal_number|str) %}\\n\\t\\t{% set _ = remarks.append(remarks.pop() + doc.return_cargo[0].extra_details|str) %}\\n\\t{% endif %}\\n{% elif 'Loose Cargo' == doc.return_cargo_type %}\\n\\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Loose Cargo') %}\\n\\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.return_loose_no_of_packages.no_of_packages|int) %}\\n\\t{% set _ = gross_weight.append(gross_weight.pop() + doc.return_loose_gross_weight|int) %}\\n\\t{% set _ = nett_weight.append(nett_weight.pop() + doc.return_loose_net_weight|int) %}\\n{% endif %}\\n\\n\\n\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\n\\t\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\n\\t\\n
Packages No. & TypeWeightDescription of GoodsConsignorConsigneeClearing AgentsBill of Entry No. and Date
\\n\\t\\t\\t\\t{{ method_of_packing[0] }}
\\n\\t\\t\\t\\t{{ no_of_packages[0] }} Packages\\n\\t\\t\\t
\\n\\t\\t\\t\\tGross:  {{ gross_weight[0] }} kg
\\n\\t\\t\\t\\tNet:    {{ nett_weight[0] }} kg\\n\\t\\t\\t
\\n\\t\\t\\t\\t{{ doc.return_goods_description }}\\n\\t\\t\\t\\n\\t\\t\\t\\t{{ doc.return_shipper }}
\\n\\t\\t\\t\\t{% if doc.return_shipper_display is defined and doc.return_shipper_display != None %}\\n\\t\\t\\t\\t\\t{{ doc.return_shipper_display }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t
\\n\\t\\t\\t\\t{{ doc.return_consignee }}
\\n\\t\\t\\t\\t{{ doc.return_consignee_display }}\\n\\t\\t\\t
\\n\\t\\t\\t\\t{% if doc.return_border1_clearing is defined and doc.return_border1_clearing != None %}\\n\\t\\t\\t\\t\\t{{ doc.return_border1_clearing }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t\\t{% if doc.return_border2_clearing is defined and doc.return_border2_clearing != None %}\\n\\t\\t\\t\\t\\t{{ doc.return_border2_clearing }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t\\t{% if doc.return_border3_clearing is defined and doc.return_border3_clearing != None %}\\n\\t\\t\\t\\t\\t{{ doc.return_border3_clearing }}
\\n\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t
\\n\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"options\": \"\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\n
\\n\\t\\t\\tI hereby certify that the particulars shown on this manifest are a true reflection of all the goods carried on the above-mentioned vehicle(S).\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t\\n\\t\\t\\t
Carrier Signature & Stamp\\n\\t\\t\\t                             \\n\\t\\t\\tManifest Issued On: {{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }}\\n\\t\\t
\\n\\t\\t\\t
FOR CUSTOMS USE
\\n\\t\\t
\\n\\t\\t\\t
CUSTOMS STAMP - EXIT
\\n\\t\\t
\\n\\t\\t\\t
CUSTOMS STAMP - ENTRY
\\n\\t\\t
\\n
\\nInstructions: \\nThis manifest is to be completed at least in triplicate by the transporter or licensed Remover of goods in bond.\\nThis manifest and a copy of the appropriate Bill(s) of Entry / Transit Declarations(s) must accompany the load carrying vehicle at all times.\", \"fieldname\": \"_custom_html\", \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}]", + "idx": 0, + "line_breaks": 0, + "modified": "2018-06-14 18:39:29.870007", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Customs Road Manifest - Return Trip", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/fleet_management/print_format/delivery_note___main_trip/__init__.py b/csf_tz/fleet_management/print_format/delivery_note___main_trip/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/print_format/delivery_note___main_trip/delivery_note___main_trip.json b/csf_tz/fleet_management/print_format/delivery_note___main_trip/delivery_note___main_trip.json new file mode 100644 index 0000000..846d4c1 --- /dev/null +++ b/csf_tz/fleet_management/print_format/delivery_note___main_trip/delivery_note___main_trip.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 0, + "creation": "2017-12-07 19:38:16.773347", + "custom_format": 1, + "disabled": 0, + "doc_type": "Vehicle Trip", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "html": "\n\n
\n \n\t \n\t\t \n\t \n
\n\t\t\tDELIVERY/ROAD CONSIGNMENT NOTE


\n\t\t\t \n\t\t
\n\t\t\n\t\t\t
\n\t\t\tBRAVO LOGISTICS LIMITED
\n\t\t\tOpp. Maersk Logistics, Mandela Road
\n\t\t\tP.O.Box 38387, DAR ES SALAAM
\n\t\t\tTel: 255 22 2850579
\n\t\t\tFax: +255 22 2850583
\n\t\t\tE-Mail: trucking@bravo.co.tz

\n\t\t\tContact Persons
\n\t\t\tEljon Dube Mob: +255 882 150005
\n\t\t\tJacob Ngalula Mob: +255 716 213071
\n\t\t\t        
\n\t\t
\n \n\t \n\t\t \n\t\t \n\t \n\t \n\t\t \n\t\t \n\t \n\t\n\t\t\n\t\t{% set no_of_packages, method_of_packing, container_no, gross_weight, nett_weight, seal_number, remarks = [0], [''], [''], [0], [0], [''], [''] %}\n\t\t{% if 'Container' == doc.main_cargo_type %}\n\t\t\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Containerized') %}\n\t\t\t{% if doc.main_cargo[0] is defined %}\n\t\t\t\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.main_cargo[0].no_of_packages) %}\n\t\t\t\t{% set _ = container_no.append(container_no.pop() + doc.main_cargo[0].container_number) %}\n\t\t\t\t{% set _ = gross_weight.append(gross_weight.pop() + doc.main_cargo[0].gross_weight) %}\n\t\t\t\t{% set _ = nett_weight.append(nett_weight.pop() + doc.main_cargo[0].net_weight) %}\n\t\t\t\t{% set _ = seal_number.append(seal_number.pop() + doc.main_cargo[0].seal_number|str) %}\n\t\t\t\t{% set _ = remarks.append(remarks.pop() + doc.main_cargo[0].extra_details|str) %}\n\t\t\t{% endif %}\n\t\t{% elif 'Loose Cargo' == doc.main_cargo_type %}\n\t\t\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Loose Cargo') %}\n\t\t\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.main_loose_no_of_packages.no_of_packages|int) %}\n\t\t\t{% set _ = gross_weight.append(gross_weight.pop() + doc.main_loose_gross_weight|int) %}\n\t\t\t{% set _ = nett_weight.append(nett_weight.pop() + doc.main_loose_net_weight|int) %}\n\t\t{% endif %}\n\t\t\n\t\t \n\t\t \n\t \n
\n\t\t\tSender: {{ doc.main_shipper }}
\n\t\t\tAdress: \n\t\t\t\t
    \n\t\t\t\t\t
  • \n\t\t\t\t\t\t{% if doc.main_shipper_display is defined %}\n\t\t\t\t\t\t\t{{ doc.main_shipper_display }}\n\t\t\t\t\t\t{% endif %} \n\t\t\t\t\t
  • \n\t\t\t\t
\n\t\t
\n\t\t\tDate: {{ doc.start_date }}
\n\t\t\tShipment Ref No: {{ doc.main_shipment_ref_no }}
\n\t\t\tClient Ref No: {{ doc.main_client_ref_no }}
\n\t\t\tTransport ref: {{ doc.name }} - Main \n\t\t
\n\t\t\tConsignee Name: {{ doc.main_consignee }}
\n\t\t\tAdress: \n\t\t\t\t
    \n\t\t\t\t\t
  • \n\t\t\t\t\t\t{% if doc.main_consignee_display is defined %}\n\t\t\t\t\t\t\t{{ doc.main_consignee_display }}\n\t\t\t\t\t\t{% endif %} \n\t\t\t\t\t
  • \n\t\t\t\t
\n\t\t\tPlace of Delivery: {{ doc.main_cargo_destination_country }}, {{doc.main_cargo_destination_city }}
\n\t\t\tCargo Loaded From: {{ doc.main_cargo_location_country }} - {{ doc.main_cargo_location_city }}
\n\t\t
\n\t\t\tTruck No: {{ doc.vehicle_plate_number }}
\n\t\t\tTrailer No: {{ doc.trailer_plate_number }}
\n\t\t\tDriver: {{ doc.driver_name }}
\n\t\t\tDriver DL No: {{ doc.driving_licence_no }}
\n\t\t\tDriver Passport No: {{ doc.passport_number }}
\n\t\t\tDriver Signature: ...................................
\n\t\t
\n\t\t\tPlease receive the undermentioned goods of carriage \"OWNERS RISK\"
\n\t\t\tNumber of Packages: {{ no_of_packages[0] }}
\n\t\t\tMethod of Packing: {{ method_of_packing[0] }}
\n\t\t\tNature of Goods: {{ doc.main_cargo_category }}, {{ doc.main_goods_description }}
\n\t\t
\n\t\t\tContainer No: {{ container_no[0] }}
\n\t\t\tGross Weight: {{ gross_weight[0] }}kg
\n\t\t\tNett Weight: {{ nett_weight[0] }}kg
\n\t\t
\n \n\t \n\t\t \n\t\t \n\t\t \n\t \n
\n\t\t\tAttached Documents

\n\t\t
\n\t\t\tCarrier Observations

\n\t\t
\n\t\t\tSeal: {{ seal_number[0] }}
\n\t\t\tContainer Remarks: {{ remarks[0] }}\n\t\t
\n \n\t \n\t\t \n\t\t \n\t \n
\n\t\t\tDelivery Instructions:
\n\t\t
\n\t\t\tBorder 1 contact details: {{ doc.main_border1_clearing }}
\n\t\t\tBorder 2 contact details: {{ doc.main_border2_clearing }}
\n\t\t\tBorder 3 contact details: {{ doc.main_border3_clearing }} \n\t\t
\n \n\t \n\t\t \n\t \n
Special Instructions to Transporter: {{ doc.main_special_instructions_transporter }}
\n \n\t \n\t\t \n\t\t \n\t\t \n\t \n
\n\t\t\tSpecial Instruction to Driver
\n\t\t\t{{ doc.main_special_instructions_to_driver }}

\n\t\t
\n\t\t\tReturn Documents:
\n\t\t\t1. Original delivery note signed and stamped
\n\t\t\t2. T1 endorsed bearing rotation number
\n\t\t\t3. Other documents
\n\t\t
\n\t\t\tSpecial Remark to Shipper\\Consignee
\n\t\t\t72hrs Maximum border clearance
\n\t\t\t24hrs offloading at destination
\n\t\t
\n \n\t \n\t\t \n\t\t \n\t\t \n\t \n
\n\t\t\tSender Sign & Stamp




\n\t\t\tDate: {{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }} \n\t\t
\n\t\t\tCarrier Sign & Stamp

\n\t\t\t
\n\t\t\tDate: {{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }} \n\t\t
\n\t\t\tRECEIVED IN GOOD ORDER AND CONDITION
\n\t\t\tRecepient Sign and Stamp


\n\t\t\tDate: ................... \n\t\t
\n
\n\n", + "idx": 0, + "line_breaks": 0, + "modified": "2018-06-11 15:11:10.315668", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Delivery Note - Main Trip", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/fleet_management/print_format/delivery_note___return_trip/__init__.py b/csf_tz/fleet_management/print_format/delivery_note___return_trip/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/print_format/delivery_note___return_trip/delivery_note___return_trip.json b/csf_tz/fleet_management/print_format/delivery_note___return_trip/delivery_note___return_trip.json new file mode 100644 index 0000000..0213086 --- /dev/null +++ b/csf_tz/fleet_management/print_format/delivery_note___return_trip/delivery_note___return_trip.json @@ -0,0 +1,22 @@ +{ + "align_labels_left": 0, + "creation": "2018-01-04 21:04:50.216833", + "custom_format": 1, + "disabled": 0, + "doc_type": "Vehicle Trip", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "html": "\n\n
\n \n\t \n\t\t \n\t \n
\n\t\t\tDELIVERY/ROAD CONSIGNMENT NOTE


\n\t\t\t \n\t\t
\n\t\t\n\t\t\t
\n\t\t\tBRAVO LOGISTICS LIMITED
\n\t\t\tOpp. Maersk Logistics, Mandela Road
\n\t\t\tP.O.Box 38387, DAR ES SALAAM
\n\t\t\tTel: 255 22 2850579
\n\t\t\tFax: +255 22 2850583
\n\t\t\tE-Mail: trucking@bravo.co.tz

\n\t\t\tContact Persons
\n\t\t\tEljon Dube Mob: +255 882 150005
\n\t\t\tJacob Ngalula Mob: +255 716 213071
\n\t\t\t        
\n\t\t
\n \n\t \n\t\t \n\t\t \n\t \n\t \n\t\t \n\t\t \n\t \n\t\n\t\t\n\t\t{% set no_of_packages, method_of_packing, container_no, gross_weight, nett_weight, seal_number, remarks = [0], [''], [''], [0], [0], [''], [''] %}\n\t\t{% if 'Container' == doc.return_cargo_type %}\n\t\t\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Containerized') %}\n\t\t\t{% if doc.return_cargo[0] is defined %}\n\t\t\t\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.return_cargo[0].no_of_packages) %}\n\t\t\t\t{% set _ = container_no.append(container_no.pop() + doc.return_cargo[0].container_number) %}\n\t\t\t\t{% set _ = gross_weight.append(gross_weight.pop() + doc.return_cargo[0].gross_weight) %}\n\t\t\t\t{% set _ = nett_weight.append(nett_weight.pop() + doc.return_cargo[0].net_weight) %}\n\t\t\t\t{% set _ = seal_number.append(seal_number.pop() + doc.return_cargo[0].seal_number|str) %}\n\t\t\t\t{% set _ = remarks.append(remarks.pop() + doc.return_cargo[0].extra_details|str) %}\n\t\t\t{% endif %}\n\t\t{% elif 'Loose Cargo' == doc.return_cargo_type %}\n\t\t\t{% set _ = method_of_packing.append(method_of_packing.pop() + 'Loose Cargo') %}\n\t\t\t{% set _ = no_of_packages.append(no_of_packages.pop() + doc.return_loose_no_of_packages.no_of_packages|int) %}\n\t\t\t{% set _ = gross_weight.append(gross_weight.pop() + doc.return_loose_gross_weight|int) %}\n\t\t\t{% set _ = nett_weight.append(nett_weight.pop() + doc.return_loose_net_weight|int) %}\n\t\t{% endif %}\n\t\t\n\t\t \n\t\t \n\t \n
\n\t\t\tSender: {{ doc.return_shipper }}
\n\t\t\tAdress: \n\t\t\t\t
    \n\t\t\t\t\t
  • \n\t\t\t\t\t\t{% if doc.return_shipper_display is defined %}\n\t\t\t\t\t\t\t{{ doc.return_shipper_display }}\n\t\t\t\t\t\t{% endif %} \n\t\t\t\t\t
  • \n\t\t\t\t
\n\t\t
\n\t\t\tDate: {{ doc.start_date }}
\n\t\t\tShipment Ref No: {{ doc.return_shipment_ref_no }}
\n\t\t\tClient Ref No: {{ doc.return_client_ref_no }}
\n\t\t\tTransport ref: {{ doc.name }} - Return \n\t\t
\n\t\t\tConsignee Name: {{ doc.return_consignee }}
\n\t\t\tAdress: \n\t\t\t\t
    \n\t\t\t\t\t
  • \n\t\t\t\t\t\t{% if doc.return_consignee_display is defined %}\n\t\t\t\t\t\t\t{{ doc.return_consignee_display }}\n\t\t\t\t\t\t{% endif %} \n\t\t\t\t\t
  • \n\t\t\t\t
\n\t\t\tPlace of Delivery: {{ doc.return_cargo_destination_country }}, {{doc.return_cargo_destination_city }}
\n\t\t\tCargo Loaded From: {{ doc.return_cargo_location_country }} - {{ doc.return_cargo_location_city }}
\n\t\t
\n\t\t\tTruck No: {{ doc.vehicle_plate_number }}
\n\t\t\tTrailer No: {{ doc.trailer_plate_number }}
\n\t\t\tDriver: {{ doc.driver_name }}
\n\t\t\tDriver DL No: {{ doc.driving_licence_no }}
\n\t\t\tDriver Passport No: {{ doc.passport_number }}
\n\t\t\tDriver Signature: ...................................
\n\t\t
\n\t\t\tPlease receive the undermentioned goods of carriage \"OWNERS RISK\"
\n\t\t\tNumber of Packages: {{ no_of_packages[0] }}
\n\t\t\tMethod of Packing: {{ method_of_packing[0] }}
\n\t\t\tNature of Goods: {{ doc.return_cargo_category }}, {{ doc.return_goods_description }}
\n\t\t
\n\t\t\tContainer No: {{ container_no[0] }}
\n\t\t\tGross Weight: {{ gross_weight[0] }}kg
\n\t\t\tNett Weight: {{ nett_weight[0] }}kg
\n\t\t
\n \n\t \n\t\t \n\t\t \n\t\t \n\t \n
\n\t\t\tAttached Documents

\n\t\t
\n\t\t\tCarrier Observations

\n\t\t
\n\t\t\tSeal: {{ seal_number[0] }}
\n\t\t\tContainer Remarks: {{ remarks[0] }}\n\t\t
\n \n\t \n\t\t \n\t\t \n\t \n
\n\t\t\tDelivery Instructions:
\n\t\t
\n\t\t\tBorder 1 contact details: {{ doc.return_border1_clearing }}
\n\t\t\tBorder 2 contact details: {{ doc.return_border2_clearing }}
\n\t\t\tBorder 3 contact details: {{ doc.return_border3_clearing }} \n\t\t
\n \n\t \n\t\t \n\t \n
Special Instructions to Transporter: {{ doc.return_special_instructions_transporter }}
\n \n\t \n\t\t \n\t\t \n\t\t \n\t \n
\n\t\t\tSpecial Instruction to Driver
\n\t\t\t{{ doc.return_special_instructions_driver }}

\n\t\t
\n\t\t\tReturn Documents:
\n\t\t\t1. Original delivery note signed and stamped
\n\t\t\t2. T1 endorsed bearing rotation number
\n\t\t\t3. Other documents
\n\t\t
\n\t\t\tSpecial Remark to Shipper\\Consignee
\n\t\t\t72hrs Maximum border clearance
\n\t\t\t24hrs offloading at destination
\n\t\t
\n \n\t \n\t\t \n\t\t \n\t\t \n\t \n
\n\t\t\tSender Sign & Stamp




\n\t\t\tDate: {{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }} \n\t\t
\n\t\t\tCarrier Sign & Stamp

\n\t\t\t
\n\t\t\tDate: {{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }} \n\t\t
\n\t\t\tRECEIVED IN GOOD ORDER AND CONDITION
\n\t\t\tRecepient Sign and Stamp


\n\t\t\tDate: ................... \n\t\t
\n
\n\n", + "idx": 0, + "line_breaks": 0, + "modified": "2018-05-25 12:29:38.371792", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Delivery Note - Return Trip", + "owner": "Administrator", + "print_format_builder": 1, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/Fuel Report/fuel_report.js b/csf_tz/fleet_management/report/Fuel Report/fuel_report.js new file mode 100644 index 0000000..780bef6 --- /dev/null +++ b/csf_tz/fleet_management/report/Fuel Report/fuel_report.js @@ -0,0 +1,10 @@ +frappe.query_reports["Fuel Report"] = { + "filters": [ + { + "fieldname":"Vehicle", + "label": __("Vehicle"), + "fieldtype": "Link", + "width": "60px" + } + ] +} diff --git a/csf_tz/fleet_management/report/Fuel Report/fuel_report.py b/csf_tz/fleet_management/report/Fuel Report/fuel_report.py new file mode 100644 index 0000000..4f8d094 --- /dev/null +++ b/csf_tz/fleet_management/report/Fuel Report/fuel_report.py @@ -0,0 +1,304 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +from erpnext.accounts.utils import get_account_currency + +def execute(filters=None): + account_details = {} + for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1): + account_details.setdefault(acc.name, acc) + + validate_filters(filters, account_details) + + validate_party(filters) + + filters = set_account_currency(filters) + + columns = get_columns(filters) + + res = get_result(filters, account_details) + + return columns, res + +def validate_filters(filters, account_details): + if not filters.get('company'): + frappe.throw(_('{0} is mandatory').format(_('Company'))) + + if filters.get("account") and not account_details.get(filters.account): + frappe.throw(_("Account {0} does not exists").format(filters.account)) + + if filters.get("account") and filters.get("group_by_account") \ + and account_details[filters.account].is_group == 0: + frappe.throw(_("Can not filter based on Account, if grouped by Account")) + + if filters.get("voucher_no") and filters.get("group_by_voucher"): + frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher")) + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date")) + + +def validate_party(filters): + party_type, party = filters.get("party_type"), filters.get("party") + + if party: + if not party_type: + frappe.throw(_("To filter based on Party, select Party Type first")) + elif not frappe.db.exists(party_type, party): + frappe.throw(_("Invalid {0}: {1}").format(party_type, party)) + +def set_account_currency(filters): + if not (filters.get("account") or filters.get("party")): + return filters + else: + filters["company_currency"] = frappe.db.get_value("Company", filters.company, "default_currency") + account_currency = None + + if filters.get("account"): + account_currency = get_account_currency(filters.account) + elif filters.get("party"): + gle_currency = frappe.db.get_value("GL Entry", {"party_type": filters.party_type, + "party": filters.party, "company": filters.company}, "account_currency") + if gle_currency: + account_currency = gle_currency + else: + account_currency = None if filters.party_type == "Employee" else \ + frappe.db.get_value(filters.party_type, filters.party, "default_currency") + + filters["account_currency"] = account_currency or filters.company_currency + + if filters.account_currency != filters.company_currency: + filters["show_in_account_currency"] = 1 + + return filters + +def get_columns(filters): + columns = [ + _("Posting Date") + ":Date:90", _("Account") + ":Link/Account:200", + _("Debit") + ":Float:100", _("Credit") + ":Float:100" + ] + + if filters.get("show_in_account_currency"): + columns += [ + _("Debit") + " (" + filters.account_currency + ")" + ":Float:100", + _("Credit") + " (" + filters.account_currency + ")" + ":Float:100" + ] + + columns += [ + _("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160", + _("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150", + _("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100", + _("Against Voucher Type") + "::120", _("Against Voucher") + ":Dynamic Link/"+_("Against Voucher Type")+":160", + _("Remarks") + "::400" + ] + + return columns + +def get_result(filters, account_details): + gl_entries = get_gl_entries(filters) + + data = get_data_with_opening_closing(filters, account_details, gl_entries) + + result = get_result_as_list(data, filters) + + return result + +def get_gl_entries(filters): + select_fields = """, sum(debit_in_account_currency) as debit_in_account_currency, + sum(credit_in_account_currency) as credit_in_account_currency""" \ + if filters.get("show_in_account_currency") else "" + + group_by_condition = "group by voucher_type, voucher_no, account, cost_center" \ + if filters.get("group_by_voucher") else "group by name" + + gl_entries = frappe.db.sql(""" + select + posting_date, account, party_type, party, + sum(debit) as debit, sum(credit) as credit, + voucher_type, voucher_no, cost_center, project, + against_voucher_type, against_voucher, + remarks, against, is_opening {select_fields} + from `tabGL Entry` + where company=%(company)s {conditions} + {group_by_condition} + order by posting_date, account"""\ + .format(select_fields=select_fields, conditions=get_conditions(filters), + group_by_condition=group_by_condition), filters, as_dict=1) + + return gl_entries + +def get_conditions(filters): + conditions = [] + if filters.get("account"): + lft, rgt = frappe.db.get_value("Account", filters["account"], ["lft", "rgt"]) + conditions.append("""account in (select name from tabAccount + where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt)) + + if filters.get("voucher_no"): + conditions.append("voucher_no=%(voucher_no)s") + + if filters.get("party_type"): + conditions.append("party_type=%(party_type)s") + + if filters.get("party"): + conditions.append("party=%(party)s") + + if not (filters.get("account") or filters.get("party") or filters.get("group_by_account")): + conditions.append("posting_date >=%(from_date)s") + + if filters.get("project"): + conditions.append("project=%(project)s") + + from frappe.desk.reportview import build_match_conditions + match_conditions = build_match_conditions("GL Entry") + if match_conditions: conditions.append(match_conditions) + + return "and {}".format(" and ".join(conditions)) if conditions else "" + +def get_data_with_opening_closing(filters, account_details, gl_entries): + data = [] + gle_map = initialize_gle_map(gl_entries) + + opening, total_debit, total_credit, opening_in_account_currency, total_debit_in_account_currency, \ + total_credit_in_account_currency, gle_map = get_accountwise_gle(filters, gl_entries, gle_map) + + # Opening for filtered account + if filters.get("account") or filters.get("party"): + data += [get_balance_row(_("Opening"), opening, opening_in_account_currency), {}] + + if filters.get("group_by_account"): + for acc, acc_dict in gle_map.items(): + if acc_dict.entries: + # Opening for individual ledger, if grouped by account + data.append(get_balance_row(_("Opening"), acc_dict.opening, + acc_dict.opening_in_account_currency)) + + data += acc_dict.entries + + # Totals and closing for individual ledger, if grouped by account + account_closing = acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit + account_closing_in_account_currency = acc_dict.opening_in_account_currency \ + + acc_dict.total_debit_in_account_currency - acc_dict.total_credit_in_account_currency + + data += [{"account": "'" + _("Totals") + "'", "debit": acc_dict.total_debit, + "credit": acc_dict.total_credit}, + get_balance_row(_("Closing (Opening + Totals)"), + account_closing, account_closing_in_account_currency), {}] + + else: + for gl in gl_entries: + if gl.posting_date >= getdate(filters.from_date) and gl.posting_date <= getdate(filters.to_date) \ + and gl.is_opening == "No": + data.append(gl) + + + # Total debit and credit between from and to date + if total_debit or total_credit: + data.append({ + "account": "'" + _("Totals") + "'", + "debit": total_debit, + "credit": total_credit, + "debit_in_account_currency": total_debit_in_account_currency, + "credit_in_account_currency": total_credit_in_account_currency + }) + + # Closing for filtered account + if filters.get("account") or filters.get("party"): + closing = opening + total_debit - total_credit + closing_in_account_currency = opening_in_account_currency + \ + total_debit_in_account_currency - total_credit_in_account_currency + + data.append(get_balance_row(_("Closing (Opening + Totals)"), + closing, closing_in_account_currency)) + + return data + +def initialize_gle_map(gl_entries): + gle_map = frappe._dict() + for gle in gl_entries: + gle_map.setdefault(gle.account, frappe._dict({ + "opening": 0, + "opening_in_account_currency": 0, + "entries": [], + "total_debit": 0, + "total_debit_in_account_currency": 0, + "total_credit": 0, + "total_credit_in_account_currency": 0, + "closing": 0, + "closing_in_account_currency": 0 + })) + return gle_map + +def get_accountwise_gle(filters, gl_entries, gle_map): + opening, total_debit, total_credit = 0, 0, 0 + opening_in_account_currency, total_debit_in_account_currency, total_credit_in_account_currency = 0, 0, 0 + + from_date, to_date = getdate(filters.from_date), getdate(filters.to_date) + for gle in gl_entries: + amount = flt(gle.debit, 3) - flt(gle.credit, 3) + amount_in_account_currency = flt(gle.debit_in_account_currency, 3) - flt(gle.credit_in_account_currency, 3) + + if (filters.get("account") or filters.get("party") or filters.get("group_by_account")) \ + and (gle.posting_date < from_date or cstr(gle.is_opening) == "Yes"): + + gle_map[gle.account].opening += amount + if filters.get("show_in_account_currency"): + gle_map[gle.account].opening_in_account_currency += amount_in_account_currency + + if filters.get("account") or filters.get("party"): + opening += amount + if filters.get("show_in_account_currency"): + opening_in_account_currency += amount_in_account_currency + + elif gle.posting_date <= to_date: + gle_map[gle.account].entries.append(gle) + gle_map[gle.account].total_debit += flt(gle.debit, 3) + gle_map[gle.account].total_credit += flt(gle.credit, 3) + + total_debit += flt(gle.debit, 3) + total_credit += flt(gle.credit, 3) + + if filters.get("show_in_account_currency"): + gle_map[gle.account].total_debit_in_account_currency += flt(gle.debit_in_account_currency, 3) + gle_map[gle.account].total_credit_in_account_currency += flt(gle.credit_in_account_currency, 3) + + total_debit_in_account_currency += flt(gle.debit_in_account_currency, 3) + total_credit_in_account_currency += flt(gle.credit_in_account_currency, 3) + + return opening, total_debit, total_credit, opening_in_account_currency, \ + total_debit_in_account_currency, total_credit_in_account_currency, gle_map + +def get_balance_row(label, balance, balance_in_account_currency=None): + balance_row = { + "account": "'" + label + "'", + "debit": balance if balance > 0 else 0, + "credit": -1*balance if balance < 0 else 0 + } + + if balance_in_account_currency != None: + balance_row.update({ + "debit_in_account_currency": balance_in_account_currency if balance_in_account_currency > 0 else 0, + "credit_in_account_currency": -1*balance_in_account_currency if balance_in_account_currency < 0 else 0 + }) + + return balance_row + +def get_result_as_list(data, filters): + result = [] + for d in data: + row = [d.get("posting_date"), d.get("account"), d.get("debit"), d.get("credit")] + + if filters.get("show_in_account_currency"): + row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")] + + row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"), + d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("against_voucher_type"), d.get("against_voucher"), d.get("remarks") + ] + + result.append(row) + + return result diff --git a/csf_tz/fleet_management/report/__init__.py b/csf_tz/fleet_management/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/daily_customer_report___transport/__init__.py b/csf_tz/fleet_management/report/daily_customer_report___transport/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.js b/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.js new file mode 100644 index 0000000..742be2a --- /dev/null +++ b/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.js @@ -0,0 +1,14 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Daily Customer Report - Transport"] = { + "filters": [ + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + } + ] +} diff --git a/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.json b/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.json new file mode 100644 index 0000000..1cc8675 --- /dev/null +++ b/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.json @@ -0,0 +1,35 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2017-12-21 18:34:00.441959", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:25:59.028330", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Daily Customer Report - Transport", + "owner": "Administrator", + "ref_doctype": "Vehicle Trip", + "report_name": "Daily Customer Report - Transport", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Import Key Account Manager" + }, + { + "role": "Fleet Coordinator" + }, + { + "role": "Fleet Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.py b/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.py new file mode 100644 index 0000000..cc814f5 --- /dev/null +++ b/csf_tz/fleet_management/report/daily_customer_report___transport/daily_customer_report___transport.py @@ -0,0 +1,426 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "file_number", + "label": _("File No"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "client", + "label": _("Client"), + "fieldtype": "Link", + "options": "Customer", + "width": 150 + }, + { + "fieldname": "order_date", + "label": _("Order Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "transporter_name", + "label": _("Transporter Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "fleet_number", + "label": _("Fleet Number"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "vehicle_plate_number", + "label": _("Truck"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "trailer_plate_number", + "label": _("Trailer"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "loading_capacity", + "label": _("Loading Capacity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "cargo_type", + "label": _("Cargo Type"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "cargo_reference", + "label": _("Cargo Ref"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "weight", + "label": _("Weight"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "driver_name", + "label": _("Driver Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "passport_number", + "label": _("Passport Number"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "drivers_licence", + "label": _("Drivers Licence"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "contact_no", + "label": _("Contact Number"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "loading_point_arrival_date", + "label": _("Loading Point Arrival date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "loading_date", + "label": _("Loading Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "loading_point_dispatch_date", + "label": _("Loading Point Dispatch date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "border_arrival_date", + "label": _("Border Arrival date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "border_dispatch_date", + "label": _("Border Dispatch Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "destination_arrival_date", + "label": _("Destination Arrival Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "offloading_date", + "label": _("Offloading Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "offloading_weight", + "label": _("Offloaded Weight"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "offloading_ref", + "label": _("Offloading Ref"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "vehicle_position", + "label": _("Vehicle Position"), + "fieldtype": "data", + "width": 150 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "data", + "width": 150 + } + ] + + today = datetime.date.today().strftime("%Y-%m-%d") + yesterday = datetime.date.today() - datetime.timedelta(1) + day_before = datetime.date.today() - datetime.timedelta(2) + yesterday = yesterday.strftime("%Y-%m-%d") + day_before = day_before.strftime("%Y-%m-%d") + + main_where = '' + return_where = '' + where_filter = {'today': today, 'yesterday': yesterday, 'day_before': day_before} + if filters.customer: + #For main trip + main_where = ' AND `tabVehicle Trip`.main_customer = %(customer)s' + where_filter.update({'customer': filters.customer}) + #For return trip + return_where = ' AND `tabVehicle Trip`.return_customer = %(customer)s' + + + data_main = frappe.db.sql('''SELECT + `tabVehicle Trip`.name AS file_number, + `tabVehicle Trip`.main_customer AS client, + `tabTransport Request`.request_received AS order_date, + CASE + WHEN `tabVehicle Trip`.transporter_type = 'Bravo' THEN 'Bravo Logistics' + WHEN `tabVehicle Trip`.transporter_type = 'Sub-Contractor' THEN `tabVehicle Trip`.sub_contractor + END AS transporter_name, + `tabVehicle Trip`.vehicle_plate_number, + `tabVehicle Trip`.trailer_plate_number, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + `tabVehicle Trip`.main_cargo_type + END AS cargo_type, + `tabVehicle Trip`.main_goods_description AS cargo, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + (SELECT `tabCargo Details`.container_number FROM `tabCargo Details` WHERE parenttype = 'Vehicle Trip' \ + AND parent = `tabVehicle Trip`.name AND parentfield = 'main_cargo' LIMIT 1) + END AS cargo_reference, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Container' THEN + (SELECT SUM(`tabCargo Details`.net_weight) FROM `tabCargo Details` WHERE `tabCargo Details`.parent = `tabVehicle Trip`.name \ + AND `tabCargo Details`.parenttype = 'Vehicle Trip' AND `tabCargo Details`.parentfield = 'main_cargo') + ELSE `tabVehicle Trip`.main_loose_net_weight + END AS weight, + `tabVehicle Trip`.driver_name, + `tabVehicle Trip`.passport_number, + `tabVehicle Trip`.main_offloading_weight AS offloading_weight, + (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE parent = `tabVehicle Trip`.name + AND parenttype = 'Vehicle Trip' AND parentfield = 'main_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp LIMIT 1) AS vehicle_position, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Vehicle Trip' \ + AND `tabReporting Status Table`.parent = `tabVehicle Trip`.name AND `tabReporting Status Table`.parentfield = 'main_reporting_status' \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks + FROM + `tabVehicle Trip` + LEFT JOIN + `tabTransport Assignment` ON `tabVehicle Trip`.reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabTransport Request` ON `tabTransport Request`.name = `tabTransport Assignment`.parent + WHERE + `tabVehicle Trip`.reference_doctype IS NOT NULL AND `tabVehicle Trip`.reference_docname IS NOT NULL ''' + main_where + + ''' + AND `tabVehicle Trip`.status = 'En Route' ''', where_filter, as_dict=1) + + data_return = frappe.db.sql(''' SELECT + `tabVehicle Trip`.name AS file_number, + `tabVehicle Trip`.return_customer AS client, + `tabTransport Request`.request_received AS order_date, + CASE + WHEN `tabVehicle Trip`.transporter_type = 'Bravo' THEN 'Bravo Logistics' + WHEN `tabVehicle Trip`.transporter_type = 'Sub-Contractor' THEN `tabVehicle Trip`.sub_contractor + END AS transporter_name, + `tabVehicle Trip`.vehicle_plate_number, + `tabVehicle Trip`.trailer_plate_number, + CASE + WHEN `tabVehicle Trip`.return_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + `tabVehicle Trip`.return_cargo_type + END AS cargo_type, + `tabVehicle Trip`.return_goods_description AS cargo, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + (SELECT `tabCargo Details`.container_number FROM `tabCargo Details` WHERE parenttype = 'Vehicle Trip' \ + AND parent = `tabVehicle Trip`.name AND parentfield = 'return_cargo' LIMIT 1) + END AS cargo_reference, + CASE + WHEN `tabVehicle Trip`.return_cargo_type = 'Container' THEN + (SELECT SUM(`tabCargo Details`.net_weight) FROM `tabCargo Details` WHERE `tabCargo Details`.parent = `tabVehicle Trip`.name \ + AND `tabCargo Details`.parenttype = 'Vehicle Trip' AND `tabCargo Details`.parentfield = 'return_cargo') + ELSE `tabVehicle Trip`.return_loose_net_weight + END AS weight, + `tabVehicle Trip`.driver_name, + `tabVehicle Trip`.passport_number, + `tabVehicle Trip`.return_offloading_weight AS offloading_weight, + (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE parent = `tabVehicle Trip`.name + AND parenttype = 'Vehicle Trip' AND parentfield = 'return_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp LIMIT 1) AS vehicle_position, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Vehicle Trip' \ + AND `tabReporting Status Table`.parent = `tabVehicle Trip`.name AND `tabReporting Status Table`.parentfield = 'return_reporting_status' \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks + FROM + `tabVehicle Trip` + LEFT JOIN + `tabTransport Assignment` ON `tabVehicle Trip`.reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabTransport Request` ON `tabTransport Request`.name = `tabTransport Assignment`.parent + WHERE + `tabVehicle Trip`.return_reference_doctype IS NOT NULL AND `tabVehicle Trip`.return_reference_docname IS NOT NULL ''' + + return_where + ''' + AND `tabVehicle Trip`.status = 'En Route - Returning' ''', where_filter, as_dict=1) + + + data_offloaded_main = frappe.db.sql('''SELECT + `tabVehicle Trip`.name AS file_number, + `tabVehicle Trip`.main_customer AS client, + `tabTransport Request`.request_received AS order_date, + CASE + WHEN `tabVehicle Trip`.transporter_type = 'Bravo' THEN 'Bravo Logistics' + WHEN `tabVehicle Trip`.transporter_type = 'Sub-Contractor' THEN `tabVehicle Trip`.sub_contractor + END AS transporter_name, + `tabVehicle Trip`.vehicle_plate_number, + `tabVehicle Trip`.trailer_plate_number, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + `tabVehicle Trip`.main_cargo_type + END AS cargo_type, + `tabVehicle Trip`.main_goods_description AS cargo, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + (SELECT `tabCargo Details`.container_number FROM `tabCargo Details` WHERE parenttype = 'Vehicle Trip' \ + AND parent = `tabVehicle Trip`.name AND parentfield = 'main_cargo' LIMIT 1) + END AS cargo_reference, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Container' THEN + (SELECT SUM(`tabCargo Details`.net_weight) FROM `tabCargo Details` WHERE `tabCargo Details`.parent = `tabVehicle Trip`.name \ + AND `tabCargo Details`.parenttype = 'Vehicle Trip' AND `tabCargo Details`.parentfield = 'main_cargo') + ELSE `tabVehicle Trip`.main_loose_net_weight + END AS weight, + `tabVehicle Trip`.driver_name, + `tabVehicle Trip`.passport_number, + `tabVehicle Trip`.main_offloading_weight AS offloading_weight, + (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE parent = `tabVehicle Trip`.name + AND parenttype = 'Vehicle Trip' AND parentfield = 'main_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp LIMIT 1) AS vehicle_position, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Vehicle Trip' \ + AND `tabReporting Status Table`.parent = `tabVehicle Trip`.name AND `tabReporting Status Table`.parentfield = 'main_reporting_status' \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks + FROM + `tabVehicle Trip` + LEFT JOIN + `tabTransport Assignment` ON `tabVehicle Trip`.reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabTransport Request` ON `tabTransport Request`.name = `tabTransport Assignment`.parent + WHERE + `tabVehicle Trip`.name IN (SELECT parent FROM `tabRoute Steps Table` WHERE parenttype = 'Vehicle Trip' AND parentfield = 'main_route_steps' AND offloading_date IN (%(today)s, %(yesterday)s, %(day_before)s)) ''' + main_where + + ''' + AND `tabVehicle Trip`.status = 'En Route' ''', where_filter, as_dict=1) + + + data_offloaded_return = frappe.db.sql(''' SELECT + `tabVehicle Trip`.name AS file_number, + `tabVehicle Trip`.return_customer AS client, + `tabTransport Request`.request_received AS order_date, + CASE + WHEN `tabVehicle Trip`.transporter_type = 'Bravo' THEN 'Bravo Logistics' + WHEN `tabVehicle Trip`.transporter_type = 'Sub-Contractor' THEN `tabVehicle Trip`.sub_contractor + END AS transporter_name, + `tabVehicle Trip`.vehicle_plate_number, + `tabVehicle Trip`.trailer_plate_number, + CASE + WHEN `tabVehicle Trip`.return_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + `tabVehicle Trip`.return_cargo_type + END AS cargo_type, + `tabVehicle Trip`.return_goods_description AS cargo, + CASE + WHEN `tabVehicle Trip`.main_cargo_type = 'Loose Cargo' THEN 'Loose' + ELSE + (SELECT `tabCargo Details`.container_number FROM `tabCargo Details` WHERE parenttype = 'Vehicle Trip' \ + AND parent = `tabVehicle Trip`.name AND parentfield = 'return_cargo' LIMIT 1) + END AS cargo_reference, + CASE + WHEN `tabVehicle Trip`.return_cargo_type = 'Container' THEN + (SELECT SUM(`tabCargo Details`.net_weight) FROM `tabCargo Details` WHERE `tabCargo Details`.parent = `tabVehicle Trip`.name \ + AND `tabCargo Details`.parenttype = 'Vehicle Trip' AND `tabCargo Details`.parentfield = 'return_cargo') + ELSE `tabVehicle Trip`.return_loose_net_weight + END AS weight, + `tabVehicle Trip`.driver_name, + `tabVehicle Trip`.passport_number, + `tabVehicle Trip`.return_offloading_weight AS offloading_weight, + (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE parent = `tabVehicle Trip`.name + AND parenttype = 'Vehicle Trip' AND parentfield = 'return_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp LIMIT 1) AS vehicle_position, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE `tabReporting Status Table`.parenttype = 'Vehicle Trip' \ + AND `tabReporting Status Table`.parent = `tabVehicle Trip`.name AND `tabReporting Status Table`.parentfield = 'return_reporting_status' \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) AS remarks + FROM + `tabVehicle Trip` + LEFT JOIN + `tabTransport Assignment` ON `tabVehicle Trip`.reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabTransport Request` ON `tabTransport Request`.name = `tabTransport Assignment`.parent + WHERE + `tabVehicle Trip`.name IN (SELECT parent FROM `tabRoute Steps Table` WHERE parenttype = 'Vehicle Trip' AND parentfield = 'return_route_steps' AND offloading_date IN (%(today)s, %(yesterday)s, %(day_before)s)) ''' + + return_where + ''' + AND `tabVehicle Trip`.status = 'En Route - Returning' ''', where_filter, as_dict=1) + + data_main = get_trip_data(data_main) + data_return = get_trip_data(data_return, True) + data_offloaded_main = get_trip_data(data_offloaded_main) + data_offloaded_return = get_trip_data(data_offloaded_return, True) + + data = data_main + data_return + data_offloaded_main + data_offloaded_return + + data = sorted(data, key=lambda k: k['file_number']) + + return columns, data + +def get_trip_data(trip_data, return_trip=False): + if trip_data: + for d in trip_data: + trip = frappe.get_doc('Vehicle Trip', d.file_number) + route_steps = [] + if return_trip: + route_steps = trip.return_route_steps + else: + route_steps = trip.main_route_steps + + for step in route_steps: + loading_point, border, offloading_point = False, False, False + if step.location_type and step.location_type.upper() == 'LOADING POINT' and not loading_point: + d['loading_point_arrival_date'] = step.get("arrival_date") + d['loading_date'] = step.get("loading_date") + d['loading_point_dispatch_date'] = step.get("departure_date") + loading_point = True + elif step.location_type and step.location_type.upper() == 'BORDER' and not border: + d['border_arrival_date'] = step.get("arrival_date") + d['border_dispatch_date'] = step.get("departure_date") + border = True + elif step.location_type and step.location_type.upper() == 'OFFLOADING POINT' and not offloading_point: + d['offloading_date'] = step.get('offloading_date') + d['destination_arrival_date'] = step.get('arrival_date') + offloading_point = True + + + return trip_data diff --git a/csf_tz/fleet_management/report/fuel_report/__init__.py b/csf_tz/fleet_management/report/fuel_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/fuel_report/fuel_report.js b/csf_tz/fleet_management/report/fuel_report/fuel_report.js new file mode 100644 index 0000000..3c97712 --- /dev/null +++ b/csf_tz/fleet_management/report/fuel_report/fuel_report.js @@ -0,0 +1,38 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Fuel Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"vehicle", + "label": __("Vehicle"), + "fieldtype": "Link", + "options": "Vehicle" + }, + { + "fieldname":"disburcement_type", + "label": __("Disburcement Type"), + "fieldtype": "Select", + "options": "\nFrom Supplier\nCash", + "default": "" + } + ] +} diff --git a/csf_tz/fleet_management/report/fuel_report/fuel_report.json b/csf_tz/fleet_management/report/fuel_report/fuel_report.json new file mode 100644 index 0000000..5ab5c56 --- /dev/null +++ b/csf_tz/fleet_management/report/fuel_report/fuel_report.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2017-10-09 12:57:57.317898", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-09-25 18:45:50.070204", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Fuel Report", + "owner": "Administrator", + "query": "SELECT\n\t`tabFuel Request`.reference_docname AS \"Vehicle Trip:Link/Vehicle Trip:100\",\n\t`tabVehicle Trip`.vehicle AS \"Vehicle:Link/Vehicle:100\",\n\t`tabFuel Request Table`.fuel_type AS \"Fuel Type:Data:100\",\n\t`tabFuel Request Table`.quantity AS \"Quantity(Litres):Float:100\",\n\t`tabFuel Request Table`.disburcement_type AS \"Disburcement Type:Select/From Supplier,Cash:150\",\n\t`tabFuel Request Table`.supplier AS \"Supplier:Link/Supplier:150\",\n\t`tabFuel Request`.name AS \"Fuel Request:Link/Fuel Request:150\"\nFROM\n\t`tabFuel Request`\nLEFT JOIN\n\t`tabVehicle Trip` ON `tabFuel Request`.reference_docname = `tabVehicle Trip`.name\nLEFT JOIN\n\t`tabFuel Request Table` ON `tabFuel Request`.reference_docname = `tabFuel Request Table`.parent", + "ref_doctype": "Fuel Request", + "report_name": "Fuel Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Fleet Manager" + }, + { + "role": "Fleet Coordinator" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/fuel_report/fuel_report.py b/csf_tz/fleet_management/report/fuel_report/fuel_report.py new file mode 100644 index 0000000..25c2e47 --- /dev/null +++ b/csf_tz/fleet_management/report/fuel_report/fuel_report.py @@ -0,0 +1,108 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "reference_docname", + "label": _("Reference"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "vehicle", + "label": _("Vehicle"), + "fieldtype": "Link", + "options": "Vehicle", + "width": 100 + }, + { + "fieldname": "fuel_type", + "label": _("Fuel Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "quantity", + "label": _("Quantity (Litres)"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "cost_per_litre", + "label": _("Cost Per Litre"), + "fieldtype": "Currency", + "width": 150, + "options": "currency" + }, + { + "fieldname": "disburcement_type", + "label": _("Disburcement Type"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "supplier", + "label": _("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + "width": 150 + }, + { + "fieldname": "fuel_request", + "label": _("Fuel Request"), + "fieldtype": "Link", + "options": "Fuel Request", + "width": 150 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where = " WHERE approved_date BETWEEN %(from_date)s AND %(to_date)s " + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date} + if filters.vehicle: + where += 'AND vehicle = %(vehicle)s' + where_filter.update({"vehicle": filters.vehicle}) + + if filters.disburcement_type: + where += ' AND disburcement_type = %(disburcement_type)s' + where_filter.update({"disburcement_type": filters.disburcement_type}) + + data = frappe.db.sql('''SELECT + `tabFuel Request`.reference_docname, + `tabVehicle Trip`.vehicle, + `tabFuel Request Table`.fuel_type, + `tabFuel Request Table`.quantity, + `tabFuel Request Table`.cost_per_litre, + `tabFuel Request Table`.disburcement_type, + `tabFuel Request Table`.supplier, + `tabFuel Request`.name AS fuel_request + FROM + `tabFuel Request` + LEFT JOIN + `tabVehicle Trip` ON `tabFuel Request`.reference_docname = `tabVehicle Trip`.name + LEFT JOIN + `tabFuel Request Table` ON `tabFuel Request`.reference_docname = `tabFuel Request Table`.parent + ''' + where, where_filter, as_dict=1) + return columns, data diff --git a/csf_tz/fleet_management/report/transport_assignment_report/__init__.py b/csf_tz/fleet_management/report/transport_assignment_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.js b/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.js new file mode 100644 index 0000000..55abb4f --- /dev/null +++ b/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.js @@ -0,0 +1,32 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Transport Assignment Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + "default": "" + } + ] +} diff --git a/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.json b/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.json new file mode 100644 index 0000000..64ab87b --- /dev/null +++ b/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-02-27 13:00:50.054825", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-27 13:00:50.054825", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Transport Assignment Report", + "owner": "Administrator", + "ref_doctype": "Transport Assignment", + "report_name": "Transport Assignment Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Fleet Coordinator" + }, + { + "role": "Fleet Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.py b/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.py new file mode 100644 index 0000000..1ad0af4 --- /dev/null +++ b/csf_tz/fleet_management/report/transport_assignment_report/transport_assignment_report.py @@ -0,0 +1,256 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +import ast +import datetime +import time + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "trip_no", + "label": _("Trip No"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "tcustomer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 100 + }, + { + "fieldname": "fleet_no", + "label": _("Fleet No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "truck_no", + "label": _("Truck No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "trailer_no", + "label": _("Trailer No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "driver", + "label": _("Driver"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "contact_no", + "label": _("Contact Number"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "passport_no", + "label": _("Passport Number"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "driving_licence", + "label": _("Driving Licence"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo_description", + "label": _("Cargo Description"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "quantity", + "label": _("Quantity"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "loading_date", + "label": _("Loading Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "departure_date", + "label": _("Departure Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "eta_border", + "label": _("ETA Border"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "ata_border", + "label": _("ATA Border"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "departure_border", + "label": _("Departure Border"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "days_at_border", + "label": _("Days at Border"), + "fieldtype": "Int", + "width": 100 + }, + { + "fieldname": "offloading_date", + "label": _("Offloading Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "trip_days", + "label": _("Trip Days"), + "fieldtype": "Int", + "width": 100 + }, + { + "fieldname": "current_position", + "label": _("Current Position"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "remarks", + "label": _("Remarks"), + "fieldtype": "Data", + "width": 200 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + having = '' + if filters.customer: + having = 'HAVING tcustomer = %(customer)s' + + data = frappe.db.sql('''SELECT + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.name + WHEN return_trip.name IS NOT NULL THEN return_trip.name + END AS trip_no, + CASE + WHEN transport_request.name IS NOT NULL THEN transport_request.customer + WHEN import_request.name IS NOT NULL THEN import_request.customer + END AS tcustomer, + `tabVehicle`.fleet_number AS fleet_no, + `tabTransport Assignment`.vehicle_plate_number AS truck_no, + `tabTransport Assignment`.trailer_plate_number AS trailer_no, + `tabTransport Assignment`.driver_name AS driver, + `tabTransport Assignment`.passport_number AS passport_no, + CASE + WHEN transport_request.name IS NOT NULL THEN transport_request.cargo_description + WHEN import_request.name IS NOT NULL THEN import_request.cargo_description + END AS cargo_description, + CASE + WHEN transport_request.name IS NOT NULL AND transport_request.cargo_type = 'Container' AND \ + `tabCargo Details`.net_weight IS NOT NULL AND `tabCargo Details`.net_weight > 0 \ + THEN (`tabCargo Details`.net_weight /1000) \ + WHEN transport_request.name IS NOT NULL AND transport_request.cargo_type = 'Loose Cargo' AND transport_request.unit = 'TONNES' + THEN `tabTransport Assignment`.amount + WHEN import_request.name IS NOT NULL AND import_request.cargo_type = 'Container' AND \ + `tabCargo Details`.net_weight IS NOT NULL AND `tabCargo Details`.net_weight > 0 \ + THEN (`tabCargo Details`.net_weight/1000) \ + WHEN import_request.name IS NOT NULL AND import_request.cargo_type = 'Loose Cargo' AND import_request.unit = 'TONNES' + THEN `tabTransport Assignment`.amount + END AS quantity, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT loading_date FROM `tabRoute Steps Table` WHERE parent = main_trip.name \ + AND parentfield = 'main_route_steps' AND loading_date IS NOT NULL LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT loading_date FROM `tabRoute Steps Table` WHERE parent = return_trip.name \ + AND parentfield = 'return_route_steps' AND loading_date IS NOT NULL LIMIT 1) + END AS loading_date, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT departure_date FROM `tabRoute Steps Table` WHERE parent = main_trip.name \ + AND parentfield = 'main_route_steps' AND departure_date IS NOT NULL LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT departure_date FROM `tabRoute Steps Table` WHERE parent = return_trip.name \ + AND parentfield = 'return_route_steps' AND departure_date IS NOT NULL LIMIT 1) + END AS departure_date, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT arrival_date FROM `tabRoute Steps Table` WHERE parent = main_trip.name \ + AND parentfield = 'main_route_steps' AND location_type = 'BORDER' ORDER BY arrival_date ASC LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT arrival_date FROM `tabRoute Steps Table` WHERE parent = return_trip.name \ + AND parentfield = 'return_route_steps' AND location_type = 'BORDER' ORDER BY arrival_date ASC LIMIT 1) + END AS ata_border, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT departure_date FROM `tabRoute Steps Table` WHERE parent = main_trip.name \ + AND parentfield = 'main_route_steps' AND location_type = 'BORDER' ORDER BY departure_date ASC LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT departure_date FROM `tabRoute Steps Table` WHERE parent = return_trip.name \ + AND parentfield = 'return_route_steps' AND location_type = 'BORDER' ORDER BY departure_date ASC LIMIT 1) + END AS departure_border, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT offloading_date FROM `tabRoute Steps Table` WHERE parent = main_trip.name \ + AND parentfield = 'main_route_steps' AND offloading_date IS NOT NULL LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT offloading_date FROM `tabRoute Steps Table` WHERE parent = return_trip.name \ + AND parentfield = 'return_route_steps' AND offloading_date IS NOT NULL LIMIT 1) + END AS offloading_date, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE \ + parent = main_trip.name AND parenttype = 'Vehicle Trip' AND parentfield = 'main_location_update' ORDER BY \ + `tabVehicle Trip Location Update`.timestamp LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT `tabVehicle Trip Location Update`.location FROM `tabVehicle Trip Location Update` WHERE \ + parent = return_trip.name AND parenttype = 'Vehicle Trip' AND parentfield = 'return_location_update' ORDER BY \ + `tabVehicle Trip Location Update`.timestamp LIMIT 1) + END AS current_position, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = main_trip.name AND \ + `tabReporting Status Table`.parentfield = 'main_reporting_status' ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = return_trip.name AND \ + `tabReporting Status Table`.parentfield = 'return_reporting_status' ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + END AS remarks + FROM + `tabTransport Assignment` + LEFT JOIN + `tabVehicle Trip` AS main_trip ON main_trip.reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabVehicle Trip` AS return_trip ON return_trip.return_reference_docname = `tabTransport Assignment`.name + LEFT JOIN + `tabTransport Request` AS transport_request ON transport_request.name = `tabTransport Assignment`.parent AND \ + `tabTransport Assignment`.parenttype = 'Transport Request' + LEFT JOIN + `tabTransport Request` AS import_request ON import_request.reference_docname = `tabTransport Assignment`.parent AND \ + `tabTransport Assignment`.parenttype = 'Import' AND import_request.file_number IS NOT NULL + LEFT JOIN + `tabVehicle` ON `tabVehicle`.name = `tabTransport Assignment`.assigned_vehicle AND `tabTransport Assignment`.transporter_type = 'Bravo' + LEFT JOIN + `tabCargo Details` ON `tabCargo Details`.container_number = `tabTransport Assignment`.container_number AND \ + `tabCargo Details`.parent = `tabTransport Assignment`.parent + WHERE + `tabTransport Assignment`.expected_loading_date BETWEEN %(from_date)s AND %(to_date)s ''' + having + , {"from_date": filters.from_date, "to_date": filters.to_date, "customer": filters.customer}, as_dict=1) + + for row in data: + if row.ata_border and row.departure_border: + row.update({"days_at_border": (row.ata_border-row.departure_border).days}) + + if row.loading_date and row.offloading_date: + row.update({"trip_days": (row.offloading_date-row.loading_date).days}) + + return columns, data diff --git a/csf_tz/fleet_management/report/trip_report/__init__.py b/csf_tz/fleet_management/report/trip_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/trip_report/trip_report.js b/csf_tz/fleet_management/report/trip_report/trip_report.js new file mode 100644 index 0000000..bd1df32 --- /dev/null +++ b/csf_tz/fleet_management/report/trip_report/trip_report.js @@ -0,0 +1,32 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Trip Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"status", + "label": __("Status"), + "fieldtype": "Select", + "options": "\nEn Route\nMain Trip Offloaded\nEn Route - Returning\nReturn Trip Offloaded", + "default": "" + } + ] +} diff --git a/csf_tz/fleet_management/report/trip_report/trip_report.json b/csf_tz/fleet_management/report/trip_report/trip_report.json new file mode 100644 index 0000000..910f09b --- /dev/null +++ b/csf_tz/fleet_management/report/trip_report/trip_report.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2017-08-24 17:36:06.719287", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-09-24 23:28:32.407045", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Trip Report", + "owner": "Administrator", + "query": "SELECT * FROM\n\t(SELECT\n\t\t`tabVehicle Trip`.name AS \"Reference:Link/Vehicle Trip:100\",\n\t\t'Main Trip' AS \"Trip Type:Data:100\",\n\t\t`tabVehicle Trip`.main_customer AS \"Customer:Link/Customer:200\",\n\t\t`tabVehicle Trip`.transporter_type AS \"Transporter Type:Data:100\",\n\t\t`tabVehicle Trip`.sub_contractor AS \"Sub Contractor Name:Link/Supplier:200\",\n\t\t`tabVehicle Trip`.vehicle_plate_number AS \"Vehicle:Data:100\",\n\t\t`tabVehicle Trip`.trailer_plate_number AS \"Trailer:Data:100\",\n\t\t`tabVehicle Trip`.driver_name AS \"Driver:Data:200\",\n\t\t`tabVehicle Trip`.main_cargo_category AS \"Cargo:Data:200\",\n\t\tCONCAT(`tabVehicle Trip`.main_loading_point, \"-\",`tabVehicle Trip`.main_cargo_location_city,\"-\",`tabVehicle Trip`.main_cargo_location_country) AS \"Source Location:Data:200\",\n\t\tCONCAT(`tabVehicle Trip`.main_offloading_point, \"-\",`tabVehicle Trip`.main_cargo_destination_city,\"-\",`tabVehicle Trip`.main_cargo_destination_country) AS \"Destination Location:Data:200\",\n\t\t`tabVehicle Trip`.main_eta AS \"ETA:Date:100\",\n\t\t`tabVehicle Trip`.status AS \"Status:Data:100\",\n\t\t(SELECT SUM(expense_amount) FROM `tabExpenses`\n\t\t\tWHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'USD'\n\t\t\t) AS \"Trip Expenses(USD):Float:200\",\n\t\t(SELECT SUM(expense_amount) FROM `tabExpenses`\n\t\t\tWHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'TZS'\n\t\t\t) AS \"Trip Expenses(TZS):Float:200\"\n\tFROM\n\t\t`tabVehicle Trip`\n\tWHERE \n\t\treference_doctype IS NOT NULL AND reference_docname IS NOT NULL\n\tUNION ALL\n\tSELECT\n\t\t`tabVehicle Trip`.name AS \"Reference:Link/Vehicle Trip:100\",\n\t\t'Return Trip' AS \"Trip Type:Data:100\",\n\t\t`tabVehicle Trip`.return_customer AS \"Customer:Link/Customer:200\",\n\t\t`tabVehicle Trip`.transporter_type AS \"Transporter Type:Data:100\",\n\t\t`tabVehicle Trip`.sub_contractor AS \"Sub Contractor Name:Link/Supplier:200\",\n\t\t`tabVehicle Trip`.vehicle_plate_number AS \"Vehicle:Data:100\",\n\t\t`tabVehicle Trip`.trailer_plate_number AS \"Trailer:Data:100\",\n\t\t`tabVehicle Trip`.driver_name AS \"Driver:Data:200\",\n\t\t`tabVehicle Trip`.return_cargo_category AS \"Cargo:Data:200\",\n\t\tCONCAT(`tabVehicle Trip`.return_loading_point, \"-\",`tabVehicle Trip`.return_cargo_location_city,\"-\",`tabVehicle Trip`.return_cargo_location_country) AS \"Source Location:Data:200\",\n\t\tCONCAT(`tabVehicle Trip`.return_offloading_point, \"-\",`tabVehicle Trip`.return_cargo_destination_city,\"-\",`tabVehicle Trip`.return_cargo_destination_country) AS \"Destination Location:Data:200\",\n\t\t`tabVehicle Trip`.return_eta AS \"ETA:Date:100\",\n\t\t`tabVehicle Trip`.status AS \"Status:Data:100\",\n\t\t(SELECT SUM(expense_amount) FROM `tabExpenses`\n\t\t\tWHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'USD'\n\t\t\t) AS \"Trip Expenses(USD):Float:200\",\n\t\t(SELECT SUM(expense_amount) FROM `tabExpenses`\n\t\t\tWHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'TZS'\n\t\t\t) AS \"Trip Expenses(TZS):Float:200\"\n\tFROM\n\t\t`tabVehicle Trip`\n\tWHERE \n\t\treturn_reference_doctype IS NOT NULL AND return_reference_docname IS NOT NULL\n\t) a\nORDER BY `Reference:Link/Vehicle Trip:100`", + "ref_doctype": "Vehicle Trip", + "report_name": "Trip Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Fleet Coordinator" + }, + { + "role": "Fleet Coordinator" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/trip_report/trip_report.py b/csf_tz/fleet_management/report/trip_report/trip_report.py new file mode 100644 index 0000000..a7705f4 --- /dev/null +++ b/csf_tz/fleet_management/report/trip_report/trip_report.py @@ -0,0 +1,187 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +from datetime import datetime +from frappe.desk.reportview import export_query +from frappe.desk.query_report import run +from frappe.desk.query_report import get_columns_dict +from six import string_types +import os, json +import openpyxl +from openpyxl.styles import Font +from openpyxl import load_workbook +from six import StringIO, string_types +from frappe.utils.xlsxutils import handle_html + + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label": _("Reference"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "trip_type", + "label": _("Trip Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 100 + }, + { + "fieldname": "transporter_type", + "label": _("Transporter Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "transporter_name", + "label": _("Transporter Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "vehicle_plate_number", + "label": _("Vehicle"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "trailer_plate_number", + "label": _("Trailer"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "driver_name", + "label": _("Driver"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "source_location", + "label": _("Source"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "destination_location", + "label": _("Destination"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "eta", + "label": _("ETA"), + "fieldtype": "Date", + "width": 120 + }, + { + "fieldname": "status", + "label": _("Status"), + "fieldtype": "Data", + "width": 120 + }, + { + "fieldname": "trip_expenses_usd", + "label": _("Trip Expenses (USD)"), + "fieldtype": "Float", + "width": 120 + }, + { + "fieldname": "trip_expenses_tzs", + "label": _("Trip Expenses (TZS)"), + "fieldtype": "Float", + "width": 120 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where = "" + where_filter = {"from_date": filters.from_date, "to_date": filters.to_date} + if filters.status: + where += 'AND status = %(status)s' + where_filter.update({"status": filters.status}) + + data = frappe.db.sql('''SELECT * FROM + (SELECT + `tabVehicle Trip`.name AS reference, + 'Main Trip' AS trip_type, + `tabVehicle Trip`.main_customer AS customer, + `tabVehicle Trip`.transporter_type, + CASE + WHEN `tabVehicle Trip`.transporter_type = 'Bravo' THEN 'Bravo' + ELSE `tabVehicle Trip`.sub_contractor + END AS transporter_name, + `tabVehicle Trip`.vehicle_plate_number, + `tabVehicle Trip`.trailer_plate_number, + `tabVehicle Trip`.driver_name, + `tabVehicle Trip`.main_cargo_category AS cargo, + CONCAT(`tabVehicle Trip`.main_loading_point, "-",`tabVehicle Trip`.main_cargo_location_city,"-",`tabVehicle Trip`.main_cargo_location_country) AS source_location, + CONCAT(`tabVehicle Trip`.main_offloading_point, "-",`tabVehicle Trip`.main_cargo_destination_city,"-",`tabVehicle Trip`.main_cargo_destination_country) AS destination_location, + `tabVehicle Trip`.main_eta AS eta, + `tabVehicle Trip`.status, + (SELECT SUM(expense_amount) FROM `tabExpenses` + WHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'USD' + ) AS trip_expenses_usd, + (SELECT SUM(expense_amount) FROM `tabExpenses` + WHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'TZS' + ) AS trip_expenses_tzs + FROM + `tabVehicle Trip` + WHERE + reference_doctype IS NOT NULL AND reference_docname IS NOT NULL ''' + where + ''' AND start_date BETWEEN %(from_date)s AND %(to_date)s + UNION ALL + SELECT + `tabVehicle Trip`.name AS reference, + 'Return Trip' AS trip_type, + `tabVehicle Trip`.return_customer AS customer, + `tabVehicle Trip`.transporter_type, + CASE + WHEN `tabVehicle Trip`.transporter_type = 'Bravo' THEN 'Bravo' + ELSE `tabVehicle Trip`.sub_contractor + END AS transporter_name, + `tabVehicle Trip`.vehicle_plate_number, + `tabVehicle Trip`.trailer_plate_number, + `tabVehicle Trip`.driver_name, + `tabVehicle Trip`.return_cargo_category AS cargo, + CONCAT(`tabVehicle Trip`.return_loading_point, "-",`tabVehicle Trip`.return_cargo_location_city,"-",`tabVehicle Trip`.return_cargo_location_country) AS source_location, + CONCAT(`tabVehicle Trip`.return_offloading_point, "-",`tabVehicle Trip`.return_cargo_destination_city,"-",`tabVehicle Trip`.return_cargo_destination_country) AS destination_location, + `tabVehicle Trip`.return_eta AS eta, + `tabVehicle Trip`.status, + (SELECT SUM(expense_amount) FROM `tabExpenses` + WHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'USD' + ) AS trip_expenses_usd, + (SELECT SUM(expense_amount) FROM `tabExpenses` + WHERE parenttype = 'Vehicle Trip' AND parent = `tabVehicle Trip`.name AND expense_currency = 'TZS' + ) AS trip_expenses_tzs + FROM + `tabVehicle Trip` + WHERE + return_reference_doctype IS NOT NULL AND return_reference_docname IS NOT NULL ''' + where + ''' AND return_start_date BETWEEN %(from_date)s AND %(to_date)s + ) a + ORDER BY reference''', where_filter, as_dict=1) + return columns, data diff --git a/csf_tz/fleet_management/report/truck_document_expiration_report/__init__.py b/csf_tz/fleet_management/report/truck_document_expiration_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.js b/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.js new file mode 100644 index 0000000..c624c74 --- /dev/null +++ b/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.js @@ -0,0 +1,31 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Truck Document Expiration Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default":from_date, + "reqd": 1 + + + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + } + + ] +} diff --git a/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.json b/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.json new file mode 100644 index 0000000..1738254 --- /dev/null +++ b/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.json @@ -0,0 +1,24 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2019-05-10 13:48:21.510404", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "bravo", + "modified": "2019-05-10 13:48:21.510404", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Truck Document Expiration Report", + "owner": "Administrator", + "ref_doctype": "Vehicle", + "report_name": "Truck Document Expiration Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.py b/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.py new file mode 100644 index 0000000..fea7a1e --- /dev/null +++ b/csf_tz/fleet_management/report/truck_document_expiration_report/truck_document_expiration_report.py @@ -0,0 +1,67 @@ +from __future__ import unicode_literals +import frappe +from frappe.utils import flt +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "description", + "label": _("Document"), + "fieldtype": "Link", + "options": "Vehicle Documents Type", + "width":250 + }, + + { + "fieldname":"expiration_date", + "label": _("Expire Date"), + "fieldtype": "Date", + }, + { + "fieldname": "type", + "label": _("Vehicle/Trailer"), + "fieldtype": "Data", + "width": 150 + }, + + + { + "fieldname": "reference_no", + "label": _("Reference Number"), + "fieldtype": "Data", + "width": 150 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + + data = frappe.db.sql('''SELECT + tvd.description AS description, + tvd.expire_date AS expiration_date, + CASE + WHEN tvd.parenttype = 'Vehicle' THEN CONCAT('', tvh.number_plate, '') + WHEN tvd.parenttype = 'Trailer' THEN CONCAT('', tt.number_plate, '') + END AS type, + tvd.reference_no AS reference_no + FROM + (`tabVehicle Documents` tvd) + LEFT JOIN tabVehicle tvh + ON (tvd.parent=tvh.name) + LEFT JOIN tabTrailer tt + ON (tvd.parent=tt.name) + WHERE + tvd.expire_date BETWEEN %(from_date)s AND %(to_date)s '''+ where +''' + ''', + where_filter, as_dict=1,as_list=1 + ); + + return columns, data + diff --git a/csf_tz/fleet_management/report/vehicle/trailer__document_expiration_report/__init__.py b/csf_tz/fleet_management/report/vehicle/trailer__document_expiration_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/vehicle_status_report/__init__.py b/csf_tz/fleet_management/report/vehicle_status_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report-bak.py b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report-bak.py new file mode 100644 index 0000000..e03e25b --- /dev/null +++ b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report-bak.py @@ -0,0 +1,192 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "fleet_no", + "label": _("Fleet No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "reg_no", + "label": _("Reg. No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "driver_name", + "label": _("Driver Name"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "contact", + "label": _("Contact"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo_type", + "label": _("Cargo Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "destination", + "label": _("Destination"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "client", + "label": _("Client"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "route", + "label": _("Route"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "dispatch_date", + "label": _("Dispatch Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "offloading_date", + "label": _("Offloading Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "position", + "label": _("Position"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "next_cargo_allocation", + "label": _("Next Cargo Allocation"), + "fieldtype": "Data", + "width": 100 + } + ] + + today = datetime.date.today().strftime("%Y-%m-%d") + yesterday = datetime.date.today() - datetime.timedelta(1) + day_before = datetime.date.today() - datetime.timedelta(2) + yesterday = yesterday.strftime("%Y-%m-%d") + day_before = day_before.strftime("%Y-%m-%d") + + data = frappe.db.sql('''SELECT + `tabVehicle`.fleet_number AS fleet_no, + CONCAT(`tabVehicle`.number_plate, '/', `tabTrailer`.number_plate) AS reg_no, + `tabEmployee`.employee_name AS driver_name, + `tabEmployee`.cell_number AS contact, + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.main_goods_description + WHEN return_trip.name IS NOT NULL THEN return_trip.return_goods_description + WHEN main_trip_offloaded.name IS NOT NULL THEN main_trip_offloaded.main_goods_description + WHEN return_trip_offloaded.name IS NOT NULL THEN return_trip_offloaded.return_goods_description + END AS cargo_type, + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.main_cargo_destination_city + WHEN return_trip.name IS NOT NULL THEN return_trip.return_cargo_destination_city + WHEN main_trip_offloaded.name IS NOT NULL THEN main_trip_offloaded.main_cargo_destination_city + WHEN return_trip_offloaded.name IS NOT NULL THEN return_trip_offloaded.return_cargo_destination_city + END AS destination, + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.main_customer + WHEN return_trip.name IS NOT NULL THEN return_trip.return_customer + WHEN main_trip_offloaded.name IS NOT NULL THEN main_trip_offloaded.main_customer + WHEN return_trip_offloaded.name IS NOT NULL THEN return_trip_offloaded.return_customer + END AS client, + CASE + WHEN UPPER(main_trip.main_cargo_location_country) = 'TANZANIA' AND UPPER(main_trip.main_cargo_destination_country) <> 'TANZANIA' THEN 'Import' + WHEN UPPER(return_trip.return_cargo_location_country) = 'TANZANIA' AND UPPER(return_trip.return_cargo_destination_country) <> 'TANZANIA' THEN 'Import' + WHEN UPPER(main_trip.main_cargo_location_country) <> 'TANZANIA' AND UPPER(main_trip.main_cargo_destination_country) = 'TANZANIA' THEN 'Export' + WHEN UPPER(return_trip.return_cargo_location_country) <> 'TANZANIA' AND UPPER(return_trip.return_cargo_destination_country) = 'TANZANIA' THEN 'Export' + WHEN UPPER(main_trip_offloaded.main_cargo_location_country) = 'TANZANIA' AND UPPER(main_trip_offloaded.main_cargo_destination_country) <> 'TANZANIA' THEN 'Import' + WHEN UPPER(return_trip_offloaded.return_cargo_location_country) = 'TANZANIA' AND UPPER(return_trip_offloaded.return_cargo_destination_country) <> 'TANZANIA' THEN 'Import' + WHEN UPPER(main_trip_offloaded.main_cargo_location_country) <> 'TANZANIA' AND UPPER(main_trip_offloaded.main_cargo_destination_country) = 'TANZANIA' THEN 'Export' + WHEN UPPER(return_trip_offloaded.return_cargo_location_country) <> 'TANZANIA' AND UPPER(return_trip_offloaded.return_cargo_destination_country) = 'TANZANIA' THEN 'Export' + END AS route, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT loading_date FROM `tabRoute Steps Table` WHERE parent = main_trip.name \ + AND parentfield = 'main_route_steps' AND loading_date IS NOT NULL LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT loading_date FROM `tabRoute Steps Table` WHERE parent = return_trip.name \ + AND parentfield = 'return_route_steps' AND loading_date IS NOT NULL LIMIT 1) + WHEN main_trip_offloaded.name IS NOT NULL THEN (SELECT loading_date FROM `tabRoute Steps Table` WHERE parent = main_trip_offloaded.name \ + AND parentfield = 'main_route_steps' AND loading_date IS NOT NULL LIMIT 1) + WHEN return_trip_offloaded.name IS NOT NULL THEN (SELECT loading_date FROM `tabRoute Steps Table` WHERE parent = return_trip_offloaded.name \ + AND parentfield = 'return_route_steps' AND loading_date IS NOT NULL LIMIT 1) + END AS dispatch_date, + CASE + WHEN main_trip.name IS NOT NULL AND return_trip.name IS NOT NULL THEN NULL + WHEN main_trip_offloaded.name IS NOT NULL THEN (SELECT offloading_date FROM `tabRoute Steps Table` WHERE parent = main_trip_offloaded.name \ + AND parentfield = 'main_route_steps' AND offloading_date IS NOT NULL LIMIT 1) + WHEN return_trip_offloaded.name IS NOT NULL THEN (SELECT offloading_date FROM `tabRoute Steps Table` WHERE parent = return_trip_offloaded.name \ + AND parentfield = 'return_route_steps' AND offloading_date IS NOT NULL LIMIT 1) + END AS offloading_date, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = main_trip.name AND \ + `tabReporting Status Table`.parentfield = 'main_reporting_status' ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = return_trip.name AND \ + `tabReporting Status Table`.parentfield = 'return_reporting_status' ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + WHEN main_trip_offloaded.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = main_trip_offloaded.name AND \ + `tabReporting Status Table`.parentfield = 'main_reporting_status' ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + WHEN return_trip_offloaded.name IS NOT NULL THEN (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Vehicle Trip' AND `tabReporting Status Table`.parent = return_trip_offloaded.name AND \ + `tabReporting Status Table`.parentfield = 'return_reporting_status' ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + END AS position, + `tabTransport Assignment`.parenttype AS next_assigned_parenttype, + `tabTransport Assignment`.parent AS next_assigned_parent + FROM + `tabVehicle` + LEFT JOIN + `tabTrailer` ON `tabTrailer`.name = `tabVehicle`.default_trailer + LEFT JOIN + `tabEmployee` ON `tabEmployee`.name = `tabVehicle`.driver + LEFT JOIN + `tabVehicle Trip` AS main_trip ON main_trip.vehicle = `tabVehicle`.name AND main_trip.status = 'En Route' + LEFT JOIN + `tabVehicle Trip` AS return_trip ON return_trip.vehicle = `tabVehicle`.name AND return_trip.status = 'En Route - Returning' + LEFT JOIN + `tabVehicle Trip` AS main_trip_offloaded ON main_trip_offloaded.vehicle = `tabVehicle`.name AND main_trip_offloaded.status = 'Main Trip Offloaded' AND (SELECT loading_date FROM `tabRoute Steps Table` WHERE \ + parent = main_trip_offloaded.name AND parentfield = 'main_route_steps' AND offloading_date IS NOT NULL LIMIT 1) IN (%(today)s, %(yesterday)s, %(day_before)s) + LEFT JOIN + `tabVehicle Trip` AS return_trip_offloaded ON return_trip_offloaded.vehicle = `tabVehicle`.name AND return_trip_offloaded.status = 'Main Trip Offloaded' AND (SELECT loading_date FROM `tabRoute Steps Table` WHERE \ + parent = return_trip_offloaded.name AND parentfield = 'return_route_steps' AND offloading_date IS NOT NULL LIMIT 1) IN (%(today)s, %(yesterday)s, %(day_before)s) + LEFT JOIN + `tabTransport Assignment` ON `tabTransport Assignment`.name = (SELECT name FROM `tabTransport Assignment` WHERE assigned_vehicle = `tabVehicle`.name \ + AND status = 'Not Processed' ORDER BY expected_loading_date ASC LIMIT 1) + LEFT JOIN + `tabTransport Request` ON `tabTransport Request`.name = `tabTransport Assignment`.parent AND `tabTransport Assignment`.parenttype = 'Transport Request' + ''', {'today': today, 'yesterday': yesterday, 'day_before': day_before}, as_dict=1) + for row in data: + if row.next_assigned_parenttype and row.next_assigned_parent: + next_assigned = None + if row.next_assigned_parenttype == 'Import': + next_assigned = frappe.get_doc('Import', row.next_assigned_parent).customer + elif row.next_assigned_parenttype == 'Transport Request': + next_assigned = frappe.get_doc('Transport Request', row.next_assigned_parent).customer + row.update({"next_cargo_allocation": next_assigned}) + + return columns, data diff --git a/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.js b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.js new file mode 100644 index 0000000..b6f872e --- /dev/null +++ b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.js @@ -0,0 +1,9 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Vehicle Status Report"] = { + "filters": [ + + ] +} diff --git a/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.json b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.json new file mode 100644 index 0000000..4fd3c78 --- /dev/null +++ b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-02-26 14:31:16.378640", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-26 14:31:30.576017", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicle Status Report", + "owner": "Administrator", + "ref_doctype": "Vehicle", + "report_name": "Vehicle Status Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Fleet Manager" + }, + { + "role": "Fleet Coordinator" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.py b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.py new file mode 100644 index 0000000..aae4f94 --- /dev/null +++ b/csf_tz/fleet_management/report/vehicle_status_report/vehicle_status_report.py @@ -0,0 +1,133 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "fleet_no", + "label": _("Fleet No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "reg_no", + "label": _("Reg. No"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "driver_name", + "label": _("Driver Name"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "contact", + "label": _("Contact"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "cargo_type", + "label": _("Cargo Type"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "destination", + "label": _("Destination"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "client", + "label": _("Client"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "route", + "label": _("Route"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "dispatch_date", + "label": _("Dispatch Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "offloading_date", + "label": _("Offloading Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "position", + "label": _("Position"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "next_cargo_allocation", + "label": _("Next Cargo Allocation"), + "fieldtype": "Data", + "width": 100 + } + ] + + today = datetime.date.today().strftime("%Y-%m-%d") + yesterday = datetime.date.today() - datetime.timedelta(1) + day_before = datetime.date.today() - datetime.timedelta(2) + yesterday = yesterday.strftime("%Y-%m-%d") + day_before = day_before.strftime("%Y-%m-%d") + + data = frappe.db.sql('''SELECT + `tabVehicle`.fleet_number AS fleet_no, + CASE + WHEN `tabTrailer`.number_plate THEN CONCAT(`tabVehicle`.number_plate, '/', `tabTrailer`.number_plate) + ELSE `tabVehicle`.number_plate + END AS reg_no, + `tabVehicle`.name, + `tabEmployee`.employee_name AS driver_name, + `tabEmployee`.cell_number AS contact, + `tabTransport Assignment`.parenttype AS next_assigned_parenttype, + `tabTransport Assignment`.parent AS next_assigned_parent + FROM + `tabVehicle` + LEFT JOIN + `tabTrailer` ON `tabTrailer`.name = `tabVehicle`.default_trailer + LEFT JOIN + `tabEmployee` ON `tabEmployee`.name = `tabVehicle`.driver + LEFT JOIN + `tabTransport Assignment` ON `tabTransport Assignment`.name = (SELECT name FROM `tabTransport Assignment` WHERE assigned_vehicle = `tabVehicle`.name \ + AND status = 'Not Processed' ORDER BY expected_loading_date ASC LIMIT 1) + ''', as_dict=1) + for row in data: + if row.next_assigned_parenttype and row.next_assigned_parent: + next_assigned = None + if row.next_assigned_parenttype == 'Import': + next_assigned = frappe.get_doc('Import', row.next_assigned_parent).customer + elif row.next_assigned_parenttype == 'Transport Request': + next_assigned = frappe.get_doc('Transport Request', row.next_assigned_parent).customer + row.update({"next_cargo_allocation": next_assigned}) + + return columns, data + +def get_trip_info(data): + if data: + for vehicle in data: + main_trip = frappe.db.get_value('Vehcile Trip', {"vehicle": vehicle.name, "status": "En Route"}) + return_trip = frappe.db.get_value('Vehcile Trip', {"vehicle": vehicle.name, "status": "En Route - Returning"}) + main_offloaded = frappe.db.sql('''SELECT parent FROM `tabRoute Steps Table` WHERE parenttype = 'Vehicle Trip' AND parentfield = 'main_route_steps' AND offloading_date IN (%(today)s, %(yesterday)s, %(day_before)s) LIMIT 1''', {'today': today, 'yesterday': yesterday, 'day_before': day_before}) + return_offloaded = frappe.db.sql('''SELECT parent FROM `tabRoute Steps Table` WHERE parenttype = 'Vehicle Trip' AND parentfield = 'return_route_steps' AND offloading_date IN (%(today)s, %(yesterday)s, %(day_before)s) LIMIT 1''', {'today': today, 'yesterday': yesterday, 'day_before': day_before}) diff --git a/csf_tz/fleet_management/report/vehicles_en_route_to_border/__init__.py b/csf_tz/fleet_management/report/vehicles_en_route_to_border/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.js b/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.js new file mode 100644 index 0000000..9e00a77 --- /dev/null +++ b/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.js @@ -0,0 +1,14 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Vehicles En Route to Border"] = { + "filters": [ + { + "fieldname":"border", + "label": __("Border"), + "fieldtype": "Link", + "options": "Trip Location" + } + ] +} diff --git a/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.json b/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.json new file mode 100644 index 0000000..5f0df3f --- /dev/null +++ b/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.json @@ -0,0 +1,38 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-03-02 12:46:04.743137", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-03-02 12:48:26.920543", + "modified_by": "Administrator", + "module": "Fleet Management", + "name": "Vehicles En Route to Border", + "owner": "Administrator", + "ref_doctype": "Vehicle Trip", + "report_name": "Vehicles En Route to Border", + "report_type": "Script Report", + "roles": [ + { + "role": "Clearing Agent" + }, + { + "role": "Expense Recommender" + }, + { + "role": "Fleet Coordinator" + }, + { + "role": "Fleet Manager" + }, + { + "role": "Declaration Officer - Border" + }, + { + "role": "Assistant Declaration Officer - Tunduma" + } + ] +} \ No newline at end of file diff --git a/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.py b/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.py new file mode 100644 index 0000000..5f93113 --- /dev/null +++ b/csf_tz/fleet_management/report/vehicles_en_route_to_border/vehicles_en_route_to_border.py @@ -0,0 +1,143 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +import ast +import datetime +import time + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "trip_no", + "label": _("Trip No"), + "fieldtype": "Link", + "options": "Vehicle Trip", + "width": 100 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150 + }, + { + "fieldname": "vehicle", + "label": _("Vehicle/Trailer"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "cargo", + "label": _("Cargo"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "border_name", + "label": _("Border Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "eta_at_border", + "label": _("ETA at Border"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "dispatch_date", + "label": _("Dispatch Date"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "last_reported_position", + "label": _("Last Reported Position"), + "fieldtype": "Data", + "width": 450 + } + ] + + + where = "" + if filters.border: + where = " HAVING border_name = %(border)s " + + data = frappe.db.sql('''SELECT + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.name + WHEN return_trip.name IS NOT NULL THEN return_trip.name + END AS trip_no, + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.main_customer + WHEN return_trip.name IS NOT NULL THEN return_trip.return_customer + END AS customer, + CASE + WHEN main_trip.name IS NOT NULL THEN CONCAT(main_trip.vehicle_plate_number, '/', main_trip.trailer_plate_number) + WHEN return_trip.name IS NOT NULL THEN CONCAT(return_trip.vehicle_plate_number, '/', return_trip.trailer_plate_number) + END AS vehicle, + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.main_goods_description + WHEN return_trip.name IS NOT NULL THEN return_trip.return_goods_description + END AS cargo, + `tabRoute Steps Table`.location AS border_name, + CASE + WHEN main_trip.name IS NOT NULL THEN main_trip.main_route + WHEN return_trip.name IS NOT NULL THEN return_trip.return_route + END AS route, + CASE + WHEN main_loading_point.name IS NOT NULL THEN main_loading_point.departure_date + WHEN return_loading_point.name IS NOT NULL THEN return_loading_point.departure_date + END AS dispatch_date, + CASE + WHEN main_trip.name IS NOT NULL THEN (SELECT CONCAT(date_format(timestamp, '%%d-%%m-%%Y %%l:%%i'), ' - ', `tabVehicle Trip Location Update`.location) \ + FROM `tabVehicle Trip Location Update` WHERE \ + `tabVehicle Trip Location Update`.parenttype = 'Vehicle Trip' AND `tabVehicle Trip Location Update`.parent = main_trip.name AND \ + `tabVehicle Trip Location Update`.parentfield = 'main_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp DESC LIMIT 1) + WHEN return_trip.name IS NOT NULL THEN (SELECT CONCAT(date_format(timestamp, '%%d-%%m-%%Y %%l:%%i'), ' - ', `tabVehicle Trip Location Update`.location) \ + FROM `tabVehicle Trip Location Update` WHERE \ + `tabVehicle Trip Location Update`.parenttype = 'Vehicle Trip' AND `tabVehicle Trip Location Update`.parent = return_trip.name AND \ + `tabVehicle Trip Location Update`.parentfield = 'return_location_update' ORDER BY `tabVehicle Trip Location Update`.timestamp DESC LIMIT 1) + END AS last_reported_position + FROM + `tabRoute Steps Table` + LEFT JOIN + `tabVehicle Trip` AS main_trip ON main_trip.name = `tabRoute Steps Table`.parent AND `tabRoute Steps Table`.parenttype = 'Vehicle Trip' + AND `tabRoute Steps Table`.parentfield = 'main_route_steps' + LEFT JOIN + `tabVehicle Trip` AS return_trip ON return_trip.name = `tabRoute Steps Table`.parent AND `tabRoute Steps Table`.parenttype = 'Vehicle Trip' + AND `tabRoute Steps Table`.parentfield = 'return_route_steps' + LEFT JOIN + `tabRoute Steps Table` AS main_loading_point ON main_loading_point.name = (SELECT name FROM `tabRoute Steps Table` WHERE \ + parent = main_trip.name AND main_loading_point.parentfield = 'main_route_steps' AND upper(main_loading_point.location_type) = 'LOADING POINT' + ORDER BY idx ASC LIMIT 1) + LEFT JOIN + `tabRoute Steps Table` AS return_loading_point ON return_loading_point.name = (SELECT name FROM `tabRoute Steps Table` WHERE \ + parent = return_trip.name AND return_loading_point.parentfield = 'return_route_steps' AND upper(return_loading_point.location_type) = 'LOADING POINT' + ORDER BY idx ASC LIMIT 1) + WHERE + upper(`tabRoute Steps Table`.location_type) = 'BORDER' AND `tabRoute Steps Table`.arrival_date IS NULL AND \ + (main_trip.status = 'En Route' OR return_trip.status = 'En Route - Returning') + ''' + where + + ''' + ORDER BY + dispatch_date ASC + ''', {"border": filters.border}, as_dict=1) + + for row in data: + if row.route: + route = frappe.get_doc('Trip Route', row.route) + for location in route.trip_steps: + if location.location == row.border_name: + if location.distance and location.distance != 0: + days_to_add = location.distance/340 + if row.dispatch_date: + row.update({"eta_at_border": row.dispatch_date + datetime.timedelta(days=days_to_add)}) + + return columns, data diff --git a/csf_tz/getallavapps.sh b/csf_tz/getallavapps.sh new file mode 100644 index 0000000..44f40ef --- /dev/null +++ b/csf_tz/getallavapps.sh @@ -0,0 +1,14 @@ +@!/bin/bash + +bench get-app git@gitlab.com:aakvatech/contractms.git +bench get-app git@gitlab.com:aakvatech/jobcard.git +bench get-app git@gitlab.com:aakvatech/payware.git +bench get-app git@gitlab.com:aakvatech/propms.git +bench get-app git@gitlab.com:aakvatech/smepayware.git +bench get-app git@gitlab.com:aakvatech/csf_tz.git +bench get-app git@gitlab.com:aakvatech/finasset.git +bench get-app git@gitlab.com:aakvatech/grantsms.git +bench get-app git@gitlab.com:aakvatech/logisticsms.git +bench get-app git@gitlab.com:aakvatech/petroms.git +bench get-app git@gitlab.com:aakvatech/recharge.git +bench get-app git@gitlab.com:aakvatech/fmlms.git diff --git a/csf_tz/hooks.py b/csf_tz/hooks.py new file mode 100644 index 0000000..bbdca38 --- /dev/null +++ b/csf_tz/hooks.py @@ -0,0 +1,488 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +from . import __version__ as app_version + +app_name = "csf_tz" +app_title = "CSF TZ" +app_publisher = "Aakvatech" +app_description = "Country Specific Functionality Tanzania" +app_icon = "octicon octicon-bookmark" +app_color = "green" +app_email = "info@aakvatech.com" +app_license = "GNU General Public License (v3)" + +fixtures = [ + { + "doctype": "Custom Field", + "filters": [ + [ + "name", + "in", + ( + "Account-item", + "Address-is_your_company_address", + "Address-tax_category", + "BOM-column_break_15", + "BOM-fg_warehouse", + "BOM-scrap_warehouse", + "BOM-source_warehouse", + "BOM-warehouses", + "BOM-wip_warehouse", + "Company-auto_create_for_purchase_withholding", + "Company-auto_create_for_sales_withholding", + "Company-auto_submit_for_purchase_withholding", + "Company-auto_submit_for_sales_withholding", + "Company-block_number", + "Company-bypass_material_request_validation", + "Company-city", + "Company-column_break_55", + "Company-column_break_60", + "Company-company_bank_details", + "Company-default_item_tax_template", + "Company-default_withholding_payable_account", + "Company-default_withholding_receivable_account", + "Company-education_section", + "Company-enabled_auto_create_delivery_notes", + "Company-fee_bank_account", + "Company-max_records_in_dialog", + "Company-nmb_password", + "Company-nmb_series", + "Company-nmb_url", + "Company-nmb_username", + "Company-p_o_box", + "Company-plot_number", + "Company-section_break_12", + "Company-send_fee_details_to_bank", + "Company-street", + "Company-student_applicant_fees_revenue_account", + "Company-tin", + "Company-vrn", + "Company-withholding_section", + "Contact-is_billing_contact", + "Custom DocPerm-dependent", + "Customer-vrn", + "Delivery Note-form_sales_invoice", + "Employee-old_employee_id", + "Fee Structure-default_fee_category", + "Fees-abbr", + "Fees-bank_reference", + "Fees-callback_token", + "Fees-from_date", + "Fees-to_date", + "Item-default_tax_template", + "Item-excisable_item", + "Item-withholding_tax_rate_on_sales", + "Item-witholding_tax_rate_on_purchase", + "Journal Entry-expense_record", + "Journal Entry-from_date", + "Journal Entry-import_file", + "Journal Entry-to_date", + "Landed Cost Voucher-import_file", + "Material Request Item-stock_reconciliation", + "Operation-image", + "Payment Entry Reference-end_date", + "Payment Entry Reference-posting_date", + "Payment Entry Reference-section_break_9", + "Payment Entry Reference-start_date", + "POS Profile-column_break_1", + "POS Profile-electronic_fiscal_device", + "Print Settings-compact_item_print", + "Print Settings-print_taxes_with_zero_amount", + "Program Fee-default_fee_category", + "Program-fees", + "Program-program_fee", + "Purchase Invoice Item-withholding_tax_entry", + "Purchase Invoice Item-withholding_tax_rate", + "Purchase Invoice-expense_record", + "Purchase Invoice-import_file", + "Purchase Invoice-reference", + "Purchase Order-posting_date", + "Sales Invoice Item-allow_over_sell", + "Sales Invoice Item-allow_override_net_rate", + "Sales Invoice Item-delivery_status", + "Sales Invoice Item-withholding_tax_entry", + "Sales Invoice Item-withholding_tax_rate", + "Sales Invoice Payment-payment_reference", + "Sales Invoice-column_break_29", + "Sales Invoice-default_item_discount", + "Sales Invoice-default_item_tax_template", + "Sales Invoice-delivery_status", + "Sales Invoice-efd_z_report", + "Sales Invoice-electronic_fiscal_device", + "Sales Invoice-enabled_auto_create_delivery_notes", + "Sales Invoice-excise_duty_applicable", + "Sales Invoice-previous_invoice_number", + "Sales Invoice-price_reduction", + "Sales Invoice-section_break_80", + "Sales Invoice-statutory_details", + "Sales Invoice-tra_control_number", + "Sales Invoice-witholding_tax_certificate_number", + "Sales Order-cost_center", + "Sales Order-default_item_discount", + "Sales Order-posting_date", + "Stock Entry Detail-column_break_32", + "Stock Entry Detail-item_weight_details", + "Stock Entry Detail-total_weight", + "Stock Entry Detail-weight_per_unit", + "Stock Entry Detail-weight_uom", + "Stock Entry-column_break_69", + "Stock Entry-driver_name", + "Stock Entry-driver", + "Stock Entry-final_destination", + "Stock Entry-item_uom", + "Stock Entry-repack_qty", + "Stock Entry-repack_template", + "Stock Entry-total_net_weight", + "Stock Entry-transport_receipt_date", + "Stock Entry-transport_receipt_no", + "Stock Entry-transporter_info", + "Stock Entry-transporter_name", + "Stock Entry-transporter", + "Stock Entry-vehicle_no", + "Stock Reconciliation Item-material_request", + "Stock Reconciliation-sort_items", + "Student Applicant-bank_reference", + "Student Applicant-fee_structure", + "Student Applicant-program_enrollment", + "Student Applicant-student_applicant_fee", + "Student-bank", + "Supplier-vrn", + "Vehicle Fine Record-fully_paid", + "Vehicle Log-column_break_11", + "Vehicle Log-destination_description", + "Vehicle Log-trip_destination", + "Vehicle Service-invoice", + "Vehicle Service-quantity", + "Vehicle Service-spare_name", + "Fees-base_grand_total", + "Fees-advance_paid", + "Employee-employee_salary_component_limits", + "Employee-employee_salary_component_limit", + "Employee-heslb_f4_index_number", + "Sales Invoice Item-is_ignored_in_pending_qty", + ), + ] + ], + }, + { + "doctype": "Property Setter", + "filters": [ + [ + "name", + "in", + ( + "Account-search_fields", + "Bank Reconciliation Detail-payment_entry-columns", + "Bank Reconciliation Detail-posting_date-columns", + "Bank Reconciliation Detail-posting_date-in_list_view", + "Budget-budget_against-options", + "Comment-main-track_changes", + "Customer-main-search_fields", + "Customer-tax_id-label", + "Delivery Note-items-allow_bulk_edit", + "Document Attachment-attachment-in_list_view", + "Energy Point Log-main-track_changes", + "Healthcare Insurance Claim-main-track_changes", + "Healthcare Service Order-main-track_changes", + "Item Price-brand-in_list_view", + "Item Price-price_list-in_list_view", + "Item Price-valid_from-in_list_view", + "Journal Entry Account-account-width", + "Journal Entry Account-accounting_dimensions_section-collapsible", + "Journal Entry Account-party_type-columns", + "Journal Entry Account-party-columns", + "Journal Entry Account-reference_name-in_list_view", + "Journal Entry-accounts-allow_bulk_edit", + "Journal Entry-total_amount-in_list_view", + "Journal Entry-total_debit-in_list_view", + "Notification Log-main-track_changes", + "Operation-image_field", + "Payment Entry Reference-due_date-columns", + "Payment Entry Reference-due_date-width", + "Payment Entry Reference-reference_doctype-columns", + "Payment Entry Reference-reference_doctype-in_list_view", + "Payment Entry Reference-reference_name-columns", + "Payment Entry-letter_head-fetch_from", + "Payment Entry-payment_accounts_section-collapsible", + "Payment Entry-section_break_12-collapsible", + "Payment Reconciliation Payment-posting_date-columns", + "Payment Reconciliation Payment-posting_date-in_list_view", + "Payment Schedule-payment_amount-options", + "Piecework Type-search_fields", + "Purchase Invoice Item-cost_center-default", + "Purchase Order-letter_head-fetch_from", + "Report-javascript-depends_on", + "Route History-main-track_changes", + "Sales Invoice Item-batch_no-in_list_view", + "Sales Invoice Item-cost_center-columns", + "Sales Invoice Item-cost_center-in_list_view", + "Sales Invoice Item-item_code-columns", + "Sales Invoice Item-item_tax_template-default", + "Sales Invoice Item-item_tax_template-fetch_if_empty", + "Sales Invoice Item-qty-columns", + "Sales Invoice Item-warehouse-in_list_view", + "Sales Invoice-is_pos-in_standard_filter", + "Sales Invoice-letter_head-fetch_from", + "Sales Invoice-letter_head-fetch_if_empty", + "Sales Invoice-loyalty_points_redemption-depends_on", + "Sales Invoice-pos_profile-in_standard_filter", + "Sales Invoice-posting_date-in_list_view", + "Sales Invoice-search_fields", + "Scheduled Job Log-main-track_changes", + "Stock Entry-from_warehouse-fetch_from", + "Student Applicant-application_status-options", + "Student Applicant-application_status-read_only", + "Supplier-read_only_onload", + "Supplier-tax_id-bold", + "Supplier-tax_id-label", + "Vehicle Log-date-default", + "Vehicle Log-date-in_list_view", + "Vehicle Log-employee-fetch_from", + "Vehicle Log-employee-fetch_if_empty", + "Vehicle Log-license_plate-in_standard_filter", + "Vehicle Log-odometer-in_list_view", + "Vehicle Log-quick_entry", + "Vehicle Service-frequency-in_list_view", + "Vehicle Service-frequency-options", + "Vehicle Service-service_item-in_list_view", + "Vehicle Service-service_item-options", + "Vehicle Service-type-options", + "Workflow Action-main-track_changes", + ), + ] + ], + }, +] + +# Override Document Class +# override_doctype_class = { +# 'Salary Slip': 'csf_tz.overrides.csftz_SalarySlip' +# } + +# Includes in +# ------------------ + +# include js, css files in header of desk.html +# app_include_css = "/assets/csf_tz/css/csf_tz.css" +# app_include_js = "/assets/csf_tz/js/csf_tz.js" +app_include_js = [ + "/assets/js/select_dialog.min.js", + "/assets/js/to_console.min.js", + "/assets/js/jobcards.min.js", + "/assets/csf_tz/node_modules/vuetify/dist/vuetify.js", +] + +app_include_css = "/assets/csf_tz/css/theme.css" +web_include_css = "/assets/csf_tz/css/theme.css" +# include js, css files in header of web template +# web_include_css = "/assets/csf_tz/css/csf_tz.css" +# web_include_js = "/assets/csf_tz/js/csf_tz.js" + +# include js in page +# page_js = {"page" : "public/js/file.js"} + +# include js in doctype views +doctype_js = { + "Payment Entry": "csf_tz/payment_entry.js", + "Sales Invoice": "csf_tz/sales_invoice.js", + "Sales Order": "csf_tz/sales_order.js", + "Delivery Note": "csf_tz/delivery_note.js", + "Customer": "csf_tz/customer.js", + "Supplier": "csf_tz/supplier.js", + "Stock Entry": "csf_tz/stock_entry.js", + "Account": "csf_tz/account.js", + "Warehouse": "csf_tz/warehouse.js", + "Company": "csf_tz/company.js", + "Stock Reconciliation": "csf_tz/stock_reconciliation.js", + "Fees": "csf_tz/fees.js", + "Program Enrollment Tool": "csf_tz/program_enrollment_tool.js", + "Purchase Invoice": "csf_tz/purchase_invoice.js", + "Quotation": "csf_tz/quotation.js", + "Purchase Receipt": "csf_tz/purchase_receipt.js", + "Purchase Order": "csf_tz/purchase_order.js", + "Student Applicant": "csf_tz/student_applicant.js", + "Bank Reconciliation": "csf_tz/bank_reconciliation.js", + "Program Enrollment": "csf_tz/program_enrollment.js", + "Payroll Entry": "csf_tz/payroll_entry.js", + "Salary Slip": "csf_tz/salary_slip.js", + "Landed Cost Voucher": "csf_tz/landed_cost_voucher.js", +} +# doctype_list_js = {"doctype" : "public/js/doctype_list.js"} +# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} +# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} + +# Home Pages +# ---------- + +# application home page (will override Website Settings) +# home_page = "login" + +# website user home page (by Role) +# role_home_page = { +# "Role": "home_page" +# } + +# Website user home page (by function) +# get_website_user_home_page = "csf_tz.utils.get_home_page" + +# Generators +# ---------- + +# automatically create page for each record of this doctype +# website_generators = ["Web Page"] + +# Installation +# ------------ + +# before_install = "csf_tz.install.before_install" +# after_install = "csf_tz.install.after_install" + +# Desk Notifications +# ------------------ +# See frappe.core.notifications.get_notification_config + +# notification_config = "csf_tz.notifications.get_notification_config" + +# Permissions +# ----------- +# Permissions evaluated in scripted ways + +# permission_query_conditions = { +# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", +# } +# +# has_permission = { +# "Event": "frappe.desk.doctype.event.event.has_permission", +# } + +# Document Events +# --------------- +# Hook on document methods and events + +doc_events = { + "Open Invoice Exchange Rate Revaluation": { + "validate": "csf_tz.custom_api.getInvoiceExchangeRate" + }, + "Sales Invoice": { + "on_submit": [ + "csf_tz.custom_api.validate_net_rate", + "csf_tz.custom_api.create_delivery_note", + "csf_tz.custom_api.check_submit_delivery_note", + "csf_tz.custom_api.make_withholding_tax_gl_entries_for_sales", + ], + "validate": [ + "csf_tz.custom_api.check_validate_delivery_note", + "csf_tz.custom_api.validate_items_remaining_qty", + "csf_tz.custom_api.calculate_price_reduction", + ], + "before_cancel": "csf_tz.custom_api.check_cancel_delivery_note", + }, + "Delivery Note": { + "on_submit": "csf_tz.custom_api.update_delivery_on_sales_invoice", + "before_cancel": "csf_tz.custom_api.update_delivery_on_sales_invoice", + }, + "Account": { + "on_update": "csf_tz.custom_api.create_indirect_expense_item", + "after_insert": "csf_tz.custom_api.create_indirect_expense_item", + }, + "Purchase Invoice": { + "on_submit": "csf_tz.custom_api.make_withholding_tax_gl_entries_for_purchase", + }, + "Fees": { + "before_insert": "csf_tz.custom_api.set_fee_abbr", + "after_insert": "csf_tz.bank_api.set_callback_token", + "on_submit": "csf_tz.bank_api.invoice_submission", + "before_cancel": "csf_tz.custom_api.on_cancel_fees", + }, + "Program Enrollment": { + "onload": "csf_tz.csftz_hooks.program_enrollment.create_course_enrollments_override", + "refresh": "csf_tz.csftz_hooks.program_enrollment.create_course_enrollments_override", + "reload": "csf_tz.csftz_hooks.program_enrollment.create_course_enrollments_override", + "before_submit": "csf_tz.csftz_hooks.program_enrollment.validate_submit_program_enrollment", + }, + "*": { + "validate": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "onload": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "before_insert": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "after_insert": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "before_naming": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "before_change": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "before_update_after_submit": [ + "csf_tz.csf_tz.doctype.visibility.visibility.run_visibility" + ], + "before_validate": [ + "csf_tz.csf_tz.doctype.visibility.visibility.run_visibility" + ], + "before_save": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "on_update": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "before_submit": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "autoname": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "on_cancel": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "on_trash": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "on_submit": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + "on_update_after_submit": [ + "csf_tz.csf_tz.doctype.visibility.visibility.run_visibility" + ], + "on_change": ["csf_tz.csf_tz.doctype.visibility.visibility.run_visibility"], + }, + "Stock Entry": { + "validate": "csf_tz.custom_api.calculate_total_net_weight", + }, + "Student Applicant": { + "on_update_after_submit": "csf_tz.csftz_hooks.student_applicant.make_student_applicant_fees", + }, + "Custom DocPerm": { + "validate": "csf_tz.csftz_hooks.custom_docperm.grant_dependant_access", + }, +} + +# Scheduled Tasks +# --------------- + +scheduler_events = { + # "all": [ + # "csf_tz.tasks.all" + # ], + "cron": { + "0 */6 * * *": [ + "csf_tz.csf_tz.doctype.parking_bill.parking_bill.check_bills_all_vehicles", + "csf_tz.csf_tz.doctype.vehicle_fine_record.vehicle_fine_record.check_fine_all_vehicles", + ], + "*/15 * * * *": [ + "csf_tz.csftz_hooks.items_revaluation.process_incorrect_balance_qty" + ], + # Routine for every day 3:30am at night + "30 3 * * *": [ + "csf_tz.custom_api.auto_close_dn", + ], + }, + "daily": [ + "csf_tz.custom_api.create_delivery_note_for_all_pending_sales_invoice", + "csf_tz.csf_tz.doctype.visibility.visibility.trigger_daily_alerts", + "csf_tz.bank_api.reconciliation", + ], + # "hourly": [ + # "csf_tz.tasks.hourly" + # ], + "weekly": [ + "csf_tz.custom_api.make_stock_reconciliation_for_all_pending_material_request" + ], + "monthly": [ + # "csf_tz.tasks.monthly", + "csf_tz.csf_tz.doctype.tz_insurance_cover_note.tz_insurance_cover_note.update_covernote_docs" + ], +} + +jenv = {"methods": ["generate_qrcode:csf_tz.custom_api.generate_qrcode"]} + +# Testing +# ------- + +# before_tests = "csf_tz.install.before_tests" + +# Overriding Whitelisted Methods +# ------------------------------ +# +override_whitelisted_methods = { + "frappe.desk.query_report.get_script": "csf_tz.csftz_hooks.query_report.get_script" +} diff --git a/csf_tz/migrate-recharge.sh b/csf_tz/migrate-recharge.sh new file mode 100644 index 0000000..9339b19 --- /dev/null +++ b/csf_tz/migrate-recharge.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +bench --site erp.vpcommunications.co.tz migrate +bench --site erp.megatelecom.co.tz migrate +bench --site erp.majestictelecom.co.tz migrate diff --git a/csf_tz/modules.txt b/csf_tz/modules.txt new file mode 100644 index 0000000..eef38b3 --- /dev/null +++ b/csf_tz/modules.txt @@ -0,0 +1,7 @@ +CSF TZ +After Sales Services +Clearing And Forwarding +Fleet Management +Purchase And Stock Management +Sales And Marketing +Workshop \ No newline at end of file diff --git a/csf_tz/monkey_patches/__init__.py b/csf_tz/monkey_patches/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/monkey_patches/db_transaction_writes.py b/csf_tz/monkey_patches/db_transaction_writes.py new file mode 100644 index 0000000..d101496 --- /dev/null +++ b/csf_tz/monkey_patches/db_transaction_writes.py @@ -0,0 +1,32 @@ +import frappe +from frappe import _ +from frappe.utils import cint +from frappe.database.database import Database + + +def check_transaction_status(self, query, *args, **kwargs): + if ( + self.transaction_writes + and query + and query.strip().split()[0].lower() + in ("start", "alter", "drop", "create", "begin", "truncate") + ): + raise Exception("This statement can cause implicit commit") + + if query and query.strip().lower() in ("commit", "rollback"): + self.transaction_writes = 0 + + if query[:6].lower() not in ("update", "insert", "delete"): + return + + self.transaction_writes += 1 + if self.transaction_writes > (cint(frappe.conf._max_writes_allowed) or 200000): + if self.auto_commit_on_many_writes: + self.commit() + else: + frappe.throw( + _("Too many writes in one request. Please send smaller requests"), + frappe.ValidationError, + ) + +Database.check_transaction_status = check_transaction_status diff --git a/csf_tz/overrides.py b/csf_tz/overrides.py new file mode 100644 index 0000000..b4e49cf --- /dev/null +++ b/csf_tz/overrides.py @@ -0,0 +1,26 @@ +from __future__ import unicode_literals + +import frappe, erpnext +import datetime, math + +from erpnext.payroll.doctype.salary_slip.salary_slip import SalarySlip +# from erpnext.payroll.doctype.additional_salary.additional_salary import get_additional_salary_component + +class csftz_SalarySlip(SalarySlip): + # def add_additional_salary_components(self, component_type): + # salary_components_details, additional_salary_details = get_additional_salary_component(self.employee, self.start_date, self.end_date, component_type) + # if salary_components_details and additional_salary_details: + # for additional_salary in additional_salary_details: + # additional_salary = frappe._dict(additional_salary) + # # exit if additional_salary.name already exists in self.earnings/deductions + # existing_additional_salary_record_found = 0 + # for d in self.get(component_type): + # if d.additional_salary == additional_salary.name: + # existing_additional_salary_record_found = 1 + # break + # if existing_additional_salary_record_found: + # continue + # amount = additional_salary.amount + # overwrite = additional_salary.overwrite + # self.update_component_row(frappe._dict(salary_components_details[additional_salary.component]), amount, component_type, overwrite=overwrite, additional_salary=additional_salary.name) + pass \ No newline at end of file diff --git a/csf_tz/patches.txt b/csf_tz/patches.txt new file mode 100644 index 0000000..88eb784 --- /dev/null +++ b/csf_tz/patches.txt @@ -0,0 +1,4 @@ +csf_tz.patches.remove_stock_entry_qty_field +csf_tz.patches.remove_core_doctype_custom_docperm +csf_tz.patches.add_custom_fields_for_sales_invoice_item_and_purchase_invoice_item +csf_tz.patches.add_custom_fields_on_customer_for_auto_close_dn \ No newline at end of file diff --git a/csf_tz/patches/add_custom_fields_for_sales_invoice_item_and_purchase_invoice_item.py b/csf_tz/patches/add_custom_fields_for_sales_invoice_item_and_purchase_invoice_item.py new file mode 100644 index 0000000..e7a9dab --- /dev/null +++ b/csf_tz/patches/add_custom_fields_for_sales_invoice_item_and_purchase_invoice_item.py @@ -0,0 +1,24 @@ +import frappe +from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + +def execute(): + new_fields = { + 'Purchase Invoice Item': [ + dict(fieldname='csf_tz_specifics', label='CSF TZ Specifics', fieldtype='Section Break', insert_after='is_free_item'), + dict(fieldname='csf_tz_wtax_jv_created', label='CSF TZ Wtax JV Created', fieldtype='Check', insert_after='csf_tz_specifics', + read_only=1, allow_on_submit=1), + dict(fieldname='csf_tz_wtax_column_break', label='', fieldtype='Column Break', insert_after='csf_tz_wtax_jv_created'), + dict(fieldname='csf_tz_create_wtax_entry', label='Create WTax Entry', fieldtype='Button', insert_after='csf_tz_wtax_column_break', + depends_on='eval: doc.docstatus == 1 && doc.withholding_tax_rate > 0 && doc.csf_tz_wtax_jv_created == 0') + ], + 'Sales Invoice Item': [ + dict(fieldname='csf_tz_specifics', label='CSF TZ Specifics', fieldtype='Section Break', insert_after='grant_commission'), + dict(fieldname='csf_tz_wtax_jv_created', label='CSF TZ Wtax JV Created', fieldtype='Check', insert_after='csf_tz_specifics', + read_only=1, allow_on_submit=1), + dict(fieldname='csf_tz_wtax_column_break', label='', fieldtype='Column Break', insert_after='csf_tz_wtax_jv_created'), + dict(fieldname='csf_tz_create_wtax_entry', label='Create WTax Entry', fieldtype='Button', insert_after='csf_tz_wtax_column_break', + depends_on='eval: doc.docstatus == 1 && doc.withholding_tax_rate > 0 && doc.csf_tz_wtax_jv_created == 0') + ], + } + + create_custom_fields(new_fields, update=True) \ No newline at end of file diff --git a/csf_tz/patches/add_custom_fields_on_customer_for_auto_close_dn.py b/csf_tz/patches/add_custom_fields_on_customer_for_auto_close_dn.py new file mode 100644 index 0000000..bb13c13 --- /dev/null +++ b/csf_tz/patches/add_custom_fields_on_customer_for_auto_close_dn.py @@ -0,0 +1,32 @@ +import frappe +from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + +def execute(): + fields = { + "Customer": [ + dict( + fieldname="csf_tz_close_dn_section_break", + fieldtype="Section Break", + label="Auto Close Dn", + insert_after="companies", + ), + dict( + fieldname="csf_tz_is_auto_close_dn", + fieldtype="Check", + label="Is Auto Close Dn", + insert_after="csf_tz_close_dn_section_break", + bold=1 + ), + dict( + fieldname="csf_tz_close_dn_after", + fieldtype="Int", + label="Close Dn after", + insert_after="csf_tz_is_auto_close_dn", + description="Delivery notes for this customer will automatically be closed after days specified at this field", + depends_on="eval:doc.csf_tz_is_auto_close_dn == 1", + mandatory_depends_on="eval: doc.csf_tz_is_auto_close_dn == 1" + ), + ] + } + + create_custom_fields(fields, update=True) \ No newline at end of file diff --git a/csf_tz/patches/remove_core_doctype_custom_docperm.py b/csf_tz/patches/remove_core_doctype_custom_docperm.py new file mode 100644 index 0000000..d40a704 --- /dev/null +++ b/csf_tz/patches/remove_core_doctype_custom_docperm.py @@ -0,0 +1,8 @@ +from __future__ import unicode_literals +import frappe + + +def execute(): + frappe.db.sql( + "DELETE FROM `tabCustom DocPerm` WHERE name != 'a' AND parent in ('DocType', 'Patch Log', 'Module Def', 'Transaction Log')" + ) diff --git a/csf_tz/patches/remove_stock_entry_qty_field.py b/csf_tz/patches/remove_stock_entry_qty_field.py new file mode 100644 index 0000000..43c194a --- /dev/null +++ b/csf_tz/patches/remove_stock_entry_qty_field.py @@ -0,0 +1,8 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + if frappe.db.exists("Custom Field", "Stock Entry-qty"): + frappe.delete_doc("Custom Field", "Stock Entry-qty", force=True) + if 'qty' in frappe.db.get_table_columns("Stock Entry"): + frappe.db.sql_ddl("alter table `tabStock Entry` drop column qty") diff --git a/csf_tz/piecework/__init__.py b/csf_tz/piecework/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/piecework/report/__init__.py b/csf_tz/piecework/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/piecework/report/piecework_net_pay/__init__.py b/csf_tz/piecework/report/piecework_net_pay/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/piecework/report/piecework_net_pay/piecework_net_pay.json b/csf_tz/piecework/report/piecework_net_pay/piecework_net_pay.json new file mode 100644 index 0000000..5052444 --- /dev/null +++ b/csf_tz/piecework/report/piecework_net_pay/piecework_net_pay.json @@ -0,0 +1,49 @@ +{ + "add_total_row": 1, + "columns": [], + "creation": "2021-07-03 12:01:00.078585", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "filters": [ + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "mandatory": 1, + "wildcard_filter": 0 + }, + { + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "mandatory": 1, + "wildcard_filter": 0 + } + ], + "idx": 0, + "is_standard": "Yes", + "json": "{}", + "modified": "2021-07-05 17:39:33.435659", + "modified_by": "Administrator", + "module": "Piecework", + "name": "Piecework Net Pay", + "owner": "Administrator", + "prepared_report": 0, + "query": "SELECT a.employee_name AS \"Employee Name:Data:200\",\n e.bank_ac_no AS \"Bank A/C No:Data:200\",\n sum(a.amount) * 0.9 AS \"Net Pay:Currency:150\"\nFROM `tabAdditional Salary` a LEFT JOIN `tabEmployee` e ON a.employee = e.name\nWHERE a.payroll_date BETWEEN %(from_date)s AND %(to_date)s\nAND a.salary_component = 'Piecework'\nGROUP BY a.employee\nORDER by a.employee_name", + "ref_doctype": "Additional Salary", + "report_name": "Piecework Net Pay", + "report_type": "Query Report", + "roles": [ + { + "role": "HR User" + }, + { + "role": "System Manager" + }, + { + "role": "HR Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/public/build.json b/csf_tz/public/build.json new file mode 100644 index 0000000..90f0f77 --- /dev/null +++ b/csf_tz/public/build.json @@ -0,0 +1,5 @@ +{ + "js/select_dialog.min.js": ["public/js/select_dialog.js"], + "js/to_console.min.js": ["public/js/to_console.js"], + "js/jobcards.min.js": ["public/js/jobcards/jobcards.js"] +} diff --git a/csf_tz/public/css/theme.css b/csf_tz/public/css/theme.css new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/public/js/jobcards/Card.vue b/csf_tz/public/js/jobcards/Card.vue new file mode 100644 index 0000000..6db35f8 --- /dev/null +++ b/csf_tz/public/js/jobcards/Card.vue @@ -0,0 +1,436 @@ + + + + + \ No newline at end of file diff --git a/csf_tz/public/js/jobcards/JobCards.vue b/csf_tz/public/js/jobcards/JobCards.vue new file mode 100644 index 0000000..1baa580 --- /dev/null +++ b/csf_tz/public/js/jobcards/JobCards.vue @@ -0,0 +1,160 @@ + + + + \ No newline at end of file diff --git a/csf_tz/public/js/jobcards/bus.js b/csf_tz/public/js/jobcards/bus.js new file mode 100644 index 0000000..c6ae75a --- /dev/null +++ b/csf_tz/public/js/jobcards/bus.js @@ -0,0 +1 @@ +export const evntBus = new Vue(); \ No newline at end of file diff --git a/csf_tz/public/js/jobcards/jobcards.js b/csf_tz/public/js/jobcards/jobcards.js new file mode 100644 index 0000000..451c6dd --- /dev/null +++ b/csf_tz/public/js/jobcards/jobcards.js @@ -0,0 +1,25 @@ +import Job_Cards from './JobCards.vue'; + +frappe.provide('frappe.JobCards'); + + +frappe.JobCards.job_cards = class { + constructor({ parent }) { + this.$parent = $(parent); + this.page = parent.page; + this.make_body(); + } + make_body() { + this.$EL = this.$parent.find('.layout-main'); + this.vue = new Vue({ + vuetify: new Vuetify(), + el: this.$EL[0], + data: { + }, + render: h => h(Job_Cards), + }); + } + setup_header() { + + } +}; \ No newline at end of file diff --git a/csf_tz/public/js/jobcards/placeholder-image.png b/csf_tz/public/js/jobcards/placeholder-image.png new file mode 100644 index 0000000..a0fbdad Binary files /dev/null and b/csf_tz/public/js/jobcards/placeholder-image.png differ diff --git a/csf_tz/public/js/select_dialog.js b/csf_tz/public/js/select_dialog.js new file mode 100644 index 0000000..84dbd9f --- /dev/null +++ b/csf_tz/public/js/select_dialog.js @@ -0,0 +1,250 @@ +frappe.ui.form.SelectDialog = Class.extend({ + init: function (opts) { + $.extend(this, opts); + var me = this; + this.make(); + }, + make: function () { + let me = this; + + this.page_length = 20; + this.start = 0; + let fields = []; + let count = 0; + if (!this.date_field) { + this.date_field = "transaction_date"; + } + + + if ($.isArray(this.query_fields)) { + for (let df of this.query_fields) { + if (df.filter) { + fields.push(df, { fieldtype: "Column Break" }); + } + } + } + + fields = fields.concat([ + { + "fieldname": "date_range", + "label": __("Date Range"), + "fieldtype": "DateRange", + }, + { fieldtype: "Section Break" }, + { fieldtype: "HTML", fieldname: "results_area" }, + { + fieldtype: "Button", fieldname: "more_btn", label: __("More"), + click: function () { + me.start += 20; + frappe.flags.auto_scroll = true; + me.get_results(); + } + } + ]); + + this.dialog = new frappe.ui.Dialog({ + title: __(this.title), + fields: fields, + primary_action_label: __("Select"), + primary_action: function () { + me.action(me.get_checked_values(), me.args); + cur_dialog.hide(); + }, + }); + + this.$parent = $(this.dialog.body); + this.$wrapper = this.dialog.fields_dict.results_area.$wrapper.append(`
`); + + this.$results = this.$wrapper.find('.results'); + this.$results.append(this.make_list_row()); + + this.args = {}; + + this.bind_events(); + this.get_results(); + this.dialog.show(); + }, + + bind_events: function () { + let me = this; + + this.$results.on('click', '.list-item-container', function (e) { + if (!$(e.target).is(':checkbox') && !$(e.target).is('a')) { + $(this).find(':checkbox').trigger('click'); + + } + }); + this.$results.on('click', '.list-item--head :checkbox', (e) => { + this.$results.find('.list-item-container .list-row-check') + .prop("checked", ($(e.target).is(':checked'))); + }); + + this.$parent.find('.input-with-feedback').on('change', (e) => { + frappe.flags.auto_scroll = false; + this.get_results(); + + }); + + + this.$parent.find('[data-fieldname="date_range"]').on('blur', (e) => { + frappe.flags.auto_scroll = false; + this.get_results(); + }); + + + }, + + get_checked_values: function () { + var me = this; + return this.$results.find('.list-item-container').map(function () { + if ($(this).find('.list-row-check:checkbox:checked').length > 0) { + return $(this).find(`[data-item-${me.return_field}]`).attr(`data-item-${me.return_field}`); + } + }).get(); + }, + + make_list_row: function (result = {}) { + var me = this; + // Make a head row by default (if result not passed) + let head = Object.keys(result).length === 0; + + let contents = ``; + let columns = []; + + if ($.isArray(this.query_fields)) { + for (let df of this.query_fields) { + columns.push(df.fieldname); + } + } + columns.push("Date"); + + columns.forEach(function (column) { + contents += `
+ ${head ? `${__(frappe.model.unscrub(column))}` + : `${__(result[column])}` + } +
`; + }); + + let $row = $(`
+
+ +
+ ${contents} +
`); + + + head ? $row.addClass('list-item--head') + : $row = $(`
`).append($row); + if (!me.multi_select) { + $(".results").find('.list-row-check').on('change', function () { + $('input.list-row-check').not(this).prop('checked', false); + }); + } + + return $row; + }, + + render_result_list: function (results, more = 0) { + var me = this; + var more_btn = me.dialog.fields_dict.more_btn.$wrapper; + + // Make empty result set if filter is set + if (!frappe.flags.auto_scroll) { + this.empty_list(); + } + more_btn.hide(); + + if (results.length === 0) return; + if (more && me.page_length + me.start < results.length) { + more_btn.show(); + } else { more_btn.hide(); } + $(".results").find(".list-item-container").remove(); + results.forEach((result) => { + me.$results.append(me.make_list_row(result)); + }); + + if (frappe.flags.auto_scroll) { + this.$results.animate({ scrollTop: me.$results.prop('scrollHeight') }, 500); + } + }, + + empty_list: function () { + this.$results.find('.list-item-container').remove(); + }, + + get_results: function () { + let me = this; + + let filters = this.get_query ? this.get_query().filters : {}; + let filter_fields = [me.date_field]; + if ($.isArray(this.query_fields)) { + for (let df of this.query_fields) { + if (df.filter) { + filters[df.fieldname] = me.dialog.fields_dict[df.fieldname].get_value() || undefined; + me.args[df.fieldname] = filters[df.fieldname]; + filter_fields.push(df.fieldname); + } + + } + } + + let date_val = this.dialog.fields_dict["date_range"].get_value(); + if (date_val) { + filters[this.date_field] = ['between', date_val]; + } + + let args = { + doctype: "", + txt: "", + filters: filters, + filter_fields: filter_fields, + start: this.start, + page_length: this.page_length + 1, + query: this.get_query ? this.get_query().query : '', + as_dict: 1 + }; + frappe.call({ + type: "GET", + method: 'frappe.desk.search.search_widget', + no_spinner: true, + args: args, + callback: function (r) { + if (r.message) { r.values = r.message; } + let results = [], more = 0; + if (r.values.length) { + if (r.values.length > me.page_length) { + r.values.pop(); + more = 1; + } + r.values.forEach(function (result) { + if (me.date_field in result) { + result["Date"] = result[me.date_field]; + } + result.checked = 0; + result.parsed_date = Date.parse(result["Date"]); + results.push(result); + }); + results.map((result) => { + result["Date"] = frappe.format(result["Date"], { "fieldtype": "Date" }); + }); + + results.sort((a, b) => { + return a.parsed_date - b.parsed_date; + }); + + // Preselect oldest entry + if (me.start < 1 && r.values.length === 1) { + results[0].checked = 1; + } + } + else { + frappe.show_alert({ message: __('There is No Records'), indicator: 'red' }, 5); + } + me.render_result_list(results, more); + } + }); + }, +}); + diff --git a/csf_tz/public/js/to_console.js b/csf_tz/public/js/to_console.js new file mode 100644 index 0000000..0e91cc0 --- /dev/null +++ b/csf_tz/public/js/to_console.js @@ -0,0 +1,8 @@ +$(function() { + console.log("ON Listing"); + frappe.realtime.on('out_to_console', function(data) { + data.forEach(element => { + console.log(element); + }); + }); +}); \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/__init__.py b/csf_tz/purchase_and_stock_management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/__init__.py b/csf_tz/purchase_and_stock_management/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_list/__init__.py b/csf_tz/purchase_and_stock_management/doctype/bin_list/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_list/bin_list.json b/csf_tz/purchase_and_stock_management/doctype/bin_list/bin_list.json new file mode 100644 index 0000000..409d612 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_list/bin_list.json @@ -0,0 +1,167 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-08-28 16:50:11.056171", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "warehouse", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Warehouse", + "length": 0, + "no_copy": 0, + "options": "Warehouse", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "current_label", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Current Bin label", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "new_label", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "new label", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-08-28 17:15:41.818033", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Bin List", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_list/bin_list.py b/csf_tz/purchase_and_stock_management/doctype/bin_list/bin_list.py new file mode 100644 index 0000000..e481a77 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_list/bin_list.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BinList(Document): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_setup/__init__.py b/csf_tz/purchase_and_stock_management/doctype/bin_setup/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.js b/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.js new file mode 100644 index 0000000..c7cbe59 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Bin Setup', { + refresh: function(frm) { + console.log(frm.doc); + } +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.json b/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.json new file mode 100644 index 0000000..722ed9c --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.json @@ -0,0 +1,93 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-08-28 16:51:27.441831", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bin_table", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bin Table", + "length": 0, + "no_copy": 0, + "options": "Bin List", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2019-08-28 16:51:27.441831", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Bin Setup", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.py b/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.py new file mode 100644 index 0000000..5e7544a --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_setup/bin_setup.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class BinSetup(Document): + def validate(self): + self.before_save() + + def before_save(self): + for d in self.bin_table: + + if d.new_label: + bin_no = frappe.db.get_value('Bin', {"item_code": d.item_code, "warehouse": d.warehouse, }, "name") + if bin_no: + doc = frappe.get_doc("Bin", bin_no) + doc.bin_label = d.new_label + doc.save() + self.bin_table = [] diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_setup/test_bin_setup.js b/csf_tz/purchase_and_stock_management/doctype/bin_setup/test_bin_setup.js new file mode 100644 index 0000000..bbc5caf --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_setup/test_bin_setup.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Bin Setup", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Bin Setup + () => frappe.tests.make('Bin Setup', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/bin_setup/test_bin_setup.py b/csf_tz/purchase_and_stock_management/doctype/bin_setup/test_bin_setup.py new file mode 100644 index 0000000..9962f04 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/bin_setup/test_bin_setup.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestBinSetup(unittest.TestCase): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/item_number/__init__.py b/csf_tz/purchase_and_stock_management/doctype/item_number/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.js b/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.js new file mode 100644 index 0000000..01636b5 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Item Number', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.json b/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.json new file mode 100644 index 0000000..ee91684 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.json @@ -0,0 +1,94 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2019-04-09 17:04:29.571033", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "id", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "ID", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2019-04-12 14:34:03.025543", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Item Number", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.py b/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.py new file mode 100644 index 0000000..d740de2 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/item_number/item_number.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ItemNumber(Document): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/item_number/test_item_number.js b/csf_tz/purchase_and_stock_management/doctype/item_number/test_item_number.js new file mode 100644 index 0000000..cbff0fd --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/item_number/test_item_number.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Item Number", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Item Number + () => frappe.tests.make('Item Number', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/item_number/test_item_number.py b/csf_tz/purchase_and_stock_management/doctype/item_number/test_item_number.py new file mode 100644 index 0000000..f130e0a --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/item_number/test_item_number.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestItemNumber(unittest.TestCase): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/order_track/__init__.py b/csf_tz/purchase_and_stock_management/doctype/order_track/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.js b/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.js new file mode 100644 index 0000000..642a835 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.js @@ -0,0 +1,62 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Order Track', { + + refresh: function(frm) { + frm.events.show_hide_fields(frm); + console.log(frm); + //console.log(hide_show_sections.name); + //alert(cur_frm.doc.docstatus) + + //make product inspection ie. submitted + if(cur_frm.doc.docstatus === 1 ) { + cur_frm.add_custom_button(__('Product Inspection'), function(){frm.events.make_product_inspection(frm)}, __("Make")); + + + } + + + + //Arrival date entered,clearing company and completion date ! blank + if (frm.doc.arrival_date && frm.doc.arrival_date != null ){ + if (frm.doc.clearing_company == '' || (frm.doc.expected_clearing_completion_date ==null)){ + var msg = "Either Clearing Company or Clearing Completion Date is unfilled,Please fill the fields"; + frappe.msgprint(msg); + throw msg; + + } + } + }, + + + show_hide_fields:function(frm){ + frm.toggle_display('section_international_supplier',(frm.doc.supplier && frm.doc.supplier_type && frm.doc.supplier_type=='International Supplier' )); + frm.toggle_display('section_containers',(frm.doc.supplier && frm.doc.supplier_type && frm.doc.supplier_type=='International Supplier')); + frm.toggle_display('section_local_supplier', (frm.doc.supplier && frm.doc.supplier_type && frm.doc.supplier_type=='Local Supplier')); + frm.toggle_display('section_order_progress',(frm.doc.supplier && frm.doc.supplier_type)); + frm.toggle_display('section_items_ordered', (frm.doc.supplier && frm.doc.supplier_type)); + frm.toggle_display('section_status', (frm.doc.supplier && frm.doc.supplier_type)); + }, + + + + supplier:function(frm){ + frm.events.show_hide_fields(frm); + + }, + + supplier_type:function(frm){ + frm.events.show_hide_fields(frm); + }, + + //Product Inspection function + make_product_inspection:function(){ + frappe.model.open_mapped_doc({ + method: "erpnext.purchase_and_stock_management.doctype.order_track.order_track.make_product_inspection", + frm: cur_frm + }) + + }, + +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.json b/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.json new file mode 100644 index 0000000..776aacb --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.json @@ -0,0 +1,902 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "ORDERTRACK.####", + "beta": 0, + "creation": "2018-09-14 11:22:44.065711", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "supplier", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supplier", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "supplier_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supplier Type", + "length": 0, + "no_copy": 0, + "options": "International Supplier\nLocal Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expected_arrival_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expected Arrival Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "arrival_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Arrival Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_containers", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Containers", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "containers", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Container", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "international_supplier", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "International Supplier", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipped_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Shipped Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bl_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Bl Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "discharged_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Discharged Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "mode_of_transport", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Mode Of Transport", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "clearing_company", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Company", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "bl_received", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BL Received", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_15", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "clearing_agent_bl", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "BL Given to Clearing Agent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "expected_clearing_completion_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expected Clearing Completion Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "clearing_completion_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Clearing Completion Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date_of_invoice", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date Of Invoice", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date_received_registration_card", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Registration Card Date Received ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_order_progress", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Order Progress", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "order_progress", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Order Progress", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_items_ordered", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Items Ordered", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Items", + "length": 0, + "no_copy": 0, + "options": "Order Tracking Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "status", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "Open\nArrived\nOverdue\nCleared", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 0, + "options": "Order Track", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-09-14 12:56:10.919725", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Order Track", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.py b/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.py new file mode 100644 index 0000000..3ec0e48 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_track/order_track.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class OrderTrack(Document): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/order_track/test_order_track.js b/csf_tz/purchase_and_stock_management/doctype/order_track/test_order_track.js new file mode 100644 index 0000000..576cc20 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_track/test_order_track.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Order Track", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Order Track + () => frappe.tests.make('Order Track', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/order_track/test_order_track.py b/csf_tz/purchase_and_stock_management/doctype/order_track/test_order_track.py new file mode 100644 index 0000000..48f21c4 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_track/test_order_track.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestOrderTrack(unittest.TestCase): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/__init__.py b/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/order_tracking_container.json b/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/order_tracking_container.json new file mode 100644 index 0000000..c768d86 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/order_tracking_container.json @@ -0,0 +1,103 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-09-07 16:21:37.510971", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "co_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "co_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Container Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-09-07 16:21:58.760240", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Order Tracking Container", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/order_tracking_container.py b/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/order_tracking_container.py new file mode 100644 index 0000000..35345e5 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/order_tracking_container/order_tracking_container.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class OrderTrackingContainer(Document): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/__init__.py b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.js b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.js new file mode 100644 index 0000000..c5cdeb4 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Purchase And Stock Management Test', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.json b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.json new file mode 100644 index 0000000..1d6944f --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.json @@ -0,0 +1,92 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-06-27 18:49:31.174054", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "pstest", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "pstest", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-27 18:49:31.174054", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Purchase And Stock Management Test", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.py b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.py new file mode 100644 index 0000000..af268a7 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/purchase_and_stock_management_test.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PurchaseAndStockManagementTest(Document): + pass diff --git a/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/test_purchase_and_stock_management_test.js b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/test_purchase_and_stock_management_test.js new file mode 100644 index 0000000..81320b4 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/test_purchase_and_stock_management_test.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Purchase And Stock Management Test", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Purchase And Stock Management Test + () => frappe.tests.make('Purchase And Stock Management Test', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/test_purchase_and_stock_management_test.py b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/test_purchase_and_stock_management_test.py new file mode 100644 index 0000000..88bcf9c --- /dev/null +++ b/csf_tz/purchase_and_stock_management/doctype/purchase_and_stock_management_test/test_purchase_and_stock_management_test.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPurchaseAndStockManagementTest(unittest.TestCase): + pass diff --git a/csf_tz/purchase_and_stock_management/report/__init__.py b/csf_tz/purchase_and_stock_management/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/bin_system/__init__.py b/csf_tz/purchase_and_stock_management/report/bin_system/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/bin_system/bin_system.json b/csf_tz/purchase_and_stock_management/report/bin_system/bin_system.json new file mode 100644 index 0000000..ecf758d --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/bin_system/bin_system.json @@ -0,0 +1,28 @@ +{ + "add_total_row": 0, + "creation": "2019-08-28 14:32:30.480565", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-08-28 14:38:51.131357", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Bin System", + "owner": "Administrator", + "ref_doctype": "Bin", + "report_name": "Bin System", + "report_type": "Report Builder", + "roles": [ + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Stock User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/item_price_stock/__init__.py b/csf_tz/purchase_and_stock_management/report/item_price_stock/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.js b/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.js new file mode 100644 index 0000000..5953148 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.js @@ -0,0 +1,9 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Item Price Stock"] = { + "filters": [ + + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.json b/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.json new file mode 100644 index 0000000..bb981dd --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.json @@ -0,0 +1,43 @@ +{ + "add_total_row": 0, + "creation": "2017-12-06 17:01:48.727970", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-07-04 08:47:26.486828", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Item Price Stock", + "owner": "Administrator", + "ref_doctype": "Item", + "report_name": "Item Price Stock", + "report_type": "Script Report", + "roles": [ + { + "role": "Item Manager" + }, + { + "role": "Stock Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Maintenance User" + }, + { + "role": "Accounts User" + }, + { + "role": "Manufacturing User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.py b/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.py new file mode 100644 index 0000000..4c11b75 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/item_price_stock/item_price_stock.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe + +def execute(filters=None): + columns, data = [], [] + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/item_shortage_report/__init__.py b/csf_tz/purchase_and_stock_management/report/item_shortage_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.js b/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.js new file mode 100644 index 0000000..2e64483 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.js @@ -0,0 +1,25 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 7); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Item Shortage Report"] = { + "filters": [ + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.json b/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.json new file mode 100644 index 0000000..60bf803 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "creation": "2013-08-20 13:43:30", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "json": "{\"add_total_row\": 0, \"sort_by\": \"Bin.projected_qty\", \"sort_order\": \"asc\", \"sort_by_next\": \"\", \"filters\": [[\"Bin\", \"projected_qty\", \"<\", \"0\"]], \"sort_order_next\": \"desc\", \"columns\": [[\"warehouse\", \"Bin\"], [\"item_code\", \"Bin\"], [\"actual_qty\", \"Bin\"], [\"ordered_qty\", \"Bin\"], [\"planned_qty\", \"Bin\"], [\"reserved_qty\", \"Bin\"], [\"projected_qty\", \"Bin\"]]}", + "modified": "2019-03-28 16:53:55.693621", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Item Shortage Report", + "owner": "Administrator", + "query": "SELECT bin.warehouse as \"Warehouse:Link/Warehouse:150\",\n\tbin.item_code as \"Item Code:Link/Item:100\",\n\tbin.actual_qty as \"Actual Quantity:Float:120\",\n\tbin.ordered_qty as \"Ordered Quantity:Float:120\",\n\tbin.planned_qty as \"Planned Quantity:Float:120\",\n\tbin.reserved_qty as \"Reserved Quantity:Float:120\",\n\tbin.projected_qty as \"Project Quantity:Float:120\",\n\titem.item_name as \"Item Name:Data:150\",\n\titem.description as \"Description::200\"\nFROM tabBin as bin\nINNER JOIN tabItem as item\nON bin.item_code=item.name\nWHERE bin.projected_qty<0\nORDER BY bin.projected_qty;", + "ref_doctype": "Bin", + "report_name": "Item Shortage Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Stock User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.py b/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.py new file mode 100644 index 0000000..019daa3 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/item_shortage_report/item_shortage_report.py @@ -0,0 +1,100 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "warehouse", + "label" : _("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname": "actual_qty", + "label": _("Actual Quantity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "ordered_qty", + "label": _("Ordered Quantity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "planned_qty", + "label": _("Planned Quantity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "reserved_qty", + "label": _("Reserved Quantity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "projected_qty", + "label": _("Projected Quantity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "item_name", + "label": _("Item Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 200 + }, + + ] + + where_filter = {} + where = "" + if filters.warehouse: + where += ' AND bin.warehouse = %(warehouse)s ' + where_filter.update({"warehouse": filters.warehouse}) + if filters.item_code: + where += ' AND bin.item_code = %(item_code)s ' + where_filter.update({"item_code": filters.item_code}) + + data = frappe.db.sql('''SELECT + bin.warehouse , + bin.item_code, + bin.actual_qty , + bin.ordered_qty, + bin.planned_qty, + bin.reserved_qty, + bin.projected_qty, + ti.item_name, + ti.description + FROM + (tabBin AS bin) + INNER JOIN + (tabItem AS ti) ON bin.item_code=ti.name + WHERE + bin.projected_qty<0 + /*ORDER BY + bin.projected_qty*/ + '''+ where, + where_filter, as_dict=1,as_list=1 + ); + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/items_to_be_requested/__init__.py b/csf_tz/purchase_and_stock_management/report/items_to_be_requested/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/items_to_be_requested/items_to_be_requested.json b/csf_tz/purchase_and_stock_management/report/items_to_be_requested/items_to_be_requested.json new file mode 100644 index 0000000..8909cff --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/items_to_be_requested/items_to_be_requested.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "creation": "2013-08-20 15:08:10", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2018-07-04 08:40:59.261932", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Items To Be Requested", + "owner": "Administrator", + "query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabItem.item_name as \"Item Name:Link/Item:200\",\n `tabItem Reorder`.warehouse as \"Warehouse:Link/Warehouse:150\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\",\n `tabItem Reorder`.warehouse_reorder_level as \"Reorder Level:Link/Warehouse:90\"\nFROM\n tabItem, tabBin\nLEFT JOIN\n `tabItem Reorder` ON `tabItem Reorder`.warehouse = tabBin.warehouse AND `tabItem Reorder`.parent = tabBin.item_code\nWHERE\n tabBin.item_code = tabItem.name\n AND tabBin.projected_qty <= `tabItem Reorder`.warehouse_reorder_level\nORDER BY\n tabBin.projected_qty ASC", + "ref_doctype": "Material Request", + "report_name": "Items To Be Requested", + "report_type": "Query Report", + "roles": [ + { + "role": "Purchase Manager" + }, + { + "role": "Stock Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Purchase User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/__init__.py b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js new file mode 100644 index 0000000..6bb4b7e --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js @@ -0,0 +1,19 @@ +// Copyright (c) 2015, InfluxERP +// License: GNU General Public License v3. See license.txt + +frappe.query_reports["Itemwise Recommended Reorder Level"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": frappe.sys_defaults.year_start_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today() + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.json b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.json new file mode 100644 index 0000000..7bf5dbc --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.json @@ -0,0 +1,43 @@ +{ + "add_total_row": 0, + "creation": "2013-06-07 12:47:22", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2018-07-04 08:57:30.984669", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Itemwise Recommended Reorder Level", + "owner": "Administrator", + "ref_doctype": "Item", + "report_name": "Itemwise Recommended Reorder Level", + "report_type": "Script Report", + "roles": [ + { + "role": "Item Manager" + }, + { + "role": "Stock Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Maintenance User" + }, + { + "role": "Accounts User" + }, + { + "role": "Manufacturing User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py new file mode 100644 index 0000000..9afd139 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py @@ -0,0 +1,90 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt +from __future__ import unicode_literals + +import frappe +from frappe import _ +from frappe.utils import getdate, flt + +def execute(filters=None): + if not filters: filters = {} + float_preceision = frappe.db.get_default("float_preceision") + + condition =get_condition(filters) + + avg_daily_outgoing = 0 + diff = ((getdate(filters.get("to_date")) - getdate(filters.get("from_date"))).days)+1 + if diff <= 0: + frappe.throw(_("'From Date' must be after 'To Date'")) + + columns = get_columns() + items = get_item_info() + consumed_item_map = get_consumed_items(condition) + delivered_item_map = get_delivered_items(condition) + + data = [] + for item in items: + total_outgoing = consumed_item_map.get(item.name, 0) + delivered_item_map.get(item.name,0) + avg_daily_outgoing = flt(total_outgoing / diff, float_preceision) + reorder_level = (avg_daily_outgoing * flt(item.lead_time_days)) + flt(item.safety_stock) + + data.append([item.name, item.item_name, item.description, item.safety_stock, item.lead_time_days, + consumed_item_map.get(item.name, 0), delivered_item_map.get(item.name,0), total_outgoing, + avg_daily_outgoing, reorder_level]) + + return columns , data + +def get_columns(): + return[ + _("Item") + ":Link/Item:120", _("Item Name") + ":Data:120", _("Description") + "::160", + _("Safety Stock") + ":Float:160", _("Lead Time Days") + ":Float:120", _("Consumed") + ":Float:120", + _("Delivered") + ":Float:120", _("Total Outgoing") + ":Float:120", _("Avg Daily Outgoing") + ":Float:160", + _("Reorder Level") + ":Float:120" + ] + +def get_item_info(): + return frappe.db.sql("""select name, item_name, description, safety_stock, + lead_time_days from tabItem""", as_dict=1) + +def get_consumed_items(condition): + cn_items = frappe.db.sql("""select se_item.item_code, + sum(se_item.transfer_qty) as 'consume_qty' + from `tabStock Entry` se, `tabStock Entry Detail` se_item + where se.name = se_item.parent and se.docstatus = 1 + and (ifnull(se_item.t_warehouse, '') = '' or se.purpose = 'Subcontract') %s + group by se_item.item_code""" % (condition), as_dict=1) + + cn_items_map = {} + for item in cn_items: + cn_items_map.setdefault(item.item_code, item.consume_qty) + + return cn_items_map + +def get_delivered_items(condition): + dn_items = frappe.db.sql("""select dn_item.item_code, sum(dn_item.stock_qty) as dn_qty + from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item + where dn.name = dn_item.parent and dn.docstatus = 1 %s + group by dn_item.item_code""" % (condition), as_dict=1) + + si_items = frappe.db.sql("""select si_item.item_code, sum(si_item.stock_qty) as si_qty + from `tabSales Invoice` si, `tabSales Invoice Item` si_item + where si.name = si_item.parent and si.docstatus = 1 and + si.update_stock = 1 %s + group by si_item.item_code""" % (condition), as_dict=1) + + dn_item_map = {} + for item in dn_items: + dn_item_map.setdefault(item.item_code, item.dn_qty) + + for item in si_items: + dn_item_map.setdefault(item.item_code, item.si_qty) + + return dn_item_map + +def get_condition(filters): + conditions = "" + if filters.get("from_date") and filters.get("to_date"): + conditions += " and posting_date between '%s' and '%s'" % (filters["from_date"],filters["to_date"]) + else: + frappe.throw(_("From and To dates required")) + return conditions diff --git a/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/__init__.py b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.js b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.js new file mode 100644 index 0000000..e8d7536 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.js @@ -0,0 +1,51 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 7); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Ordered Items To Be Delivered"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer", + }, + { + "fieldname":"sales_order", + "label": __("Sales Order"), + "fieldtype": "Link", + "options": "Sales Order", + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json new file mode 100644 index 0000000..f75f70b --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "creation": "2018-01-09 18:38:23.540100", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-03-28 17:41:35.569559", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Ordered Items To Be Delivered", + "owner": "Administrator", + "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`customer_name` as \"Customer Name::150\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project:Link/Project:120\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.qty as \"Qty:Float:140\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float:140\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float:140\",\n `tabSales Order Item`.base_rate as \"Rate:Float:140\",\n `tabSales Order Item`.base_amount as \"Amount:Float:140\",\n ((`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0))*`tabSales Order Item`.base_rate) as \"Amount to Deliver:Float:140\",\n `tabBin`.actual_qty as \"Available Qty:Float:120\",\n `tabBin`.projected_qty as \"Projected Qty:Float:120\",\n `tabSales Order Item`.`delivery_date` as \"Item Delivery Date:Date:120\",\n DATEDIFF(CURDATE(),`tabSales Order Item`.`delivery_date`) as \"Delay Days:Int:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order Item`.item_group as \"Item Group:Link/Item Group:120\",\n `tabSales Order Item`.warehouse as \"Warehouse:Link/Warehouse:200\"\nfrom\n `tabSales Order` JOIN `tabSales Order Item` \n LEFT JOIN `tabBin` ON (`tabBin`.item_code = `tabSales Order Item`.item_code\n and `tabBin`.warehouse = `tabSales Order Item`.warehouse)\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status not in (\"Stopped\", \"Closed\")\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc", + "ref_doctype": "Delivery Note", + "report_name": "Ordered Items To Be Delivered", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Stock Manager" + }, + { + "role": "Sales User" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.py b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.py new file mode 100644 index 0000000..c9c6182 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.py @@ -0,0 +1,195 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "name", + "label" : _("Sales Order"), + "fieldtype": "Link", + "options": "Sales Order" + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + }, + { + "fieldname": "customer_name", + "label": _("Customer Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "transaction_date", + "label": _("Date "), + "fieldtype": "Date", + }, + { + "fieldname": "project", + "label": _("Project"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname": "req_by", + "label": _("Req By Date "), + "fieldtype": "Date", + }, + + { + "fieldname": "qty", + "label": _("Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "delivered_qty", + "label": _("Delivered Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "qty_to_deliver", + "label": _("Qty to Deliver"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "base_rate", + "label": _("Rate"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "base_amount", + "label": _("Amount"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "amount_to_deliver", + "label": _("Amount To Deliver"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "actual_qty", + "label": _("Available Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "projected_qty", + "label": _("Projected Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "delivery_date", + "label": _("Item Delivery Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "delay_days", + "label": _("Delay Days"), + "fieldtype": "Int", + "width": 150 + }, + { + "fieldname": "item_name", + "label": _("Item Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "item_group", + "label": _("Item Group"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + "width": 150 + }, + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + if filters.sales_order: + where += ' AND tso.name = %(sales_order)s ' + where_filter.update({"sales_order": filters.sales_order}) + if filters.item_code: + where += ' AND so_itm.item_code = %(item_code)s ' + where_filter.update({"item_code": filters.item_code}) + if filters.customer: + where += ' AND tso.customer = %(customer)s ' + where_filter.update({"customer": filters.customer}) + if filters.warehouse: + where += ' AND so_itm.warehouse = %(warehouse)s ' + where_filter.update({"warehouse": filters.warehouse}) + + + data = frappe.db.sql('''SELECT + tso.name, + tso.customer, + tso.customer_name, + tso.transaction_date, + tso.project, + so_itm.item_code, + so_itm.qty, + so_itm.delivered_qty, + (so_itm.qty - ifnull(so_itm.delivered_qty, 0)) AS qty_to_deliver, + so_itm.base_rate, + so_itm.base_amount, + ((so_itm.qty - ifnull(so_itm.delivered_qty, 0))* so_itm.base_rate) + AS amount_to_deliver, + bin.actual_qty, + bin.projected_qty, + so_itm.delivery_date, + DATEDIFF(CURDATE(),so_itm.delivery_date) AS delay_days, + so_itm.item_name, + so_itm.description, + so_itm.item_group, + so_itm.warehouse + FROM + (`tabSales Order` tso) JOIN (`tabSales Order Item` so_itm) + LEFT JOIN + (tabBin AS bin ) ON (bin.item_code = so_itm.item_code + and bin.warehouse = so_itm.warehouse) + WHERE + so_itm.parent = tso.name + AND tso.docstatus = 1 + AND tso.status not in ("Stopped", "Closed") + AND ifnull(so_itm.delivered_qty, 0) < ifnull(so_itm.qty, 0) +/* ORDER BY tso.transaction_date +*/ '''+ where, + where_filter, as_dict=1,as_list=1 + ); + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/pending_ordered_items/__init__.py b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.js b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.js new file mode 100644 index 0000000..3b2305d --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.js @@ -0,0 +1,51 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 7); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Pending Ordered Items"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"purchase_order", + "label": __("Purchase Order"), + "fieldtype": "Link", + "options": "Purchase Order", + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + }, + { + "fieldname":"supplier", + "label": __("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.json b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.json new file mode 100644 index 0000000..1e7c1e5 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "creation": "2018-07-10 12:03:10.633041", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-03-28 15:52:05.388704", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Pending Ordered Items", + "owner": "Administrator", + "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n\t`tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order Item`.`schedule_date` as \"Reqd by Date:Date:110\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.qty as \"Qty:Float:100\",\n\t`tabPurchase Order Item`.received_qty as \"Received Qty:Float:100\", \n\t(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) as \"Qty to Receive:Float:100\",\n `tabPurchase Order Item`.warehouse as \"Warehouse:Link/Warehouse:150\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n `tabPurchase Order Item`.brand as \"Brand::100\",\n\t`tabPurchase Order`.`company` as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status not in (\"Stopped\", \"Closed\")\n\tand ifnull(`tabPurchase Order Item`.received_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc", + "ref_doctype": "Purchase Receipt", + "report_name": "Pending Ordered Items", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Purchase User" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.py b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.py new file mode 100644 index 0000000..fb06e4e --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/pending_ordered_items/pending_ordered_items.py @@ -0,0 +1,153 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "name", + "label" : _("Purchase Order"), + "fieldtype": "Link", + "options": "Purchase Order" + }, + { + "fieldname": "transaction_date", + "label": _("Date "), + "fieldtype": "Date", + }, + { + "fieldname": "req_by", + "label": _("Req By Date "), + "fieldtype": "Date", + }, + { + "fieldname": "supplier", + "label": _("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + }, + { + "fieldname": "supplier_name", + "label": _("Supplier Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "project", + "label": _("Project"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname": "qty", + "label": _("Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "received_qty", + "label": _("Received Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "qty_to_receive", + "label": _("Qty To Receive"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + "width": 150 + }, + { + "fieldname": "item_name", + "label": _("Item Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "brand", + "label": _("Brand"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "company", + "label": _("Company"), + "fieldtype": "Link", + "options": "Company", + "width": 150 + }, + + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + if filters.purchase_order: + where += ' AND tpo.name = %(purchase_order)s ' + where_filter.update({"purchase_order": filters.purchase_order}) + if filters.item_code: + where += ' AND tpoi.item_code = %(item_code)s ' + where_filter.update({"item_code": filters.item_code}) + if filters.warehouse: + where += ' AND tpoi.warehouse = %(warehouse)s ' + where_filter.update({"warehouse": filters.warehouse}) + if filters.supplier: + where += ' AND tpo.supplier = %(supplier)s ' + where_filter.update({"supplier": filters.supplier}) + + data = frappe.db.sql('''SELECT + tpo.name , + tpo.transaction_date , + tpoi.schedule_date AS req_by, + tpo.supplier, + tpo.supplier_name, + tpoi.project, + tpoi.item_code, + tpoi.qty , + tpoi.received_qty, + (tpoi.qty - ifnull(tpoi.received_qty, 0)) AS qty_to_receive, + tpoi.warehouse, + tpoi.item_name, + tpoi.description, + tpoi.brand, + tpo.company + FROM + (`tabPurchase Order` tpo), (`tabPurchase Order Item` tpoi) + /*LEFT JOIN + (`tabPurchase Order Item` tpoi) ON (tpoi.parent = tpo.name)*/ + WHERE + tpoi.parent = tpo.name + and tpo.docstatus = 1 + and tpo.status not in ("Stopped", "Closed") + and ifnull(tpoi.received_qty, 0) < ifnull(tpoi.qty, 0) + AND tpo.transaction_date BETWEEN %(from_date)s AND %(to_date)s +/* ORDER BY tpo.transaction_date +*/ '''+ where, + where_filter, as_dict=1,as_list=1 + ); + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/purchase_history/__init__.py b/csf_tz/purchase_and_stock_management/report/purchase_history/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.js b/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.js new file mode 100644 index 0000000..4801f78 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.js @@ -0,0 +1,45 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 7); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Purchase History"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"supplier", + "label": __("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + }, + { + "fieldname":"purchase_order", + "label": __("Purchase Order"), + "fieldtype": "Link", + "options": "Purchase Order", + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.json b/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.json new file mode 100644 index 0000000..0e7c72f --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "creation": "2018-07-10 12:12:48.093571", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-03-28 15:04:51.301485", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Purchase History", + "owner": "Administrator", + "query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n po_item.item_group as \"Item Group:Link/Item Group:120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n sup.supplier_name as \"Supplier Name::150\",\n\tpo_item.project as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\",\n\tpo.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item, `tabSupplier` sup\nwhere\n\tpo.name = po_item.parent and po.supplier = sup.name and po.docstatus = 1\norder by po.name desc", + "ref_doctype": "Purchase Order", + "report_name": "Purchase History", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Purchase Manager" + }, + { + "role": "Purchase User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.py b/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.py new file mode 100644 index 0000000..d0eed57 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/purchase_history/purchase_history.py @@ -0,0 +1,151 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname": "item_name", + "label": _("Item Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "item_group", + "label": _("Item Group"), + "fieldtype": "Link", + "options": "Item Group", + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "qty", + "label": _("Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "uom", + "label": _("UOM"), + "fieldtype": "Link", + "options": "UOM", + "width": 80 + + }, + { + "fieldname": "base_rate", + "label": _("Rate"), + "fieldtype": "Currency", + "width": 80 + }, + { + "fieldname": "base_amount", + "label": _("Amount"), + "fieldtype": "Currency", + "width": 80 + }, + { + "fieldname": "name", + "label" : _("Purchase Order"), + "fieldtype": "Link", + "options": "Purchase Order" + }, + { + "fieldname": "transaction_date", + "label": _("Date "), + "fieldtype": "Date", + }, + { + "fieldname": "supplier", + "label": _("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + }, + { + "fieldname": "supplier_name", + "label": _("Supplier Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "project", + "label": _("Project"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "received_qty", + "label": _("Received Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "company", + "label": _("Company"), + "fieldtype": "Link", + "options": "Company", + "width": 150 + }, + + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + if filters.purchase_order: + where += ' AND tpo.name = %(purchase_order)s ' + where_filter.update({"purchase_order": filters.purchase_order}) + if filters.item_code: + where += ' AND po_item.item_code = %(item_code)s ' + where_filter.update({"item_code": filters.item_code}) + if filters.supplier: + where += ' AND tpo.supplier = %(supplier)s ' + where_filter.update({"supplier": filters.supplier}) + + data = frappe.db.sql('''SELECT + po_item.item_code, + po_item.item_name, + po_item.item_group, + po_item.description, + po_item.qty , + po_item.uom, + po_item.base_rate, + po_item.base_amount, + + tpo.name , + tpo.transaction_date , + tpo.supplier, + sup.supplier_name, + po_item.project, + ifnull(po_item.received_qty, 0) AS received_qty, + tpo.company + + FROM + (`tabPurchase Order` tpo), (`tabPurchase Order Item` po_item), (`tabSupplier` sup) + /*LEFT JOIN + (`tabPurchase Order Item` po_item) ON (po_item.parent = tpo.name)*/ + WHERE + po_item.parent = tpo.name + AND tpo.supplier = sup.name + AND tpo.transaction_date BETWEEN %(from_date)s AND %(to_date)s + AND tpo.docstatus = 1 '''+ where, + where_filter, as_dict=1,as_list=1 + ); + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/reordering_items/__init__.py b/csf_tz/purchase_and_stock_management/report/reordering_items/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.js b/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.js new file mode 100644 index 0000000..80a7acc --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.js @@ -0,0 +1,39 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 7); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Reordering Items"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"material_request", + "label": __("Material Request"), + "fieldtype": "Link", + "options": "Material Request", + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.json b/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.json new file mode 100644 index 0000000..0d4f992 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "creation": "2018-07-10 11:53:15.279209", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-03-28 18:04:41.005899", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Reordering Items", + "owner": "Administrator", + "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc", + "ref_doctype": "Purchase Order", + "report_name": "Reordering Items", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Purchase Manager" + }, + { + "role": "Purchase User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.py b/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.py new file mode 100644 index 0000000..cadde82 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/reordering_items/reordering_items.py @@ -0,0 +1,107 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "name", + "label" : _("Material Request"), + "fieldtype": "Link", + "options": "Material Request" + }, + { + "fieldname": "transaction_date", + "label": _("Date "), + "fieldtype": "Date", + }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname": "qty", + "label": _("Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "ordered_qty", + "label": _("Ordered Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "qty_to_order", + "label": _("Qty To Order"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "item_name", + "label": _("Item Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "company", + "label": _("Company"), + "fieldtype": "Link", + "options": "Company", + "width": 150 + }, + + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + if filters.material_request: + where += ' AND tmr.name = %(material_request)s ' + where_filter.update({"material_request": filters.material_request}) + if filters.item_code: + where += ' AND tmri.item_code = %(item_code)s ' + where_filter.update({"item_code": filters.item_code}) + + data = frappe.db.sql('''SELECT + tmr.name , + tmr.transaction_date , + tmr.company, + tmri.item_code, + sum(ifnull(tmri.qty, 0)) AS qty, + sum(ifnull(tmri.ordered_qty, 0)) AS ordered_qty, + (sum(tmri.qty) - sum(ifnull(tmri.ordered_qty, 0))) AS qty_to_order, + tmri.item_name, + tmri.description, + tmr.company + FROM + (`tabMaterial Request` tmr), (`tabMaterial Request Item` tmri) + WHERE + tmri.parent = tmr.name + AND tmr.material_request_type = "Purchase" + AND tmr.docstatus = 1 + AND tmr.status != "Stopped" + AND tmr.transaction_date BETWEEN %(from_date)s AND %(to_date)s + GROUP BY tmr.name, tmri.item_code + HAVING + sum(ifnull(tmri.ordered_qty, 0)) < sum(ifnull(tmri.qty, 0)) +/* ORDER BY tmr.transaction_date +*/ '''+ where, + where_filter, as_dict=1,as_list=1 + ); + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/__init__.py b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.js b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.js new file mode 100644 index 0000000..1229f9e --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.js @@ -0,0 +1,39 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 7); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Requested Items To Be Transferred"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname":"material_request", + "label": __("Material Request"), + "fieldtype": "Link", + "options": "Material Request", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json new file mode 100644 index 0000000..bddaa7b --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json @@ -0,0 +1,32 @@ +{ + "add_total_row": 0, + "creation": "2013-05-13 16:23:05", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2019-03-28 17:59:50.346332", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Requested Items To Be Transferred", + "owner": "Administrator", + "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Transferred Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Transfer:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type in (\"Material Transfer\", \"Material Issue\")\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc", + "ref_doctype": "Stock Entry", + "report_name": "Requested Items To Be Transferred", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Manufacturing User" + }, + { + "role": "Manufacturing Manager" + }, + { + "role": "Stock Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.py b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.py new file mode 100644 index 0000000..5c971f6 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/requested_items_to_be_transferred/requested_items_to_be_transferred.py @@ -0,0 +1,105 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "name", + "label" : _("Material Request"), + "fieldtype": "Link", + "options": "Material Request" + }, + { + "fieldname": "transaction_date", + "label": _("Date "), + "fieldtype": "Date", + }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname": "qty", + "label": _("Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "ordered_qty", + "label": _("Ordered Qty"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "qty_to_order", + "label": _("Qty To Order"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "item_name", + "label": _("Item Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "description", + "label": _("Description"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "company", + "label": _("Company"), + "fieldtype": "Link", + "options": "Company", + "width": 150 + }, + + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + if filters.material_request: + where += ' AND tmr.name = %(material_request)s ' + where_filter.update({"material_request": filters.material_request}) + if filters.item_code: + where += ' AND tmri.item_code = %(item_code)s ' + where_filter.update({"item_code": filters.item_code}) + + data = frappe.db.sql('''SELECT + tmr.name , + tmr.transaction_date , + tmri.item_code, + tmri.qty, + tmri.ordered_qty, + (tmri.qty - ifnull(tmri.ordered_qty, 0)) AS qty_to_transfer, + tmri.item_name, + tmri.description, + tmr.company + + FROM + (`tabMaterial Request` tmr), (`tabMaterial Request Item` tmri) + WHERE + tmri.parent = tmr.name + and tmr.material_request_type in ("Material Transfer", "Material Issue") + and tmr.docstatus = 1 + and tmr.status != "Stopped" + and (ifnull(tmri.ordered_qty, 0) < ifnull(tmri.qty, 0)) + AND tmr.transaction_date BETWEEN %(from_date)s AND %(to_date)s +/* ORDER BY tmr.transaction_date +*/ '''+ where, + where_filter, as_dict=1,as_list=1 + ); + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/shipment_tracking/__init__.py b/csf_tz/purchase_and_stock_management/report/shipment_tracking/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.js b/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.js new file mode 100644 index 0000000..c3cf2d4 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.js @@ -0,0 +1,43 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Shipment Tracking"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"order", + "label": __("Order"), + "fieldtype": "Link", + "options": "Order Tracking", + }, +/* { + "fieldname":"purchase_order", + "label": __("Purchase Order"), + "fieldtype": "Link", + "options": "Purchase Order", + },*/ + { + "fieldname":"supplier", + "label": __("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.json b/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.json new file mode 100644 index 0000000..275dc17 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2019-05-23 12:18:43.832618", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-05-23 15:29:37.527392", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Shipment Tracking", + "owner": "Administrator", + "ref_doctype": "Order Tracking", + "report_name": "Shipment Tracking", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Branch Stock Controller" + }, + { + "role": "Branch Service Controller" + }, + { + "role": "Branch In Charge" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.py b/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.py new file mode 100644 index 0000000..485fc73 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/shipment_tracking/shipment_tracking.py @@ -0,0 +1,172 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "order_no", + "label": _("Order No"), + "fieldtype": "Link", + "options": "Order Tracking", + "width": 150 + }, + { + "fieldname": "project", + "label" : _("Project"), + "fieldtype": "Link", + "options": "Project" + }, + { + "fieldname": "supplier", + "label": _("Supplier"), + "fieldtype": "Link", + "options": "Supplier", + }, + { + "fieldname": "mode_of_transport", + "label": _("Mode of Transport"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "shipped_date", + "label": _("Shipping Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "expected_arrival_date", + "label": _("Expected Arrival Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "arrival_date", + "label": _("Arrival Date"), + "fieldtype": "Date", + }, + { + "fieldname": "order_status", + "label": _("Status"), + "fieldtype": "Data", + "width": 200 + }, + { + "fieldname": "bl_number", + "label": _("Bl No"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "container_no", + "label": _("Container"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "container_size", + "label": _("Container Size"), + "fieldtype": "Data", + }, + { + "fieldname": "no_of_packages", + "label": _("No of Packages"), + "fieldtype": "Data", + }, + { + "fieldname": "clearing_completion_date", + "label": _("Clearing Completion Date"), + "fieldtype": "Date", + }, + { + "fieldname": "delivered_date", + "label": _("Delivered Date"), + "fieldtype": "Date", + }, + { + "fieldname": "offloading_date", + "label": _("Off-Loading Date"), + "fieldtype": "Date", + }, + + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + if filters.order: + where += ' AND tot.name = %(order)s ' + where_filter.update({"order": filters.order}) + + if filters.supplier: + where += ' AND tot.supplier = %(supplier)s ' + where_filter.update({"supplier": filters.supplier}) + + data = frappe.db.sql('''SELECT + tot.name AS order_no, + tot.supplier, + tot.project, + tot.shipped_date, + tot.expected_arrival_date, + tot.mode_of_transport, + tot.bl_number, + tot.arrival_date, + tot.clearing_completion_date, + tot.delivered_date, + tot.offloading_date, + /*tc.container_no, + tc.size, + tc.no_of_packages,*/ + + (SELECT + CONCAT(op.date, " : ", op.current_location, ":", op.status) + FROM + `tabOrder Progress` AS op + WHERE + tot.name = op.parent + ORDER BY + op.date DESC + LIMIT 0,1 + ) AS order_status + FROM + (`tabOrder Tracking` tot) + /*LEFT JOIN + (`tabContainer` tc) + ON (tot.name = tc.parent)*/ + Where + tot.expected_arrival_date BETWEEN %(from_date)s AND %(to_date)s + '''+ where, + where_filter, as_dict=1) + + for order in data: + # + # For container info + # + container_info = frappe.db.sql('''SELECT + container_no, size,no_of_packages + FROM + (`tabContainer` tc) + LEFT JOIN + (`tabOrder Tracking` tot) + ON (tot.name = tc.parent) + WHERE + tot.name = %(parent)s ''', + {"parent": order.order_no,}, as_dict=1) + order.container_no = '' + order.container_size='' + order.no_of_packages='' + + for co in container_info: + order.container_no += str(co.container_no) + ',' + order.container_size += str(co.size) + ',' + order.no_of_packages += str(co.no_of_packages) + ',' + + return columns, data diff --git a/csf_tz/purchase_and_stock_management/report/stock_ageing/__init__.py b/csf_tz/purchase_and_stock_management/report/stock_ageing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.js b/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.js new file mode 100644 index 0000000..a345dd7 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.js @@ -0,0 +1,40 @@ +// Copyright (c) 2015, InfluxERP +// License: GNU General Public License v3. See license.txt + +frappe.query_reports["Stock Ageing"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "default": frappe.defaults.get_user_default("Company"), + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": frappe.datetime.get_today(), + "reqd": 1 + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item" + }, + { + "fieldname":"brand", + "label": __("Brand"), + "fieldtype": "Link", + "options": "Brand" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.json b/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.json new file mode 100644 index 0000000..156a88b --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.json @@ -0,0 +1,43 @@ +{ + "add_total_row": 0, + "creation": "2013-12-02 17:09:31", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2018-07-04 08:45:23.291355", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Stock Ageing", + "owner": "Administrator", + "ref_doctype": "Item", + "report_name": "Stock Ageing", + "report_type": "Script Report", + "roles": [ + { + "role": "Item Manager" + }, + { + "role": "Stock Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Maintenance User" + }, + { + "role": "Accounts User" + }, + { + "role": "Manufacturing User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.py b/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.py new file mode 100644 index 0000000..1147ab8 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/stock_ageing/stock_ageing.py @@ -0,0 +1,103 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.utils import date_diff, flt + +def execute(filters=None): + + columns = get_columns() + item_details = get_fifo_queue(filters) + to_date = filters["to_date"] + data = [] + for item, item_dict in item_details.items(): + fifo_queue = item_dict["fifo_queue"] + details = item_dict["details"] + if not fifo_queue: continue + + average_age = get_average_age(fifo_queue, to_date) + earliest_age = date_diff(to_date, fifo_queue[0][1]) + latest_age = date_diff(to_date, fifo_queue[-1][1]) + + data.append([item, details.item_name, details.description, details.item_group, + details.brand, average_age, earliest_age, latest_age, details.stock_uom]) + + return columns, data + +def get_average_age(fifo_queue, to_date): + batch_age = age_qty = total_qty = 0.0 + for batch in fifo_queue: + batch_age = date_diff(to_date, batch[1]) + age_qty += batch_age * batch[0] + total_qty += batch[0] + + return (age_qty / total_qty) if total_qty else 0.0 + +def get_columns(): + return [_("Item Code") + ":Link/Item:100", _("Item Name") + "::100", _("Description") + "::200", + _("Item Group") + ":Link/Item Group:100", _("Brand") + ":Link/Brand:100", _("Average Age") + ":Float:100", + _("Earliest") + ":Int:80", _("Latest") + ":Int:80", _("UOM") + ":Link/UOM:100"] + +def get_fifo_queue(filters): + item_details = {} + for d in get_stock_ledger_entries(filters): + item_details.setdefault(d.name, {"details": d, "fifo_queue": []}) + fifo_queue = item_details[d.name]["fifo_queue"] + + if d.voucher_type == "Stock Reconciliation": + d.actual_qty = flt(d.qty_after_transaction) - flt(item_details[d.name].get("qty_after_transaction", 0)) + + if d.actual_qty > 0: + fifo_queue.append([d.actual_qty, d.posting_date]) + else: + qty_to_pop = abs(d.actual_qty) + while qty_to_pop: + batch = fifo_queue[0] if fifo_queue else [0, None] + if 0 < batch[0] <= qty_to_pop: + # if batch qty > 0 + # not enough or exactly same qty in current batch, clear batch + qty_to_pop -= batch[0] + fifo_queue.pop(0) + else: + # all from current batch + batch[0] -= qty_to_pop + qty_to_pop = 0 + + item_details[d.name]["qty_after_transaction"] = d.qty_after_transaction + + return item_details + +def get_stock_ledger_entries(filters): + return frappe.db.sql("""select + item.name, item.item_name, item_group, brand, description, item.stock_uom, + actual_qty, posting_date, voucher_type, qty_after_transaction + from `tabStock Ledger Entry` sle, + (select name, item_name, description, stock_uom, brand, item_group + from `tabItem` {item_conditions}) item + where item_code = item.name and + company = %(company)s and + posting_date <= %(to_date)s + {sle_conditions} + order by posting_date, posting_time, sle.name"""\ + .format(item_conditions=get_item_conditions(filters), + sle_conditions=get_sle_conditions(filters)), filters, as_dict=True) + +def get_item_conditions(filters): + conditions = [] + if filters.get("item_code"): + conditions.append("item_code=%(item_code)s") + if filters.get("brand"): + conditions.append("brand=%(brand)s") + + return "where {}".format(" and ".join(conditions)) if conditions else "" + +def get_sle_conditions(filters): + conditions = [] + if filters.get("warehouse"): + lft, rgt = frappe.db.get_value('Warehouse', filters.get("warehouse"), ['lft', 'rgt']) + conditions.append("""warehouse in (select wh.name from `tabWarehouse` wh + where wh.lft >= {0} and rgt <= {1})""".format(lft, rgt)) + + return "and {}".format(" and ".join(conditions)) if conditions else "" diff --git a/csf_tz/purchase_and_stock_management/report/stock_projected_qty/__init__.py b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.js b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.js new file mode 100644 index 0000000..8c2253d --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.js @@ -0,0 +1,36 @@ +// Copyright (c) 2015, InfluxERP +// License: GNU General Public License v3. See license.txt + +frappe.query_reports["Stock Projected Qty"] = { + "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company" + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + { + "fieldname":"item_code", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + "get_query": function() { + return { + query: "erpnext.controllers.queries.item_query" + } + } + }, + { + "fieldname":"brand", + "label": __("Brand"), + "fieldtype": "Link", + "options": "Brand" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.json b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.json new file mode 100644 index 0000000..7398774 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.json @@ -0,0 +1,43 @@ +{ + "add_total_row": 1, + "creation": "2013-12-04 18:21:56", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2018-07-04 08:44:08.400719", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Stock Projected Qty", + "owner": "Administrator", + "ref_doctype": "Item", + "report_name": "Stock Projected Qty", + "report_type": "Script Report", + "roles": [ + { + "role": "Item Manager" + }, + { + "role": "Stock Manager" + }, + { + "role": "Stock User" + }, + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Maintenance User" + }, + { + "role": "Accounts User" + }, + { + "role": "Manufacturing User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.py b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.py new file mode 100644 index 0000000..694d148 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/stock_projected_qty/stock_projected_qty.py @@ -0,0 +1,113 @@ +# Copyright (c) 2015, InfluxERP +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.utils import flt, today + +def execute(filters=None): + filters = frappe._dict(filters or {}) + return get_columns(), get_data(filters) + +def get_columns(): + return [_("Item Code") + ":Link/Item:140", _("Item Name") + "::100", _("Description") + "::200", + _("Item Group") + ":Link/Item Group:100", _("Brand") + ":Link/Brand:100", _("Warehouse") + ":Link/Warehouse:120", + _("UOM") + ":Link/UOM:100", _("Actual Qty") + ":Float:100", _("Planned Qty") + ":Float:100", + _("Requested Qty") + ":Float:110", _("Ordered Qty") + ":Float:100", + _("Reserved Qty") + ":Float:100", _("Reserved Qty for Production") + ":Float:100", + _("Reserved for sub contracting") + ":Float:100", + _("Projected Qty") + ":Float:100", _("Reorder Level") + ":Float:100", _("Reorder Qty") + ":Float:100", + _("Shortage Qty") + ":Float:100"] + +def get_data(filters): + bin_list = get_bin_list(filters) + item_map = get_item_map(filters.get("item_code")) + warehouse_company = {} + data = [] + + for bin in bin_list: + item = item_map.get(bin.item_code) + + if not item: + # likely an item that has reached its end of life + continue + + # item = item_map.setdefault(bin.item_code, get_item(bin.item_code)) + company = warehouse_company.setdefault(bin.warehouse, + frappe.db.get_value("Warehouse", bin.warehouse, "company")) + + if filters.brand and filters.brand != item.brand: + continue + + elif filters.company and filters.company != company: + continue + + re_order_level = re_order_qty = 0 + + for d in item.get("reorder_levels"): + if d.warehouse == bin.warehouse: + re_order_level = d.warehouse_reorder_level + re_order_qty = d.warehouse_reorder_qty + + shortage_qty = re_order_level - flt(bin.projected_qty) if (re_order_level or re_order_qty) else 0 + + data.append([item.name, item.item_name, item.description, item.item_group, item.brand, bin.warehouse, + item.stock_uom, bin.actual_qty, bin.planned_qty, bin.indented_qty, bin.ordered_qty, + bin.reserved_qty, bin.reserved_qty_for_production, bin.reserved_qty_for_sub_contract, + bin.projected_qty, re_order_level, re_order_qty, shortage_qty]) + + return data + +def get_bin_list(filters): + conditions = [] + + if filters.item_code: + conditions.append("item_code = '%s' "%filters.item_code) + + if filters.warehouse: + warehouse_details = frappe.db.get_value("Warehouse", filters.warehouse, ["lft", "rgt"], as_dict=1) + + if warehouse_details: + conditions.append(" exists (select name from `tabWarehouse` wh \ + where wh.lft >= %s and wh.rgt <= %s and bin.warehouse = wh.name)"%(warehouse_details.lft, + warehouse_details.rgt)) + + bin_list = frappe.db.sql("""select item_code, warehouse, actual_qty, planned_qty, indented_qty, + ordered_qty, reserved_qty, reserved_qty_for_production, reserved_qty_for_sub_contract, projected_qty + from tabBin bin {conditions} order by item_code, warehouse + """.format(conditions=" where " + " and ".join(conditions) if conditions else ""), as_dict=1) + return bin_list + +def get_item_map(item_code): + """Optimization: get only the item doc and re_order_levels table""" + + condition = "" + if item_code: + condition = 'and item_code = "{0}"'.format(frappe.db.escape(item_code, percent=False)) + + items = frappe.db.sql("""select * from `tabItem` item + where is_stock_item = 1 + and disabled=0 + {condition} + and (end_of_life > %(today)s or end_of_life is null or end_of_life='0000-00-00') + and exists (select name from `tabBin` bin where bin.item_code=item.name)"""\ + .format(condition=condition), {"today": today()}, as_dict=True) + + condition = "" + if item_code: + condition = 'where parent="{0}"'.format(frappe.db.escape(item_code, percent=False)) + + reorder_levels = frappe._dict() + for ir in frappe.db.sql("""select * from `tabItem Reorder` {condition}""".format(condition=condition), as_dict=1): + if ir.parent not in reorder_levels: + reorder_levels[ir.parent] = [] + + reorder_levels[ir.parent].append(ir) + + item_map = frappe._dict() + for item in items: + item["reorder_levels"] = reorder_levels.get(item.name) or [] + item_map[item.name] = item + + return item_map diff --git a/csf_tz/purchase_and_stock_management/report/supplier_contacts/__init__.py b/csf_tz/purchase_and_stock_management/report/supplier_contacts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.js b/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.js new file mode 100644 index 0000000..ca737c9 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.js @@ -0,0 +1,34 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Supplier Contacts"] = { + "filters": [ + { + "reqd": 1, + "fieldname":"party_type", + "label": __("Party Type"), + "fieldtype": "Link", + "options": "DocType", + "get_query": function() { + return { + "filters": { + "name": ["in","Customer,Supplier,Sales Partner"], + } + } + } + }, + { + "fieldname":"party_name", + "label": __("Party Name"), + "fieldtype": "Dynamic Link", + "get_options": function() { + let party_type = frappe.query_report_filters_by_name.party_type.get_value(); + if(!party_type) { + frappe.throw(__("Please select Party Type first")); + } + return party_type; + } + } + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.json b/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.json new file mode 100644 index 0000000..7021d83 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2018-07-10 12:26:37.118490", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-07-10 12:26:37.118490", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Supplier Contacts", + "owner": "Administrator", + "ref_doctype": "Address", + "report_name": "Supplier Contacts", + "report_type": "Script Report", + "roles": [ + { + "role": "Sales User" + }, + { + "role": "Purchase User" + }, + { + "role": "Maintenance User" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.py b/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.py new file mode 100644 index 0000000..43cb279 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/supplier_contacts/supplier_contacts.py @@ -0,0 +1,91 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +from six.moves import range +import frappe + + +field_map = { + "Contact": [ "first_name", "last_name", "phone", "mobile_no", "email_id", "is_primary_contact" ], + "Address": [ "address_line1", "address_line2", "city", "state", "pincode", "country", "is_primary_address" ] +} + +def execute(filters=None): + columns, data = get_columns(filters), get_data(filters) + return columns, data + +def get_columns(filters): + return [ + "{party_type}:Link/{party_type}".format(party_type=filters.get("party_type")), + "Address Line 1", + "Address Line 2", + "City", + "State", + "Postal Code", + "Country", + "Is Primary Address:Check", + "First Name", + "Last Name", + "Phone", + "Mobile No", + "Email Id", + "Is Primary Contact:Check" + ] + +def get_data(filters): + data = [] + party_type = filters.get("party_type") + party = filters.get("party_name") + + return get_party_addresses_and_contact(party_type, party) + +def get_party_addresses_and_contact(party_type, party): + data = [] + filters = None + party_details = [] + + if not party_type: + return [] + + if party: + filters = { "name": party } + + party_details = frappe.get_list(party_type, filters=filters, fields=["name"], as_list=True) + for party_detail in map(list, party_details): + docname = party_detail[0] + + addresses = get_party_details(party_type, docname, doctype="Address") + contacts = get_party_details(party_type, docname, doctype="Contact") + + if not any([addresses, contacts]): + party_detail.extend([ "" for field in field_map.get("Address", []) ]) + party_detail.extend([ "" for field in field_map.get("Contact", []) ]) + data.append(party_detail) + else: + addresses = map(list, addresses) + contacts = map(list, contacts) + + max_length = max(len(addresses), len(contacts)) + for idx in range(0, max_length): + result = list(party_detail) + + address = addresses[idx] if idx < len(addresses) else [ "" for field in field_map.get("Address", []) ] + contact = contacts[idx] if idx < len(contacts) else [ "" for field in field_map.get("Contact", []) ] + result.extend(address) + result.extend(contact) + + data.append(result) + return data + +def get_party_details(party_type, docname, doctype="Address", fields=None): + default_filters = get_default_address_contact_filters(party_type, docname) + if not fields: + fields = field_map.get(doctype, ["name"]) + return frappe.get_list(doctype, filters=default_filters, fields=fields, as_list=True) + +def get_default_address_contact_filters(party_type, docname): + return [ + ["Dynamic Link", "link_doctype", "=", party_type], + ["Dynamic Link", "link_name", "=", docname] + ] \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/total_stock_summary/__init__.py b/csf_tz/purchase_and_stock_management/report/total_stock_summary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.js b/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.js new file mode 100644 index 0000000..05160b9 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.js @@ -0,0 +1,24 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Total Stock Summary"] = { + "filters": [ + { + "fieldname":"group_by", + "label": __("Group By"), + "fieldtype": "Select", + "width": "80", + "reqd": 1, + "options": ["","Warehouse", "Company"], + "default": "Warehouse" + }, + { + "fieldname": "company", + "label": __("Company"), + "fieldtype": "Link", + "width": "80", + "options": "Company" + }, + ] +} diff --git a/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.json b/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.json new file mode 100644 index 0000000..4294795 --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.json @@ -0,0 +1,31 @@ +{ + "add_total_row": 0, + "creation": "2017-06-26 14:05:50.256693", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-07-04 08:46:51.311355", + "modified_by": "Administrator", + "module": "Purchase And Stock Management", + "name": "Total Stock Summary", + "owner": "Administrator", + "ref_doctype": "Stock Entry", + "report_name": "Total Stock Summary", + "report_type": "Script Report", + "roles": [ + { + "role": "Stock User" + }, + { + "role": "Manufacturing User" + }, + { + "role": "Manufacturing Manager" + }, + { + "role": "Stock Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.py b/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.py new file mode 100644 index 0000000..991f56c --- /dev/null +++ b/csf_tz/purchase_and_stock_management/report/total_stock_summary/total_stock_summary.py @@ -0,0 +1,60 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + +def execute(filters=None): + if not filters: filters = {} + validate_filters(filters) + columns = get_columns() + stock = get_total_stock(filters) + + return columns, stock + +def get_columns(): + columns = [ + _("Company") + ":Link/Item:250", + _("Warehouse") + ":Link/Item:150", + _("Item") + ":Link/Item:150", + _("Description") + "::300", + _("Current Qty") + ":Float:100", + ] + + return columns + +def get_total_stock(filters): + conditions = "" + columns = "" + + if filters.get("group_by") == "Warehouse": + if filters.get("company"): + conditions += " AND warehouse.company = '%s'" % frappe.db.escape(filters.get("company"), percent=False) + + conditions += " GROUP BY ledger.warehouse, item.item_code" + columns += "'' as company, ledger.warehouse" + else: + conditions += " GROUP BY warehouse.company, item.item_code" + columns += " warehouse.company, '' as warehouse" + + return frappe.db.sql(""" + SELECT + %s, + item.item_code, + item.description, + sum(ledger.actual_qty) as actual_qty + FROM + `tabBin` AS ledger + INNER JOIN `tabItem` AS item + ON ledger.item_code = item.item_code + INNER JOIN `tabWarehouse` warehouse + ON warehouse.name = ledger.warehouse + WHERE + actual_qty != 0 %s""" % (columns, conditions)) + +def validate_filters(filters): + if filters.get("group_by") == 'Company' and \ + filters.get("company"): + + frappe.throw(_("Please set Company filter blank if Group By is 'Company'")) diff --git a/csf_tz/sales_and_marketing/__init__.py b/csf_tz/sales_and_marketing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/__init__.py b/csf_tz/sales_and_marketing/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/allert_custom/__init__.py b/csf_tz/sales_and_marketing/doctype/allert_custom/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.js b/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.js new file mode 100644 index 0000000..9ba064b --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Allert Custom', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.json b/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.json new file mode 100644 index 0000000..14fc3c2 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.json @@ -0,0 +1,92 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-09-07 17:10:34.066184", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-09-07 17:10:34.066184", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Allert Custom", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.py b/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.py new file mode 100644 index 0000000..c6fafee --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/allert_custom/allert_custom.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AllertCustom(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/allert_custom/test_allert_custom.js b/csf_tz/sales_and_marketing/doctype/allert_custom/test_allert_custom.js new file mode 100644 index 0000000..3c7889c --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/allert_custom/test_allert_custom.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Allert Custom", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Allert Custom + () => frappe.tests.make('Allert Custom', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/sales_and_marketing/doctype/allert_custom/test_allert_custom.py b/csf_tz/sales_and_marketing/doctype/allert_custom/test_allert_custom.py new file mode 100644 index 0000000..9236a5d --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/allert_custom/test_allert_custom.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestAllertCustom(unittest.TestCase): + pass diff --git a/csf_tz/sales_and_marketing/doctype/communications/__init__.py b/csf_tz/sales_and_marketing/doctype/communications/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/communications/communications.js b/csf_tz/sales_and_marketing/doctype/communications/communications.js new file mode 100644 index 0000000..f1d493a --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/communications/communications.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Communications', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/sales_and_marketing/doctype/communications/communications.json b/csf_tz/sales_and_marketing/doctype/communications/communications.json new file mode 100644 index 0000000..fd27445 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/communications/communications.json @@ -0,0 +1,302 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2018-08-01 15:23:55.792736", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 0, + "options": "COMM-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "type_of_communication", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Type Of Communication", + "length": 0, + "no_copy": 0, + "options": "Phone Call\nE-mail\nSms\nVisit", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "contacted_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Contacted By", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date_of_communication", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date of Communication", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "communication_feedback", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "feedback", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-08-03 15:22:13.397782", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Communications", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/communications/communications.py b/csf_tz/sales_and_marketing/doctype/communications/communications.py new file mode 100644 index 0000000..0709bd7 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/communications/communications.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Communications(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/communications/test_communications.js b/csf_tz/sales_and_marketing/doctype/communications/test_communications.js new file mode 100644 index 0000000..7796c7a --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/communications/test_communications.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Communications", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Communications + () => frappe.tests.make('Communications', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/sales_and_marketing/doctype/communications/test_communications.py b/csf_tz/sales_and_marketing/doctype/communications/test_communications.py new file mode 100644 index 0000000..6b9cb81 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/communications/test_communications.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestCommunications(unittest.TestCase): + pass diff --git a/csf_tz/sales_and_marketing/doctype/customer_item/__init__.py b/csf_tz/sales_and_marketing/doctype/customer_item/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/customer_item/customer_item.json b/csf_tz/sales_and_marketing/doctype/customer_item/customer_item.json new file mode 100644 index 0000000..606c610 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/customer_item/customer_item.json @@ -0,0 +1,137 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-08-02 10:59:29.720673", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "serial_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Serial No", + "length": 0, + "no_copy": 0, + "options": "Serial No", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Sales Invoice", + "length": 0, + "no_copy": 0, + "options": "Sales Invoice", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-08-06 15:54:59.784628", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Customer Item", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/customer_item/customer_item.py b/csf_tz/sales_and_marketing/doctype/customer_item/customer_item.py new file mode 100644 index 0000000..ef118c9 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/customer_item/customer_item.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class CustomerItem(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/marketing_dept/__init__.py b/csf_tz/sales_and_marketing/doctype/marketing_dept/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.js b/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.js new file mode 100644 index 0000000..6468f7a --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Marketing Dept', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.json b/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.json new file mode 100644 index 0000000..8302a78 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.json @@ -0,0 +1,92 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-06-27 15:23:03.516165", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "dept_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Dept Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-28 12:01:46.886677", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Marketing Dept", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.py b/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.py new file mode 100644 index 0000000..d4d60cd --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/marketing_dept/marketing_dept.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class MarketingDept(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/marketing_dept/test_marketing_dept.js b/csf_tz/sales_and_marketing/doctype/marketing_dept/test_marketing_dept.js new file mode 100644 index 0000000..ce64aac --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/marketing_dept/test_marketing_dept.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Marketing Dept", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Marketing Dept + () => frappe.tests.make('Marketing Dept', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/sales_and_marketing/doctype/marketing_dept/test_marketing_dept.py b/csf_tz/sales_and_marketing/doctype/marketing_dept/test_marketing_dept.py new file mode 100644 index 0000000..4cef646 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/marketing_dept/test_marketing_dept.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestMarketingDept(unittest.TestCase): + pass diff --git a/csf_tz/sales_and_marketing/doctype/past_sales/__init__.py b/csf_tz/sales_and_marketing/doctype/past_sales/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.js b/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.js new file mode 100644 index 0000000..43116ce --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Past Sales', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.json b/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.json new file mode 100644 index 0000000..e917819 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.json @@ -0,0 +1,281 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2019-01-07 11:31:35.302700", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 0, + "options": "PS-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_sold", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Sold", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sold_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date Sold", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "serial_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Serial Number", + "length": 0, + "no_copy": 0, + "options": "Past Serial No", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "plate_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-01-07 11:31:35.302700", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Past Sales", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.py b/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.py new file mode 100644 index 0000000..82c85c4 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_sales/past_sales.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PastSales(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/past_sales/test_past_sales.js b/csf_tz/sales_and_marketing/doctype/past_sales/test_past_sales.js new file mode 100644 index 0000000..bdc1bb5 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_sales/test_past_sales.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Past Sales", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Past Sales + () => frappe.tests.make('Past Sales', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/sales_and_marketing/doctype/past_sales/test_past_sales.py b/csf_tz/sales_and_marketing/doctype/past_sales/test_past_sales.py new file mode 100644 index 0000000..88b12d2 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_sales/test_past_sales.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPastSales(unittest.TestCase): + pass diff --git a/csf_tz/sales_and_marketing/doctype/past_serial_no/__init__.py b/csf_tz/sales_and_marketing/doctype/past_serial_no/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.js b/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.js new file mode 100644 index 0000000..6bf3a8a --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, InfluxERP +// For license information, please see license.txt + +frappe.ui.form.on('Past Serial No', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.json b/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.json new file mode 100644 index 0000000..5cecdb0 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.json @@ -0,0 +1,498 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:serial_no", + "beta": 0, + "creation": "2019-01-07 11:29:38.632804", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "serial_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Past Serial Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "past_item_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Past Item Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer", + "length": 0, + "no_copy": 0, + "options": "Customer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "past_item_group", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Past Item Group", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_5", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "options": "Company:company.default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_ref_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Ref No", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date_of_sale", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Date Of Sale", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "plate_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Plate Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "extra_details", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra detail", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_9", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Payment Plan ", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "payment_plan", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "options": "Payment Plan", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Past Serial No", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-01-25 13:44:22.659806", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Past Serial No", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.py b/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.py new file mode 100644 index 0000000..19cbaff --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_serial_no/past_serial_no.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PastSerialNo(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/past_serial_no/test_past_serial_no.js b/csf_tz/sales_and_marketing/doctype/past_serial_no/test_past_serial_no.js new file mode 100644 index 0000000..0736391 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_serial_no/test_past_serial_no.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Past Serial No", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Past Serial No + () => frappe.tests.make('Past Serial No', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/sales_and_marketing/doctype/past_serial_no/test_past_serial_no.py b/csf_tz/sales_and_marketing/doctype/past_serial_no/test_past_serial_no.py new file mode 100644 index 0000000..4ae03c7 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/past_serial_no/test_past_serial_no.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestPastSerialNo(unittest.TestCase): + pass diff --git a/csf_tz/sales_and_marketing/doctype/payment_plan/__init__.py b/csf_tz/sales_and_marketing/doctype/payment_plan/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/payment_plan/payment_plan.json b/csf_tz/sales_and_marketing/doctype/payment_plan/payment_plan.json new file mode 100644 index 0000000..4cdd609 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/payment_plan/payment_plan.json @@ -0,0 +1,167 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-01-08 10:41:58.989760", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "planned_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Planned Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "planned_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Planned Amount", + "length": 0, + "no_copy": 0, + "options": "Company:company.default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "actual_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Actual Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "actual_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Actual Amount", + "length": 0, + "no_copy": 0, + "options": "Company:company.default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-01-08 11:08:31.767058", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Payment Plan", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/payment_plan/payment_plan.py b/csf_tz/sales_and_marketing/doctype/payment_plan/payment_plan.py new file mode 100644 index 0000000..e0d67e1 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/payment_plan/payment_plan.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PaymentPlan(Document): + pass diff --git a/csf_tz/sales_and_marketing/doctype/products_of_interest/__init__.py b/csf_tz/sales_and_marketing/doctype/products_of_interest/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/doctype/products_of_interest/products_of_interest.json b/csf_tz/sales_and_marketing/doctype/products_of_interest/products_of_interest.json new file mode 100644 index 0000000..7d83513 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/products_of_interest/products_of_interest.json @@ -0,0 +1,1896 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2018-07-05 15:39:19.003631", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 4, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_code", + "oldfieldtype": "Link", + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": "150px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "150px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "extra_details", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_item_code", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer's Item Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "col_break1", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_name", + "oldfieldtype": "Data", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "150px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "150px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": "300px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "300px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Image", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "image_view", + "fieldtype": "Image", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Image View", + "length": 0, + "no_copy": 0, + "options": "image", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quantity and Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 2, + "fieldname": "qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "oldfieldname": "qty", + "oldfieldtype": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stock_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Stock UOM", + "length": 0, + "no_copy": 0, + "oldfieldname": "stock_uom", + "oldfieldtype": "Data", + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "col_break2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "UOM", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "conversion_factor", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "UOM Conversion Factor", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stock_qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Qty as per Stock UOM", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_16", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "price_list_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Price List Rate", + "length": 0, + "no_copy": 0, + "oldfieldname": "ref_rate", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "base_price_list_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Price List Rate (Company Currency)", + "length": 0, + "no_copy": 0, + "oldfieldname": "base_ref_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "discount_and_margin", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Discount and Margin", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "price_list_rate", + "fieldname": "margin_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Margin Type", + "length": 0, + "no_copy": 0, + "options": "\nPercentage\nAmount", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.margin_type && doc.price_list_rate", + "fieldname": "margin_rate_or_amount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Margin Rate or Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fieldname": "rate_with_margin", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Rate With Margin", + "length": 0, + "no_copy": 0, + "options": "currency", + "permlevel": 0, + "precision": "2", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_18", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "price_list_rate", + "fieldname": "discount_percentage", + "fieldtype": "Percent", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Discount (%) on Price List Rate with Margin", + "length": 0, + "no_copy": 0, + "oldfieldname": "adj_rate", + "oldfieldtype": "Float", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fieldname": "base_rate_with_margin", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Rate With Margin (Company Currency)", + "length": 0, + "no_copy": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break1", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 2, + "depends_on": "", + "fieldname": "rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Rate", + "length": 0, + "no_copy": 0, + "oldfieldname": "export_rate", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "net_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 2, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "oldfieldname": "export_amount", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "net_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Amount", + "length": 0, + "no_copy": 0, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "col_break3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "base_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Rate (Company Currency)", + "length": 0, + "no_copy": 0, + "oldfieldname": "basic_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "base_net_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Rate (Company Currency)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "base_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amount (Company Currency)", + "length": 0, + "no_copy": 0, + "oldfieldname": "amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "base_net_amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Amount (Company Currency)", + "length": 0, + "no_copy": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "pricing_rule", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Pricing Rule", + "length": 0, + "no_copy": 0, + "options": "Pricing Rule", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "item_weight_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Weight Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "weight_per_unit", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Weight Per Unit", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_20", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "weight_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Weight UOM", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "eval:doc.warehouse", + "columns": 0, + "fieldname": "item_balance", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Balance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "warehouse", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Warehouse", + "length": 0, + "no_copy": 0, + "options": "Warehouse", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_30", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "projected_qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Projected Qty", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "actual_qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Actual Qty", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "stock_balance", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Stock Balance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "prevdoc_doctype", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Against Doctype", + "length": 0, + "no_copy": 1, + "oldfieldname": "prevdoc_doctype", + "oldfieldtype": "Data", + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "150px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "150px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "prevdoc_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Against Docname", + "length": 0, + "no_copy": 1, + "oldfieldname": "prevdoc_docname", + "oldfieldtype": "Data", + "options": "prevdoc_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "150px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "150px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_tax_rate", + "fieldtype": "Code", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Tax Rate", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_tax_rate", + "oldfieldtype": "Small Text", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "col_break4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "page_break", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Page Break", + "length": 0, + "no_copy": 1, + "oldfieldname": "page_break", + "oldfieldtype": "Check", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "item_group", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Group", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_group", + "oldfieldtype": "Link", + "options": "Item Group", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brand", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Brand", + "length": 0, + "no_copy": 0, + "oldfieldname": "brand", + "oldfieldtype": "Link", + "options": "Brand", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "150px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0, + "width": "150px" + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2018-07-05 15:39:19.003631", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Products of Interest", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/doctype/products_of_interest/products_of_interest.py b/csf_tz/sales_and_marketing/doctype/products_of_interest/products_of_interest.py new file mode 100644 index 0000000..7f51320 --- /dev/null +++ b/csf_tz/sales_and_marketing/doctype/products_of_interest/products_of_interest.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ProductsofInterest(Document): + pass diff --git a/csf_tz/sales_and_marketing/report/__init__.py b/csf_tz/sales_and_marketing/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/brand_sales_report/__init__.py b/csf_tz/sales_and_marketing/report/brand_sales_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.js b/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.js new file mode 100644 index 0000000..4ebfc1e --- /dev/null +++ b/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.js @@ -0,0 +1,37 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 30); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Brand Sales Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"brand", + "label": __("Brand"), + "fieldtype": "Link", + "options": "Brand" + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer" + }, + ] +} diff --git a/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.json b/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.json new file mode 100644 index 0000000..6c9eb78 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.json @@ -0,0 +1,25 @@ +{ + "add_total_row": 0, + "creation": "2020-01-08 12:02:24.608234", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-01-08 12:15:11.626546", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Brand Sales Report", + "owner": "Administrator", + "ref_doctype": "Sales Invoice", + "report_name": "Brand Sales Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.py b/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.py new file mode 100644 index 0000000..af756f5 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/brand_sales_report/brand_sales_report.py @@ -0,0 +1,124 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "posting_date", + "label": _("Sale Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150, + }, + { + "fieldname": "customer_address", + "label": _("Customer Address"), + "fieldtype": "Small Text", + "width": 200 + }, + { + "fieldname": "contact", + "label": _("Customer Contacts"), + "fieldtype": "Small Text", + "width": 150 + }, + { + "fieldname": "itm", + "label": _("Item Sold"), + "fieldtype": "Link", + "options": "Item", + "width": 200 + }, + { + "fieldname": "brand", + "label": _("Brand"), + "fieldtype": "Link", + "options": "Sales Invoice", + "width": 150 + }, + { + "fieldname": "quantity", + "label": _("Quantity"), + "fieldtype": "data", + "width": 150 + }, + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = '' + + if filters.customer: + where += ' AND si.customer = %(customer)s' + where_filter.update({"customer": filters.customer}) + + if filters.brand: + where += ' AND ti.brand = %(brand)s' + where_filter.update({"brand": filters.brand}) + + data = frappe.db.sql('''SELECT + si.customer, + si.name, + si.posting_date, + si.grand_total, + sit.warehouse, + sit.item_code as itm, + sit.qty as quantity, + ti.brand as brand, + sit.parent as si_name, + si.customer as cust + FROM + (`tabSales Invoice Item` sit) + LEFT JOIN + (`tabSales Invoice` si) + ON (si.name = sit.parent) + LEFT JOIN + (`tabItem` ti) + ON (ti.item_code = sit.item_code) + WHERE + si.docstatus = 1 AND ti.item_group <> 'Spare Parts' + AND si.customer <> 'Guest' AND si.posting_date BETWEEN %(from_date)s AND %(to_date)s + ''' + where, + where_filter, as_dict=1 + ); + + for customer in data: + address = [] + address_name = frappe.db.sql("""SELECT + dl.parent + FROM + (`tabDynamic Link` dl) + WHERE + dl.parenttype='Address' AND dl.link_doctype='Customer' AND dl.link_name= %(customer)s + ORDER BY + dl.creation + LIMIT 1""", {"customer": customer.customer}, as_dict=1) + if address_name: + address = frappe.db.sql("""SELECT + CONCAT(ta.address_line1,",", ta.city,',', ta.country) AS customer_address, + ta.phone AS contact + FROM + (`tabAddress` ta) + WHERE + ta.name = %(address_name)s""", {"address_name": address_name[0].parent}, as_dict=1) + if address: + customer.update({ + "customer_address": address[0].customer_address, + "contact": address[0].contact + }) + + return columns, data diff --git a/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/__init__.py b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.js b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.js new file mode 100644 index 0000000..da01532 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.js @@ -0,0 +1,33 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + + +frappe.query_reports["Customer Loan Assistance report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date, + "reqd": 1 + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date, + "reqd": 1 + }, + { + "fieldname":"loan_supplier", + "label": __("Loan Supplier"), + "fieldtype": "Link", + "options": "Supplier" + } + ] +} diff --git a/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.json b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.json new file mode 100644 index 0000000..a06ad5f --- /dev/null +++ b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.json @@ -0,0 +1,19 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2019-05-07 16:55:08.188256", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-05-07 16:55:16.886358", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Customer Loan Assistance report", + "owner": "Administrator", + "ref_doctype": "Customer Loan Assistance", + "report_name": "Customer Loan Assistance report", + "report_type": "Script Report", + "roles": [] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.py b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.py new file mode 100644 index 0000000..6a2c62a --- /dev/null +++ b/csf_tz/sales_and_marketing/report/customer_loan_assistance_report/customer_loan_assistance_report.py @@ -0,0 +1,97 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label" : _("Reference"), + "fieldtype": "Link", + "options": "Customer Loan Assistance", + "width": 150 + }, + { + "fieldname": "customer_type", + "label" : _("Lead / Customer"), + "fieldtype": "Link", + "options": "Doctype", + "width": 150, + "hidden": 1 + }, + { + "fieldname": "customer_reference", + "label" : _("Customer Reference"), + "fieldtype": "Dynamic Link", + "options": "customer_type", + "width": 150 + }, + { + "fieldname": "customer_name", + "label" : _("Customer Name"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "loan_supplier", + "label" : _("Loan Supplier"), + "fieldtype": "Link", + "options": "Supplier", + "width": 150 + }, + { + "fieldname": "start_date", + "label" : _("Start Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "end_date", + "label" : _("End Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "loan_status", + "label" : _("Loan Status"), + "fieldtype": "Dynamic Link", + "options": "customer_type", + "width": 150 + } + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"start_date": filters.from_date,"end_date": filters.to_date,} + where = "" + if filters.loan_supplier: + where += ' AND loan_supplier = %(loan_supplier)s ' + where_filter.update({"loan_supplier": filters.loan_supplier}) + + data = frappe.db.sql('''SELECT + name AS reference, + CASE + WHEN customer IS NOT NULL THEN 'Customer' + ELSE 'Lead' END AS customer_type, + CASE + WHEN customer IS NOT NULL THEN customer + ELSE lead END AS customer_reference, + CASE + WHEN customer IS NOT NULL THEN customer + ELSE lead_name END AS customer_name, + loan_supplier, + DATE(creation) AS start_date, + completion_date AS end_date, + loan_status + FROM + `tabCustomer Loan Assistance` + WHERE + creation BETWEEN %(start_date)s AND %(end_date)s + ''' + where, where_filter, as_dict=1) + return columns, data diff --git a/csf_tz/sales_and_marketing/report/item_wise_leads_report/__init__.py b/csf_tz/sales_and_marketing/report/item_wise_leads_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.js b/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.js new file mode 100644 index 0000000..a09cfd6 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.js @@ -0,0 +1,37 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Item Wise Leads Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"item", + "label": __("Item"), + "fieldtype": "Link", + "options": "Item", + }, + { + "fieldname":"branch", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + ] +} diff --git a/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.json b/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.json new file mode 100644 index 0000000..e1dba19 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.json @@ -0,0 +1,37 @@ +{ + "add_total_row": 0, + "creation": "2019-05-29 12:25:44.802471", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-05-30 16:42:14.827404", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Item Wise Leads Report", + "owner": "Administrator", + "ref_doctype": "Quotation", + "report_name": "Item Wise Leads Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Sales Manager" + }, + { + "role": "System Manager" + }, + { + "role": "Sales User" + }, + { + "role": "Sales Executive" + }, + { + "role": "Branch In Charge" + }, + { + "role": "Stock Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.py b/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.py new file mode 100644 index 0000000..a9ea25a --- /dev/null +++ b/csf_tz/sales_and_marketing/report/item_wise_leads_report/item_wise_leads_report.py @@ -0,0 +1,76 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "item_code", + "label": _("Item"), + "fieldtype": "Link", + "options": "Item", + "width": 200 + }, + { + "fieldname": "total_qty", + "label": _("Quantity"), + "fieldtype": "Float", + }, + { + "fieldname": "quotations", + "label" : _("Quotations"), + "fieldtype": "int", + "width": 150 + }, + { + "fieldname": "customers", + "label": _("Customers"), + "fieldtype": "Int", + "width": 150 + }, + { + "fieldname": "leads", + "label": _("Leads"), + "fieldtype": "Int", + "width": 150 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse", + "width": 200 + }, + ] + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = "" + + data = frappe.db.sql('''SELECT + tqi.item_code, + tqi.item_name, + SUM(tqi.qty) AS total_qty, + COUNT(tq.name) AS quotations, + COUNT(DISTINCT customer_quot.customer) AS customers, + COUNT(DISTINCT tq.lead) AS leads, + tqi.warehouse + FROM + (`tabQuotation Item` tqi) + LEFT JOIN + (`tabQuotation` tq) ON (tqi.parent = tq.name) + LEFT JOIN + (`tabQuotation` customer_quot) ON tqi.parent = customer_quot.name AND customer_quot.quotation_to = 'Customer' + WHERE + tq.docstatus = 1 AND tq.transaction_date BETWEEN %(from_date)s AND %(to_date)s + GROUP BY tqi.item_code, tqi.warehouse + '''+ where, + where_filter, as_dict=1,as_list=1 + ); + return columns, data diff --git a/csf_tz/sales_and_marketing/report/items_marked_for_delivery/__init__.py b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.js b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.js new file mode 100644 index 0000000..3282078 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.js @@ -0,0 +1,25 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 30); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Items Marked For Delivery"] = { + "filters": [ + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + { + "fieldname":"item_group", + "label": __("Item Group"), + "fieldtype": "Link", + "options": "Item Group" + }, + ] +} diff --git a/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.json b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.json new file mode 100644 index 0000000..c74f98b --- /dev/null +++ b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.json @@ -0,0 +1,26 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2018-07-09 19:15:24.118597", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-07-10 07:39:07.523596", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Items Marked For Delivery", + "owner": "Administrator", + "ref_doctype": "Sales Invoice", + "report_name": "Items Marked For Delivery", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.py b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.py new file mode 100644 index 0000000..cc09c19 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/items_marked_for_delivery/items_marked_for_delivery.py @@ -0,0 +1,144 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "customer_name", + "label": _("Customer"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "customer_address", + "label": _("Customer Address"), + "fieldtype": "Small Text", + "width": 200 + }, + { + "fieldname": "phone_number", + "label": _("Phone Number"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "item_name", + "label": _("Item"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "item_code", + "label": _("Item Code"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "quantity", + "label": _("Quantity"), + "fieldtype": "Float", + "width": 150 + }, + { + "fieldname": "uom", + "label": _("UOM"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "serial_no", + "label": _("Serial Numbers"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "actual_quantity", + "label": _("Actual Quantity"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "projected_quantity", + "label": _("Projected Quantity"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "sales_invoice", + "label": _("Sales Invoice"), + "fieldtype": "Link", + "options": "Sales Invoice", + "width": 150 + }, + { + "fieldname": "sales_order", + "label": _("Sales Order"), + "fieldtype": "Link", + "options": "Sales Order", + "width": 150 + } + ] + + where = '' + where_filter = {} + + if filters.warehouse: + where += ' AND sit.warehouse = %(warehouse)s' + where_filter.update({"warehouse": filters.warehouse}) + + if filters.item_group: + where += ' AND tabItem.item_group = %(item_group)s' + where_filter.update({"item_group": filters.item_group}) + + data = frappe.db.sql('''SELECT + si.customer_name, + CONCAT(ta.address_line1,",", ta.city,',', ta.country) AS customer_address, + ta.phone AS phone_number, + sit.item_name, + sit.item_code, + sit.serial_no, + sit.qty AS quantity, + sit.uom, + sit.warehouse, + si.name AS sales_invoice, + so.name AS sales_order, + `tabBin`.actual_qty AS actual_quantity, + `tabBin`.projected_qty AS projected_quantity + FROM + (`tabSales Invoice Item`sit) + LEFT JOIN + (`tabSales Order` so) + ON (sit.sales_order = so.name) + LEFT JOIN + (`tabSales Invoice` si) + ON (sit.parent=si.name) + LEFT JOIN + `tabBin` ON (`tabBin`.item_code = sit.item_code + and `tabBin`.warehouse = sit.warehouse) + LEFT JOIN + tabItem ON tabItem.item_code = sit.item_code + LEFT JOIN + (`tabAddress` ta) ON ta.name=(SELECT dl.parent + FROM (`tabDynamic Link` dl) + WHERE + dl.parenttype='Address' AND dl.link_doctype='Customer' AND + dl.link_name=si.customer ORDER BY ta.creation LIMIT 1 + ) + WHERE + is_marked = 1 AND sit.delivered_qty < sit.qty AND si.docstatus = 1 AND si.status IN ('Submitted', 'Paid', 'Overdue', 'Unpaid') + AND (SELECT name FROM `tabSales Invoice` WHERE return_against = si.name LIMIT 1) IS NULL''' + where, + where_filter, as_dict=1 + ); + return columns, data diff --git a/csf_tz/sales_and_marketing/report/previous_ams_customer_report/__init__.py b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.js b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.js new file mode 100644 index 0000000..1f04774 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.js @@ -0,0 +1,37 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 30); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Previous Ams Customer Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"brand", + "label": __("Brand"), + "fieldtype": "Link", + "options": "Brand" + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer" + }, + ] +} diff --git a/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.json b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.json new file mode 100644 index 0000000..9f1ea84 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.json @@ -0,0 +1,43 @@ +{ + "add_total_row": 0, + "creation": "2020-01-20 12:32:34.129686", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2020-01-21 21:29:03.355098", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Previous Ams Customer Report", + "owner": "Administrator", + "ref_doctype": "Past Serial No", + "report_name": "Previous Ams Customer Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Sales Manager" + }, + { + "role": "Sales Master Manager" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + }, + { + "role": "Parts Manager" + }, + { + "role": "After Sales Branch Manager" + }, + { + "role": "After Sales User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.py b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.py new file mode 100644 index 0000000..fbc368c --- /dev/null +++ b/csf_tz/sales_and_marketing/report/previous_ams_customer_report/previous_ams_customer_report.py @@ -0,0 +1,131 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "date_of_sale", + "label": _("Date of Sale"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150, + }, + { + "fieldname": "customer_address", + "label": _("Customer Address"), + "fieldtype": "Small Text", + "width": 200 + }, + { + "fieldname": "contact", + "label": _("Customer Contacts"), + "fieldtype": "Small Text", + "width": 150 + }, + { + "fieldname": "itm", + "label": _("Item Sold"), + "fieldtype": "Link", + "options": "Item", + "width": 200 + }, + { + "fieldname": "brand", + "label": _("Brand"), + "fieldtype": "Link", + "options": "Brand", + "width": 150 + }, + { + "fieldname": "name", + "label": _("Serial No"), + "fieldtype": "Link", + "options": "Past Serial No", + "width": 200 + }, + { + "fieldname": "amount", + "label": _("Price"), + "fieldtype": "Currency", + "width": 150 + }, + { + "fieldname": "past_item_group", + "label": _("Item Group"), + "fieldtype": "Data", + "width": 150 + }, + + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = '' + + if filters.customer: + where += ' AND psn.customer = %(customer)s' + where_filter.update({"customer": filters.customer}) + + if filters.brand: + where += ' AND `tabItem`.brand = %(brand)s' + where_filter.update({"brand": filters.brand}) + + data = frappe.db.sql('''SELECT + psn.customer, + psn.name, + psn.date_of_sale, + psn.amount, + psn.past_item_group, + psn.item_code as itm, + psn.past_item_group, + `tabItem`.brand + FROM + (`tabPast Serial No` psn) + LEFT JOIN + `tabItem` ON `tabItem`.name = psn.item_code + WHERE + psn.docstatus = 1 AND psn.date_of_sale BETWEEN %(from_date)s AND %(to_date)s + ''' + where + ''' GROUP BY psn.name + ORDER BY psn.date_of_sale''', + where_filter, as_dict=1 + ); + for customer in data: + address = [] + address_name = frappe.db.sql("""SELECT + dl.parent + FROM + (`tabDynamic Link` dl) + WHERE + dl.parenttype='Address' AND dl.link_doctype='Customer' AND dl.link_name= %(customer)s + ORDER BY + dl.creation + LIMIT 1""", {"customer": customer.customer}, as_dict=1) + if address_name: + address = frappe.db.sql("""SELECT + CONCAT(ta.address_line1,",", ta.city,',', ta.country) AS customer_address, + ta.phone AS contact + FROM + (`tabAddress` ta) + WHERE + ta.name = %(address_name)s""", {"address_name": address_name[0].parent}, as_dict=1) + if address: + customer.update({ + "customer_address": address[0].customer_address, + "contact": address[0].contact + }) + + return columns, data diff --git a/csf_tz/sales_and_marketing/report/sales_details_report/__init__.py b/csf_tz/sales_and_marketing/report/sales_details_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.js b/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.js new file mode 100644 index 0000000..d245701 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.js @@ -0,0 +1,43 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 30); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Sales Details Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"cust_group", + "label": __("Customer Group"), + "fieldtype": "Link", + "options": "Customer Group" + }, + { + "fieldname":"customer", + "label": __("Customer"), + "fieldtype": "Link", + "options": "Customer" + }, + { + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + ] +} diff --git a/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.json b/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.json new file mode 100644 index 0000000..e9979f9 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.json @@ -0,0 +1,34 @@ +{ + "add_total_row": 0, + "creation": "2019-06-27 11:44:07.445420", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-06-27 11:59:55.012109", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Sales Details Report", + "owner": "Administrator", + "ref_doctype": "Sales Invoice", + "report_name": "Sales Details Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts Manager" + }, + { + "role": "Accounts User" + }, + { + "role": "Sales Executive" + }, + { + "role": "Branch In Charge" + }, + { + "role": "Stock Supervisor" + } + ] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.py b/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.py new file mode 100644 index 0000000..80c1ba5 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/sales_details_report/sales_details_report.py @@ -0,0 +1,132 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + columns, data = [], [] + columns = [ + { + "fieldname": "posting_date", + "label": _("Date"), + "fieldtype": "Date", + "width": 150 + }, + { + "fieldname": "customer", + "label": _("Customer"), + "fieldtype": "Link", + "options": "Customer", + "width": 150, + }, + { + "fieldname": "customer_group", + "label": _("Customer Group"), + "fieldtype": "Link", + "options": "Customer Group", + "width": 150 + }, + { + "fieldname": "item_no", + "label": _("Item Sold"), + "fieldtype": "Link", + "options": "Item", + "width": 150 + }, + { + "fieldname": "name", + "label": _("Sales Invoice"), + "fieldtype": "Link", + "options": "Sales Invoice", + "width": 150 + }, + { + "fieldname": "grand_total", + "label": _("Amount"), + "fieldtype": "Currency", + "width": 150 + }, + { + "fieldname": "quantity", + "label": _("Quantity"), + "fieldtype": "data", + "width": 150 + }, + { + "fieldname": "warehouse", + "label": _("Warehouse"), + "fieldtype": "Data", + "width": 150 + }, + ] + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = '' + + if filters.customer: + where += ' AND si.customer = %(customer)s' + where_filter.update({"customer": filters.customer}) + + if filters.warehouse: + where += ' AND sit.warehouse = %(warehouse)s' + where_filter.update({"warehouse": filters.warehouse}) + + if filters.cust_group: + where += ' AND tc.customer_group = %(cust_group)s' + where_filter.update({"cust_group": filters.cust_group}) + + data = frappe.db.sql('''SELECT + si.customer, + si.name, + si.posting_date, + tc.customer_group, + si.grand_total, + sit.warehouse + + FROM + (`tabSales Invoice` si) + LEFT JOIN + (`tabSales Invoice Item` sit) + ON (si.name = sit.parent) + LEFT JOIN + (`tabCustomer` tc) + ON (tc.customer_name=si.customer) + WHERE + si.docstatus = 1 + AND si.posting_date BETWEEN %(from_date)s AND %(to_date)s + GROUP BY si.name + ''' + where, + where_filter, as_dict=1 + ); + + for item in data: + # + # For item info + # + itm_info = frappe.db.sql('''SELECT + sit.item_code as itm, sit.qty, + sit.parent as si_name, si.customer as cust + FROM + (`tabSales Invoice Item` sit) + LEFT JOIN + (`tabSales Invoice` si) + ON (si.name = sit.parent) + WHERE + si.name = sit.parent AND si.docstatus = 1 ''' , + {"cust": item.customer,}, as_dict=1); + + item.item_no = '' + item.quantity='' + + for co in itm_info: + if co.si_name == item.name: + item.item_no += '' + str(co.itm) + ',' + ' ' + item.quantity += str(co.qty) + ', ' + + return columns, data diff --git a/csf_tz/sales_and_marketing/report/spare_sales_report/__init__.py b/csf_tz/sales_and_marketing/report/spare_sales_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.js b/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.js new file mode 100644 index 0000000..05114bc --- /dev/null +++ b/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.js @@ -0,0 +1,37 @@ +// Copyright (c) 2016, InfluxERP +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var from_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() + 30); +var to_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Spare Sales Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"brand", + "label": __("Brand"), + "fieldtype": "Link", + "options": "Brand" + }, + { + "fieldname":"shop", + "label": __("Warehouse"), + "fieldtype": "Link", + "options": "Warehouse" + }, + ] +} diff --git a/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.json b/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.json new file mode 100644 index 0000000..1b6f34f --- /dev/null +++ b/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.json @@ -0,0 +1,35 @@ +{ + "add_total_row": 1, + "creation": "2020-02-21 12:05:21.825687", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "letter_head": "Default Letter Head", + "modified": "2020-02-21 14:39:35.593647", + "modified_by": "Administrator", + "module": "Sales And Marketing", + "name": "Spare Sales Report", + "owner": "Administrator", + "ref_doctype": "Sales Invoice", + "report_name": "Spare Sales Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Sales User" + }, + { + "role": "System Manager" + }, + { + "role": "Parts Consultant" + } + ] +} \ No newline at end of file diff --git a/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.py b/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.py new file mode 100644 index 0000000..47093a8 --- /dev/null +++ b/csf_tz/sales_and_marketing/report/spare_sales_report/spare_sales_report.py @@ -0,0 +1,79 @@ +# Copyright (c) 2013, InfluxERP +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + if not filters: filters = {} + columns = get_columns() + item_list = get_items(filters) + + data = [] + for d in item_list: + row = [d.posting_date, d.itm,d.item_name, d.customer, d.warehouse, + d.quantity, d.amount, d.brand, d.name] + data.append(row) + + return columns, data + + +def get_columns(): + columns = [ + _("Due Date") + ":Date:80", + _("Item Code") + ":Link/Item:120", + _("Item Name") + ":Data:120", + _("Customer") + ":Link/Customer:120", + _("Warehouse") + ":Link/Warehouse:120", + _("Qty") + ":Float:120", + _("Amount") + ":Float:120", + _("Brand") + ":Link/Brand:120", + _("Invoice") + ":Link/Sales Invoice:120",] + + return columns + +def get_items(filters): + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + where_filter = {"from_date": filters.from_date,"to_date": filters.to_date,} + where = '' + + if filters.brand: + where += ' AND ti.brand = %(brand)s' + where_filter.update({"brand": filters.brand}) + + if filters.shop: + where += ' AND sit.warehouse = %(shop)s' + where_filter.update({"shop": filters.shop}) + + return frappe.db.sql('''SELECT + si.customer, + si.name, + si.posting_date, + si.grand_total, + sit.warehouse, + sit.item_code as itm, + sit.item_name, + sit.qty as quantity, + sit.amount, + ti.brand as brand, + sit.parent as si_name, + si.customer as cust + FROM + (`tabSales Invoice Item` sit) + LEFT JOIN + (`tabSales Invoice` si) + ON (si.name = sit.parent) + LEFT JOIN + (`tabItem` ti) + ON (ti.item_code = sit.item_code) + WHERE + si.docstatus = 1 AND ti.item_group = 'Spare Parts' + AND si.customer = 'Guest' AND si.posting_date BETWEEN %(from_date)s AND %(to_date)s + ORDER BY si.posting_date + ''' + where, + where_filter, as_dict=1 + ); \ No newline at end of file diff --git a/csf_tz/tanzania/__init__.py b/csf_tz/tanzania/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/templates/__init__.py b/csf_tz/templates/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/templates/pages/__init__.py b/csf_tz/templates/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/__init__.py b/csf_tz/workshop/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/__init__.py b/csf_tz/workshop/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/issued_items_table/__init__.py b/csf_tz/workshop/doctype/issued_items_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/issued_items_table/issued_items_table.json b/csf_tz/workshop/doctype/issued_items_table/issued_items_table.json new file mode 100644 index 0000000..4e2eaf4 --- /dev/null +++ b/csf_tz/workshop/doctype/issued_items_table/issued_items_table.json @@ -0,0 +1,193 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-12-15 14:42:37.086659", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Requested", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "issued", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Issued", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "difference", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Difference", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "units", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Units", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-12-15 14:44:46.963980", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Issued Items Table", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/workshop/doctype/issued_items_table/issued_items_table.py b/csf_tz/workshop/doctype/issued_items_table/issued_items_table.py new file mode 100644 index 0000000..37fd153 --- /dev/null +++ b/csf_tz/workshop/doctype/issued_items_table/issued_items_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class IssuedItemsTable(Document): + pass diff --git a/csf_tz/workshop/doctype/requested_items/__init__.py b/csf_tz/workshop/doctype/requested_items/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/requested_items/requested_items.js b/csf_tz/workshop/doctype/requested_items/requested_items.js new file mode 100644 index 0000000..7075446 --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items/requested_items.js @@ -0,0 +1,185 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Requested Items', { + onload: function(frm) { + //Load the approve and reject buttons + var html_approve_buttons = ' '; + html_approve_buttons += '' + $(frm.fields_dict.html_approve_buttons.wrapper).html(html_approve_buttons); + + //Load the recommend and recommend against buttons + var html_recommend_buttons = ' '; + html_recommend_buttons += '' + $(frm.fields_dict.html_recommend_buttons.wrapper).html(html_recommend_buttons); + + }, + + refresh: function(frm) { + //Make stock entry button + frm.add_custom_button(__('Issue Material'), + function() { + frm.events.make_stock_entry(); + } + ); + + console.log(frm); + //If no items to approve, hide approval buttons + if(frm.doc.requested_items && frm.doc.requested_items.length > 0) + { + cur_frm.set_df_property("html_recommend_buttons", "hidden", 0); + cur_frm.set_df_property("html_approve_buttons", "hidden", 0); + } + }, + + make_stock_entry: function() { + frappe.model.open_mapped_doc({ + method: "fleet_management.workshop.doctype.requested_items.requested_items.make_from_requested_items", + frm: cur_frm + }) + }, +}); + + +//For recommend button +cur_frm.cscript.recommend_request = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['requested_items']) + { + frappe.confirm( + 'Confirm: Recommend selected requests?', + function(){ + $.each(selected['requested_items'], function(index, value){ + frappe.call({ + method: "fleet_management.workshop.doctype.requested_items.requested_items.recommend_request", + freeze: true, + args: { + request_doctype: "Requested Items Table", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +//For recommend against button +cur_frm.cscript.recommend_against_request = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['requested_items']) + { + frappe.confirm( + 'Confirm: Recommend against the selected requests?', + function(){ + $.each(selected['requested_items'], function(index, value){ + frappe.call({ + method: "fleet_management.workshop.doctype.requested_items.requested_items.recommend_against_request", + freeze: true, + args: { + request_doctype: "Requested Items Table", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + + +//For approve button +cur_frm.cscript.approve_request = function(frm){ + var selected = cur_frm.get_selected(); + if(selected['requested_items']) + { + frappe.confirm( + 'Confirm: Approve selected requests?', + function(){ + $.each(selected['requested_items'], function(index, value){ + frappe.call({ + method: "fleet_management.workshop.doctype.requested_items.requested_items.approve_request", + freeze: true, + args: { + request_doctype: "Requested Items Table", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} + +//For reject button +cur_frm.cscript.reject_request = function(frm){ + //cur_frm.cscript.populate_child(cur_frm.doc.reference_doctype, cur_frm.doc.reference_docname); + var selected = cur_frm.get_selected(); + if(selected['requested_items']) + { + frappe.confirm( + 'Confirm: Reject selected requests?', + function(){ + $.each(selected['requested_items'], function(index, value){ + frappe.call({ + method: "fleet_management.workshop.doctype.requested_items.requested_items.reject_request", + freeze: true, + args: { + request_doctype: "Requested Items Table", + request_docname: value, + user: frappe.user.full_name() + }, + callback: function(data){ + //alert(JSON.stringify(data)); + } + }); + }); + location.reload(); + }, + function(){ + //Do nothing + } + ); + } + else + { + show_alert("Error: Please select requests to process."); + } +} diff --git a/csf_tz/workshop/doctype/requested_items/requested_items.json b/csf_tz/workshop/doctype/requested_items/requested_items.json new file mode 100644 index 0000000..dd5ce5a --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items/requested_items.json @@ -0,0 +1,459 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "IREQ.###", + "beta": 0, + "creation": "2017-09-06 19:15:38.142807", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Items", + "length": 0, + "no_copy": 0, + "options": "Requested Items Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "html_recommend_buttons", + "fieldtype": "HTML", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "html_approve_buttons", + "fieldtype": "HTML", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_previous_requests", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Previous Requested Items", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "previous_requested_items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Previous Requested Items", + "length": 0, + "no_copy": 0, + "options": "Requested Items Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_issued_items", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Issued Items", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "issued_items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Issued Items", + "length": 0, + "no_copy": 0, + "options": "Issued Items Table", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_references", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "References & Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_doctype", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested From Module", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Requested From", + "length": 0, + "no_copy": 0, + "options": "reference_doctype", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Waiting Approval", + "fieldname": "approval_status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Approval Status", + "length": 0, + "no_copy": 0, + "options": "Waiting Approval\nProcessed", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Waiting Approval", + "fieldname": "items_issue_status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Items Issue Status", + "length": 0, + "no_copy": 0, + "options": "Waiting Approval\nTo Issue", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-12-30 17:52:52.846955", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Requested Items", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/workshop/doctype/requested_items/requested_items.py b/csf_tz/workshop/doctype/requested_items/requested_items.py new file mode 100644 index 0000000..ed7329b --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items/requested_items.py @@ -0,0 +1,263 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import time +import datetime +from frappe.model.document import Document +from frappe.model.mapper import get_mapped_doc + +class RequestedItems(Document): + def onload(self): + self.set_approval_status() + self.set_issue_status() + + + def set_approval_status(self): + waiting_approval = frappe.db.get_values('Requested Items Table', + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'requested_items', "status": ["not in", ['Approved', 'Rejected']]}) + + if waiting_approval and self.approval_status != "Waiting Approval": + self.db_set('approval_status', 'Waiting Approval') + elif not waiting_approval and self.approval_status != "Processed": + self.db_set('approval_status', 'Processed') + frappe.db.commit() + + + def set_issue_status(self): + waiting_issue = False + fully_issued = True + issued_qty = 0 + + children_approved = frappe.db.sql('''SELECT item, SUM(quantity) AS quantity FROM `tabRequested Items Table` WHERE \ + parenttype = %(reference_doctype)s \ + AND parent = %(reference_docname)s \ + AND parentfield = 'requested_items' \ + AND status = 'Approved' + GROUP BY item''', {'reference_doctype': self.get('reference_doctype'), 'reference_docname': self.get('reference_docname')}, as_dict=True) + + for row in children_approved: + issued = frappe.db.sql('''SELECT SUM(`tabStock Entry Detail`.qty) AS issued_qty FROM `tabStock Entry Detail` \ + WHERE \ + `tabStock Entry Detail`.item_code = %(item)s \ + AND `tabStock Entry Detail`.parenttype = 'Stock Entry' \ + AND `tabStock Entry Detail`.parent IN \ + (SELECT name FROM `tabStock Entry` WHERE `tabStock Entry`.reference_doctype = 'Requested Items' AND `tabStock Entry`.reference_docname = %(docname)s)''', + {'docname': self.name, 'item': row.item}, as_dict=True) + + + if not issued[0].issued_qty: + self.db_set('items_issue_status', 'To Issue') + frappe.db.commit() + elif issued[0].issued_qty and issued[0].issued_qty < row.quantity and self.items_issue_status != 'To Issue': #If partially issued + fully_issued = False + issued_qty = issued_qty + issued[0].issued_qty + self.db_set('items_issue_status', 'To Issue') + frappe.db.commit() + + #If fully issued + if fully_issued and issued_qty > 0 and self.items_issue_status not in ['Waiting Approval', 'Fully Issued']: + self.db_set('items_issue_status', 'Fully Issued') + frappe.db.commit() + + + def get_all_children(self, parenttype=None): + #For getting children + return [] + + def update_children(self): + '''update child tables''' + self.update_child_table([]) + + def load_from_db(self): + """Load document and children from database and create properties + from fields""" + if not getattr(self, "_metaclass", False) and self.meta.issingle: + single_doc = frappe.db.get_singles_dict(self.doctype) + if not single_doc: + single_doc = frappe.new_doc(self.doctype).as_dict() + single_doc["name"] = self.doctype + del single_doc["__islocal"] + + super(Document, self).__init__(single_doc) + self.init_valid_columns() + self._fix_numeric_types() + + else: + d = frappe.db.get_value(self.doctype, self.name, "*", as_dict=1) + if not d: + frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError) + + super(Document, self).__init__(d) + + if self.name=="DocType" and self.doctype=="DocType": + from frappe.model.meta import doctype_table_fields + table_fields = doctype_table_fields + else: + table_fields = self.meta.get_table_fields() + + for df in table_fields: + if df.fieldname == "previous_requested_items": + #Load approved or rejected requests + children_approved = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'requested_items', "status": "Approved"}, + "*", as_dict=True, order_by="idx asc") + children_rejected = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'requested_items', "status": "Rejected"}, + "*", as_dict=True, order_by="idx asc") + children = children_approved + children_rejected + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + elif df.fieldname == "requested_items": + #Load requests which are not approved nor rejected + children = frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'requested_items', "status": "Requested"}, + "*", as_dict=True, order_by="idx asc") + children += frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'requested_items', "status": "Recommended"}, + "*", as_dict=True, order_by="idx asc") + children += frappe.db.get_values(df.options, + {"parent": self.get('reference_docname'), "parenttype": self.get('reference_doctype'), "parentfield": 'requested_items', "status": "Recommended Against"}, + "*", as_dict=True, order_by="idx asc") + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + elif df.fieldname == "issued_items": + #Load previously issued items + children = frappe.db.sql('''SELECT + `tabStock Entry Detail`.item_code AS item, + SUM(`tabRequested Items Table`.quantity) AS requested, + SUM(`tabStock Entry Detail`.qty) AS issued, + (SUM(`tabRequested Items Table`.quantity) - SUM(`tabStock Entry Detail`.qty)) AS difference, + `tabStock Entry Detail`.uom AS units + FROM \ + `tabStock Entry Detail` \ + LEFT JOIN \ + `tabRequested Items Table` ON `tabRequested Items Table`.item = `tabStock Entry Detail`.item_code \ + AND `tabRequested Items Table`.status = 'Approved' + AND `tabRequested Items Table`.parenttype = %(reference_doctype)s \ + AND `tabRequested Items Table`.parent = %(reference_docname)s \ + WHERE \ + `tabStock Entry Detail`.parenttype = 'Stock Entry' \ + AND `tabStock Entry Detail`.parent IN \ + (SELECT name FROM `tabStock Entry` WHERE `tabStock Entry`.reference_doctype = 'Requested Items' AND `tabStock Entry`.reference_docname = %(docname)s) + GROUP BY + item, units''', {'docname': self.name, 'reference_docname': self.get('reference_docname'), 'reference_doctype': self.get('reference_doctype')} ,as_dict=1) + if children: + self.set(df.fieldname, children) + else: + self.set(df.fieldname, []) + + # sometimes __setup__ can depend on child values, hence calling again at the end + if hasattr(self, "__setup__"): + self.__setup__() + +@frappe.whitelist(allow_guest=True) +def request_items(**args): + args = frappe._dict(args) + + existing_payment_request = frappe.db.get_value("Requested Items", + {"reference_doctype": args.reference_doctype, "reference_docname": args.reference_docname}) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + if existing_payment_request: + #Mark the request as open + doc = frappe.get_doc("Requested Items", existing_payment_request) + doc.db_set("approval_status", "Waiting Approval") + doc.db_set("modified", timestamp) + return "Request Updated" + else: + request = frappe.new_doc("Requested Items") + request.update({ + "reference_doctype":args.reference_doctype, + "reference_docname": args.reference_docname + }) + request.insert(ignore_permissions=True) + return "Request Inserted" + + +@frappe.whitelist(allow_guest=True) +def recommend_request(**args): + args = frappe._dict(args) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + doc = frappe.get_doc("Requested Items Table", args.request_docname) + doc.db_set("status", "Recommended") + doc.db_set("recommended_by", args.user) + doc.db_set("recommended_date", timestamp) + return "Request Updated" + + +@frappe.whitelist(allow_guest=True) +def recommend_against_request(**args): + args = frappe._dict(args) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + doc = frappe.get_doc("Requested Items Table", args.request_docname) + doc.db_set("status", "Recommended Against") + doc.db_set("recommended_by", args.user) + doc.db_set("recommended_date", timestamp) + return "Request Updated" + + +@frappe.whitelist(allow_guest=True) +def approve_request(**args): + args = frappe._dict(args) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + doc = frappe.get_doc("Requested Items Table", args.request_docname) + doc.db_set("status", "Approved") + doc.db_set("approved_by", args.user) + doc.db_set("approved_date", timestamp) + return "Request Updated" + +@frappe.whitelist(allow_guest=True) +def reject_request(**args): + args = frappe._dict(args) + + #Timestamp + ts = time.time() + timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') + + doc = frappe.get_doc("Requested Items Table", args.request_docname) + doc.db_set("status", "Rejected") + doc.db_set("approved_by", args.user) + doc.db_set("approved_date", timestamp) + return "Request Updated" + +@frappe.whitelist() +def make_from_requested_items(source_name, target_doc=None, ignore_permissions=False): + def postprocess(source, target): + set_missing_values(source, target) + + def set_missing_values(source, target): + target.purpose = "Material Issue" + + doclist = get_mapped_doc("Requested Items", source_name, { + "Requested Items": { + "doctype": "Stock Entry", + "field_map": { + "doctype": "reference_doctype", + "name": "reference_docname" + } + } + }, target_doc, postprocess) + + return doclist diff --git a/csf_tz/workshop/doctype/requested_items/test_requested_items.js b/csf_tz/workshop/doctype/requested_items/test_requested_items.js new file mode 100644 index 0000000..039b831 --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items/test_requested_items.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Requested Items", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Requested Items + () => frappe.tests.make('Requested Items', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/workshop/doctype/requested_items/test_requested_items.py b/csf_tz/workshop/doctype/requested_items/test_requested_items.py new file mode 100644 index 0000000..b6d6add --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items/test_requested_items.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestRequestedItems(unittest.TestCase): + pass diff --git a/csf_tz/workshop/doctype/requested_items_table/__init__.py b/csf_tz/workshop/doctype/requested_items_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/requested_items_table/requested_items_table.json b/csf_tz/workshop/doctype/requested_items_table/requested_items_table.json new file mode 100644 index 0000000..8005aa5 --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items_table/requested_items_table.json @@ -0,0 +1,375 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-09-06 13:40:37.896669", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Today", + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quantity", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "units", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Units", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_for", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested For", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "fieldname": "status", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommended_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommended By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "recommended_date", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Recommended Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "approved_date", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Approved Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-09-07 04:59:36.296370", + "modified_by": "info@aakvatech.com", + "module": "Workshop", + "name": "Requested Items Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/workshop/doctype/requested_items_table/requested_items_table.py b/csf_tz/workshop/doctype/requested_items_table/requested_items_table.py new file mode 100644 index 0000000..ee69e79 --- /dev/null +++ b/csf_tz/workshop/doctype/requested_items_table/requested_items_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class RequestedItemsTable(Document): + pass diff --git a/csf_tz/workshop/doctype/used_items_table/__init__.py b/csf_tz/workshop/doctype/used_items_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/used_items_table/used_items_table.json b/csf_tz/workshop/doctype/used_items_table/used_items_table.json new file mode 100644 index 0000000..494833d --- /dev/null +++ b/csf_tz/workshop/doctype/used_items_table/used_items_table.json @@ -0,0 +1,223 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-09-06 13:48:19.443392", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Item", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_description", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "quantity", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Quantity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "units", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Units", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "extra_information", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Extra Information", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-09-08 23:10:28.960146", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Used Items Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/workshop/doctype/used_items_table/used_items_table.py b/csf_tz/workshop/doctype/used_items_table/used_items_table.py new file mode 100644 index 0000000..fb89650 --- /dev/null +++ b/csf_tz/workshop/doctype/used_items_table/used_items_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class UsedItemsTable(Document): + pass diff --git a/csf_tz/workshop/doctype/workshop_request/__init__.py b/csf_tz/workshop/doctype/workshop_request/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/workshop_request/test_workshop_request.js b/csf_tz/workshop/doctype/workshop_request/test_workshop_request.js new file mode 100644 index 0000000..c7ffb06 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_request/test_workshop_request.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Workshop Request", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Workshop Request + () => frappe.tests.make('Workshop Request', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/workshop/doctype/workshop_request/test_workshop_request.py b/csf_tz/workshop/doctype/workshop_request/test_workshop_request.py new file mode 100644 index 0000000..6ba85bc --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_request/test_workshop_request.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestWorkshopRequest(unittest.TestCase): + pass diff --git a/csf_tz/workshop/doctype/workshop_request/workshop_request.js b/csf_tz/workshop/doctype/workshop_request/workshop_request.js new file mode 100644 index 0000000..6e62b0d --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_request/workshop_request.js @@ -0,0 +1,39 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Workshop Request', { + refresh: function(frm) { + frm.events.show_hide_sections(frm); + frm.set_query("requested_for", function(){ + return{ + "filters": { + "name": ["in", ['Vehicle', 'Trailer']], + } + } + }); + + //Make job card button + frm.add_custom_button(__('Make Job Card'), + function() { + frm.events.make_job_card(); + } + ); + }, + + request_type: function(frm){ + frm.events.show_hide_sections(frm); + }, + + // Show or Hide sections depending on previously entered information. + show_hide_sections: function(frm){ + frm.toggle_display("previous_job", (frm.doc.request_type && frm.doc.request_type == "Rework")); + frm.refresh_fields() + }, + + make_job_card: function() { + frappe.model.open_mapped_doc({ + method: "fleet_management.workshop.doctype.job_card.job_card.make_job_card", + frm: cur_frm + }) + }, +}); diff --git a/csf_tz/workshop/doctype/workshop_request/workshop_request.json b/csf_tz/workshop/doctype/workshop_request/workshop_request.json new file mode 100644 index 0000000..e668b47 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_request/workshop_request.json @@ -0,0 +1,306 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "WREQ.###", + "beta": 0, + "creation": "2017-09-05 17:47:59.141475", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_for", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Requested For", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_for_docname", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Vehicle/Trailer", + "length": 0, + "no_copy": 0, + "options": "requested_for", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "requested_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Request For Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_requested_job", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Requested Job", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "request_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Request Type", + "length": 0, + "no_copy": 0, + "options": "Routine Checkup\nScheduled Service\nBreakdown\nRework\nOther", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "previous_job", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Job No.", + "length": 0, + "no_copy": 0, + "options": "Job Card", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "details", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-09-08 22:29:26.581839", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Workshop Request", + "name_case": "UPPER CASE", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/workshop/doctype/workshop_request/workshop_request.py b/csf_tz/workshop/doctype/workshop_request/workshop_request.py new file mode 100644 index 0000000..ef607da --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_request/workshop_request.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class WorkshopRequest(Document): + pass diff --git a/csf_tz/workshop/doctype/workshop_service/__init__.py b/csf_tz/workshop/doctype/workshop_service/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/workshop_service/test_workshop_service.js b/csf_tz/workshop/doctype/workshop_service/test_workshop_service.js new file mode 100644 index 0000000..06f19b0 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service/test_workshop_service.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Workshop Service", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Workshop Service + () => frappe.tests.make('Workshop Service', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/workshop/doctype/workshop_service/test_workshop_service.py b/csf_tz/workshop/doctype/workshop_service/test_workshop_service.py new file mode 100644 index 0000000..05bdf8d --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service/test_workshop_service.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestWorkshopService(unittest.TestCase): + pass diff --git a/csf_tz/workshop/doctype/workshop_service/workshop_service.js b/csf_tz/workshop/doctype/workshop_service/workshop_service.js new file mode 100644 index 0000000..4078794 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service/workshop_service.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Workshop Service', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/workshop/doctype/workshop_service/workshop_service.json b/csf_tz/workshop/doctype/workshop_service/workshop_service.json new file mode 100644 index 0000000..8fc869f --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service/workshop_service.json @@ -0,0 +1,124 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:service", + "beta": 0, + "creation": "2017-09-05 20:10:01.190019", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Service", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Service Type", + "length": 0, + "no_copy": 0, + "options": "Workshop Service Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-09-08 21:46:45.789166", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Workshop Service", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/workshop/doctype/workshop_service/workshop_service.py b/csf_tz/workshop/doctype/workshop_service/workshop_service.py new file mode 100644 index 0000000..b9b16ce --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service/workshop_service.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class WorkshopService(Document): + pass diff --git a/csf_tz/workshop/doctype/workshop_service_type/__init__.py b/csf_tz/workshop/doctype/workshop_service_type/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/workshop_service_type/test_workshop_service_type.js b/csf_tz/workshop/doctype/workshop_service_type/test_workshop_service_type.js new file mode 100644 index 0000000..6b9c92b --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service_type/test_workshop_service_type.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Workshop Service Type", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Workshop Service Type + () => frappe.tests.make('Workshop Service Type', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/csf_tz/workshop/doctype/workshop_service_type/test_workshop_service_type.py b/csf_tz/workshop/doctype/workshop_service_type/test_workshop_service_type.py new file mode 100644 index 0000000..2211d78 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service_type/test_workshop_service_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestWorkshopServiceType(unittest.TestCase): + pass diff --git a/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.js b/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.js new file mode 100644 index 0000000..cb3433d --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Bravo Logistics and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Workshop Service Type', { + refresh: function(frm) { + + } +}); diff --git a/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.json b/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.json new file mode 100644 index 0000000..b712e4b --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.json @@ -0,0 +1,93 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:service_type", + "beta": 0, + "creation": "2017-09-08 21:45:26.664806", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Service Type", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-09-08 21:47:39.365396", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Workshop Service Type", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.py b/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.py new file mode 100644 index 0000000..6f020d6 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_service_type/workshop_service_type.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class WorkshopServiceType(Document): + pass diff --git a/csf_tz/workshop/doctype/workshop_services_table/__init__.py b/csf_tz/workshop/doctype/workshop_services_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/doctype/workshop_services_table/workshop_services_table.json b/csf_tz/workshop/doctype/workshop_services_table/workshop_services_table.json new file mode 100644 index 0000000..02adc39 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_services_table/workshop_services_table.json @@ -0,0 +1,437 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-09-05 20:00:20.692774", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Service", + "length": 0, + "no_copy": 0, + "options": "Workshop Service", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "work_done", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Work Done", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "service_status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Service Status", + "length": 0, + "no_copy": 0, + "options": "Not Started\nPartially Completed\nFully Completed", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "subcontracted", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Subcontracted", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "subcontractor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Subcontractor", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "technician", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Technician", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "start_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Start Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "start_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Start Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "end_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "End Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "end_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "End Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "billable_hours", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Billable Hours", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "rate_per_hour", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Rate per Hour", + "length": 0, + "no_copy": 0, + "options": "currency_rate_per_hour", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "currency_rate_per_hour", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-09-08 21:00:51.051486", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Workshop Services Table", + "name_case": "", + "owner": "info@aakvatech.com", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} diff --git a/csf_tz/workshop/doctype/workshop_services_table/workshop_services_table.py b/csf_tz/workshop/doctype/workshop_services_table/workshop_services_table.py new file mode 100644 index 0000000..16fb8b0 --- /dev/null +++ b/csf_tz/workshop/doctype/workshop_services_table/workshop_services_table.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class WorkshopServicesTable(Document): + pass diff --git a/csf_tz/workshop/report/__init__.py b/csf_tz/workshop/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/report/unprocessed_workshop_requests/__init__.py b/csf_tz/workshop/report/unprocessed_workshop_requests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/report/unprocessed_workshop_requests/unprocessed_workshop_requests.json b/csf_tz/workshop/report/unprocessed_workshop_requests/unprocessed_workshop_requests.json new file mode 100644 index 0000000..31757aa --- /dev/null +++ b/csf_tz/workshop/report/unprocessed_workshop_requests/unprocessed_workshop_requests.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2017-09-08 22:37:15.647639", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:26:19.599084", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Unprocessed Workshop Requests", + "owner": "Administrator", + "query": "SELECT\n\t`tabWorkshop Request`.name AS \"Name:Link/Workshop Request:100\",\n\t`tabWorkshop Request`.requested_date AS \"Requested For Date:Date:100\",\n\t`tabWorkshop Request`.requested_for AS \"Requested For:Data:100\",\n\t`tabWorkshop Request`.requested_for_docname AS \"Vehicle/Trailer:Data:150\",\n\t`tabWorkshop Request`.request_type AS \"Request Type:Data:150\"\nFROM\n\t`tabWorkshop Request`\nWHERE\n\tNOT EXISTS (SELECT `tabJob Card`.requested_from FROM `tabJob Card` WHERE `tabJob Card`.requested_from = `tabWorkshop Request`.name)", + "ref_doctype": "Workshop Request", + "report_name": "Unprocessed Workshop Requests", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Workshop Manager" + }, + { + "role": "Workshop User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/workshop/report/used_items_report/__init__.py b/csf_tz/workshop/report/used_items_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/report/used_items_report/used_items_report.json b/csf_tz/workshop/report/used_items_report/used_items_report.json new file mode 100644 index 0000000..c72e221 --- /dev/null +++ b/csf_tz/workshop/report/used_items_report/used_items_report.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2017-09-08 23:17:24.196906", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:26:35.599190", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Used Items Report", + "owner": "Administrator", + "query": "SELECT\n\t`tabUsed Items Table`.date AS \"Date:Date:100\",\n\t`tabJob Card`.job_done_on AS \"Used On:Data:100\",\n\t`tabJob Card`.job_done_on_docname AS \"Vehicle/Trailer No:Data:150\",\n\t`tabUsed Items Table`.item AS \"Item:Link/Item:200\",\n\t`tabUsed Items Table`.item_description AS \"Item Description:Data:200\",\n\t`tabUsed Items Table`.quantity AS \"Quantity:Float:150\",\n\t`tabUsed Items Table`.units AS \"Units:Data:100\",\n\t`tabUsed Items Table`.extra_information AS \"Extra Information:Data:200\",\n\t`tabJob Card`.name AS \"Job Card:Link/Job Card:150\"\nFROM\n\t`tabUsed Items Table`\nLEFT JOIN\n\t`tabJob Card` ON `tabJob Card`.name = `tabUsed Items Table`.parent", + "ref_doctype": "Job Card", + "report_name": "Used Items Report", + "report_type": "Query Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Workshop Manager" + }, + { + "role": "Workshop User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/workshop/report/workshop_daily_report/__init__.py b/csf_tz/workshop/report/workshop_daily_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.js b/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.js new file mode 100644 index 0000000..16d0f13 --- /dev/null +++ b/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.js @@ -0,0 +1,9 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Workshop Daily Report"] = { + "filters": [ + + ] +} diff --git a/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.json b/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.json new file mode 100644 index 0000000..bb6fd73 --- /dev/null +++ b/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.json @@ -0,0 +1,35 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2018-02-13 17:20:15.005432", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-13 17:20:39.689251", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Workshop Daily Report", + "owner": "Administrator", + "ref_doctype": "Job Card", + "report_name": "Workshop Daily Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Workshop Manager" + }, + { + "role": "Workshop User" + }, + { + "role": "Fleet Coordinator" + }, + { + "role": "Fleet Manager" + } + ] +} \ No newline at end of file diff --git a/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.py b/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.py new file mode 100644 index 0000000..baf15ac --- /dev/null +++ b/csf_tz/workshop/report/workshop_daily_report/workshop_daily_report.py @@ -0,0 +1,133 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime +from datetime import date + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label": _("Job Card Reference"), + "fieldtype": "Link", + "options": "Job Card", + "width": 100 + }, + { + "fieldname": "requested_on", + "label": _("Requested On"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "started_on", + "label": _("Started Work On"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "ended_on", + "label": _("Ended On"), + "fieldtype": "Datetime", + "width": 150 + }, + { + "fieldname": "days_in_workshop", + "label": _("Days in Workshop"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "job_type", + "label": _("Job Type"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "work_done_on", + "label": _("Work Done On"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "plate_number", + "label": _("Plate NUmber"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "fleet_number", + "label": _("Fleet NUmber"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "job_description", + "label": _("Job Description"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "reporting_status", + "label": _("Reporting Status"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "status", + "label": _("Status"), + "fieldtype": "Data", + "width": 150 + } + ] + + today = datetime.date.today().strftime("%Y-%m-%d") + + data = frappe.db.sql('''SELECT + `tabJob Card`.name AS reference, + `tabWorkshop Request`.requested_date AS requested_on, + `tabJob Card`.start_date, + `tabJob Card`.end_date, + CONCAT(`tabJob Card`.start_date, ' ' , `tabJob Card`.start_time) AS started_on, + CONCAT(`tabJob Card`.end_date, ' ' ,`tabJob Card`.end_time) AS ended_on, + `tabJob Card`.job_type, + `tabJob Card`.job_done_on AS work_done_on, + CASE + WHEN `tabJob Card`.job_done_on = 'Vehicle' THEN `tabJob Card`.job_done_on_docname + WHEN `tabJob Card`.job_done_on = 'Trailer' THEN `tabTrailer`.number_plate + END AS plate_number, + CASE + WHEN `tabJob Card`.job_done_on = 'Vehicle' THEN `tabVehicle`.fleet_number + ELSE '' + END AS fleet_number, + REPLACE(CONCAT(`tabJob Card`.job_type, ' ', `tabJob Card`.job_description),'\n','. ') AS job_description, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Job Card' AND `tabReporting Status Table`.parent = `tabJob Card`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + AS reporting_status, + `tabJob Card`.status + FROM + `tabJob Card` + LEFT JOIN + `tabWorkshop Request` ON `tabWorkshop Request`.name = `tabJob Card`.requested_from + LEFT JOIN + `tabTrailer` ON `tabTrailer`.name = `tabJob Card`.job_done_on_docname AND `tabJob Card`.job_done_on = 'Trailer' + LEFT JOIN + `tabVehicle` ON `tabVehicle`.name = `tabJob Card`.job_done_on_docname AND `tabJob Card`.job_done_on = 'Vehicle' + WHERE `tabJob Card`.docstatus <> 2 AND `tabJob Card`.status = 'Open' OR (`tabJob Card`.status = 'Closed' AND `tabJob Card`.end_date = %(today)s) + ''', {"today": today}, as_dict=1) + + for row in data: + if row.start_date and row.end_date: + row.update({"days_in_workshop": (row.end_date - row.start_date).days}) + elif row.start_date and not row.end_date: + row.update({"days_in_workshop": (datetime.date.today() - row.start_date).days}) + + return columns, data diff --git a/csf_tz/workshop/report/workshop_report/__init__.py b/csf_tz/workshop/report/workshop_report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csf_tz/workshop/report/workshop_report/workshop_report.js b/csf_tz/workshop/report/workshop_report/workshop_report.js new file mode 100644 index 0000000..801af33 --- /dev/null +++ b/csf_tz/workshop/report/workshop_report/workshop_report.js @@ -0,0 +1,32 @@ +// Copyright (c) 2016, Bravo Logistics and contributors +// For license information, please see license.txt +/* eslint-disable */ + +var aday = new Date(); +var to_date = aday.toISOString().split('T')[0]; +aday.setDate(aday.getDate() - 30); +var from_date = aday.toISOString().split('T')[0]; + +frappe.query_reports["Workshop Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "default": from_date + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "default": to_date + }, + { + "fieldname":"status", + "label": __("Status"), + "fieldtype": "Select", + "options": "Open\nClosed", + "default": "Open" + } + ] +} diff --git a/csf_tz/workshop/report/workshop_report/workshop_report.json b/csf_tz/workshop/report/workshop_report/workshop_report.json new file mode 100644 index 0000000..42aa332 --- /dev/null +++ b/csf_tz/workshop/report/workshop_report/workshop_report.json @@ -0,0 +1,29 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 0, + "creation": "2018-01-23 16:43:00.435830", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2018-02-08 20:27:46.718216", + "modified_by": "Administrator", + "module": "Workshop", + "name": "Workshop Report", + "owner": "Administrator", + "ref_doctype": "Job Card", + "report_name": "Workshop Report", + "report_type": "Script Report", + "roles": [ + { + "role": "System Manager" + }, + { + "role": "Workshop Manager" + }, + { + "role": "Workshop User" + } + ] +} \ No newline at end of file diff --git a/csf_tz/workshop/report/workshop_report/workshop_report.py b/csf_tz/workshop/report/workshop_report/workshop_report.py new file mode 100644 index 0000000..47acbbe --- /dev/null +++ b/csf_tz/workshop/report/workshop_report/workshop_report.py @@ -0,0 +1,137 @@ +# Copyright (c) 2013, Bravo Logistics and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import flt, getdate, cstr +from frappe import _ +import ast +import datetime + +def execute(filters=None): + columns, data = [], [] + + columns = [ + { + "fieldname": "reference", + "label": _("Job Card Reference"), + "fieldtype": "Link", + "options": "Job Card", + "width": 100 + }, + { + "fieldname": "requested_on", + "label": _("Requested On"), + "fieldtype": "Date", + "width": 100 + }, + { + "fieldname": "started_on", + "label": _("Started Work On"), + "fieldtype": "Datetime", + "width": 100 + }, + { + "fieldname": "ended_on", + "label": _("Ended On"), + "fieldtype": "Datetime", + "width": 150 + }, + { + "fieldname": "days_in_workshop", + "label": _("Days in Workshop"), + "fieldtype": "Float", + "width": 100 + }, + { + "fieldname": "job_type", + "label": _("Job Type"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "work_done_on", + "label": _("Work Done On"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "plate_number", + "label": _("Plate NUmber"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "fleet_number", + "label": _("Fleet NUmber"), + "fieldtype": "Data", + "width": 100 + }, + { + "fieldname": "job_description", + "label": _("Job Description"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "reporting_status", + "label": _("Reporting Status"), + "fieldtype": "Data", + "width": 150 + }, + { + "fieldname": "status", + "label": _("Status"), + "fieldtype": "Data", + "width": 150 + } + ] + + + if filters.from_date > filters.to_date: + frappe.throw(_("From Date must be before To Date {}").format(filters.to_date)) + + + data = frappe.db.sql('''SELECT + `tabJob Card`.name AS reference, + `tabWorkshop Request`.requested_date AS requested_on, + `tabJob Card`.start_date, + `tabJob Card`.end_date, + CONCAT(`tabJob Card`.start_date, ' ' , `tabJob Card`.start_time) AS started_on, + CONCAT(`tabJob Card`.end_date, ' ' ,`tabJob Card`.end_time) AS ended_on, + `tabJob Card`.job_type, + `tabJob Card`.job_done_on AS work_done_on, + CASE + WHEN `tabJob Card`.job_done_on = 'Vehicle' THEN `tabJob Card`.job_done_on_docname + WHEN `tabJob Card`.job_done_on = 'Trailer' THEN `tabTrailer`.number_plate + END AS plate_number, + CASE + WHEN `tabJob Card`.job_done_on = 'Vehicle' THEN `tabVehicle`.fleet_number + ELSE '' + END AS fleet_number, + REPLACE(CONCAT(`tabJob Card`.job_type, ' ', `tabJob Card`.job_description),'\n','. ') AS job_description, + (SELECT `tabReporting Status Table`.status FROM `tabReporting Status Table` WHERE \ + `tabReporting Status Table`.parenttype = 'Job Card' AND `tabReporting Status Table`.parent = `tabJob Card`.name \ + ORDER BY `tabReporting Status Table`.datetime DESC LIMIT 1) + AS reporting_status, + `tabJob Card`.status + FROM + `tabJob Card` + LEFT JOIN + `tabWorkshop Request` ON `tabWorkshop Request`.name = `tabJob Card`.requested_from + LEFT JOIN + `tabTrailer` ON `tabTrailer`.name = `tabJob Card`.job_done_on_docname AND `tabJob Card`.job_done_on = 'Trailer' + LEFT JOIN + `tabVehicle` ON `tabVehicle`.name = `tabJob Card`.job_done_on_docname AND `tabJob Card`.job_done_on = 'Vehicle' + WHERE + `tabJob Card`.docstatus <> 2 AND `tabJob Card`.status = %(status)s \ + AND `tabJob Card`.start_date BETWEEN %(from_date)s AND %(to_date)s + ''', {"from_date": filters.from_date, "to_date": filters.to_date, "status": filters.status}, as_dict=1) + + for row in data: + if row.start_date and row.end_date and isinstance(row.start_date, datetime.date) and isinstance(row.end_date, datetime.date): + row.update({"days_in_workshop": (row.end_date - row.start_date).days}) + elif row.start_date and not row.end_date and isinstance(row.start_date, datetime.date): + row.update({"days_in_workshop": (datetime.date.today() - row.start_date).days}) + + return columns, data diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..2fdf7c7 --- /dev/null +++ b/license.txt @@ -0,0 +1 @@ +License: MIT \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..ba409d2 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "vuetify": "^2.6.10" + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d700de5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +frappe +erpnext diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..01e4a51 --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from setuptools import setup, find_packages +import re, ast + +with open('requirements.txt') as f: + install_requires = f.read().strip().split('\n') + +# get version from __version__ variable in csf_tz/__init__.py +_version_re = re.compile(r'__version__\s+=\s+(.*)') + +with open('csf_tz/__init__.py', 'rb') as f: + version = str(ast.literal_eval(_version_re.search( + f.read().decode('utf-8')).group(1))) + +setup( + name='csf_tz', + version=version, + description='Country Specific Functionality Tanzania', + author='Aakvatech', + author_email='info@aakvatech.com', + packages=find_packages(), + zip_safe=False, + include_package_data=True, + install_requires=install_requires +) diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..eba62ef --- /dev/null +++ b/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +vuetify@^2.6.10: + version "2.6.10" + resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-2.6.10.tgz#b86cd7a97bf8cd3828a72c349795b5b3c539ebc2" + integrity sha512-fgUeRDDCwYkwu6WGEEKGe7IdfzOsXJCZGrqkn1pcS2ycuoDL8mR2/dejH5iFNnBY6MnsT365PAGn0J+9otjfQg==