diff --git a/configs/reports/configs/pt-reports.yml b/configs/reports/configs/pt-reports.yml index 270d077a..0cf720af 100644 --- a/configs/reports/configs/pt-reports.yml +++ b/configs/reports/configs/pt-reports.yml @@ -280,7 +280,7 @@ ReportDefinitions: egcl_billdetial bd, egcl_billaccountdetail bad, eg_user un, - eg_pt_address_v2 addr, + eg_pt_address addr, eg_user eu, message msg where pd.paymentid= pay.id and @@ -291,7 +291,7 @@ ReportDefinitions: addr.property=bill.consumercode and RIGHT(msg.code,5)=addr.locality and msg.tenantid=pay.tenantid and - eu.uuid=(select poo.userid from eg_pt_owner_v2 poo where poo.propertydetail=(select pdd.assessmentnumber from eg_pt_propertydetail_v2 pdd where pdd.property= bill.consumercode fetch first 1 row only) fetch first 1 row only) and + eu.uuid=(select poo.userid from eg_pt_owner poo where poo.propertydetail=(select pdd.assessmentnumber from eg_pt_asmt_assessment pdd where pdd.property= bill.consumercode fetch first 1 row only) fetch first 1 row only) and msg.locale='hi_IN' and pay.tenantid LIKE $tenantid and pd.businessservice='PT'and @@ -448,7 +448,7 @@ ReportDefinitions: SUM(totalamount) AS totalamount, SUM(amount) AS totalamountpaid, (SUM(totalamount) - SUM(amount)) AS totalamountdue - FROM eg_pt_propertydetail_v2 AS pd + FROM eg_pt_asmt_assessment AS pd LEFT OUTER JOIN (SELECT consumercode, totalamount, amount FROM egcl_receiptheader AS rh LEFT OUTER JOIN egcl_receiptinstrument AS ri ON rh.id = ri.receiptheader @@ -657,8 +657,8 @@ ReportDefinitions: JOIN egcl_receiptinstrument AS ri ON rh.id = ri.receiptheader JOIN egcl_instrumentheader AS ih ON ih.id = ri.instrumentheader JOIN receipt_breakup ON rh.id = receipt_breakup.receiptheader - JOIN eg_pt_propertydetail_v2 pt_detail ON CONCAT(pt_detail.property, ':', pt_detail.assessmentnumber) = rh.consumercode - JOIN eg_pt_address_v2 pt_addr ON pt_detail.property = pt_addr.property + JOIN eg_pt_asmt_assessment pt_detail ON CONCAT(pt_detail.property, ':', pt_detail.assessmentnumber) = rh.consumercode + JOIN eg_pt_address pt_addr ON pt_detail.property = pt_addr.property WHERE rh.tenantid != 'uk.testing' and rh.status = 'Cancelled' orderby: ORDER BY rh.receiptdate DESC @@ -743,7 +743,7 @@ ReportDefinitions: SUM(CASE WHEN collectiontype LIKE 'ONLINE' THEN amount ELSE 0 END) AS totalonline, SUM(CASE WHEN collectiontype LIKE 'COUNTER' THEN amount ELSE 0 END) AS totaloffline, (SUM(totalamount) - SUM(amount)) AS totalamountdue - FROM eg_pt_propertydetail_v2 AS pd + FROM eg_pt_asmt_assessment AS pd LEFT OUTER JOIN (SELECT consumercode, totalamount, amount, collectiontype, receiptdate FROM egcl_receiptheader AS rh LEFT OUTER JOIN egcl_receiptinstrument AS ri ON rh.id = ri.receiptheader LEFT OUTER JOIN egcl_instrumentheader AS ih ON ri.instrumentheader = ih.id and ih.instrumentstatus != 'CANCELLED' @@ -821,7 +821,7 @@ ReportDefinitions: SUM(CASE WHEN collectiontype LIKE 'ONLINE' THEN amount ELSE 0 END) AS totalonline, SUM(CASE WHEN collectiontype LIKE 'COUNTER' THEN amount ELSE 0 END) AS totaloffline, (SUM(totalamount) - SUM(amount)) AS totalamountdue - FROM eg_pt_propertydetail_v2 AS pd + FROM eg_pt_asmt_assessment AS pd LEFT OUTER JOIN (SELECT consumercode, totalamount, amount, collectiontype, receiptdate FROM egcl_receiptheader_v1 AS rh LEFT OUTER JOIN egcl_receiptinstrument_v1 AS ri ON rh.id = ri.receiptheader LEFT OUTER JOIN egcl_instrumentheader_v1 AS ih ON ri.instrumentheader = ih.id and ih.instrumentstatus != 'CANCELLED' @@ -947,7 +947,7 @@ ReportDefinitions: propertydetail, string_agg(distinct pu.occupancytype, ',') as occupancytype, string_agg(distinct coalesce(usagecategoryminor, usagecategorymajor), ',') as propertytype - from eg_pt_unit_v2 as pu + from eg_pt_unit as pu where pu.tenantid = $tenantid AND pu.tenantid != 'uk.testing' group by propertydetail ) @@ -973,11 +973,11 @@ ReportDefinitions: REGEXP_REPLACE(REGEXP_REPLACE(CONCAT(pta.doorno, ',', pta.addressline1, ',', pta.addressline2, ',', pta.buildingname, ',', pta.pincode), ',+', ','), '^,|,$', '') as "address" from egcl_receiptheader as rh inner join egcl_receiptinstrument as ri on ri.receiptheader = rh.id inner join egcl_instrumentheader as ih on ih.id = ri.instrumentheader - inner join eg_pt_property_v2 as pt on pt.propertyid = split_part(consumercode, ':', 1) - inner join eg_pt_propertydetail_v2 as pd on pd.assessmentnumber = split_part(consumercode, ':', 2) - inner join eg_pt_owner_v2 as po on po.propertydetail = pd.assessmentnumber + inner join eg_pt_property as pt on pt.propertyid = split_part(consumercode, ':', 1) + inner join eg_pt_asmt_assessment as pd on pd.assessmentnumber = split_part(consumercode, ':', 2) + inner join eg_pt_owner as po on po.propertydetail = pd.assessmentnumber inner join eg_user as eu on eu.uuid = po.userid - inner join eg_pt_address_v2 as pta on pta.property = pt.propertyid + inner join eg_pt_address as pta on pta.property = pt.propertyid inner join eg_pt_unit_v2_ot as pot on pot.propertydetail = pd.assessmentnumber where rh.tenantid = $tenantid AND rh.tenantid != 'uk.testing' @@ -1205,16 +1205,16 @@ ReportDefinitions: e.totaldemand totaldemand, e.totalrevenuecollected totalrevenuecollected FROM (SELECT Initcap(Split_part(pd.tenantid, '.', 2)) tenant,Count(DISTINCT pd.property) AS Total_properties - FROM eg_pt_propertydetail_v2 pd WHERE pd.tenantid != 'uk.testing' GROUP BY pd.tenantid) AS a LEFT OUTER JOIN (SELECT Initcap(Split_part(pd1.tenantid, '.', 2)) tenant, Count(DISTINCT pd1.property) Total_properties_to_be_update - FROM eg_pt_propertydetail_v2 pd1 WHERE pd1.tenantid != 'uk.testing' AND pd1.additionaldetails ->> 'isMigrated' = 'true' + FROM eg_pt_asmt_assessment pd WHERE pd.tenantid != 'uk.testing' GROUP BY pd.tenantid) AS a LEFT OUTER JOIN (SELECT Initcap(Split_part(pd1.tenantid, '.', 2)) tenant, Count(DISTINCT pd1.property) Total_properties_to_be_update + FROM eg_pt_asmt_assessment pd1 WHERE pd1.tenantid != 'uk.testing' AND pd1.additionaldetails ->> 'isMigrated' = 'true' GROUP BY pd1.tenantid) AS b ON a.tenant = b.tenant LEFT OUTER JOIN (SELECT Initcap(Split_part(tenantid, '.', 2)) tenant, Count(DISTINCT propertyid) Total_properties_updated FROM - eg_pt_property_v2 WHERE additionaldetails ->> 'updatedByULB' = 'true' GROUP BY tenantid) AS c ON b.tenant = c.tenant + eg_pt_property WHERE additionaldetails ->> 'updatedByULB' = 'true' GROUP BY tenantid) AS c ON b.tenant = c.tenant LEFT OUTER JOIN (SELECT Initcap(Split_part(pd1.tenantid, '.' , 2)) tenant, Count(DISTINCT pd1.property) - Total_properties_DataEntry FROM eg_pt_propertydetail_v2 pd1 WHERE pd1.tenantid != 'uk.testing' AND ( pd1.additionaldetails ->> + Total_properties_DataEntry FROM eg_pt_asmt_assessment pd1 WHERE pd1.tenantid != 'uk.testing' AND ( pd1.additionaldetails ->> 'isMigrated' != 'true' OR pd1.additionaldetails ->> 'isMigrated' IS NULL ) GROUP BY pd1.tenantid) AS d ON d.tenant = a.tenant LEFT OUTER JOIN (SELECT Initcap(Split_part(pd1.tenantid, '.', 2)) tenant, Sum(dd.taxamount) AS totaldemand , Sum(dd.collectionamount) - AS totalrevenuecollected FROM eg_pt_propertydetail_v2 pd1 JOIN (SELECT DISTINCT ON (consumercode) * FROM egbs_demand_v1 dd ORDER + AS totalrevenuecollected FROM eg_pt_asmt_assessment pd1 JOIN (SELECT DISTINCT ON (consumercode) * FROM egbs_demand_v1 dd ORDER BY consumercode, lastmodifiedtime DESC) AS d ON d.consumercode = pd1.property JOIN egbs_demanddetail_v1 dd ON dd.demandid = d.id WHERE pd1.tenantid != 'uk.testing' GROUP BY pd1.tenantid) AS e ON e.tenant = a.tenant orderby: ORDER BY a.tenant @@ -1259,16 +1259,16 @@ ReportDefinitions: (c.Total_properties_updated) propertiesverified, round((c.Total_properties_updated*100/Total_properties_to_be_update),2) verificationpercentage from(select pd.tenantid, - count(distinct pd.property) as Total_properties from eg_pt_propertydetail_v2 pd where pd.tenantid != 'uk.testing' group by pd.tenantid) as a, + count(distinct pd.property) as Total_properties from eg_pt_asmt_assessment pd where pd.tenantid != 'uk.testing' group by pd.tenantid) as a, (select pd1.tenantid, - count( distinct pd1.property) Total_properties_to_be_update from eg_pt_propertydetail_v2 pd1 where pd1.tenantid != 'uk.testing' + count( distinct pd1.property) Total_properties_to_be_update from eg_pt_asmt_assessment pd1 where pd1.tenantid != 'uk.testing' and pd1.additionaldetails ->>'isMigrated' = 'true' group by pd1.tenantid) as b, - (select d.tenantid,count(distinct d.consumercode) Total_properties_updated from egbs_demand_v1 d,egbs_demanddetail_v1 dd,eg_pt_property_v2 - pt,eg_pt_propertydetail_v2 pd where pd.property=pt.propertyid and pd.ctid in(select max(ctid) from eg_pt_propertydetail_v2 group + (select d.tenantid,count(distinct d.consumercode) Total_properties_updated from egbs_demand_v1 d,egbs_demanddetail_v1 dd,eg_pt_property + pt,eg_pt_asmt_assessment pd where pd.property=pt.propertyid and pd.ctid in(select max(ctid) from eg_pt_asmt_assessment group by financialyear,property having property=pd.property) and d.id=dd.demandid and dd.taxamount<>0 and pd.property=d.consumercode and taxheadcode like 'PT_TAX%' and pd.property in (select distinct pd.property from egbs_demand_v1 d,egbs_demanddetail_v1 - dd,eg_pt_property_v2 pt,eg_pt_propertydetail_v2 pd where pd.property=pt.propertyid and pd.additionaldetails ->>'isMigrated' = - 'true' and pd.ctid in(select max(ctid) from eg_pt_propertydetail_v2 group by financialyear,property having property=pd.property) + dd,eg_pt_property pt,eg_pt_asmt_assessment pd where pd.property=pt.propertyid and pd.additionaldetails ->>'isMigrated' = + 'true' and pd.ctid in(select max(ctid) from eg_pt_asmt_assessment group by financialyear,property having property=pd.property) and d.id=dd.demandid and dd.taxamount<>0 and pd.property=d.consumercode and taxheadcode like 'PT_TAX%' and pd.financialyear=to_char(to_timestamp(d.taxperiodfrom/1000),'YYYY')||'-'||to_char(to_timestamp(d.taxperiodto/1000),'YY') and pd.financialyear='2020-21') group by d.tenantid) as c @@ -1405,7 +1405,7 @@ ReportDefinitions: select initcap(split_part(prop.tenantid, '.', 2)) as tenantid, prop.propertyid, sum(dd.taxamount-dd.collectionamount) as ArrearCollection - from eg_pt_property_v2 prop + from eg_pt_property prop join egbs_demand_v1 demand on prop.propertyid= demand.consumercode join egbs_demanddetail_v1 dd