DELETE FROM t_tctb_formula WHERE FID = 1204176406393669723;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669723,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_ybnsr_jsxm#2#qcye',' ','一般纳税人减税项目#2#期初余额','1','2','1155767441758909440','zzsxgmnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','if({C[#type]} = 0,{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD = ''#strStartPeriod'' and t.fewbhxh = ''2'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']},{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') and t.fewbhxh = ''2'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']})');
DELETE FROM t_tctb_formula WHERE FID = 1204176406393669724;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669724,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_ybnsr_jsxm#3#qcye',' ','一般纳税人减税项目#3#期初余额','1','3','1155767441758909440','zzsxgmnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','if({C[#type]} = 0,{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD = ''#strStartPeriod'' and t.fewbhxh = ''3'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']},{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') and t.fewbhxh = ''3'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']})');
DELETE FROM t_tctb_formula WHERE FID = 1204176406393669725;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669725,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_ybnsr_jsxm#4#qcye',' ','一般纳税人减税项目#4#期初余额','1','4','1155767441758909440','zzsxgmnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','if({C[#type]} = 0,{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD = ''#strStartPeriod'' and t.fewbhxh = ''4'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']},{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') and t.fewbhxh = ''4'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']})');
DELETE FROM t_tctb_formula WHERE FID = 1204176406393669726;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669726,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_ybnsr_jsxm#5#qcye',' ','一般纳税人减税项目#5#期初余额','1','5','1155767441758909440','zzsxgmnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','if({C[#type]} = 0,{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD = ''#strStartPeriod'' and t.fewbhxh = ''5'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']},{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') and t.fewbhxh = ''5'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']})');
DELETE FROM t_tctb_formula WHERE FID = 1204176406393669727;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669727,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_ybnsr_jsxm#6#qcye',' ','一般纳税人减税项目#6#期初余额','1','6','1155767441758909440','zzsxgmnsr','tcvat_ybnsr_jsxm','qcye',' ',' ','if({C[#type]} = 0,{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD = ''#strStartPeriod'' and t.fewbhxh = ''6'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']},{S[select sum(fqmye) from  t_tcvat_ybnsr_jsxm where fswsxdm in (select t.ftaxreductionid  from T_TCVAT_TAXREDUCE_SUM t WHERE  t.FORGID = ''#orgid''  AND t.FTAXPERIOD in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') and t.fewbhxh = ''6'' and t.fdeadline = ''#deadline'') and fsbbid = ''#sbbid'']})');

DELETE FROM t_tctb_formula WHERE FID = 1204176406393669662;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669662,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_xgm_zb#2#wdqzdmse',' ','小规模主表#2#19.未达起征点免税额','1','2','1155767441758909440','zzsxgmnsr','tcvat_xgm_zb','wdqzdmse',' ',' ','if({C[#type]} = 0, if({Q[tcvat_xgm_zb#2#wdqzdxse]} != 0,  {S[select t.ftaxfreeamount from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strStartPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''2'' and t.fdeadline = ''#deadline'']} * 0.03+ {S[select t.ftaxfreeamount from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strStartPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''3'' and t.fdeadline = ''#deadline'']} * 0.05,0), if({Q[tcvat_xgm_zb#2#wdqzdxse]} != 0,  {S[select sum(t.ftaxfreeamount) from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') AND t.forgid = ''#orgid''  AND t.fewblxh in (''2'',''10'',''18'') and t.fdeadline = ''#deadline'']} * 0.03 + {S[select sum(t.ftaxfreeamount) from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') AND t.forgid = ''#orgid''  AND t.fewblxh in (''3'',''11'',''19'') and t.fdeadline = ''#deadline'']} * 0.05,0))');
DELETE FROM t_tctb_formula WHERE FID = 1204176406393669704;
INSERT INTO t_tctb_formula(FID,FUPDATETIME,FCONTENT,FTITLE,FTEMPLATENUM,FFORMULAKEY,FFORMULANAME,FNAME,FFORMULATYPE,FROW,FTEMPLATEID,FTAXTYPE,FTABLE,FCOLUMN,FCELLTYPE,FDESCRIBE,FFORMULA) VALUES (1204176406393669704,{ts'2022-06-02  00:00:00'},' ',' ','VAT3','tcvat_xgm_flzl#1#qbhssr',' ','附列资料#1#5.全部含税收入3%','1','1','1155767441758909440','zzsxgmnsr','tcvat_xgm_flzl','qbhssr',' ',' ','if({C[#type]} = 0, if({S[select t.ftaxableamount from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strStartPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''8'' and t.fdeadline = ''#deadline'']} != 0 , if({S[select t.ftaxfreeamount from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strStartPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''8'' and t.fdeadline = ''#deadline'']} =0, {S[select t.fincomeincludtax from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strStartPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''2'' and t.fdeadline = ''#deadline'']}, {S[select t.fspecialincludtax from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strStartPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''2'' and t.fdeadline = ''#deadline'']}*1.01),0), if({S[select t.ftaxableamount from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strEndPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''25'' and t.fdeadline = ''#deadline'']} != 0 , if({S[select t.ftaxfreeamount from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod = ''#strEndPeriod'' AND t.forgid = ''#orgid''  AND t.fewblxh = ''25'' and t.fdeadline = ''#deadline'']} =0,  {S[select sum(t.fincomeincludtax) from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') AND t.forgid = ''#orgid''  AND t.fewblxh in (''2'',''10'',''18'') and t.fdeadline = ''#deadline'']},  {S[select sum(t.fspecialincludtax) from T_TCVAT_XGM_CURRENT_PAY t WHERE  t.ftaxperiod in (''#strStartPeriod'',''#strMiddlePeriod'',''#strEndPeriod'') AND t.forgid = ''#orgid''  AND t.fewblxh in (''2'',''10'',''18'') and t.fdeadline = ''#deadline'']}*1.01),0))');
