如何为下一个付款截止日期创建计划日期 [英] How to create schedule date for next due date for payment
问题描述
我需要能够提供一份报告,其中包含付款日期的下一个截止日期。用户可以看到下一个付款截止日期。这可以通过指定频率(每日,每周,每月,每年),乘数(即每3天,每2周,每6个月等等)来完成,并且开始日期必须来自前端到SQL。在计算之后,我希望它将记录插入到scheduleTable中,该表将用户显示为报告。计划表的示例
I need to be able to provide a report with a next due date for payment date. The user is able to see next due date for payment. This can be done by specifying the frequency (daily, weekly, monthly,yearly), a "multiplier" (i.e. every 3 days, every 2 weeks, every 6 months, etc...) and a start date must be supply from the front end to the SQL. After the calculation I want it to insert the records into a scheduleTable which presented the user as a report. Example for schedule table
Create Table ScheduledDate
(
LoanID SmallInt Not Null,
LenderName Varchar(30)Not Null,
ScheduledDates DateTime Not Null
)
Create Proc prcCalculateScheduleDate
(
@LoanID SmallInt,
@StartDate DateTime,
@EndDate DateTime
)
As
Begin
Select 0 n, LOANID,REPAYMENT_STARTDATE,Frequency,Multiplier From LOANS_REPAYMENT_PLAN
Where LOANID = @LoanID AND REPAYMENT_STARTDATE=@StartDate AND REPAYMENT_ENDDATE = @EndDate
Begin
Select n+1 n,
Case[Frequency]
When 'Daily' Then DateAdd(Day,Multiplier,ScheduleDate)
When 'Weekly' Then DateAdd(Week,Multiplier,ScheduleDate)
When 'Monthly' Then DateAdd(Month,Multiplier,ScheduleDate)
When 'Yearly' Then DateAdd(Year,Multiplier,ScheduleDate)
End As ScheduleDate,
[Frequency],
[Multiplier]
From LOANS_REPAYMENT_PLAN
Insert Into ScheduledDate
Group By LOANID,LENDER_NAME
End
任何帮助将不胜感激。 NanaKwame
Any help will be appreciated. NanaKwame
推荐答案
您需要什么样的帮助?
可能检测通过频率生成的分期付款,并通过使用while循环。
您可以逐个将记录插入表格。
what kind of a help do you need?
Possibly Detect the no of installments generated through the frequency,and through the use of while loop.
You can insert one by one record into table.
这篇关于如何为下一个付款截止日期创建计划日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!