DELETE FROM T_TCTB_FORMULA WHERE FID = 1388990222582183399;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388990222582183399,{ts'2022-04-27  00:00:00'},' ',' ','VAT202206','tcvat_ybnsr_fb2#2#je',' ','一般纳税人附表二#2-本期认证相符且本期申报抵扣#金额','1','2','1388990221600714752','zzsybnsr','tcvat_ybnsr_fb2','je',' ',' ','{S[select sum(s.finvoice_amount) from t_rim_inv_special s where s.ftax_org = ''#orgid'' and s.ftax_period >= ''#startDate'' and s.ftax_period <= ''#endDate 23:59:59'' and s.finvoice_status = ''0'' and s.fauthenticate_flag in (''2'',''3'') and s.fdeduction_purpose=''1'']}  +  {S[select sum(finvoice_amount) from t_rim_inv_toll where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(finvoice_amount) from t_rim_inv_motor where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(finvoice_amount) from t_rim_inv_electric where forg_id = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']}-{C[#amount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1389922187686720521;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1389922187686720521,{ts'2022-04-27  00:00:00'},' ',' ','VAT202206-A','tcvat_ybnsr_fb2#2#je',' ','一般纳税人附表二#2-本期认证相符且本期申报抵扣#金额','1','2','1389922186361365504','zzsybnsr','tcvat_ybnsr_fb2','je',' ',' ','{S[select sum(s.finvoice_amount) from t_rim_inv_special s where s.ftax_org = ''#orgid'' and s.ftax_period >= ''#startDate'' and s.ftax_period <= ''#endDate 23:59:59'' and s.finvoice_status = ''0'' and s.fauthenticate_flag in (''2'',''3'') and s.fdeduction_purpose=''1'']}  +  {S[select sum(finvoice_amount) from t_rim_inv_toll where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(finvoice_amount) from t_rim_inv_motor where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(finvoice_amount) from t_rim_inv_electric where forg_id = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']}-{C[#amount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1392817179346356714;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1392817179346356714,{ts'2022-04-27  00:00:00'},' ',' ','VAT202206-GD','tcvat_ybnsr_fb2#2#se','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#税额','1','2','1392817178188729344','zzsybnsr','tcvat_ybnsr_fb2','se',' ',' ','{S[select sum(s.feffective_tax_amount) from t_rim_inv_special s where s.ftax_org = ''#orgid'' and s.ftax_period >= ''#startDate'' and s.ftax_period <= ''#endDate 23:59:59'' and s.finvoice_status = ''0'' and s.fauthenticate_flag in (''2'',''3'') and s.fdeduction_purpose=''1'']}  +  {S[select sum(feffective_tax_amount) from t_rim_inv_toll where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(feffective_tax_amount) from t_rim_inv_motor where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(feffective_tax_amount) from t_rim_inv_electric where forg_id = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']}-{C[#taxamount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1393361442341670220;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1393361442341670220,{ts'2022-04-27  00:00:00'},' ',' ','VAT-YB-202206-GD','tcvat_ybnsr_fb2#2#se','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#税额','1','2','1393361441116932096','zzsybnsr_ybhz','tcvat_ybnsr_fb2','se',' ',' ','{S[select sum(feffective_tax_amount) from t_rim_inv_special where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+ {S[select sum(feffective_tax_amount) from t_rim_inv_toll where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(feffective_tax_amount) from t_rim_inv_motor where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(feffective_tax_amount) from t_rim_inv_electric where forg_id  in (select forgid from t_tctb_org_group_detail where  fcollectorg = ''#orgid'' and fid in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']} -{C[#ybtaxamount]}');
DELETE FROM T_TCTB_FORMULA WHERE FID = 1388990222582183400;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388990222582183400,{ts'2022-04-27  00:00:00'},' ',' ','VAT202206','tcvat_ybnsr_fb2#2#se','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#税额','1','2','1388990221600714752','zzsybnsr','tcvat_ybnsr_fb2','se',' ',' ','{S[select sum(s.feffective_tax_amount) from t_rim_inv_special s where s.ftax_org = ''#orgid'' and s.ftax_period >= ''#startDate'' and s.ftax_period <= ''#endDate 23:59:59'' and s.finvoice_status = ''0'' and s.fauthenticate_flag in (''2'',''3'') and s.fdeduction_purpose=''1'']}  +  {S[select sum(feffective_tax_amount) from t_rim_inv_toll where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(feffective_tax_amount) from t_rim_inv_motor where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(feffective_tax_amount) from t_rim_inv_electric where forg_id = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']}-{C[#taxamount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1389856118104143089;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1389856118104143089,{ts'2022-04-27  00:00:00'},' ',' ','VAT-YB-202206','tcvat_ybnsr_fb2#2#je','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#金额','1','2','1389856116283859968','zzsybnsr_ybhz','tcvat_ybnsr_fb2','je',' ',' ','{S[select sum(finvoice_amount) from t_rim_inv_special where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +{S[select sum(finvoice_amount) from t_rim_inv_toll where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(finvoice_amount) from t_rim_inv_motor where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(finvoice_amount) from t_rim_inv_electric where forg_id  in (select forgid from t_tctb_org_group_detail where  fcollectorg = ''#orgid'' and fid in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']} - {C[#ybamount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1389856118104143090;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1389856118104143090,{ts'2022-04-27  00:00:00'},' ',' ','VAT-YB-202206','tcvat_ybnsr_fb2#2#se','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#税额','1','2','1389856116283859968','zzsybnsr_ybhz','tcvat_ybnsr_fb2','se',' ',' ','{S[select sum(feffective_tax_amount) from t_rim_inv_special where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+ {S[select sum(feffective_tax_amount) from t_rim_inv_toll where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(feffective_tax_amount) from t_rim_inv_motor where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(feffective_tax_amount) from t_rim_inv_electric where forg_id  in (select forgid from t_tctb_org_group_detail where  fcollectorg = ''#orgid'' and fid in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']} -{C[#ybtaxamount]}');
DELETE FROM T_TCTB_FORMULA WHERE FID = 1389922187686720522;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1389922187686720522,{ts'2022-04-27  00:00:00'},' ',' ','VAT202206-A','tcvat_ybnsr_fb2#2#se','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#税额','1','2','1389922186361365504','zzsybnsr','tcvat_ybnsr_fb2','se',' ',' ','{S[select sum(s.feffective_tax_amount) from t_rim_inv_special s where s.ftax_org = ''#orgid'' and s.ftax_period >= ''#startDate'' and s.ftax_period <= ''#endDate 23:59:59'' and s.finvoice_status = ''0'' and s.fauthenticate_flag in (''2'',''3'') and s.fdeduction_purpose=''1'']}  +  {S[select sum(feffective_tax_amount) from t_rim_inv_toll where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(feffective_tax_amount) from t_rim_inv_motor where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(feffective_tax_amount) from t_rim_inv_electric where forg_id = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']}-{C[#taxamount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1392817179346356713;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1392817179346356713,{ts'2022-04-27  00:00:00'},' ',' ','VAT202206-GD','tcvat_ybnsr_fb2#2#je',' ','一般纳税人附表二#2-本期认证相符且本期申报抵扣#金额','1','2','1392817178188729344','zzsybnsr','tcvat_ybnsr_fb2','je',' ',' ','{S[select sum(s.finvoice_amount) from t_rim_inv_special s where s.ftax_org = ''#orgid'' and s.ftax_period >= ''#startDate'' and s.ftax_period <= ''#endDate 23:59:59'' and s.finvoice_status = ''0'' and s.fauthenticate_flag in (''2'',''3'') and s.fdeduction_purpose=''1'']}  +  {S[select sum(finvoice_amount) from t_rim_inv_toll where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(finvoice_amount) from t_rim_inv_motor where ftax_org = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(finvoice_amount) from t_rim_inv_electric where forg_id = ''#orgid'' and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']}-{C[#amount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1393323893741079792;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1393323893741079792,{ts'2022-04-27  00:00:00'},' ',' ','VAT-YB-202206-A','tcvat_ybnsr_fb2#2#je','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#金额','1','2','1393323890779899904','zzsybnsr_ybhz','tcvat_ybnsr_fb2','je',' ',' ','{S[select sum(finvoice_amount) from t_rim_inv_special where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +{S[select sum(finvoice_amount) from t_rim_inv_toll where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(finvoice_amount) from t_rim_inv_motor where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(finvoice_amount) from t_rim_inv_electric where forg_id  in (select forgid from t_tctb_org_group_detail where  fcollectorg = ''#orgid'' and fid in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']} - {C[#ybamount]}'); 
DELETE FROM T_TCTB_FORMULA WHERE FID = 1393323893741079793;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1393323893741079793,{ts'2022-04-27  00:00:00'},' ',' ','VAT-YB-202206-A','tcvat_ybnsr_fb2#2#se','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#税额','1','2','1393323890779899904','zzsybnsr_ybhz','tcvat_ybnsr_fb2','se',' ',' ','{S[select sum(feffective_tax_amount) from t_rim_inv_special where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+ {S[select sum(feffective_tax_amount) from t_rim_inv_toll where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(feffective_tax_amount) from t_rim_inv_motor where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(feffective_tax_amount) from t_rim_inv_electric where forg_id  in (select forgid from t_tctb_org_group_detail where  fcollectorg = ''#orgid'' and fid in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']} -{C[#ybtaxamount]}');
DELETE FROM T_TCTB_FORMULA WHERE FID = 1393361442341670219;
INSERT INTO T_TCTB_FORMULA(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1393361442341670219,{ts'2022-04-27  00:00:00'},' ',' ','VAT-YB-202206-GD','tcvat_ybnsr_fb2#2#je','进项税额抵扣台账','一般纳税人附表二#2-本期认证相符且本期申报抵扣#金额','1','2','1393361441116932096','zzsybnsr_ybhz','tcvat_ybnsr_fb2','je',' ',' ','{S[select sum(finvoice_amount) from t_rim_inv_special where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +{S[select sum(finvoice_amount) from t_rim_inv_toll where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']} +  {S[select sum(finvoice_amount) from t_rim_inv_motor where ftax_org  in (select forgid from  t_tctb_org_group_detail where fcollectorg = ''#orgid'' and fid  in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'']}+{S[select sum(finvoice_amount) from t_rim_inv_electric where forg_id  in (select forgid from t_tctb_org_group_detail where  fcollectorg = ''#orgid'' and fid in (select fid from t_tctb_org_group where ftaxtype=''zzs'' and feffectdate<=''#startDate'' and (finvaliddate>=''#endDate'' or finvaliddate is null) and fstatus = ''2''))  and ftax_period >= ''#startDate'' and ftax_period <= ''#endDate 23:59:59'' and finvoice_status = ''0'' and fauthenticate_flag in (''2'',''3'') and fdeduction_purpose=''1'' and finvoice_type = ''1376129725579325440'']} - {C[#ybamount]}'); 
