TYPE=VIEW
query=select `ht`.`sl_no` AS `sl_no`,`ht`.`code` AS `code`,`ht`.`head_type` AS `head_type`,round(if(((`ht`.`code` <> \'22000\') and (`ht`.`code` <> \'28000\')),(sum(`v`.`dr`) - sum(`v`.`cr`)),(sum(`v`.`cr`) - sum(`v`.`dr`))),2) AS `cur_bal`,\'0\' AS `bal`,0 AS `pre_bal`,0 AS `bal1`,`ht`.`main_head` AS `main_head` from (`co-club`.`headvoucher` `v` join `co-club`.`head_type` `ht`) where ((`v`.`htcode` = `ht`.`code`) and ((`ht`.`main_head` = \'20000\') or (`ht`.`code` = \'32000\') or (`ht`.`code` = \'38000\')) and ((`v`.`cr` <> 0) or (`v`.`dr` <> 0)) and (`v`.`date` <= \'2022-03-31\')) group by `ht`.`code` union select \'2\' AS `sl_no`,\'22000\' AS `code`,\'INVESTMENTS\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19205\') or ((`co-club`.`voucher`.`sub_head` = \'19211\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\'))) union select \'3\' AS `sl_no`,\'23000\' AS `code`,\'LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19206\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\')) union select \'5\' AS `sl_no`,\'25000\' AS `code`,\'INTEREST RECEIVABLE ON LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19207\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\')) union select \'6\' AS `sl_no`,\'32000\' AS `code`,\'SUNDRY DEBTORS\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19203\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\')) union select \'7\' AS `sl_no`,\'38000\' AS `code`,\'CLOSING STOCK\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`approciation`.`cr`) - sum(`co-club`.`approciation`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'30000\' AS `main_head` from `co-club`.`approciation` where ((`co-club`.`approciation`.`sub_head` = \'38101\') and (`co-club`.`approciation`.`date` <= \'2022-03-31\')) union select `ht`.`sl_no` AS `sl_no`,`ht`.`code` AS `code`,`ht`.`head_type` AS `head_type`,0 AS `cur_bal`,\'0\' AS `bal`,round(if(((`ht`.`code` <> \'22000\') and (`ht`.`code` <> \'28000\')),(sum(`v`.`dr`) - sum(`v`.`cr`)),(sum(`v`.`cr`) - sum(`v`.`dr`))),2) AS `pre_bal`,0 AS `bal1`,`ht`.`main_head` AS `main_head` from (`co-club`.`headvoucher` `v` join `co-club`.`head_type` `ht`) where ((`v`.`htcode` = `ht`.`code`) and ((`ht`.`main_head` = \'20000\') or (`ht`.`code` = \'32000\') or (`ht`.`code` = \'38000\')) and ((`v`.`cr` <> 0) or (`v`.`dr` <> 0)) and (`v`.`date` <= \'2021-03-31\')) group by `ht`.`code` union all select \'2\' AS `sl_no`,\'22000\' AS `code`,\'INVESTMENTS\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19205\') or ((`co-club`.`voucher`.`sub_head` = \'19211\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\'))) union all select \'3\' AS `sl_no`,\'23000\' AS `code`,\'LOAN\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19206\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\')) union all select \'5\' AS `sl_no`,\'25000\' AS `code`,\'INTEREST RECEIVABLE ON LOAN\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19207\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\')) union all select \'6\' AS `sl_no`,\'32000\' AS `code`,\'SUNDRY DEBTORS\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19203\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\')) union all select \'7\' AS `sl_no`,\'38000\' AS `code`,\'CLOSING STOCK\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`approciation`.`cr`) - sum(`co-club`.`approciation`.`dr`)) AS `bal1`,\'30000\' AS `main_head` from `co-club`.`approciation` where ((`co-club`.`approciation`.`sub_head` = \'38101\') and (`co-club`.`approciation`.`date` <= \'2021-03-31\'))
md5=8da3ff16b9bccd292226801b05ec338f
updatable=0
algorithm=0
definer_user=admin
definer_host=localhost
suid=2
with_check_option=0
timestamp=2022-05-08 04:27:38
create-version=1
source=select ht.sl_no AS sl_no,ht.code AS code,ht.head_type AS head_type,round(if(((ht.code <> \'22000\') and (ht.code <> \'28000\')),(sum(v.dr) - sum(v.cr)),(sum(v.cr) - sum(v.dr))),2) AS cur_bal,\'0\' AS bal,0 as pre_bal,0 as bal1,ht.main_head AS main_head from (headvoucher v join head_type ht) where (v.htcode=ht.code and  ((ht.main_head = \'20000\') or (ht.code = \'32000\') or (ht.code = \'38000\')) and ((v.cr <> 0) or (v.dr <> 0)) and (v.date <= \'2022-03-31\')) group by ht.code union all SELECT \'2\' as sl_no, \'22000\' as code,\'INVESTMENTS\' as head_type,0 as cur_bal,(sum(cr)-sum(dr)) as bal,0 as pre_bal,0 as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19205\' or sub_head=\'19211\' and date<=\'2022-03-31\' union all SELECT \'3\' as sl_no, \'23000\' as code,\'LOAN\' as head_type,0 as cur_bal,(sum(cr)-sum(dr)) as bal,0 as pre_bal,0 as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19206\'  and date<=\'2022-03-31\' union all SELECT \'5\' as sl_no, \'25000\' as code,\'INTEREST RECEIVABLE ON LOAN\' as head_type,0 as cur_bal,(sum(cr)-sum(dr)) as bal,0 as pre_bal,0 as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19207\'  and date<=\'2022-03-31\' union all SELECT \'6\' as sl_no, \'32000\' as code,\'SUNDRY DEBTORS\' as head_type,0 as cur_bal,(sum(cr)-sum(dr)) as bal,0 as pre_bal,0 as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19203\'  and date<=\'2022-03-31\' union all SELECT \'7\' as sl_no, \'38000\' as code,\'CLOSING STOCK\' as head_type,0 as cur_bal,(sum(cr)-sum(dr)) as bal,0 as pre_bal,0 as bal1,\'30000\' as main_head  FROM approciation WHERE sub_head=\'38101\'  and date<=\'2022-03-31\'union select ht.sl_no AS sl_no,ht.code AS code,ht.head_type AS head_type,0 AS cur_bal,\'0\' AS bal,round(if(((ht.code <> \'22000\') and (ht.code <> \'28000\')),(sum(v.dr) - sum(v.cr)),(sum(v.cr) - sum(v.dr))),2) as pre_bal,0 as bal1,ht.main_head AS main_head from (headvoucher v join head_type ht) where (v.htcode=ht.code and  ((ht.main_head = \'20000\') or (ht.code = \'32000\') or (ht.code = \'38000\')) and ((v.cr <> 0) or (v.dr <> 0)) and (v.date <= \'2021-03-31\')) group by ht.code union all SELECT \'2\' as sl_no, \'22000\' as code,\'INVESTMENTS\' as head_type,0 as cur_bal,0 as bal,0 as pre_bal,(sum(cr)-sum(dr)) as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19205\' or sub_head=\'19211\' and date<=\'2021-03-31\' union all SELECT \'3\' as sl_no, \'23000\' as code,\'LOAN\' as head_type,0 as cur_bal,0 as bal,0 as pre_bal,(sum(cr)-sum(dr)) as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19206\'  and date<=\'2021-03-31\' union all SELECT \'5\' as sl_no, \'25000\' as code,\'INTEREST RECEIVABLE ON LOAN\' as head_type,0 as cur_bal,0 as bal,0 as pre_bal,(sum(cr)-sum(dr)) as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19207\'  and date<=\'2021-03-31\' union all SELECT \'6\' as sl_no, \'32000\' as code,\'SUNDRY DEBTORS\' as head_type,0 as cur_bal,0 as bal,0 as pre_bal,(sum(cr)-sum(dr)) as bal1,\'20000\' as main_head  FROM voucher WHERE sub_head=\'19203\'  and date<=\'2021-03-31\' union all SELECT \'7\' as sl_no, \'38000\' as code,\'CLOSING STOCK\' as head_type,0 as cur_bal,0 as bal,0 as pre_bal,(sum(cr)-sum(dr)) as bal1,\'30000\' as main_head  FROM approciation WHERE sub_head=\'38101\'  and date<=\'2021-03-31\'
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select `ht`.`sl_no` AS `sl_no`,`ht`.`code` AS `code`,`ht`.`head_type` AS `head_type`,round(if(((`ht`.`code` <> \'22000\') and (`ht`.`code` <> \'28000\')),(sum(`v`.`dr`) - sum(`v`.`cr`)),(sum(`v`.`cr`) - sum(`v`.`dr`))),2) AS `cur_bal`,\'0\' AS `bal`,0 AS `pre_bal`,0 AS `bal1`,`ht`.`main_head` AS `main_head` from (`co-club`.`headvoucher` `v` join `co-club`.`head_type` `ht`) where ((`v`.`htcode` = `ht`.`code`) and ((`ht`.`main_head` = \'20000\') or (`ht`.`code` = \'32000\') or (`ht`.`code` = \'38000\')) and ((`v`.`cr` <> 0) or (`v`.`dr` <> 0)) and (`v`.`date` <= \'2022-03-31\')) group by `ht`.`code` union select \'2\' AS `sl_no`,\'22000\' AS `code`,\'INVESTMENTS\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19205\') or ((`co-club`.`voucher`.`sub_head` = \'19211\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\'))) union select \'3\' AS `sl_no`,\'23000\' AS `code`,\'LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19206\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\')) union select \'5\' AS `sl_no`,\'25000\' AS `code`,\'INTEREST RECEIVABLE ON LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19207\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\')) union select \'6\' AS `sl_no`,\'32000\' AS `code`,\'SUNDRY DEBTORS\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19203\') and (`co-club`.`voucher`.`date` <= \'2022-03-31\')) union select \'7\' AS `sl_no`,\'38000\' AS `code`,\'CLOSING STOCK\' AS `head_type`,0 AS `cur_bal`,(sum(`co-club`.`approciation`.`cr`) - sum(`co-club`.`approciation`.`dr`)) AS `bal`,0 AS `pre_bal`,0 AS `bal1`,\'30000\' AS `main_head` from `co-club`.`approciation` where ((`co-club`.`approciation`.`sub_head` = \'38101\') and (`co-club`.`approciation`.`date` <= \'2022-03-31\')) union select `ht`.`sl_no` AS `sl_no`,`ht`.`code` AS `code`,`ht`.`head_type` AS `head_type`,0 AS `cur_bal`,\'0\' AS `bal`,round(if(((`ht`.`code` <> \'22000\') and (`ht`.`code` <> \'28000\')),(sum(`v`.`dr`) - sum(`v`.`cr`)),(sum(`v`.`cr`) - sum(`v`.`dr`))),2) AS `pre_bal`,0 AS `bal1`,`ht`.`main_head` AS `main_head` from (`co-club`.`headvoucher` `v` join `co-club`.`head_type` `ht`) where ((`v`.`htcode` = `ht`.`code`) and ((`ht`.`main_head` = \'20000\') or (`ht`.`code` = \'32000\') or (`ht`.`code` = \'38000\')) and ((`v`.`cr` <> 0) or (`v`.`dr` <> 0)) and (`v`.`date` <= \'2021-03-31\')) group by `ht`.`code` union all select \'2\' AS `sl_no`,\'22000\' AS `code`,\'INVESTMENTS\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19205\') or ((`co-club`.`voucher`.`sub_head` = \'19211\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\'))) union all select \'3\' AS `sl_no`,\'23000\' AS `code`,\'LOAN\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19206\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\')) union all select \'5\' AS `sl_no`,\'25000\' AS `code`,\'INTEREST RECEIVABLE ON LOAN\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19207\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\')) union all select \'6\' AS `sl_no`,\'32000\' AS `code`,\'SUNDRY DEBTORS\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`voucher`.`cr`) - sum(`co-club`.`voucher`.`dr`)) AS `bal1`,\'20000\' AS `main_head` from `co-club`.`voucher` where ((`co-club`.`voucher`.`sub_head` = \'19203\') and (`co-club`.`voucher`.`date` <= \'2021-03-31\')) union all select \'7\' AS `sl_no`,\'38000\' AS `code`,\'CLOSING STOCK\' AS `head_type`,0 AS `cur_bal`,0 AS `bal`,0 AS `pre_bal`,(sum(`co-club`.`approciation`.`cr`) - sum(`co-club`.`approciation`.`dr`)) AS `bal1`,\'30000\' AS `main_head` from `co-club`.`approciation` where ((`co-club`.`approciation`.`sub_head` = \'38101\') and (`co-club`.`approciation`.`date` <= \'2021-03-31\'))
