displaying button complete, incomplete in receving for finance department
This commit is contained in:
parent
eb7223d47e
commit
e5e4f315ac
@ -39,22 +39,14 @@ namespace CPRNIMS.Domain.Services.Finance
|
|||||||
}
|
}
|
||||||
public async Task<List<ReceivingDetail>> GetRRDetailByPO(RRDetailsDto itemDto)
|
public async Task<List<ReceivingDetail>> GetRRDetailByPO(RRDetailsDto itemDto)
|
||||||
{
|
{
|
||||||
try
|
var allItems = await _dbContext.ReceivingDetails
|
||||||
{
|
.FromSqlRaw($"EXEC GetRRDetailByPOFinance @PONo,@POTypeId,@UserId",
|
||||||
var allItems = await _dbContext.ReceivingDetails
|
new SqlParameter("@PONo", itemDto.PONo),
|
||||||
.FromSqlRaw($"EXEC GetRRDetailByPO @PONo,@POTypeId,@UserId",
|
new SqlParameter("@POTypeId", itemDto.POTypeId),
|
||||||
new SqlParameter("@PONo", itemDto.PONo),
|
new SqlParameter("@UserId", itemDto.UserId))
|
||||||
new SqlParameter("@POTypeId", itemDto.POTypeId),
|
.ToListAsync();
|
||||||
new SqlParameter("@UserId", itemDto.UserId))
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return allItems ?? new List<ReceivingDetail>();
|
return allItems ?? new List<ReceivingDetail>();
|
||||||
}
|
|
||||||
catch (SqlException ex)
|
|
||||||
{
|
|
||||||
ex.ToString();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto)
|
public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ namespace CPRNIMS.Domain.UIContracts.Account
|
|||||||
Task<List<RegisterVM>> GetAllUserAsync(User user);
|
Task<List<RegisterVM>> GetAllUserAsync(User user);
|
||||||
Task<List<UserRoleVM>> GetAllRoleAsync(User user);
|
Task<List<UserRoleVM>> GetAllRoleAsync(User user);
|
||||||
Task<List<ControllerAccessVM>> GetLandingPageByUserId(User user);
|
Task<List<ControllerAccessVM>> GetLandingPageByUserId(User user);
|
||||||
|
Task<List<ControllerAccessVM>> GetLandingPageByUserId(User user,string token);
|
||||||
Task<List<string>> GetRoles(User user);
|
Task<List<string>> GetRoles(User user);
|
||||||
Task<List<RegisterVM>> GetUserProfileById(User user);
|
Task<List<RegisterVM>> GetUserProfileById(User user);
|
||||||
Task<EmailMessageDetailsVM> GetUserByEmail(string email, EmailMessageDetailsVM forgotPassword);
|
Task<EmailMessageDetailsVM> GetUserByEmail(string email, EmailMessageDetailsVM forgotPassword);
|
||||||
|
|||||||
@ -439,42 +439,31 @@ namespace CPRNIMS.Domain.UIServices.Account
|
|||||||
// Handle token retrieval failure
|
// Handle token retrieval failure
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public async Task<List<ControllerAccessVM>> GetLandingPageByUserId(User user)
|
public async Task<List<ControllerAccessVM>> GetLandingPageByUserId(User user, string token)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var token = await _tokenHelper.GetValidTokenAsync();
|
if (string.IsNullOrEmpty(token))
|
||||||
|
return null;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(token))
|
var jsonContent = JsonSerializer.Serialize(user);
|
||||||
|
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
using (var httpClient = _apiConfigurationService.CreateHttpClientWithDefaultHeaders(token))
|
||||||
{
|
{
|
||||||
var jsonContent = JsonSerializer.Serialize(user);
|
var response = await httpClient.PostAsync(_configuration["Account:GetLandingPageByUserId"], content);
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
|
||||||
|
|
||||||
using (var httpClient = _apiConfigurationService.CreateHttpClientWithDefaultHeaders(token))
|
|
||||||
{
|
{
|
||||||
var response = await httpClient.PostAsync(_configuration["Account:GetLandingPageByUserId"], content);
|
var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
if (response.IsSuccessStatusCode)
|
|
||||||
{
|
{
|
||||||
var jsonResponse = await response.Content.ReadAsStringAsync();
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||||
|
};
|
||||||
var options = new JsonSerializerOptions
|
var myAccess = JsonSerializer.Deserialize<List<ControllerAccessVM>>(jsonResponse, options);
|
||||||
{
|
return myAccess;
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
|
||||||
};
|
|
||||||
|
|
||||||
var myAccess = JsonSerializer.Deserialize<List<ControllerAccessVM>>(jsonResponse, options);
|
|
||||||
return myAccess;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Handle API request failure
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle token retrieval failure
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -483,6 +472,17 @@ namespace CPRNIMS.Domain.UIServices.Account
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async Task<List<ControllerAccessVM>> GetLandingPageByUserId(User user)
|
||||||
|
{
|
||||||
|
var token = await _tokenHelper.GetValidTokenAsync();
|
||||||
|
if (!string.IsNullOrEmpty(token))
|
||||||
|
{
|
||||||
|
// Call the overload
|
||||||
|
return await GetLandingPageByUserId(user, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
public async Task<List<DepartmentVM>> GetDepartment(User user)
|
public async Task<List<DepartmentVM>> GetDepartment(User user)
|
||||||
{
|
{
|
||||||
var token = await _tokenHelper.GetValidTokenAsync();
|
var token = await _tokenHelper.GetValidTokenAsync();
|
||||||
|
|||||||
@ -9,4 +9,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -28,34 +28,16 @@ namespace CPRNIMS.WebApi.Controllers.Finance
|
|||||||
[HttpPost("GetAllClosedPO")]
|
[HttpPost("GetAllClosedPO")]
|
||||||
public async Task<IActionResult> GetAllClosedPO(RRDetailsDto itemCodeDto)
|
public async Task<IActionResult> GetAllClosedPO(RRDetailsDto itemCodeDto)
|
||||||
{
|
{
|
||||||
try
|
var allPR = await _rr.GetAllClosedPO(itemCodeDto);
|
||||||
{
|
|
||||||
var allPR = await _rr.GetAllClosedPO(itemCodeDto);
|
|
||||||
|
|
||||||
return Ok(allPR);
|
return Ok(allPR);
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var message = ex.InnerException?.ToString() ?? ex.Message.ToString();
|
|
||||||
await PostErrorMessage(message, "WebApi");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
[HttpPost("GetRRDetailByPO")]
|
[HttpPost("GetRRDetailByPO")]
|
||||||
public async Task<IActionResult> GetRRDetailByPO(RRDetailsDto itemDto)
|
public async Task<IActionResult> GetRRDetailByPO(RRDetailsDto itemDto)
|
||||||
{
|
{
|
||||||
try
|
var myPR = await _rr.GetRRDetailByPO(itemDto);
|
||||||
{
|
|
||||||
var myPR = await _rr.GetRRDetailByPO(itemDto);
|
|
||||||
|
|
||||||
return Ok(myPR);
|
return Ok(myPR);
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var message = ex.InnerException?.ToString() ?? ex.Message.ToString();
|
|
||||||
await PostErrorMessage(message, "WebApi");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using CPRNIMS.Domain.Contracts.Items;
|
using CPRNIMS.Domain.Contracts.Items;
|
||||||
using CPRNIMS.Domain.Contracts.Receiving;
|
using CPRNIMS.Domain.Contracts.Receiving;
|
||||||
using CPRNIMS.Domain.Contracts.SMTP;
|
|
||||||
using CPRNIMS.Domain.Services;
|
using CPRNIMS.Domain.Services;
|
||||||
using CPRNIMS.Infrastructure.Dto.Items;
|
using CPRNIMS.Infrastructure.Dto.Items;
|
||||||
using CPRNIMS.Infrastructure.Helper;
|
using CPRNIMS.Infrastructure.Helper;
|
||||||
|
|||||||
@ -6,10 +6,13 @@
|
|||||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||||
<View_SelectedScaffolderID>RazorViewEmptyScaffolder</View_SelectedScaffolderID>
|
<View_SelectedScaffolderID>RazorViewEmptyScaffolder</View_SelectedScaffolderID>
|
||||||
<View_SelectedScaffolderCategoryPath>root/Common/MVC/View</View_SelectedScaffolderCategoryPath>
|
<View_SelectedScaffolderCategoryPath>root/Common/MVC/View</View_SelectedScaffolderCategoryPath>
|
||||||
<NameOfLastUsedPublishProfile>D:\sourcecode\CPRNIMS\CPRNIMS.WebApps\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
<NameOfLastUsedPublishProfile>D:\sourcecode\NonInventPurchasing\CPRNIMS.WebApps\Properties\PublishProfiles\FolderProfile1.pubxml</NameOfLastUsedPublishProfile>
|
||||||
<WebStackScaffolding_ViewDialogWidth>650.4</WebStackScaffolding_ViewDialogWidth>
|
<WebStackScaffolding_ViewDialogWidth>650.4</WebStackScaffolding_ViewDialogWidth>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -260,8 +260,7 @@ namespace CPRNIMS.WebApps.Controllers.Account
|
|||||||
#region Views
|
#region Views
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
await IsAuthenTicated();
|
return await IsAuthenTicated();
|
||||||
return View();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ namespace CPRNIMS.WebApps.Controllers.Base
|
|||||||
ViewBag.UserCompany = User.FindFirst("Company")?.Value;
|
ViewBag.UserCompany = User.FindFirst("Company")?.Value;
|
||||||
ViewBag.UserRoles = string.Join(",",
|
ViewBag.UserRoles = string.Join(",",
|
||||||
User.FindAll(ClaimTypes.Role).Select(c => c.Value));
|
User.FindAll(ClaimTypes.Role).Select(c => c.Value));
|
||||||
ViewBag.URLAttachment = User.FindFirst("URLAttachment")?.Value;
|
ViewBag.URLAttachment = User.FindFirst("URLAttachment")?.Value ?? "Content/Images/UserProfile/404userImage.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IActionResult GetResponse<T>(T response)
|
protected IActionResult GetResponse<T>(T response)
|
||||||
|
|||||||
@ -158,23 +158,6 @@ namespace CPRNIMS.WebApps.Controllers
|
|||||||
|
|
||||||
var handler = new JwtSecurityTokenHandler();
|
var handler = new JwtSecurityTokenHandler();
|
||||||
var jwtToken = handler.ReadJwtToken(login.token);
|
var jwtToken = handler.ReadJwtToken(login.token);
|
||||||
if (login.expiresInSeconds > 0)
|
|
||||||
{
|
|
||||||
expirationTime = DateTime.UtcNow.AddSeconds(login.expiresInSeconds);
|
|
||||||
}
|
|
||||||
else if (!string.IsNullOrEmpty(login.token))
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if (jwtToken.ValidTo > DateTime.MinValue)
|
|
||||||
{
|
|
||||||
expirationTime = jwtToken.ValidTo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
|
||||||
|
|
||||||
var claims = new List<Claim>
|
var claims = new List<Claim>
|
||||||
{
|
{
|
||||||
@ -212,8 +195,19 @@ namespace CPRNIMS.WebApps.Controllers
|
|||||||
new ClaimsPrincipal(identity),
|
new ClaimsPrincipal(identity),
|
||||||
authProperties
|
authProperties
|
||||||
);
|
);
|
||||||
|
var currentUser = new Infrastructure.Models.Account.User
|
||||||
|
{
|
||||||
|
UserId = login.userId,
|
||||||
|
UserName = login.userName,
|
||||||
|
FullName = login.fullName,
|
||||||
|
Company = login.company,
|
||||||
|
Token = login.token,
|
||||||
|
MyAccess = string.Join(",", jwtToken.Claims
|
||||||
|
.Where(c => c.Type == ClaimTypes.Role)
|
||||||
|
.Select(c => c.Value))
|
||||||
|
};
|
||||||
|
|
||||||
var userAccess = await _account.GetLandingPageByUserId(GetUser());
|
var userAccess = await _account.GetLandingPageByUserId(currentUser, login.token);
|
||||||
|
|
||||||
var landingAction = userAccess?.FirstOrDefault(u => u.AccessTypeId == 1);
|
var landingAction = userAccess?.FirstOrDefault(u => u.AccessTypeId == 1);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
using CPRNIMS.Domain.UIServices.Updater;
|
using CPRNIMS.Domain.UIServices.Updater;
|
||||||
using CPRNIMS.WebApps.Common;
|
using CPRNIMS.WebApps.Common;
|
||||||
using Microsoft.AspNetCore.Rewrite;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@ -18,7 +16,6 @@ if (!app.Environment.IsDevelopment())
|
|||||||
//app.UseRewriter(options);
|
//app.UseRewriter(options);
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseCors("AllowAll");
|
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
|
|||||||
@ -142,3 +142,37 @@ var colDefForReceivingSKU = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
var colRRFinance = [
|
||||||
|
{ data: 'prNo' },
|
||||||
|
{ data: 'itemNo' },
|
||||||
|
{ data: 'itemDescription' },
|
||||||
|
{ data: 'itemCategoryName' },
|
||||||
|
{
|
||||||
|
data: 'quantity',
|
||||||
|
render: function (data, type, row, meta) {
|
||||||
|
return numberWithCommas(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'remainingQty',
|
||||||
|
render: function (data, type, row, meta) {
|
||||||
|
return numberWithCommas(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'quantityReceived',
|
||||||
|
render: function (data, type, row, meta) {
|
||||||
|
return numberWithCommas(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ data: 'uomName' },
|
||||||
|
{
|
||||||
|
data: 'unitPrice',
|
||||||
|
render: function (data, type, row, meta) {
|
||||||
|
return numberWithCommas(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ data: 'prDetailsId', visible: false },
|
||||||
|
{ data: 'emailAddress', visible: false },
|
||||||
|
{ data: 'supplierName', visible: false },
|
||||||
|
];
|
||||||
@ -32,13 +32,11 @@
|
|||||||
vatRate.style.display = 'none';
|
vatRate.style.display = 'none';
|
||||||
amountPHP.style.display = 'none';
|
amountPHP.style.display = 'none';
|
||||||
}
|
}
|
||||||
let btnComplete = document.getElementById('btnComplete');
|
//let btnComplete = document.getElementById('btnComplete');
|
||||||
let btnIncomplete = document.getElementById('btnIncomplete');
|
//let btnIncomplete = document.getElementById('btnIncomplete');
|
||||||
let btnClosePO = document.getElementById('btnClosePO');
|
let btnClosePO = document.getElementById('btnClosePO');
|
||||||
btnPayment.style.display = 'none';
|
btnPayment.style.display = 'none';
|
||||||
if (UserRights == 'POApprover' || UserRights == 'LLIFINANCE' || UserRights == 'CnvssAppver') {
|
if (UserRights == 'POApprover' || UserRights == 'LLIFINANCE' || UserRights == 'CnvssAppver') {
|
||||||
btnComplete.style.display = 'none';
|
|
||||||
btnIncomplete.style.display = 'none';
|
|
||||||
btnSubmit.style.display = 'none';
|
btnSubmit.style.display = 'none';
|
||||||
btnReject.style.display = 'none';
|
btnReject.style.display = 'none';
|
||||||
dynamicColumn = colRRFinance;
|
dynamicColumn = colRRFinance;
|
||||||
Loading…
Reference in New Issue
Block a user