DELETE FROM t_tctb_formula WHERE FID = 1809561062874509312;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1809561062874509312,{ts'2023-11-20  00:00:00'},' ',' ','VAT_DRAFT_YBNSR_YBHZ_01','tcvat_zlb_zzsybnsr_ybhz#38#ybxm',' ','增值税汇总一般企业税额计算总览表#38#一般项目','1','38','1626005309052994560','draft_zzsybnsr_ybhz_sjjt','tcvat_zlb_zzsybnsr_ybhz','ybxm',' ',' ','if({C[#cswhjssenable]} = 1, {Q[tcvat_zlb_zzsybnsr_ybhz#34#ybxm]}+{Q[tcvat_zlb_zzsybnsr_ybhz#34#jzjtxm]}+min({S[select sum(t1.fqmye) from t_tcvat_ybnsr_jsxm t1 left join t_tctb_declare_main t2 on t1.fsbbid = CONCAT(t2.fid , '''') where t2.forgid=''#orgid'' and t2.fskssqq=to_date(''#prestartDate'') and t2.fskssqz=to_date(''#preendDate'') and t2.fnsrtype=''#taxpayertype'' and t1.fswsxdm in (789806480298652672,789806480307039232,789806484249687040,789806484258073600,789806484266464256,789806484274850816) and t1.fewblxh != ''1'']}+{S[select sum(fcurrentamount) from t_tcvat_hz_jsxm_sum_sjjt where forgid=''#orgid'' and fstartdate=to_date(''#startDate'') AND fenddate=to_date(''#endDate'') and ftaxpayertype=''#taxpayertype'' and ftaxreductionid in (789806480298652672,789806480307039232,789806484249687040,789806484258073600,789806484266464256,789806484274850816)]},{Q[tcvat_zlb_zzsybnsr_ybhz#28#ybxm]}+{Q[tcvat_zlb_zzsybnsr_ybhz#28#jzjtxm]}),0)');
