TYPE=VIEW
query=select if(((sum(`h1`.`dr`) - sum(`h1`.`cr`)) > -(100000)),(sum(`h1`.`dr`) - sum(`h1`.`cr`)),0) AS `ln`,if(((select if((sum(`h2`.`dr`) > 0),sum(`h2`.`dr`),0) AS `ln1` from `co-operativebank-mohati`.`headvoucher` `h2` where ((`h2`.`hcode` = `h1`.`hcode`) and (`h2`.`htcode` = \'25000\') and ((`h2`.`date` >= \'2025-09-10\') + interval -(1) year) and ((`h2`.`date` <= \'2025-09-10\') + interval -(1) year)) group by `h2`.`hcode`) > 0),(select if((sum(`h2`.`dr`) > 0),sum(`h2`.`dr`),0) AS `ln1` from `co-operativebank-mohati`.`headvoucher` `h2` where ((`h2`.`hcode` = `h1`.`hcode`) and (`h2`.`htcode` = \'25000\') and ((`h2`.`date` >= \'2025-09-10\') + interval -(1) year) and ((`h2`.`date` <= \'2025-09-10\') + interval -(1) year)) group by `h2`.`hcode`),0) AS `ln1`,(`h1`.`hcode` + 27000) AS `hcode`,(`h1`.`htcode` + 27000) AS `htcode` from `co-operativebank-mohati`.`headvoucher` `h1` where ((`h1`.`htcode` = \'25000\') and (`h1`.`date` <= \'2024-09-09\')) group by `h1`.`htcode`
md5=93abaeb0ec6f3229ae24c679682a6db3
updatable=0
algorithm=0
definer_user=admin
definer_host=%
suid=2
with_check_option=0
timestamp=2025-09-10 12:40:04
create-version=1
source=select if(sum(dr)-sum(cr)>-100000,sum(dr)-sum(cr),0) ln,if((select if(((sum(`h2`.`dr`)) > 0),(sum(`h2`.`dr`) ),0) AS `ln1` from `headvoucher` `h2` where ((`h2`.`hcode` = `h1`.`hcode`) and h2.htcode=\'25000\' and date_add((`h2`.`date` >= \'2025-09-10\'), interval -1 year) and date_add((`h2`.`date` <= \'2025-09-10\'), interval -1 year)) group by `h2`.`hcode`)>0,(select if(((sum(`h2`.`dr`) ) > 0),(sum(`h2`.`dr`) ),0) AS `ln1` from `headvoucher` `h2` where ((`h2`.`hcode` = `h1`.`hcode`) and h2.htcode=\'25000\' and date_add((`h2`.`date` >= \'2025-09-10\'), interval -1 year) and date_add((`h2`.`date` <= \'2025-09-10\'), interval -1 year)) group by `h2`.`hcode`),0) AS `ln1`,(hcode+27000) hcode,(htcode+27000) as htcode from headvoucher h1 where  htcode=\'25000\' and date<=\'2024-09-09\' group by htcode
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select if(((sum(`h1`.`dr`) - sum(`h1`.`cr`)) > -(100000)),(sum(`h1`.`dr`) - sum(`h1`.`cr`)),0) AS `ln`,if(((select if((sum(`h2`.`dr`) > 0),sum(`h2`.`dr`),0) AS `ln1` from `co-operativebank-mohati`.`headvoucher` `h2` where ((`h2`.`hcode` = `h1`.`hcode`) and (`h2`.`htcode` = \'25000\') and ((`h2`.`date` >= \'2025-09-10\') + interval -(1) year) and ((`h2`.`date` <= \'2025-09-10\') + interval -(1) year)) group by `h2`.`hcode`) > 0),(select if((sum(`h2`.`dr`) > 0),sum(`h2`.`dr`),0) AS `ln1` from `co-operativebank-mohati`.`headvoucher` `h2` where ((`h2`.`hcode` = `h1`.`hcode`) and (`h2`.`htcode` = \'25000\') and ((`h2`.`date` >= \'2025-09-10\') + interval -(1) year) and ((`h2`.`date` <= \'2025-09-10\') + interval -(1) year)) group by `h2`.`hcode`),0) AS `ln1`,(`h1`.`hcode` + 27000) AS `hcode`,(`h1`.`htcode` + 27000) AS `htcode` from `co-operativebank-mohati`.`headvoucher` `h1` where ((`h1`.`htcode` = \'25000\') and (`h1`.`date` <= \'2024-09-09\')) group by `h1`.`htcode`
