1) Closing stock should be same in profit and loss account and Balance sheet.
2) Profit/loss amount also should be same in profit and loss account and balance sheet.
(While open the profit and loss account need to give entire financial year )
3) To Found the problematic transaction. Below query will show the problematic voucher number and vouchertype. So you can check that transaction.
select a.voucherslno as voucherno ,b.vouchertype from accvoucher a join accvouchertype b
on a.vouchercode = b.vouchercode where VoucherNo in (select VoucherNo from accvoucher where VoucherNo <> 0 group by VoucherNo having SUM(Amount) <> 0 )group by a.voucherslno,b.vouchertype
4) If any ledger or group is deleted by query or any other reason. Below query will listed that problematic ledgers.
select * from ACCLEDGERMASTER where GroupCode not in (select GroupCode from accgroupmaster) and ledgercode not in (15,21)
select * from accvoucher where LedgerCode not in (select LedgerCode from ACCLEDGERMASTER)