 --todo: separate script/sproc to add period end (levy and payment scripts can add add as appropriate)
 -- make period end/dates align for payment gen
--- number of payments in month
 -- transfers
 
 -- DELETE THE TEMP STORED PROCEDURES IF THEY EXIST

    @ukprn BIGINT,
    @courseName NVARCHAR(MAX),
	@periodEndDate DATETIME,
    @totalAmount DECIMAL(18,5)
)  
AS  
BEGIN  	

    DECLARE @paymentAmount DECIMAL(18,5) = @totalAmount / 3

    -- Create transfer payments
    EXEC #createPayment @accountId, @providerName, @courseName, 1, 'Mark Redwood', @ukprn, 1003, 3333, 1, @paymentAmount, @periodEndDate
    EXEC #createPayment @accountId, @providerName, @courseName, 1, 'Sarah Redwood', @ukprn, 2003, 7777, 1, @paymentAmount, @periodEndDate
    EXEC #createPayment @accountId, @providerName, @courseName, 1, 'Tim Woods', @ukprn, 2004, 8888, 1, @paymentAmount, @periodEndDate
END
GO


		(@periodEndId,dbo.CalendarPeriodMonth(@periodEndDate),dbo.CalendarPeriodYear(@periodEndDate),'2018-05-04 00:00:00.000','2018-05-04 09:07:34.457','2018-05-04 10:50:27.760','https://pp-payments.apprenticeships.sfa.bis.gov.uk/api/payments?periodId=1617-R10')
	END

    EXEC #createAccountPayments @accountId, @accountName, 'CHESTERFIELD COLLEGE', 10001378, 'Accounting', @periodEndDate, @totalPaymentAmount, @numberOfPayments
        
    exec #ProcessPaymentDataTransactionsGenerateDataEdition @accountId, @createDate

