added client side functions and mode_of_payment defaults
diff --git a/public/js/utils.js b/public/js/utils.js
index 4398498..d02fdb3 100644
--- a/public/js/utils.js
+++ b/public/js/utils.js
@@ -82,4 +82,25 @@
case when name like \"%s%%\" then 0 else 1 end, \
case when supplier_name like \"%s%%\" then 0 else 1 end, \
name, supplier_name limit 50";
-};
\ No newline at end of file
+};
+
+wn.provide("erpnext.queries");
+
+erpnext.queries.account = function(opts) {
+ if(!opts)
+ opts = {};
+ if(!opts.group_or_ledger)
+ opts.group_or_ledger = "Ledger";
+
+ conditions = [];
+ $.each(opts, function(key, val) {
+ conditions.push("tabAccount.`" + key + "`='"+esc_quotes(val)+"'");
+ });
+
+ return 'SELECT tabAccount.name, tabAccount.parent_account, tabAccount.debit_or_credit \
+ FROM tabAccount \
+ WHERE tabAccount.docstatus!=2 \
+ AND tabAccount.%(key)s LIKE "%s" ' + (conditions
+ ? (" AND " + conditions.join(" AND "))
+ : "")
+}
\ No newline at end of file