Hi All,
May I ask if is it possible to subtract date and count how many days has been past.
I have Posting Date field, Due Date field and the result for days count has been past field.
Total of 3 fields at all.
Thanks for your help.
Thanks and regards.
@Foxdemon96
I only Created this, but it works for years.
frappe.ui.form.on("Beta", "posting_date", function(frm) {
frm.set_value("count", flt(frm.doc.posting_date) - flt(frm.doc.due_date));
})
frappe.ui.form.on("Beta", "due_date", function(frm) {
frm.set_value("count", flt(frm.doc.posting_date) - flt(frm.doc.due_date));
})
I hope you can help me on this guys.
on how to I do this on number of Days.
Thanks.
@Foxdemon96
shahid
5
Try this
frappe.datetime.get_day_diff(frm.doc.posting_date, frm.doc.due_date );
Hi @shahid Thank you so much for your reply on this.
Sorry about this but I mean I don’t get it.
I tried
on custom script but it didn’t work on me.
anyway thank you so much for your reply.
Thanks.
@Foxdemon96
shahid
7
Can you share your complete script?
Hi @shahid
I already did it by this scrip
frappe.ui.form.on("beta", "refresh", function(frm, cdt, cdn){
var b = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, "count", frappe.datetime.get_day_diff( b.due_date , b.posting_date));
refresh_field("count");
});
Thank you so much for your help @shahid
Regards.
@Foxdemon96
shahid
9
Beta is Normal Doctype or Child table?
shahid
11
This script is for child table doctype,
You should use like this for parent,
frappe.ui.form.on("Beta", "posting_date", function(frm) {
frm.set_value("count", frappe.datetime.get_day_diff(frm.doc.posting_date, frm.doc.due_date ));
})
Thanks @shahid it helps me a lot.