SELECT IFNULL(IFNULL(t6.PreviousBal, 0) - IFNULL(t2.paidamt, 0),0) OpenningBalance FROM (SELECT IFNULL(SUM(ivca.receivedamt),0) paidamt FROM invoicemaster_onaccount ivca WHERE `ReceivedDate`<='2025-01-15' AND `Panel_id`=703 AND ivca.iscancel=0 ) t2 , ( SELECT IFNULL(SUM(im.`NetAmount`),0) PreviousBal FROM invoicemaster im WHERE im.invoicedate<'2025-01-15' and im.panelid = 703 and im.iscancel=0 ) t6