--VAT202201
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925050;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925050,{ts'2021-07-20  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb1#15#hjxxynse','{Q[简易计税-即征即退服务、不动产和无形资产#开具税控增值税专用发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#开具其他发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#未开具发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#纳税检查调整-销项(应纳)税额]}','简易计税-即征即退服务、不动产和无形资产#合计-销项(应纳)税额','1','15','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb1','hjxxynse',' ',' ','{S[select sum(s.faccountingamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.ftaxrate in(''3%'') and s.fjzjt=''1'']}*0.03+{S[select sum(s.faccountingamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.ftaxrate in(''5%'') and s.fjzjt=''1'']}*0.05'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550458;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550458,{ts'2021-05-10  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb1#15#hjxxynse','{Q[简易计税-即征即退服务、不动产和无形资产#开具税控增值税专用发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#开具其他发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#未开具发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#纳税检查调整-销项(应纳)税额]}','简易计税-即征即退服务、不动产和无形资产#合计-销项(应纳)税额','1','15','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb1','hjxxynse',' ',' ','{S[select sum(s.ftotaltaxamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925513;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925513,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb4#3#bqfse',' ','一般纳税人附表四#3#2-本期发生额1','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''1'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550921;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550921,{ts'2022-03-27  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb4#3#bqfse',' ','一般纳税人附表四#3#2-本期发生额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''1'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925514;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925514,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb4#4#bqfse',' ','一般纳税人附表四#4#2-本期发生额1','1','4','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''2'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550922;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550922,{ts'2022-03-27  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb4#4#bqfse',' ','一般纳税人附表四#4#2-本期发生额','1','4','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''2'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925515;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925515,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb4#5#bqfse',' ','一般纳税人附表四#5#2-本期发生额1','1','5','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''3'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550923;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550923,{ts'2022-03-27  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_fb4#5#bqfse',' ','一般纳税人附表四#5#2-本期发生额','1','5','1152873149667245056','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''3'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925140;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925140,{ts'2021-07-20  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_jsxm#1#qcye','{Q[2#期初余额]}+{Q[3#期初余额]}+{Q[4#期初余额]}+{Q[5#期初余额]}+{Q[6#期初余额]}','1#期初余额','1','1','1152873149667245056','zzsybnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','{Q[tcvat_ybnsr_jsxm#2#qcye]}+{Q[tcvat_ybnsr_jsxm#3#qcye]}+{Q[tcvat_ybnsr_jsxm#4#qcye]}+{Q[tcvat_ybnsr_jsxm#5#qcye]}+{Q[tcvat_ybnsr_jsxm#6#qcye]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550548;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550548,{ts'2021-05-10  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_jsxm#1#qcye','{Q[2#期初余额]}+{Q[3#期初余额]}+{Q[4#期初余额]}+{Q[5#期初余额]}+{Q[6#期初余额]}','1#期初余额','1','1','1152873149667245056','zzsybnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','{Q[tcvat_ybnsr_jsxm#2#qcye]}+{Q[tcvat_ybnsr_jsxm#3#qcye]}+{Q[tcvat_ybnsr_jsxm#4#qcye]}+{Q[tcvat_ybnsr_jsxm#5#qcye]}+{Q[tcvat_ybnsr_jsxm#6#qcye]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550866;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550866,{ts'2022-02-18  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#1#bqjnsqynse','上一税款所属期申报表一般项目本月数列第34行本期应补(退)税额','一般纳税人主表实体#1#30-③本期缴纳上期应纳税额','1','1','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select fybxm from t_tcvat_zlb_ybnsr where fsbbid = concat((select fid from t_tctb_declare_main where forgid=''#orgid'' and fskssqq=''#startDate'' and fskssqz=''#endDate'' and fnsrtype=''draft_zzsybnsr''),'''') and fewblxh=''32'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925458;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925458,{ts'2021-07-20  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#1#bqjnsqynse','上一税款所属期申报表一般项目本月数列第34行本期应补(退)税额','一般纳税人主表实体#1#30-③本期缴纳上期应纳税额','1','1','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select b.FBQYBTSE from  t_tcvat_ybnsr_zb b where b.fsbbid=''#sbbid'' and b.FEWBLXH =''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550867;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550867,{ts'2022-02-18  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#3#bqjnsqynse','上一税款所属期申报表即征即退本月数列第34行本期应补(退)税额','一般纳税人主表实体#3#30-③本期缴纳上期应纳税额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select fjzjtxm from t_tcvat_zlb_ybnsr where fsbbid = concat((select fid from t_tctb_declare_main where forgid=''#orgid'' and fskssqq=''#startDate'' and fskssqz=''#endDate'' and fnsrtype=''draft_zzsybnsr''),'''') and fewblxh=''32'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925459;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925459,{ts'2021-07-20  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#3#bqjnsqynse','上一税款所属期申报表即征即退本月数列第34行本期应补(退)税额','一般纳税人主表实体#3#30-③本期缴纳上期应纳税额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select b.FBQYBTSE from  t_tcvat_ybnsr_zb b where b.fsbbid=''#sbbid'' and b.FEWBLXH =''3'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550779;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550779,{ts'2021-08-26  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#3#yshwxse',' ','一般纳税人主表实体#即征即退-本月数#2-应税货物销售额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','yshwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and t.fmergecode like ''1%'' and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925371;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925371,{ts'2021-07-20  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#3#yshwxse',' ','一般纳税人主表实体#即征即退-本月数#2-应税货物销售额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','yshwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''1%'') and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1152873150472550780;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1152873150472550780,{ts'2021-08-26  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#3#yslwxse',' ','一般纳税人主表实体#即征即退-本月数#3-应税劳务销售额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','yslwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and t.fmergecode like ''2%'' and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1204171728259925372;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204171728259925372,{ts'2021-07-20  00:00:00'},' ',' ','VAT202201','tcvat_ybnsr_zb#3#yslwxse',' ','一般纳税人主表实体#即征即退-本月数#3-应税劳务销售额','1','3','1152873149667245056','zzsybnsr','tcvat_ybnsr_zb','yslwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''2%'') and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
--VAT202201-GD
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921976;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921976,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb1#15#hjxxynse','{Q[简易计税-即征即退服务、不动产和无形资产#开具税控增值税专用发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#开具其他发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#未开具发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#纳税检查调整-销项(应纳)税额]}','简易计税-即征即退服务、不动产和无形资产#合计-销项(应纳)税额','1','15','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb1','hjxxynse',' ',' ','{S[select sum(s.ftotaltaxamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921463;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921463,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb1#15#hjxxynse','{Q[简易计税-即征即退服务、不动产和无形资产#开具税控增值税专用发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#开具其他发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#未开具发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#纳税检查调整-销项(应纳)税额]}','简易计税-即征即退服务、不动产和无形资产#合计-销项(应纳)税额','1','15','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb1','hjxxynse',' ',' ','{S[select sum(s.faccountingamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.ftaxrate in(''3%'') and s.fjzjt=''1'']}*0.03+{S[select sum(s.faccountingamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.ftaxrate in(''5%'') and s.fjzjt=''1'']}*0.05'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921989;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921989,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb4#3#bqfse',' ','一般纳税人附表四#3#2-本期发生额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''1'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921840;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921840,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb4#3#bqfse',' ','一般纳税人附表四#3#2-本期发生额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''1'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921990;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921990,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb4#4#bqfse',' ','一般纳税人附表四#4#2-本期发生额','1','4','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''2'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921841;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921841,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb4#4#bqfse',' ','一般纳税人附表四#4#2-本期发生额','1','4','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''2'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921842;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921842,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb4#5#bqfse',' ','一般纳税人附表四#5#2-本期发生额','1','5','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''3'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921991;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921991,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_fb4#5#bqfse',' ','一般纳税人附表四#5#2-本期发生额','1','5','1388249294787639296','zzsybnsr','tcvat_ybnsr_fb4','bqfse',' ',' ','{S[select sum(fadvanceamount) from t_tcvat_prepay where fewblxh=''3'' and fsbbid in (select fsbbid from t_tcvat_prepay_declare where forgid=''#orgid'' and fskssqq>=''#prestartDate'' and fskssqz<=''#endDate'' and fpaystatus=''1'' and fdeductionperiod=''0'' and fdeclarestatus=''declared'' and (fsssbbid=''0'' or fsssbbid=''#currentSbbid''))]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347922018;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347922018,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_jsxm#1#qcye','{Q[2#期初余额]}+{Q[3#期初余额]}+{Q[4#期初余额]}+{Q[5#期初余额]}+{Q[6#期初余额]}','1#期初余额','1','1','1388249294787639296','zzsybnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','{Q[tcvat_ybnsr_jsxm#2#qcye]}+{Q[tcvat_ybnsr_jsxm#3#qcye]}+{Q[tcvat_ybnsr_jsxm#4#qcye]}+{Q[tcvat_ybnsr_jsxm#5#qcye]}+{Q[tcvat_ybnsr_jsxm#6#qcye]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921551;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921551,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_jsxm#1#qcye','{Q[2#期初余额]}+{Q[3#期初余额]}+{Q[4#期初余额]}+{Q[5#期初余额]}+{Q[6#期初余额]}','1#期初余额','1','1','1388249294787639296','zzsybnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','{Q[tcvat_ybnsr_jsxm#2#qcye]}+{Q[tcvat_ybnsr_jsxm#3#qcye]}+{Q[tcvat_ybnsr_jsxm#4#qcye]}+{Q[tcvat_ybnsr_jsxm#5#qcye]}+{Q[tcvat_ybnsr_jsxm#6#qcye]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921795;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921795,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#1#bqjnsqynse','上一税款所属期申报表一般项目本月数列第34行本期应补(退)税额','一般纳税人主表实体#1#30-③本期缴纳上期应纳税额','1','1','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select b.FBQYBTSE from  t_tcvat_ybnsr_zb b where b.fsbbid=''#sbbid'' and b.FEWBLXH =''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347922026;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347922026,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#1#bqjnsqynse','上一税款所属期申报表一般项目本月数列第34行本期应补(退)税额','一般纳税人主表实体#1#30-③本期缴纳上期应纳税额','1','1','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select fybxm from t_tcvat_zlb_ybnsr where fsbbid = concat((select fid from t_tctb_declare_main where forgid=''#orgid'' and fskssqq=''#startDate'' and fskssqz=''#endDate'' and fnsrtype=''draft_zzsybnsr''),'''') and fewblxh=''32'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347922027;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347922027,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#3#bqjnsqynse','上一税款所属期申报表即征即退本月数列第34行本期应补(退)税额','一般纳税人主表实体#3#30-③本期缴纳上期应纳税额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select fjzjtxm from t_tcvat_zlb_ybnsr where fsbbid = concat((select fid from t_tctb_declare_main where forgid=''#orgid'' and fskssqq=''#startDate'' and fskssqz=''#endDate'' and fnsrtype=''draft_zzsybnsr''),'''') and fewblxh=''32'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921796;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921796,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#3#bqjnsqynse','上一税款所属期申报表即征即退本月数列第34行本期应补(退)税额','一般纳税人主表实体#3#30-③本期缴纳上期应纳税额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','bqjnsqynse',' ',' ','{S[select b.FBQYBTSE from  t_tcvat_ybnsr_zb b where b.fsbbid=''#sbbid'' and b.FEWBLXH =''3'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921938;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921938,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#3#yshwxse',' ','一般纳税人主表实体#即征即退-本月数#2-应税货物销售额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','yshwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and t.fmergecode like ''1%'' and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921708;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921708,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#3#yshwxse',' ','一般纳税人主表实体#即征即退-本月数#2-应税货物销售额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','yshwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''1%'') and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921939;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921939,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#3#yslwxse',' ','一般纳税人主表实体#即征即退-本月数#3-应税劳务销售额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','yslwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and t.fmergecode like ''2%'' and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1388249296347921709;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1388249296347921709,{ts'2022-03-31  00:00:00'},' ',' ','VAT202201-GD','tcvat_ybnsr_zb#3#yslwxse',' ','一般纳税人主表实体#即征即退-本月数#3-应税劳务销售额','1','3','1388249294787639296','zzsybnsr','tcvat_ybnsr_zb','yslwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''2%'') and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 

--VAT202201-A
DELETE FROM t_tctb_formula WHERE FID = 1300556861401005056;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1300556861401005056,{ts'2021-11-30  00:00:00'},' ',' ','VAT202201-A','tcvat_ybnsr_fb1#15#hjxxynse','{Q[简易计税-即征即退服务、不动产和无形资产#开具税控增值税专用发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#开具其他发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#未开具发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#纳税检查调整-销项(应纳)税额]}','简易计税-即征即退服务、不动产和无形资产#合计-销项(应纳)税额','1','15','1300556849665341440','zzsybnsr','tcvat_ybnsr_fb1','hjxxynse',' ',' ','{S[select sum(s.ftotaltaxamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1300556861409393736;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1300556861409393736,{ts'2021-11-30  00:00:00'},' ',' ','VAT202201-A','tcvat_ybnsr_fb1#15#hjxxynse','{Q[简易计税-即征即退服务、不动产和无形资产#开具税控增值税专用发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#开具其他发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#未开具发票-销项(应纳)税额]}+{Q[简易计税-即征即退服务、不动产和无形资产#纳税检查调整-销项(应纳)税额]}','简易计税-即征即退服务、不动产和无形资产#合计-销项(应纳)税额','1','15','1300556849665341440','zzsybnsr','tcvat_ybnsr_fb1','hjxxynse',' ',' ','{S[select sum(s.faccountingamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.ftaxrate in(''3%'') and s.fjzjt=''1'']}*0.03+{S[select sum(s.faccountingamount) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''3%'' or t.fmergecode like ''4%'' or t.fmergecode like ''5%'') and s.FTAXMETHOD in(''按3%简易征收'',''按5%简易征收'') and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.ftaxrate in(''5%'') and s.fjzjt=''1'']}*0.05'); 
DELETE FROM t_tctb_formula WHERE FID = 1300556861401005099;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1300556861401005099,{ts'2021-11-30  00:00:00'},' ',' ','VAT202201-A','tcvat_ybnsr_zb#3#yshwxse',' ','一般纳税人主表实体#即征即退-本月数#2-应税货物销售额','1','3','1300556849665341440','zzsybnsr','tcvat_ybnsr_zb','yshwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and t.fmergecode like ''1%'' and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1300556861417782366;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1300556861417782366,{ts'2021-11-30  00:00:00'},' ',' ','VAT202201-A','tcvat_ybnsr_zb#3#yshwxse',' ','一般纳税人主表实体#即征即退-本月数#2-应税货物销售额','1','3','1300556849665341440','zzsybnsr','tcvat_ybnsr_zb','yshwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''1%'') and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1300556861401005100;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1300556861401005100,{ts'2021-11-30  00:00:00'},' ',' ','VAT202201-A','tcvat_ybnsr_zb#3#yslwxse',' ','一般纳税人主表实体#即征即退-本月数#3-应税劳务销售额','1','3','1300556849665341440','zzsybnsr','tcvat_ybnsr_zb','yslwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and t.fmergecode like ''2%'' and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 
DELETE FROM t_tctb_formula WHERE FID = 1300556861417782367;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1300556861417782367,{ts'2021-11-30  00:00:00'},' ',' ','VAT202201-A','tcvat_ybnsr_zb#3#yslwxse',' ','一般纳税人主表实体#即征即退-本月数#3-应税劳务销售额','1','3','1300556849665341440','zzsybnsr','tcvat_ybnsr_zb','yslwxse',' ',' ','{S[select sum(s.FTAXAMOUNT) from t_tcvat_income_summary s,t_tpo_taxitemrateentry t  where s.FBUSINESSTYPEID=t.FENTRYID and (t.fmergecode like ''2%'') and s.FTAXMETHOD=''一般计税'' and s.FORGID=''#orgid''and s.FTAXPERIOD=''#taxperiod'' and s.fjzjt=''1'']}'); 


--删除多余公式
delete from t_tctb_formula where  ftemplatenum ='VAT202201' and fid in (1204171728259925371,1204171728259925372,1204171728259925459,1204171728259925458,1152873150472550548,1152873150472550923,1152873150472550922,
1152873150472550921,1204171728259925050) and fformulakey in ('tcvat_ybnsr_zb#3#yshwxse','tcvat_ybnsr_zb#3#yslwxse','tcvat_ybnsr_zb#3#bqjnsqynse','tcvat_ybnsr_zb#1#bqjnsqynse','tcvat_ybnsr_jsxm#1#qcye',
'tcvat_ybnsr_fb4#5#bqfse','tcvat_ybnsr_fb4#4#bqfse','tcvat_ybnsr_fb4#3#bqfse','tcvat_ybnsr_fb1#15#hjxxynse');

delete from t_tctb_formula where ftemplatenum ='VAT202201-GD'  
and fid in (1388249296347921463,1388249296347921840,1388249296347921841,1388249296347921842,1388249296347922018,1388249296347921795,1388249296347921796,1388249296347921708,1388249296347921709) 
and fformulakey in ('tcvat_ybnsr_fb1#15#hjxxynse','tcvat_ybnsr_fb4#3#bqfse','tcvat_ybnsr_fb4#4#bqfse','tcvat_ybnsr_fb4#5#bqfse','tcvat_ybnsr_jsxm#1#qcye','tcvat_ybnsr_zb#1#bqjnsqynse','tcvat_ybnsr_zb#3#bqjnsqynse','tcvat_ybnsr_zb#3#yshwxse','tcvat_ybnsr_zb#3#yslwxse');

delete from t_tctb_formula where ftemplatenum ='VAT202201-A' and fid in (1300556861409393736,1300556861417782366,1300556861417782367) and fformulakey in ( 'tcvat_ybnsr_fb1#15#hjxxynse','tcvat_ybnsr_zb#3#yshwxse','tcvat_ybnsr_zb#3#yslwxse');
