added more features to loan

This commit is contained in:
Rushabh Mehta 2011-07-14 12:41:39 +05:30
parent 4fed41fb7a
commit 62e77f536b

View File

@ -8,11 +8,39 @@ $.extend(cur_frm.cscript, {
}
cur_frm.refresh();
},
refresh: function(doc) {
cur_frm.cscript.hide_show_buttons(doc);
},
hide_show_buttons: function(doc) {
if(doc.docstatus==0) {
hide_field('Installment Reciept'); show_field('Generate');
} else if (doc.docstatus==1) {
show_field('Installment Reciept'); hide_field('Generate');
}
},
clear_installments: function(doc) {
$.each(getchildren('Loan Installment', doc.name, 'installments', 'Loan'),
function(i, d) {
LocalDB.delete_doc('Loan Installment', d.name);
}
)
},
'Installment Reciept': function(doc, dt, dn) {
var d = new wn.widgets.Dialog({
width: 500,
title: 'Add a new payment installment',
fields: [
{fieldtype:'Data', label:'Check Number', fieldname:'check_number', reqd:1},
{fieldtype:'Date', label:'Check Date', fieldname:'check_date', reqd:1},
{fieldtype:'Button', label:'Update',fieldname:'update'}
]
})
d.show();
d.fields_dict.update.input.onclick = function() {
var data = d.get_values();
if(data) {
$c_obj()
}
}
}
})