Skip to content

Commit

Permalink
Merge branch 'master' into CON-1518-Triage-Questions
Browse files Browse the repository at this point in the history
  • Loading branch information
cofaulco committed Apr 16, 2020
2 parents 57fc09b + 8510620 commit 924eb2c
Show file tree
Hide file tree
Showing 72 changed files with 2,296 additions and 329 deletions.
100 changes: 100 additions & 0 deletions src/.cr/personal/Navigation/RecentFilesHistory.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.Foundation.Navigation.QuickFileNav.SolutionFileInfosContainer">
<Options Language="Neutral">
<Items>
<Item Id="{8a02d3a3-2b65-4c3b-b255-20e60303a11e}">
<Filename>EmployerTeamController.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath>
<Folders>
<Item>Controllers</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{94894b8d-c8da-4361-a132-fbf3ed6eae94}">
<Filename>EmployerTeamController.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath>
<Folders>
<Item>Controllers</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{d300401c-1b37-4cc1-8d68-e727c2ccba80}">
<Filename>UrlHelperExtensions.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\extensions\urlhelperextensions.cs</FilePath>
<Folders>
<Item>Extensions</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{6b7660f7-c583-4ef0-8f67-9faaa29e950c}">
<Filename>UrlHelperExtensions.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.eas.support.web\extensions\urlhelperextensions.cs</FilePath>
<Folders>
<Item>Extensions</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EAS.Support.Web\SFA.DAS.EAS.Support.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EAS.Support.Web</ProjectName>
</Item>
<Item Id="{92d9e756-5f0e-45a3-8820-7b3103628e2a}">
<Filename>EmployerTeamOrchestrator.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\orchestrators\employerteamorchestrator.cs</FilePath>
<Folders>
<Item>Orchestrators</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{36f1e025-c645-4f6a-95ac-8c2bb7e72efc}">
<Filename>EmployerTeamController.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath>
<Folders>
<Item>Controllers</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{c2e527d6-e2b9-4f3d-b526-160c267e3386}">
<Filename>EmployerTeam</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\views\employerteam\</FilePath>
<Folders>
<Item>Views</Item>
</Folders>
<LocationType>Folder</LocationType>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{892a4756-3f8f-4434-acef-51f7367a7bd8}">
<Filename>EmployerTeamController.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath>
<Folders>
<Item>Controllers</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName>
</Item>
<Item Id="{86a9c0a5-db6c-4a6e-8308-862537d621c5}">
<Filename>GetReservationsRequestHandler.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts\queries\getreservations\getreservationsrequesthandler.cs</FilePath>
<Folders>
<Item>Queries</Item>
<Item>GetReservations</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts\SFA.DAS.EmployerAccounts.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts</ProjectName>
</Item>
<Item Id="{af3cefe5-28eb-4a50-8565-af435bf961de}">
<Filename>WhenGettingAccount.cs</Filename>
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web.unittests\orchestrators\employerteamorchestratortests\whengettingaccount.cs</FilePath>
<Folders>
<Item>Orchestrators</Item>
<Item>EmployerTeamOrchestratorTests</Item>
</Folders>
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web.UnitTests\SFA.DAS.EmployerAccounts.Web.UnitTests.csproj</ProjectFileName>
<ProjectName>SFA.DAS.EmployerAccounts.Web.UnitTests</ProjectName>
</Item>
</Items>
</Options>
</Root>
Original file line number Diff line number Diff line change
Expand Up @@ -133,155 +133,65 @@ SELECT DATEADD(dd, DATEDIFF(dd, 0, tl.DateCreated), 0) AS DateCreated,
AND DateCreated >= @FromDate
AND DateCreated < @ToDate
AND tl.TransactionType = 5
and tl.Amount > 0
AND tl.Amount > 0

UNION ALL

-- sender transfers
SELECT
DATEADD(dd, DATEDIFF(dd, 0, tl.DateCreated), 0) AS DateCreated,
tl.AccountId AS AccountId,
tlt.[Description] AS TransactionType,
NULL AS PayeScheme,
NULL AS PayrollYear,
NULL AS PayrollMonth,
NULL AS LevyDeclared,
NULL AS EnglishFraction,
NULL AS TenPercentTopUp,
CASE tlt.[Description]
WHEN 'Payment' THEN meta.ProviderName
ELSE NULL
END AS TrainingProvider,
NULL AS Uln,
NULL AS Apprentice,
trans.CourseName AS ApprenticeTrainingCourse,
meta.CourseLevel AS ApprenticeTrainingCourseLevel,
SUM(tl.Amount) AS PaidFromLevy,
SUM(tl.SfaCoInvestmentAmount) AS EmployerContribution,
SUM(tl.EmployerCoInvestmentAmount) AS GovermentContribution,
SUM(tl.Amount) AS Total,
tl.TransferSenderAccountId AS TransferSenderAccountId,
tl.TransferSenderAccountName AS TransferSenderAccountName,
tl.TransferReceiverAccountId AS TransferReceiverAccountId,
tl.TransferReceiverAccountName AS TransferReceiverAccountName
FROM [employer_financial].[TransactionLine] tl

