Custom Script validation and fetching

Both Scripts is working separately, but when i put them together in custom script, only the “cur_frm.cscript.customer” is working. Please help, Thanks.

cur_frm.cscript.customer = function(doc) {
method: “erpnext.accounts.utils.get_balance_on”,
args: {
date: frappe.datetime.nowdate(),
party_type: ‘Customer’,
party: doc.customer
callback: function(r) {
doc.outstanding_balance = format_currency(r.message, erpnext.get_currency(;
frappe.ui.form.on(“Sales Order”,“validate”, function(frm)
if (!frm.doc.attachments && frm.doc.payment_terms_template==“PREPAID”)
msgprint(“Deposit Slip must be attached for PREPAID Customer”);