 BEGIN  
 BEGIN TRANSACTION
 
---todo: use numberOfPayments
-
     DECLARE @periodEndDate DATETIME = DATEADD(month, -1, @createDate)
 
 	--SELECT dbo.CalendarPeriodYear(@periodEndDate)

		(@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	
        
    exec #ProcessPaymentDataTransactionsGenerateDataEdition @accountId, @createDate


--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
-- transfers

-- DELETE THE TEMP STORED PROCEDURES IF THEY EXIST