JOIN [employer_financial].[TransactionLineTypes] tlt
ON tl.TransactionType = tlt.TransactionType

LEFT JOIN
(SELECT tl2.AccountId, tr2.CourseName, tl2.PeriodEnd
FROM [employer_financial].[TransactionLine] tl2

LEFT JOIN [employer_financial].[AccountTransfers] tr2
ON (tr2.SenderAccountId = tl2.AccountId and tr2.PeriodEnd = tl2.PeriodEnd)

WHERE tl2.AccountId = @AccountId
AND tl2.TransactionType = 4 -- Transfer
) as trans
on trans.AccountId = tl.AccountId
and trans.PeriodEnd = tl.PeriodEnd

LEFT JOIN
(SELECT DISTINCT p3.AccountId, p3.PeriodEnd, m3.ProviderName, m3.ApprenticeshipCourseLevel as 'CourseLevel'
FROM [employer_financial].[Payment] p3
inner join [employer_financial].[TransactionLine] tl3
on tl3.AccountId = @AccountId
AND tl3.AccountId = tl3.TransferSenderAccountId
AND tl3.TransactionType IN (3, 4)
INNER JOIN [employer_financial].[PaymentMetaData] m3
ON m3.Id = p3.PaymentMetaDataId
AND p3.AccountId = tl3.TransferReceiverAccountId
WHERE m3.ProviderName IS NOT NULL
) as meta
on meta.AccountId = tl.TransferReceiverAccountId
and meta.PeriodEnd = tl.PeriodEnd

WHERE tl.AccountId = @AccountId
AND tl.AccountId = tl.TransferSenderAccountId
AND tl.TransactionType IN (3, 4) -- Payment and Transfer
GROUP BY
tl.DateCreated,
tl.AccountId,
tlt.[Description],
tl.PeriodEnd,
meta.ProviderName,
trans.CourseName,
meta.CourseLevel,
tl.TransferSenderAccountId,
tl.TransferSenderAccountName,
tl.TransferReceiverAccountId,
tl.TransferReceiverAccountName

UNION

-- receiver transfers
SELECT
DATEADD(dd, DATEDIFF(dd, 0, tl.DateCreated), 0) AS DateCreated,
tl.AccountId AS AccountId,
tlt.[Description] AS TransactionType,
NULL AS PayeScheme,
NULL AS PayrollYear,
NULL AS PayrollMonth,
NULL AS LevyDeclared,
NULL AS EnglishFraction,
NULL AS TenPercentTopUp,
CASE tlt.[Description]
WHEN 'Payment' THEN meta.ProviderName
ELSE NULL
END AS TrainingProvider,
NULL AS Uln,
NULL AS Apprentice,
trans.CourseName AS ApprenticeTrainingCourse,
meta.CourseLevel AS ApprenticeTrainingCourseLevel,
SUM(tl.Amount) AS PaidFromLevy,
SUM(tl.SfaCoInvestmentAmount) AS EmployerContribution,
SUM(tl.EmployerCoInvestmentAmount) AS GovermentContribution,
SUM(tl.Amount) AS Total,
tl.TransferSenderAccountId AS TransferSenderAccountId,
tl.TransferSenderAccountName AS TransferSenderAccountName,
tl.TransferReceiverAccountId AS TransferReceiverAccountId,
tl.TransferReceiverAccountName AS TransferReceiverAccountName
FROM [employer_financial].[TransactionLine] tl

JOIN [employer_financial].[TransactionLineTypes] tlt
ON tl.TransactionType = tlt.TransactionType
LEFT JOIN
(SELECT tl2.AccountId, tr2.CourseName, tl2.PeriodEnd
FROM [employer_financial].[TransactionLine] tl2

LEFT JOIN [employer_financial].[AccountTransfers] tr2
ON (tr2.ReceiverAccountId = tl2.AccountId and tr2.PeriodEnd = tl2.PeriodEnd)

WHERE tl2.AccountId = @AccountId
AND tl2.TransactionType = 4 -- Transfer
) as trans
on trans.AccountId = tl.AccountId
and trans.PeriodEnd = tl.PeriodEnd

