How to fetch outstanding amount in supllier doc type using custom script

frappe.ui.form.on(“Supplier”, “validate”, function(frm, cdt, cdn) {
var total=0.0;
var i =0.0;
// var t=cur_frm.doc.material_transfer_type ;
// default_transit_warehouse = ‘aa’

total = cur_frm.doc.supplier_credit_limit;
frappe.msgprint(‘Supplier credit limit is :’ + total);
frappe.call({
method: “frappe.client.get_value”,

      args: {
          doctype: "Purchase Invoice",
          fieldname: "outstanding_amount",
      	  
          
      },

       callback: function(res){
       	// i = cur_frm.doc.outstanding_amount;
       	// i = cur_frm.doc.outstanding_amount;
       	// frappe.msgprint('outstanding_amount1 is :' + outstanding_amount);
         if (res && res.message){
         outstanding_amount=res.message['outstanding_amount']
            frappe.msgprint('outstanding_amount2 is :' + outstanding_amount);
                  
         }
         
     }  

});
});