DELETE FROM t_tctb_formula WHERE FID = 1120056162679899136;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1120056162679899136,{ts'2022-12-06  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#12#ybxm',' ','增值税汇总一般企业税额计算总览表#12#一般项目','1','12','1119375361449286656','draft_zzsybnsr_ybhz','tcvat_zlb_zzsybnsr_ybhz','ybxm',' ',' ','{S[SELECT fqmldse from t_tcvat_ybnsr_zb t1  where t1.fewblxh=''1'' AND t1.fsbbid IN (select CONCAT(fid , '''') from t_tctb_declare_main where FNSRTYPE = ''#taxpayertype'' and FSKSSQQ  = ''#prestartDate'' and FSKSSQZ  = ''#preendDate'' and FTAXLIMIT = ''month'' and  FORGID = ''#orgid'') ]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1120059425689027584;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1120059425689027584,{ts'2022-12-06  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#16#ybxm',' ','增值税汇总一般企业税额计算总览表#16#一般项目','1','16','1119375361449286656','draft_zzsybnsr_ybhz','tcvat_zlb_zzsybnsr_ybhz','ybxm',' ',' ','{S[SELECT fqmye from t_tcvat_ybnsr_jjdj t1  where t1.fewblxh=''1'' AND t1.fsbbid IN (select CONCAT(fid , '''') from t_tctb_declare_main where FNSRTYPE = ''#taxpayertype'' and FSKSSQQ  = ''#prestartDate'' and FSKSSQZ  = ''#preendDate'' and FTAXLIMIT = ''month'' and  FORGID = ''#orgid'') ]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1120083752115187712;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1120083752115187712,{ts'2022-12-06  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#21#ybxm',' ','增值税汇总一般企业税额计算总览表#21#一般项目','1','21','1119375361449286656','draft_zzsybnsr_ybhz','tcvat_zlb_zzsybnsr_ybhz','ybxm',' ',' ','{S[SELECT t1.fqmye from t_tcvat_ybnsr_jsxm t1  where t1.fewblxh=''1'' AND t1.fsbbid IN (select CONCAT(fid , '''') from t_tctb_declare_main where FNSRTYPE =''#taxpayertype'' and FSKSSQQ  = ''#prestartDate'' and FSKSSQZ  = ''#preendDate'' and FTAXLIMIT = ''month'' and  FORGID = ''#orgid'') ]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1120110384075161600;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1120110384075161600,{ts'2022-12-06  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#12#jzjtxm',' ','增值税汇总一般企业税额计算总览表#12#即征即退项目','1','12','1119375361449286656','draft_zzsybnsr_ybhz','tcvat_zlb_zzsybnsr_ybhz','jzjtxm',' ',' ','{S[SELECT fqmldse from t_tcvat_ybnsr_zb t1  where t1.fewblxh=''3'' AND t1.fsbbid IN (select CONCAT(fid , '''') from t_tctb_declare_main where FNSRTYPE = ''#taxpayertype'' and FSKSSQQ  = ''#prestartDate'' and FSKSSQZ  = ''#preendDate'' and FTAXLIMIT = ''month'' and  FORGID = ''#orgid'') ]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1120116307665534976;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1120116307665534976,{ts'2022-12-06  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#16#jzjtxm',' ','增值税汇总一般企业税额计算总览表#16#即征即退项目','1','16','1119375361449286656','draft_zzsybnsr_ybhz','tcvat_zlb_zzsybnsr_ybhz','jzjtxm',' ',' ','{S[SELECT fqmye from t_tcvat_ybnsr_jjdj t1  where t1.fewblxh=''2'' AND t1.fsbbid IN (select CONCAT(fid , '''') from t_tctb_declare_main where FNSRTYPE = ''#taxpayertype'' and FSKSSQQ  = ''#prestartDate'' and FSKSSQZ  = ''#preendDate'' and FTAXLIMIT = ''month'' and  FORGID = ''#orgid'') ]}'); 
DELETE FROM t_tctb_formula WHERE FID = 1119592992584261632;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1119592992584261632,{ts'2022-12-06  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#7#ybxm',' ','增值税汇总一般企业税额计算总览表#7#一般项目','1','7','1119375361449286656','draft_zzsybnsr_ybhz','tcvat_zlb_zzsybnsr_ybhz','ybxm',' ',' ','if({C[#diff]}=1,({S[select sum(s.fpricetaxamount) from t_tcvat_hz_account_summar s, t_tpo_taxitemrateentry t where s.fbusinesstypeid=t.fentryid and s.ftaxpayertype=''#taxpayertype'' and s.forgid=''#orgid'' and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate=''13%'' and (t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]}-min({S[select sum(s.fpricetaxamount) from t_tcvat_hz_account_summar s, t_tpo_taxitemrateentry t where s.fbusinesstypeid=t.fentryid and s.ftaxpayertype=''#taxpayertype'' and s.forgid=''#orgid'' and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate=''13%'' and (t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]},{S[select sum(fcurrentamount) from t_tcvat_hz_diff_temp where ftaxpayertype=''#taxpayertype'' and forgid=''#orgid'' and fstartdate=''#startDate'' and fenddate=''#endDate'' and fdifftypeid=859352590188589056]}+{S[select sum(s.fqmye) from t_tcvat_ybnsr_fb3 s, t_tctb_declare_main t where s.fsbbid=CONCAT(t.fid,'''') and s.fewblxh=''1'' and t.forgid=''#orgid'' and t.fskssqq=''#prestartDate'' and t.fskssqz=''#preendDate'' and t.fnsrtype=''#taxpayertype'']}))/1.13*0.13+({S[select sum(s.fpricetaxamount) from t_tcvat_hz_account_summar s left join t_tpo_taxitemrateentry t on s.fbusinesstypeid=t.fentryid where s.ftaxpayertype=''#taxpayertype'' and s.forgid=''#orgid'' and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate=''9%'' and (t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]}-min({S[select sum(s.fpricetaxamount) from t_tcvat_hz_account_summar s left join t_tpo_taxitemrateentry t on s.fbusinesstypeid=t.fentryid where s.ftaxpayertype=''#taxpayertype'' and s.forgid=''#orgid'' and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate=''9%'' and (t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]},{S[select sum(fcurrentamount) from t_tcvat_hz_diff_temp where ftaxpayertype=''#taxpayertype'' and forgid=''#orgid'' and fstartdate=''#startDate'' and fenddate=''#endDate'' and fdifftypeid=859352590188589057]}+{S[select sum(s.fqmye) from t_tcvat_ybnsr_fb3 s ,t_tctb_declare_main t where s.fsbbid=CONCAT(t.fid,'''') and s.fewblxh=''2'' and t.forgid=''#orgid'' and t.fskssqq=''#prestartDate'' and t.fskssqz=''#preendDate'' and t.fnsrtype=''#taxpayertype'']}))/1.09*0.09+({S[select sum(s.fpricetaxamount) from t_tcvat_hz_account_summar s, t_tpo_taxitemrateentry t where s.fbusinesstypeid=t.fentryid and s.ftaxpayertype=''#taxpayertype'' and s.forgid=''#orgid'' and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate=''6%'' and (t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]}-min({S[select sum(s.fpricetaxamount) from t_tcvat_hz_account_summar s, t_tpo_taxitemrateentry t where s.fbusinesstypeid=t.fentryid and s.ftaxpayertype=''#taxpayertype'' and s.forgid=''#orgid''  and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate=''6%'' and (t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]},{S[select sum(fcurrentamount) from t_tcvat_hz_diff_temp where ftaxpayertype=''#taxpayertype'' and forgid=''#orgid'' and fstartdate=''#startDate'' and fenddate=''#endDate'' and fdifftypeid in(859352590188589058,859352590188589059)]}+{S[select sum(s.fqmye) from t_tcvat_ybnsr_fb3 s, t_tctb_declare_main t where s.fsbbid=CONCAT(t.fid,'''') and s.fewblxh in(''3'',''4'') and t.forgid=''#orgid'' and t.fskssqq=''#prestartDate'' and t.fskssqz=''#preendDate'' and t.fnsrtype=''#taxpayertype'']}))/1.06*0.06,{S[select sum(s.ftotaltaxamount) from t_tcvat_hz_account_summar s,t_tpo_taxitemrateentry t where s.ftaxpayertype=''#taxpayertype'' and s.fbusinesstypeid=t.fentryid and s.forgid=''#orgid'' and s.fstartdate=''#startDate'' and s.fenddate=''#endDate'' and s.fjzjt=''0'' and s.ftaxrate in(''6%'',''9%'',''10%'',''11%'',''13%'',''16%'',''17%'') and(t.flongnumber like ''3%'' or t.flongnumber like ''4%'' or t.flongnumber like ''5%'')]})');
DELETE FROM t_tctb_formula WHERE FID = 1120094676742225920;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTEMPLATENUM,FTITLE,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FCOLUMN,FTABLE,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1120094676742225920,{ts'2021-09-14  00:00:00'},' ','VAT_DRAFT_YBNSR_YBHZ_01',' ','tcvat_zlb_zzsybnsr_ybhz#27#ybxm',' ','增值税汇总一般企业税额计算总览表#27#一般项目','1','27','1119375361449286656','draft_zzsybnsr_ybhz','ybxm','tcvat_zlb_zzsybnsr_ybhz',' ',' ','if({C[#diff]} = 1,({S[select sum(t1.fpricetaxamount) from t_tcvat_hz_account_summar t1 where t1.ftaxpayertype = ''#taxpayertype'' and t1.forgid=''#orgid'' and t1.fstartdate=''#startDate'' and t1.fenddate = ''#endDate'' and t1.fjzjt=''0'' and t1.ftaxrate=''5%'']} - min({S[select sum(t1.fpricetaxamount) from t_tcvat_hz_account_summar t1 where t1.ftaxpayertype = ''#taxpayertype'' and t1.forgid=''#orgid'' and t1.fstartdate=''#startDate'' and t1.fenddate = ''#endDate'' and t1.fjzjt=''0'' and t1.ftaxrate=''5%'']}, {S[select sum(fcurrentamount) from t_tcvat_hz_diff_temp where forgid=''#orgid'' and fstartdate=''#startDate'' and fenddate = ''#endDate'' and fdifftypeid=859352590188589060]} + {S[select sum(t1.fqmye) from t_tcvat_ybnsr_fb3 t1 left join t_tctb_declare_main t2 on t1.fsbbid = CONCAT(t2.fid , '''') where t1.fewblxh=''5'' and t2.forgid=''#orgid'' and t2.fskssqq=''#prestartDate'' and t2.fskssqz=''#preendDate'' and t2.fnsrtype=''#taxpayertype'']}))/1.05*0.05  +  ({S[select sum(t1.fpricetaxamount) from t_tcvat_hz_account_summar t1 where t1.ftaxpayertype = ''#taxpayertype'' and t1.forgid=''#orgid''  and t1.fstartdate=''#startDate'' and t1.fenddate = ''#endDate'' and t1.fjzjt=''0'' and t1.ftaxrate=''3%'']} - min({S[select sum(t1.fpricetaxamount) from t_tcvat_hz_account_summar t1 where t1.ftaxpayertype = ''#taxpayertype'' and  t1.forgid=''#orgid'' and t1.fstartdate=''#startDate'' and t1.fenddate = ''#endDate'' and t1.fjzjt=''0'' and t1.ftaxrate=''3%'']}, {S[select sum(fcurrentamount) from t_tcvat_hz_diff_temp where forgid=''#orgid'' and fstartdate=''#startDate'' and fenddate = ''#endDate'' and fdifftypeid=859352590188589061]} + {S[select sum(t1.fqmye) from t_tcvat_ybnsr_fb3 t1 left join t_tctb_declare_main t2 on t1.fsbbid = CONCAT(t2.fid , '''') where t1.fewblxh=''6'' and t2.forgid=''#orgid'' and t2.fskssqq=''#prestartDate'' and t2.fskssqz=''#preendDate'' and t2.fnsrtype=''#taxpayertype'']}))/1.03*0.03,{S[select sum(t1.ftotaltaxamount) from t_tcvat_hz_account_summar t1 , t_tpo_taxitemrateentry t2  where t1.ftaxpayertype = ''#taxpayertype'' and t1.fbusinesstypeid=t2.fentryid  and  t1.forgid=''#orgid'' and t1.fstartdate=''#startDate'' and t1.fenddate = ''#endDate'' and t1.fjzjt=''0'' and t1.ftaxrate in (''3%'',''5%'') ]})');
