From 62e77f536bacf69662513aed6ed480d8bae80d57 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 14 Jul 2011 12:41:39 +0530 Subject: [PATCH] added more features to loan --- accounts/doctype/loan/loan.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/accounts/doctype/loan/loan.js b/accounts/doctype/loan/loan.js index 37e49dc857..d4e063d7be 100644 --- a/accounts/doctype/loan/loan.js +++ b/accounts/doctype/loan/loan.js @@ -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() + } + } } }) \ No newline at end of file