sqlite 根据日期生成收费明细
时间:2022-01-15 访问量:1306
insert into 收费明细(编号,序号,号,起始日期,截止日期,保育费,餐费,其他费一,其他费二,其他费三,合计,已核定)
select 编号,序号,号,起始日期,截止日期,保育费,餐费,其他费一,其他费二,其他费三,合计,已核定 from
(select':编号' as 编号,':序号' as 序号,(号+1) as 号,strftime('%Y-%m-%d',date(':收费起始', '+'||"号"||' month')) as 起始日期,
strftime('%Y-%m-%d',date(':收费起始', '+'||"号"||' month','+1 month','-1 day')) as 截止日期,:保育费 as 保育费,:餐费 as 餐费,
:其他费一 as 其他费一,:其他费二 as 其他费二,:其他费三 as 其他费三,:合计 as 合计,'False' as 已核定
from 收费设置,表
where strftime('%Y-%m-%d',date(':收费起始', '+'||"号"||' month','+1 month','-1 day'))<=':收费截止'
and 编号=':编号' and 序号=':序号'
) as A
where (NOT EXISTS
(SELECT 编号,序号,号 FROM 收费明细
WHERE 收费明细.编号 = A.编号 and 收费明细.序号 = A.序号 and 收费明细.号 = A.号 ))