-- 申报优化申报方式、缴款方式、缴款状态、申报人、申报日期、缴款人、缴款日期历史数据升级
UPDATE t_tctb_declare_main SET fdeclaretype = '0' WHERE fdeclarestatus = 'declared' AND (fdeclaretype = '' OR fdeclaretype IS NULL); 
UPDATE t_tctb_declare_main SET fpaytype = '0' WHERE fdeclarestatus = 'declared' AND (fpaytype = '' OR fdeclaretype IS NULL) AND FBQYBTSE > 0; 
UPDATE t_tctb_declare_main SET fpaystatus = 'nopay' WHERE fdeclarestatus = 'declared' AND FBQYBTSE <= 0; 
UPDATE t_tctb_declare_main SET fpaystatus = 'paid' WHERE fdeclarestatus = 'declared' AND FBQYBTSE > 0; 
UPDATE t_tctb_declare_main SET fpaystatus = 'unpaid' WHERE fdeclarestatus != 'declared'; 
UPDATE t_tctb_declare_main SET fpayer = fmodifierid WHERE fdeclarestatus = 'declared' AND fpaystatus = 'paid' AND (fpayer IS NULL OR fpayer = 0); 
UPDATE t_tctb_declare_main SET fdeclarer = fmodifierid WHERE fdeclarestatus = 'declared' AND (fdeclarer IS NULL OR fdeclarer = 0); 
UPDATE t_tctb_declare_main SET fsbrq = fmodifytime WHERE fdeclarestatus = 'declared' AND fsbrq IS NULL; 
UPDATE t_tctb_declare_main SET fpaydate = fmodifytime WHERE fdeclarestatus = 'declared' AND fpaystatus = 'paid' AND fpaydate IS NULL;