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`,`ht`.`main_head` AS `main_head` from (`co-operativebank-243`.`headvoucher` `v` join `co-operativebank-243`.`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` <= \'2019-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(`co-operativebank-243`.`voucher`.`cr`) - sum(`co-operativebank-243`.`voucher`.`dr`)) AS `bal`,\'20000\' AS `main_head` from `co-operativebank-243`.`voucher` where ((`co-operativebank-243`.`voucher`.`sub_head` = \'19205\') or ((`co-operativebank-243`.`voucher`.`sub_head` = \'19211\') and (`co-operativebank-243`.`voucher`.`date` <= \'2019-03-31\'))) union all select \'3\' AS `sl_no`,\'23000\' AS `code`,\'LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-operativebank-243`.`voucher`.`cr`) - sum(`co-operativebank-243`.`voucher`.`dr`)) AS `bal`,\'20000\' AS `main_head` from `co-operativebank-243`.`voucher` where ((`co-operativebank-243`.`voucher`.`sub_head` = \'19206\') and (`co-operativebank-243`.`voucher`.`date` <= \'2019-03-31\')) union all select \'5\' AS `sl_no`,\'25000\' AS `code`,\'INTEREST RECEIVABLE ON LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-operativebank-243`.`voucher`.`cr`) - sum(`co-operativebank-243`.`voucher`.`dr`)) AS `bal`,\'20000\' AS `main_head` from `co-operativebank-243`.`voucher` where ((`co-operativebank-243`.`voucher`.`sub_head` = \'19207\') and (`co-operativebank-243`.`voucher`.`date` <= \'2019-03-31\'))
md5=64290615fdb62f6cda9dc273b880a18f
updatable=0
algorithm=0
definer_user=admin
definer_host=%
suid=1
with_check_option=0
timestamp=2025-09-15 05:27:52
create-version=1
source=select  `ht`.`sl_no`  AS  `sl_no` ,\n `ht`.`code`  AS  `code` ,\n `ht`.`head_type`  AS  `head_type` ,\nround( if( ( (  `ht`.`code`  <>  \'22000\' ) and (  `ht`.`code`  <>  \'28000\' ) ) , ( sum(  `v`.`dr`  )  - sum(  `v`.`cr`  )  ) ,\n( sum(  `v`.`cr`  )  - sum(  `v`.`dr`  )  ) ),\n2 ) AS  `cur_bal` ,\n \'0\' AS  `bal` ,\n `ht`.`main_head`  AS  `main_head`  from (  `co-operativebank-243`.`headvoucher`  `v`  join  `co-operativebank-243`.`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`  <=  \'2019-03-31\' ) ) group  by  `ht`.`code`  union  all  select  \'2\' AS  `sl_no` ,\n \'22000\' AS  `code` ,\n \'INVESTMENTS\' AS  `head_type` ,\n0 AS  `cur_bal` ,\n( sum(  `co-operativebank-243`.`voucher`.`cr`  )  - sum(  `co-operativebank-243`.`voucher`.`dr`  )  ) AS  `bal` ,\n \'20000\' AS  `main_head`  from  `co-operativebank-243`.`voucher`  where ( (  `co-operativebank-243`.`voucher`.`sub_head`  =  \'19205\' ) or ( (  `co-operativebank-243`.`voucher`.`sub_head`  =  \'19211\' ) and (  `co-operativebank-243`.`voucher`.`date`  <=  \'2019-03-31\' ) ) ) union  all  select  \'3\' AS  `sl_no` ,\n \'23000\' AS  `code` ,\n \'LOAN\' AS  `head_type` ,\n0 AS  `cur_bal` ,\n( sum(  `co-operativebank-243`.`voucher`.`cr`  )  - sum(  `co-operativebank-243`.`voucher`.`dr`  )  ) AS  `bal` ,\n \'20000\' AS  `main_head`  from  `co-operativebank-243`.`voucher`  where ( (  `co-operativebank-243`.`voucher`.`sub_head`  =  \'19206\' ) and (  `co-operativebank-243`.`voucher`.`date`  <=  \'2019-03-31\' ) ) union  all  select  \'5\' AS  `sl_no` ,\n \'25000\' AS  `code` ,\n \'INTEREST RECEIVABLE ON LOAN\' AS  `head_type` ,\n0 AS  `cur_bal` ,\n( sum(  `co-operativebank-243`.`voucher`.`cr`  )  - sum(  `co-operativebank-243`.`voucher`.`dr`  )  ) AS  `bal` ,\n \'20000\' AS  `main_head`  from  `co-operativebank-243`.`voucher`  where ( (  `co-operativebank-243`.`voucher`.`sub_head`  =  \'19207\' ) and (  `co-operativebank-243`.`voucher`.`date`  <=  \'2019-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`,`ht`.`main_head` AS `main_head` from (`co-operativebank-243`.`headvoucher` `v` join `co-operativebank-243`.`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` <= \'2019-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(`co-operativebank-243`.`voucher`.`cr`) - sum(`co-operativebank-243`.`voucher`.`dr`)) AS `bal`,\'20000\' AS `main_head` from `co-operativebank-243`.`voucher` where ((`co-operativebank-243`.`voucher`.`sub_head` = \'19205\') or ((`co-operativebank-243`.`voucher`.`sub_head` = \'19211\') and (`co-operativebank-243`.`voucher`.`date` <= \'2019-03-31\'))) union all select \'3\' AS `sl_no`,\'23000\' AS `code`,\'LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-operativebank-243`.`voucher`.`cr`) - sum(`co-operativebank-243`.`voucher`.`dr`)) AS `bal`,\'20000\' AS `main_head` from `co-operativebank-243`.`voucher` where ((`co-operativebank-243`.`voucher`.`sub_head` = \'19206\') and (`co-operativebank-243`.`voucher`.`date` <= \'2019-03-31\')) union all select \'5\' AS `sl_no`,\'25000\' AS `code`,\'INTEREST RECEIVABLE ON LOAN\' AS `head_type`,0 AS `cur_bal`,(sum(`co-operativebank-243`.`voucher`.`cr`) - sum(`co-operativebank-243`.`voucher`.`dr`)) AS `bal`,\'20000\' AS `main_head` from `co-operativebank-243`.`voucher` where ((`co-operativebank-243`.`voucher`.`sub_head` = \'19207\') and (`co-operativebank-243`.`voucher`.`date` <= \'2019-03-31\'))
