{"Totals":[8,9], "Hide":[0,1,2,3], "width-list":[30,15,15,15,20,20], "align-list":[0,0,0,0,1,1], "print-cols":[4,5,6,7,8,9], "stretch":4, "additional":[{"widget-name":"Opening Balance","widget-type":"QLabel", "value-type":"amount", "value-from":"query", "query":"SELECT round(coalesce(sum(credit - debit),0),2) from ( SELECT  subq.Voucher_Date, subq.Voucher_ID, subq.Voucher_Type, case when subq.deb>0 then subq.deb else '' end as Debit,case when subq.cred>0 then subq.cred else '' end as Credit ,subq.Voucher_Prefix FROM ( SELECT Against_Ledger, SUM(Credit_Amount-Debit_Amount) as cred, SUM(Debit_Amount-Credit_Amount)as deb,Voucher_Date, Voucher_ID,  Voucher_Type, Voucher_Prefix From Transaction_Helper Where Ledger_ID='0x2x15A95' AND Voucher_Date < str_to_date('$fromDateTime','%Y-%m-%d') AND ( case when Voucher_Type = 'SalesVoucher' then Voucher_ID in  ( SELECT Voucher_No from Sales_Invoice_Main Where POC_Phone = '$f1') when Voucher_Type = 'PurchaseVoucher' then Voucher_ID in ( SELECT Voucher_No from Purchase_Invoice_Main Where POC_Phone = '$f1') when Voucher_Type = 'PaymentVoucher' then  Voucher_ID in ( SELECT Voucher_No from Payment_Voucher_Main Where POC_Phone = '$f1') when Voucher_Type = 'ReceiptVoucher' then Voucher_ID in ( SELECT Voucher_No from Receipt_Voucher_Main Where POC_Phone = '$f1') end ) GROUP BY Voucher_ID, Voucher_Type ORDER BY Voucher_Date, Voucher_ID, Voucher_Type ) subq UNION SELECT so.Voucher_Date, so.Voucher_No, 'SALES ORDER', cast(so.Total as decimal(10,2)) as Debit, 0 as Credit , so.Voucher_Prefix  FROM Sales_Order_Main so Where POC_Phone = '$f1' AND so.Voucher_Date  <str_to_date('$fromDateTime','%Y-%m-%d')  AND so.VoucherStatus  < 170) A", "layout":"additionalLay1", "alignment":"right"}, {"widget-name":"Closing Balance", "widget-type":"QLabel", "value-type":"amount", "value-from":"query", "query":"SELECT round(coalesce(sum(credit - debit),0),2) from ( SELECT  subq.Voucher_Date, subq.Voucher_ID, subq.Voucher_Type, case when subq.deb>0 then subq.deb else '' end as Debit,case when subq.cred>0 then subq.cred else '' end as Credit ,subq.Voucher_Prefix FROM ( SELECT Against_Ledger, SUM(Credit_Amount-Debit_Amount) as cred, SUM(Debit_Amount-Credit_Amount)as deb,Voucher_Date, Voucher_ID,  Voucher_Type, Voucher_Prefix From Transaction_Helper Where Ledger_ID='0x2x15A95' AND Voucher_Date < str_to_date('$toDateTime','%Y-%m-%d') AND( case when Voucher_Type = 'SalesVoucher' then Voucher_ID in  ( SELECT Voucher_No from Sales_Invoice_Main Where POC_Phone = '$f1') when Voucher_Type = 'PurchaseVoucher' then Voucher_ID in  ( SELECT Voucher_No from Purchase_Invoice_Main Where POC_Phone = '$f1') when Voucher_Type = 'PaymentVoucher' then  Voucher_ID in  ( SELECT Voucher_No from Payment_Voucher_Main Where POC_Phone = '$f1') when Voucher_Type = 'ReceiptVoucher' then Voucher_ID in ( SELECT Voucher_No from Receipt_Voucher_Main Where POC_Phone = '$f1') end ) GROUP BY Voucher_ID, Voucher_Type ORDER BY Voucher_Date, Voucher_ID, Voucher_Type ) subq UNION SELECT so.Voucher_Date, so.Voucher_No, 'SALES ORDER', cast(so.Total as decimal(10,2)) as Debit, 0 as Credit , so.Voucher_Prefix  FROM Sales_Order_Main so Where POC_Phone = '$f1' AND so.Voucher_Date  <str_to_date('$toDateTime','%Y-%m-%d')  AND so.VoucherStatus  < 170) A",  "layout":"additionalLay2", "alignment":"right"}]}