/*
select ti.* , p.TAXDISTRIC
--update ti set ti.TAXTYPE=6, ti.DESCRIP='Bellemede Lighting  ', ti.comp_no='BML'
from dy2022.dbo.TAXFEE_ITEMS ti
inner join dy2022.dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='04' and DESCRIP='Street Light'

select * from dy2022.dbo.taxfee 
--select * from dy2022.dbo.TAXFEE_TYPES
select * from dy2022.dbo.TAXDIST
*/
/*
update dy2021.dbo.taxfee set taxtype=6 where recid=1
update dy2021.dbo.taxfee set taxtype=7 where recid=2
update dy2021.dbo.taxfee set taxtype=8 where recid=3
update dy2021.dbo.taxfee set taxtype=9 where recid=4
update dy2021.dbo.taxfee set taxtype=10 where recid=5
update dy2021.dbo.taxfee set taxtype=11 where recid=6
update dy2021.dbo.taxfee set taxtype=12 where recid=14

delete from dy2021.dbo.taxfee where taxtype=5

use dy2022

update ti set ti.TAXTYPE=6, ti.DESCRIP='Bellemede Lighting  ', ti.comp_no='BML'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='04' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=7, ti.DESCRIP='Northview Acres LI  ', ti.comp_no='NAL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='05' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=8, ti.DESCRIP='Cedar Creek Lighting', ti.comp_no='CCL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='06' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=9, ti.DESCRIP='Deerfield Lighting  ', ti.comp_no='DFL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='07' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=10, ti.DESCRIP='Elias Station LI    ', ti.comp_no='ESL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='08' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=12, ti.DESCRIP='Oak Grove Lighting  ', ti.comp_no='OGL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC not in ('04','05','06','07','08') and DESCRIP='Street Light'

update ti set ti.TAXTYPE=11, ti.comp_no='FFEE'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where DESCRIP='Fire Fee            '


insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (606,'DUE TO Bellemede Lighting',	'L',0 ,0 )
insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (607,'DUE TO Northview Acres LI',	'L',0 ,1 )
insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (608,'DUE TO Cedar Creek Lighting',	'L',0 ,1 )
insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (609,'DUE TO Deerfield Lighting',	'L',0 ,1 )
insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (610,'DUE TO Elias Station LI',		'L',0 ,1 )
insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (611,'DUE TO Fire Fee',				'L',0 ,1 )
insert into DY2022.dbo.CHART_ACCOUNTS (ACCT_CODE, DESCRIP, ACCT_TYPE, BEGIN_BALANCE, DISBURSEMENT) values (612,'DUE TO Oak Grove Lighting',	'L',0 ,1 )

select * from dy2022.dbo.taxtype
*/
/*
INSERT INTO DY2022.DBO.TAXTYPE (TAXTYPE, DESCRIP, ENTITY, ASMTPCT, ASSET1, ASSET2, LIABILITY1, LIABILITY2, COMMISSION_PERC, PENALTY, BOND, SORTORDER)
SELECT 6, 'Bellemede Lighting', 'FA',   .4, 100, 200, 606, 400, 0, 0, 0, 6 UNION 
SELECT 7, 'Northview Acres LI', 'FA',   .4, 100, 200, 607, 400, 0, 0, 0, 7 UNION 
SELECT 8, 'Cedar Creek Lighting', 'FA', .4, 100, 200, 608, 400, 0, 0, 0, 8 UNION 
SELECT 9, 'Deerfield Lighting', 'FA',   .4, 100, 200, 609, 400, 0, 0, 0, 9 UNION 
SELECT 10, 'Elias Station LI', 'FA',    .4, 100, 200, 610, 400, 0, 0, 0, 10 UNION 
SELECT 11, 'Fire Fee', 'FA',            .4, 100, 200, 611, 400, 0, 0, 0, 11 UNION 
SELECT 12, 'Oak Grove Lighting', 'FA',  .4, 100, 200, 612, 400, 0, 0, 0, 12 

select * from dy2022.dbo.TAXDETAIL where realkey=47
update dy2022.dbo.TAXDETAIL set taxtype=11 where recid=8320
*/


use dy2022

update ti set ti.TAXTYPE=6, ti.DESCRIP='Bellemede Lighting  ', ti.comp_no='BML'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='04' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=7, ti.DESCRIP='Northview Acres LI  ', ti.comp_no='NAL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='05' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=8, ti.DESCRIP='Cedar Creek Lighting', ti.comp_no='CCL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='06' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=9, ti.DESCRIP='Deerfield Lighting  ', ti.comp_no='DFL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='07' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=10, ti.DESCRIP='Elias Station LI    ', ti.comp_no='ESL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='08' and DESCRIP='Street Light'

update ti set ti.TAXTYPE=12, ti.DESCRIP='Oak Grove Lighting  ', ti.comp_no='OGL'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC not in ('04','05','06','07','08') and DESCRIP='Street Light'

update ti set ti.TAXTYPE=11, ti.comp_no='FFEE'
from dbo.TAXFEE_ITEMS ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where DESCRIP='Fire Fee            '

update ti set ti.TAXTYPE=6, ti.TT_DESC='Bellemede Lighting  '--, ti.comp_no='BML'
from dbo.TAXDETAIL ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='04' and TT_DESC='Street Light'

update ti set ti.TAXTYPE=7, ti.TT_DESC='Northview Acres LI  '--, ti.comp_no='NAL'
from dbo.TAXDETAIL ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='05' and TT_DESC='Street Light'

update ti set ti.TAXTYPE=8, ti.TT_DESC='Cedar Creek Lighting'--, ti.comp_no='CCL'
from dbo.TAXDETAIL ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='06' and TT_DESC='Street Light'

update ti set ti.TAXTYPE=9, ti.TT_DESC='Deerfield Lighting  '--, ti.comp_no='DFL'
from dbo.TAXDETAIL ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='07' and TT_DESC='Street Light'

update ti set ti.TAXTYPE=10, ti.TT_DESC='Elias Station LI    '--, ti.comp_no='ESL'
from dbo.TAXDETAIL ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC='08' and TT_DESC='Street Light'

update ti set ti.TAXTYPE=12, ti.TT_DESC='Oak Grove Lighting  '--, ti.comp_no='OGL'
from dbo.TAXDETAIL ti
inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 
where p.TAXDISTRIC not in ('04','05','06','07','08') and TT_DESC='Street Light'

update ti set ti.TAXTYPE=11 from dbo.TAXDETAIL ti inner join dbo.property p on p.realkey=ti.realkey and p.realkey > 0 where TT_DESC='Fire Fee'