LEFT JOIN
(SELECT DISTINCT p3.AccountId, p3.PeriodEnd, m3.ProviderName, m3.ApprenticeshipCourseLevel as 'CourseLevel'
FROM [employer_financial].[Payment] p3
INNER JOIN [employer_financial].[PaymentMetaData] m3
ON m3.Id = p3.PaymentMetaDataId
AND p3.AccountId = @AccountId
WHERE m3.ProviderName IS NOT NULL
) as meta
on meta.AccountId = tl.TransferReceiverAccountId
and meta.PeriodEnd = tl.PeriodEnd

WHERE tl.AccountId = @AccountId
AND tl.AccountId = tl.TransferReceiverAccountId
AND tl.TransactionType IN (3, 4) -- Payment and Transfer
GROUP BY
tl.DateCreated,
tl.AccountId,
tlt.[Description],
tl.PeriodEnd,
meta.ProviderName,
trans.CourseName,
meta.CourseLevel,
tl.TransferSenderAccountId,
tl.TransferSenderAccountName,
tl.TransferReceiverAccountId,
tl.TransferReceiverAccountName
-- sender transfers
SELECT DATEADD(dd, DATEDIFF(dd, 0, [employer_financial].[AccountTransfers].CreatedDate), 0) AS DateCreated,
[employer_financial].[AccountTransfers].SenderAccountId AS AccountId,
'Transfer' AS TransactionType,
NULL AS PayeScheme,
NULL AS PayrollYear,
NULL AS PayrollMonth,
NULL AS LevyDeclared,
NULL AS EnglishFraction,
NULL AS TenPercentTopUp,
NULL AS TrainingProvider,
NULL AS Uln,
NULL AS Apprentice,
[employer_financial].[AccountTransfers].CourseName AS ApprenticeTrainingCourse,
[employer_financial].[AccountTransfers].CourseLevel AS ApprenticeTrainingCourseLevel,
cast([AccountTransfers].[Amount]as decimal(18,4)) AS PaidFromLevy,
NULL AS EmployerContribution,
NULL AS GovermentContribution,
cast([AccountTransfers].[Amount] as decimal(18,4)) AS Total,
[employer_financial].[AccountTransfers].SenderAccountID AS TransferSenderAccountId,
[employer_financial].[AccountTransfers].[SenderAccountName] AS TransferSenderAccountName,
[employer_financial].[AccountTransfers].[ReceiverAccountId] AS TransferReceiverAccountId,
[employer_financial].[AccountTransfers].[ReceiverAccountName] AS TransferReceiverAccountName
FROM [employer_financial].[AccountTransfers]
WHERE SenderAccountId = @AccountId
AND [employer_financial].[AccountTransfers].[CreatedDate] >= @FromDate
AND [employer_financial].[AccountTransfers].[CreatedDate] < @ToDate

UNION ALL

-- receiver transfers
SELECT DATEADD(dd, DATEDIFF(dd, 0, [employer_financial].[AccountTransfers].CreatedDate), 0) AS DateCreated,
[employer_financial].[AccountTransfers].SenderAccountId AS AccountId,
'Transfer' AS TransactionType,
NULL AS PayeScheme,
NULL AS PayrollYear,
NULL AS PayrollMonth,
NULL AS LevyDeclared,
NULL AS EnglishFraction,
NULL AS TenPercentTopUp,
NULL AS TrainingProvider,
NULL AS Uln,
NULL AS Apprentice,
[employer_financial].[AccountTransfers].CourseName AS ApprenticeTrainingCourse,
[employer_financial].[AccountTransfers].CourseLevel AS ApprenticeTrainingCourseLevel,
cast([AccountTransfers].[Amount] as decimal(18,4)) AS PaidFromLevy,
NULL AS EmployerContribution,
NULL AS GovermentContribution,
cast([employer_financial].[AccountTransfers].[Amount] as decimal(18,4)) AS Total,
[employer_financial].[AccountTransfers].SenderAccountID AS TransferSenderAccountId,
[employer_financial].[AccountTransfers].[SenderAccountName] AS TransferSenderAccountName,
[employer_financial].[AccountTransfers].[ReceiverAccountId] AS TransferReceiverAccountId,
[employer_financial].[AccountTransfers].[ReceiverAccountName] AS TransferReceiverAccountName
FROM [employer_financial].[AccountTransfers]
WHERE [employer_financial].[AccountTransfers].[ReceiverAccountId] = @AccountId
AND [employer_financial].[AccountTransfers].[CreatedDate] >= @FromDate
AND [employer_financial].[AccountTransfers].[CreatedDate] < @ToDate
ORDER BY datecreated
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public void ThenShouldUseValidConfiguration()
c.AddProfile<TransferConnectionInvitationMappings>();
c.AddProfile<UserMappings>();
c.AddProfile<VacancyMappings>();
c.AddProfile<CohortMappings>();
c.AddProfile<ApprenticeshipMappings>();
});

config.AssertConfigurationIsValid();
Expand Down
Loading

0 comments on commit 924eb2c

Please sign in to comment.