cur_frm.add_fetch("sales_order","customer","customer");
cur_frm.add_fetch("sales_order","customer_name","customer_name");
cur_frm.add_fetch("item_code","item_name","item_name");
cur_frm.add_fetch("item_code","description","description");
cur_frm.add_fetch("item_code","rate","rate")
//set total quantity of item on save of sales order
frappe.ui.form.on("docttype name ","validate",function(frm){
set_total_qty(frm);
});
// set total quantity of item , on change of qty
frappe.ui.form.on(" Sales Order item","qty", function(frm,cdt,cdn){
set_total_qty(frm);
});
// calculate total quantity
var set_total_qty= function(frm){
var total_qty=0.0;
total_amount=0.0;
$.each(frm.doc.items, function(i,row){
total_qty +=flt(row.qty);
total= toatl_qty * row.rate;
total_amount += flt(total);
})
frm.set_value('total_qty',total_qty);
frm.set_value('total_amount',total_amount);
frm.set_value("total",total_amount);
frm.refresh();
}
cur_frm.add_fetch("sales_order","customer_name","customer_name");
cur_frm.add_fetch("item_code","item_name","item_name");
cur_frm.add_fetch("item_code","description","description");
cur_frm.add_fetch("item_code","rate","rate")
//set total quantity of item on save of sales order
frappe.ui.form.on("docttype name ","validate",function(frm){
set_total_qty(frm);
});
// set total quantity of item , on change of qty
frappe.ui.form.on(" Sales Order item","qty", function(frm,cdt,cdn){
set_total_qty(frm);
});
// calculate total quantity
var set_total_qty= function(frm){
var total_qty=0.0;
total_amount=0.0;
$.each(frm.doc.items, function(i,row){
total_qty +=flt(row.qty);
total= toatl_qty * row.rate;
total_amount += flt(total);
})
frm.set_value('total_qty',total_qty);
frm.set_value('total_amount',total_amount);
frm.set_value("total",total_amount);
frm.refresh();
}
No comments:
Post a Comment