Skip to content

Commit

Permalink
Merge branch 'master' into CON-1403-Add-Apprentice-Journey-Provider-A…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
cofaulco committed Mar 31, 2020
2 parents 59c6763 + a9ecc76 commit 3a93fd5
Show file tree
Hide file tree
Showing 29 changed files with 233 additions and 272 deletions.
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 @@ -87,13 +87,9 @@ public async Task<ActionResult> Details(string agreementId, string hashedAccount
public async Task<ActionResult> View(string agreementId, string hashedAccountId,
FlashMessageViewModel flashMessage)
{
var agreement = await _orchestrator.GetById(
agreementId,
hashedAccountId,
OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName)
);
var agreement = await GetSignedAgreementViewModel(new GetEmployerAgreementRequest { AgreementId = agreementId, HashedAccountId = hashedAccountId, ExternalUserId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName) });

return View(agreement.Data);
return View(agreement);
}

[HttpGet]
Expand Down Expand Up @@ -200,8 +196,8 @@ public async Task<ActionResult> Sign(string agreementId, string hashedAccountId,
}
else
{
flashMessage.Headline = "All agreements signed";
flashMessage.Message = "You’ve successfully signed your organisation agreement(s)";
flashMessage.Headline = "Agreement accepted";
flashMessage.Message = "You’ve successfully accepted your organisation agreement(s)";
result = RedirectToAction(ControllerConstants.IndexActionName, ControllerConstants.EmployerTeamControllerName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@
<Content Include="Views\EmployerTeam\VacancyClosed.cshtml" />
<Content Include="Views\Shared\_NotSignedV3AgreementMessage.cshtml" />
<Content Include="Views\Shared\_NotSignedV3AgreementMessage_CDN.cshtml" />
<Content Include="Views\Shared\_COVID19GuidanceBanner.cshtml" />
<Content Include="Views\EmployerTeam\SingleApprenticeshipContinueSetup.cshtml" />
<Content Include="Views\EmployerTeam\SingleApprenticeshipApproved.cshtml" />
<Content Include="Views\EmployerTeam\SingleApprenticeshipWithTrainingProvider.cshtml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
@if (Html.IsAuthorized("EmployerFeature.Transfers"))
{
<p class="govuk-body">This agreement creates a legal contract between <span class="govuk-!-font-weight-bold">@Model.Data.EmployerAgreement.LegalEntityName</span> and the <span class="bold">Education and Skills Funding Agency (ESFA)</span>. It allows you to transfer funds to other employers and pay training providers for apprenticeships.</p>
<p class="govuk-body">You need to ensure you have the authority from your organisation before you sign this agreement.</p>
<p class="govuk-body">You need to ensure you have the authority from your organisation before you accept this agreement.</p>
}
else
{
<p class="govuk-body">This agreement creates a legal contract between <span class="govuk-!-font-weight-bold">@Model.Data.EmployerAgreement.LegalEntityName</span>and the <span class="govuk-!-font-weight-bold">Education and Skills Funding Agency (ESFA)</span>.It allows ESFA to pay your training providers for apprenticeships.</p>
<p class="govuk-body"> You need to make sure you have authority from your organisation before you sign this agreement.</p>
<p class="govuk-body"> You need to make sure you have authority from your organisation before you accept this agreement.</p>
}

<form method="get" action="@Url.Action(ControllerConstants.SignAgreementActionName ,ControllerConstants.EmployerAgreementControllerName)">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@using SFA.DAS.EmployerAccounts.Web.Helpers
@model EmployerAgreementViewModel
@model SignEmployerAgreementViewModel
@{
ViewBag.PageID = "agreement-view";
ViewBag.Title = "Agreement view";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ViewBag.Title = name;
ViewBag.Section = "team";
var errorMessage = string.Empty;

ViewBag.ZenDeskLabel = "eas-change-team-member";
}

@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
@{
ViewBag.PageID = "page-manage-team";
ViewBag.Title = "Manage team members";
ViewBag.Section = "team";
ViewBag.Section = "team";
ViewBag.ZenDeskLabel = "eas-view-team-member";

if (!string.IsNullOrEmpty(Model.FlashMessage?.HiddenFlashMessageInformation))
{
ViewBag.PageID = Model.FlashMessage.HiddenFlashMessageInformation;
}

}

@{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@if (ViewBag.UseCDN ?? false)
{
<div class="das-notification">
<p class="das-notification__heading govuk-!-margin-bottom-0">
Coronavirus (COVID-19): <a href="https://www.gov.uk/government/publications/coronavirus-covid-19-apprenticeship-programme-response/coronavirus-covid-19-guidance-for-apprentices-employers-training-providers-end-point-assessment-organisations-and-external-quality-assurance-pro" target="_blank" class="govuk-link">read our guidance</a> on the changes we're making to apprenticeships and <a href="https://help.apprenticeships.education.gov.uk/hc/en-gb/articles/360009509360-Pause-or-stop-an-apprenticeship" target="_blank" class="govuk-link">find out how you can pause your apprenticeships</a>.
</p>
</div>
}
else
{
<div class="info-summary">
<h2 class="heading-medium">
Coronavirus (COVID-19): <a href="https://www.gov.uk/government/publications/coronavirus-covid-19-apprenticeship-programme-response/coronavirus-covid-19-guidance-for-apprentices-employers-training-providers-end-point-assessment-organisations-and-external-quality-assurance-pro" target="_blank">read our guidance</a> on the changes we're making to apprenticeships and <a href="https://help.apprenticeships.education.gov.uk/hc/en-gb/articles/360009509360-Pause-or-stop-an-apprenticeship" target="_blank">find out how you can pause your apprenticeships</a>.
</h2>
</div>
}
19 changes: 13 additions & 6 deletions src/SFA.DAS.EmployerAccounts.Web/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,23 @@

<main role="main" id="content">
@RenderSection("breadcrumb", required: false)


@if (HttpContext.Current.User.Identity.IsAuthenticated)
{
var userId = Html.ViewContext.RequestContext.HttpContext.GetOwinContext().Authentication.User?.Claims.
FirstOrDefault(x => x.Type == ControllerConstants.UserRefClaimKeyName)?.Value;
var hashedAccountId = Html.ViewContext.RouteData.Values[ControllerConstants.AccountHashedIdRouteKeyName]?.ToString();
if (!string.IsNullOrEmpty(hashedAccountId))
@Html.Partial("_COVID19GuidanceBanner")

if (Html.IsAuthorized("EmployerFeature.V3AgreementBanner"))
{
if (Html.ShowExpiringAgreementBanner(userId, hashedAccountId))
var userId = Html.ViewContext.RequestContext.HttpContext.GetOwinContext().Authentication.User?.Claims.
FirstOrDefault(x => x.Type == ControllerConstants.UserRefClaimKeyName)?.Value;
var hashedAccountId = Html.ViewContext.RouteData.Values[ControllerConstants.AccountHashedIdRouteKeyName]?.ToString();
if (!string.IsNullOrEmpty(hashedAccountId))
{
@Html.Partial(@"_NotSignedV3AgreementMessage")
if (Html.ShowExpiringAgreementBanner(userId, hashedAccountId))
{
@Html.Partial(@"_NotSignedV3AgreementMessage")
}
}
}
}
Expand Down
22 changes: 16 additions & 6 deletions src/SFA.DAS.EmployerAccounts.Web/Views/Shared/_Layout_CDN.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
@using SFA.DAS.Authorization.Mvc
@using SFA.DAS.EmployerAccounts.Web.Helpers


@{
ViewBag.UseCDN = true;
}
<!DOCTYPE html>
<html lang="en" class="govuk-template ">
<head>
Expand Down Expand Up @@ -147,18 +151,24 @@

<div class="govuk-width-container">
@RenderSection("breadcrumb", required: false)

<main class="govuk-main-wrapper" id="main-content" role="main">
@if (HttpContext.Current.User.Identity.IsAuthenticated)
{
var userId = Html.ViewContext.RequestContext.HttpContext.GetOwinContext().Authentication.User?.Claims.
FirstOrDefault(x => x.Type == ControllerConstants.UserRefClaimKeyName)?.Value;
var hashedAccountId = Html.ViewContext.RouteData.Values[ControllerConstants.AccountHashedIdRouteKeyName]?.ToString();
@Html.Partial("_COVID19GuidanceBanner")

if (Html.IsAuthorized("EmployerFeature.V3AgreementBanner"))
{
if (!string.IsNullOrEmpty(hashedAccountId))
var userId = Html.ViewContext.RequestContext.HttpContext.GetOwinContext().Authentication.User?.Claims.
FirstOrDefault(x => x.Type == ControllerConstants.UserRefClaimKeyName)?.Value;
var hashedAccountId = Html.ViewContext.RouteData.Values[ControllerConstants.AccountHashedIdRouteKeyName]?.ToString();
{
if (Html.ShowExpiringAgreementBanner(userId, hashedAccountId))
if (!string.IsNullOrEmpty(hashedAccountId))
{
@Html.Partial(@"_NotSignedV3AgreementMessage_CDN")
if (Html.ShowExpiringAgreementBanner(userId, hashedAccountId))
{
@Html.Partial(@"_NotSignedV3AgreementMessage_CDN")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<p>Before connecting to another employer, both employers will need to:</p>
<ul class="list list-bullet">
<li>read and understand the <a href="https://www.gov.uk/government/publications/apprenticeship-funding-and-performance-management-rules-2017-to-2018">rules for sending and receiving transfers</a></li>
<li>sign the updated ESFA organisation agreement once it's available. View <a href="https://www.gov.uk/government/publications/apprenticeship-funding-legal-agreement-to-enable-spending/guidance-note-on-the-employer-agreement">guidance on the updated agreement</a> to find out what's changed.</li>
<li>accept the updated ESFA organisation agreement once it's available. View <a href="https://www.gov.uk/government/publications/apprenticeship-funding-legal-agreement-to-enable-spending/guidance-note-on-the-employer-agreement">guidance on the updated agreement</a> to find out what's changed.</li>
</ul>
}
</div>
Expand Down
Loading

0 comments on commit 3a93fd5

Please sign in to comment.