chore: hide internal fields and better painting logic for heatmap

This commit is contained in:
ruthra kumar 2023-09-27 14:40:57 +05:30
parent 16db6c2f47
commit f6831fba13
2 changed files with 26 additions and 13 deletions

View File

@ -28,11 +28,18 @@ frappe.ui.form.on("Bisect Accounting Statements", {
// milliseconds in a day // milliseconds in a day
let msiad=24*60*60*1000; let msiad=24*60*60*1000;
let datapoints = {}; let datapoints = {};
let fr_dt = new Date(frm.doc.current_from_date).getTime(); let fr_dt = new Date(frm.doc.from_date).getTime();
let to_dt = new Date(frm.doc.current_to_date).getTime(); let to_dt = new Date(frm.doc.to_date).getTime();
let bisect_start = new Date(frm.doc.current_from_date).getTime();
let bisect_end = new Date(frm.doc.current_to_date).getTime();
for(let x=fr_dt; x <= to_dt; x+=msiad){ for(let x=fr_dt; x <= to_dt; x+=msiad){
let epoch_in_seconds = x/1000; let epoch_in_seconds = x/1000;
datapoints[epoch_in_seconds] = 1; if ((bisect_start <= x) && (x <= bisect_end )) {
datapoints[epoch_in_seconds] = 1.0;
} else {
datapoints[epoch_in_seconds] = 0.0;
}
} }
console.log(datapoints); console.log(datapoints);
@ -45,7 +52,7 @@ frappe.ui.form.on("Bisect Accounting Statements", {
end: new Date(frm.doc.to_date), end: new Date(frm.doc.to_date),
}, },
countLabel: 'Difference', countLabel: 'Difference',
discreteDomains: 1 discreteDomains: 1,
}); });
}, },
bisect_left(frm) { bisect_left(frm) {

View File

@ -58,23 +58,25 @@
{ {
"fieldname": "current_node", "fieldname": "current_node",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1,
"label": "Current Node", "label": "Current Node",
"options": "Nodes" "options": "Nodes"
}, },
{ {
"fieldname": "section_break_hmsy", "fieldname": "section_break_hmsy",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"hidden": 1
}, },
{ {
"fieldname": "current_from_date", "fieldname": "current_from_date",
"fieldtype": "Datetime", "fieldtype": "Datetime",
"label": "Current From Date" "label": "Current From Date",
"read_only": 1
}, },
{ {
"fieldname": "current_to_date", "fieldname": "current_to_date",
"fieldtype": "Datetime", "fieldtype": "Datetime",
"label": "Current To Date" "label": "Current To Date",
"read_only": 1
}, },
{ {
"fieldname": "column_break_uqyd", "fieldname": "column_break_uqyd",
@ -87,17 +89,20 @@
{ {
"fieldname": "p_l_summary", "fieldname": "p_l_summary",
"fieldtype": "Data", "fieldtype": "Data",
"label": "P&L Summary" "label": "P&L Summary",
"read_only": 1
}, },
{ {
"fieldname": "b_s_summary", "fieldname": "b_s_summary",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Balance Sheet Summary" "label": "Balance Sheet Summary",
"read_only": 1
}, },
{ {
"fieldname": "difference", "fieldname": "difference",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Difference" "label": "Difference",
"read_only": 1
}, },
{ {
"fieldname": "column_break_aivo", "fieldname": "column_break_aivo",
@ -123,7 +128,8 @@
}, },
{ {
"fieldname": "section_break_8ph9", "fieldname": "section_break_8ph9",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"hidden": 1
}, },
{ {
"fieldname": "bisect_heatmap", "fieldname": "bisect_heatmap",
@ -135,7 +141,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2023-09-27 12:10:40.044935", "modified": "2023-09-27 14:32:09.962067",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Bisect Accounting Statements", "name": "Bisect Accounting Statements",