Custom Script Calculation

How can i subtract the “Total Amount” field from “Statement Ending Balance” field and set the difference in “Reconciled difference” field in custom script of Bank Reconciliation.

You ca do something like this in your doctype.js


frappe.ui.form.on("Your DocType Name", "statement_ending_balance", (frm) => {
    frm.set_value("reconciled_difference", frm.doc.total_amount - frm.doc.statement_ending_balance);
});