fixing the receiving for finance

This commit is contained in:
rowell_m_soriano 2026-02-09 16:28:02 +08:00
parent e5e4f315ac
commit efd7017476
9 changed files with 51 additions and 83 deletions

View File

@ -1,7 +1,6 @@
using CPRNIMS.Domain.Contracts.Finance; using CPRNIMS.Domain.Contracts.Finance;
using CPRNIMS.Infrastructure.Database; using CPRNIMS.Infrastructure.Database;
using CPRNIMS.Infrastructure.Dto.Finance; using CPRNIMS.Infrastructure.Dto.Finance;
using CPRNIMS.Infrastructure.Dto.Items;
using CPRNIMS.Infrastructure.Entities.Finance; using CPRNIMS.Infrastructure.Entities.Finance;
using CPRNIMS.Infrastructure.Entities.Purchasing; using CPRNIMS.Infrastructure.Entities.Purchasing;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
@ -22,8 +21,6 @@ namespace CPRNIMS.Domain.Services.Finance
_dbContext = dbContext; _dbContext = dbContext;
} }
public async Task<List<ForPayment>> GetAllClosedPO(RRDetailsDto itemDto) public async Task<List<ForPayment>> GetAllClosedPO(RRDetailsDto itemDto)
{
try
{ {
var allItems = await _dbContext.ForPayments var allItems = await _dbContext.ForPayments
.FromSqlRaw($"EXEC GetAllClosedPO @UserId = '{itemDto.UserId}'") .FromSqlRaw($"EXEC GetAllClosedPO @UserId = '{itemDto.UserId}'")
@ -31,12 +28,6 @@ namespace CPRNIMS.Domain.Services.Finance
return allItems ?? new List<ForPayment>(); return allItems ?? new List<ForPayment>();
} }
catch (SqlException ex)
{
ex.ToString();
throw;
}
}
public async Task<List<ReceivingDetail>> GetRRDetailByPO(RRDetailsDto itemDto) public async Task<List<ReceivingDetail>> GetRRDetailByPO(RRDetailsDto itemDto)
{ {
var allItems = await _dbContext.ReceivingDetails var allItems = await _dbContext.ReceivingDetails
@ -50,8 +41,6 @@ namespace CPRNIMS.Domain.Services.Finance
} }
public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto) public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto)
{
try
{ {
await _dbContext.Database await _dbContext.Database
.ExecuteSqlRawAsync("EXEC PostPutPayment @UserId, @PONo, @POTypeId, @PRDetailsId", .ExecuteSqlRawAsync("EXEC PostPutPayment @UserId, @PONo, @POTypeId, @PRDetailsId",
@ -61,11 +50,5 @@ namespace CPRNIMS.Domain.Services.Finance
new SqlParameter("@PRDetailsId", itemDto.PRDetailsId)); new SqlParameter("@PRDetailsId", itemDto.PRDetailsId));
return new RRDetail(); return new RRDetail();
} }
catch (SqlException ex)
{
ex.ToString();
throw;
}
}
} }
} }

View File

@ -385,34 +385,15 @@ namespace CPRNIMS.WebApi.Controllers.Account
[HttpPost("GetLandingPageByUserId")] [HttpPost("GetLandingPageByUserId")]
public async Task<IActionResult> GetLandingPageByUserId(ControllerAccessVM model) public async Task<IActionResult> GetLandingPageByUserId(ControllerAccessVM model)
{ {
try return await ExecuteWithErrorHandling(
{ () => _controllerAccess.GetControllerAccessByUserId(model.UserId),
var controllerAccesse = await _controllerAccess.GetControllerAccessByUserId(model.UserId); nameof(GetLandingPageByUserId), false);
return Ok(controllerAccesse);
}
catch (Exception ex)
{
var message = ex.InnerException?.ToString() ?? ex.Message.ToString();
await PostErrorMessage(message, "WebApi");
throw;
}
} }
[HttpGet("GetAllRoles")] [HttpGet("GetAllRoles")]
public async Task<IActionResult> GetAllRoles() public async Task<IActionResult> GetAllRoles()
{
try
{ {
var roles = await _roleManager.Roles.ToListAsync(); var roles = await _roleManager.Roles.ToListAsync();
return Ok(roles); return Ok(roles);
}
catch (Exception ex)
{
var message = ex.InnerException?.ToString() ?? ex.Message.ToString();
await PostErrorMessage(message, "WebApi");
throw;
}
} }
[HttpGet("GetRoles")] [HttpGet("GetRoles")]
public async Task<IActionResult> GetRoles() public async Task<IActionResult> GetRoles()
@ -434,7 +415,7 @@ namespace CPRNIMS.WebApi.Controllers.Account
} }
else else
{ {
return NotFound(); // or any other appropriate status code return NotFound();
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -49,7 +49,7 @@
</div> </div>
<link href="~/css/pr/receiving.css" rel="stylesheet" /> <link href="~/css/pr/receiving.css" rel="stylesheet" />
@await Html.PartialAsync("PagesView/Receiving/_Receiving") @await Html.PartialAsync("PagesView/Receiving/_Receiving")
<script src="~/JsFunctions/Receiving/Receiving.js"></script>
@await Html.PartialAsync("PagesView/Receiving/_ReceivingScripts")
</div> </div>
</body> </body>
<script src="~/JsFunctions/Receiving/Receiving.js"></script>
@await Html.PartialAsync("PagesView/Receiving/_ReceivingScripts")

View File

@ -2,11 +2,11 @@
<div id="loader" class="loader"></div> <div id="loader" class="loader"></div>
</div> </div>
<script src="~/jsfunctions/receiving/receivingvar.js"></script> <script src="~/jsfunctions/receiving/receivingvar.js"></script>
<script src="~/jsfunctions/receiving/receivingcolumn.js"></script> <script src="~/jsfunctions/receiving/ReceivingColumnV2.js"></script>
<script src="~/jsfunctions/receiving/ReceivingViewV2.js"></script> <script src="~/jsfunctions/receiving/ReceivingViewV4.js"></script>
<script src="~/jsfunctions/receiving/receivingcallback.js"></script> <script src="~/jsfunctions/receiving/receivingcallback.js"></script>
<script src="~/jsfunctions/receiving/receivingbutton.js"></script> <script src="~/jsfunctions/receiving/receivingbutton.js"></script>
<script src="~/jsfunctions/receiving/receivingpostput.js"></script> <script src="~/jsfunctions/receiving/ReceivingPostPutV2.js"></script>
<script src="~/jsfunctions/utilities/searchengine.js"></script> <script src="~/jsfunctions/utilities/searchengine.js"></script>
<script src="~/jsfunctions/utilities/stylesv3.js"></script> <script src="~/jsfunctions/utilities/stylesv3.js"></script>
<script src="~/jsfunctions/utilities/utilsV3.js"></script> <script src="~/jsfunctions/utilities/utilsV3.js"></script>

View File

@ -17,7 +17,6 @@
var myControllerAccess = await _account.GetLandingPageByUserId(userCred); var myControllerAccess = await _account.GetLandingPageByUserId(userCred);
var groupedElements = myControllerAccess.GroupBy(e => e.ElementMenuName).ToList(); var groupedElements = myControllerAccess.GroupBy(e => e.ElementMenuName).ToList();
// Pass the data to the view
ViewBag.TempDataElements = groupedElements; ViewBag.TempDataElements = groupedElements;
} }

View File

@ -64,7 +64,6 @@ var colDefForReceivingSKU = [
&& UserRights == 'Approver1' && UserRights == 'Approver2') { && UserRights == 'Approver1' && UserRights == 'Approver2') {
return '<input type="text" class="editable-qty" style="width:120px;text-align:center;" value="' + formattedData + '" />'; return '<input type="text" class="editable-qty" style="width:120px;text-align:center;" value="' + formattedData + '" />';
} else { } else {
console.log('ELSE PASOK BA?');
// Non-admin users get a readonly input // Non-admin users get a readonly input
return '<input readonly class="editable-qty" style="width:120px;text-align:center;" value="' + formattedData + '" />'; return '<input readonly class="editable-qty" style="width:120px;text-align:center;" value="' + formattedData + '" />';
} }

View File

@ -79,7 +79,7 @@ function putPOItemDetail() {
const PortOfDischarge = portOfDischarge.value; const PortOfDischarge = portOfDischarge.value;
var poTypeId = $('#potype-cancel').val(); var poTypeId = $('#potype-cancel').val();
console.log('PodId', PodId);
if (!UOMId || !Specification || !Qty || !UnitPrice || !PaymentTermsId || PaymentTermsId == 0 || !ItemDescription) { if (!UOMId || !Specification || !Qty || !UnitPrice || !PaymentTermsId || PaymentTermsId == 0 || !ItemDescription) {
showToast('warning', 'Please fill the required fields !', 'Updating failed!', 4000); showToast('warning', 'Please fill the required fields !', 'Updating failed!', 4000);
if (!UOMId) { if (!UOMId) {

View File

@ -83,9 +83,14 @@
return; return;
} }
const confirmation = confirm('Are you sure you want to proceed?'); showConfirmation({
title: 'Receiving',
if (confirmation) { message: 'Are you sure you want to receive this item? This action cannot be undone.',
type: 'warning',
confirmText: 'Yes',
cancelText: 'No'
}).then((confirmed) => {
if (confirmed) {
$.ajax($.extend({ $.ajax($.extend({
url: '/Receiving/PostPutReceiving', url: '/Receiving/PostPutReceiving',
type: 'POST', type: 'POST',
@ -95,14 +100,15 @@
$('#viewRRDetailByPO').modal('hide'); $('#viewRRDetailByPO').modal('hide');
receivingTable.ajax.reload(); receivingTable.ajax.reload();
alert('Item Received Successfully!'); showToast('success', 'Item Received Successfully!', 'Receiving', 4000);
} else { } else {
alert('Failed: ' + response.response); showToast('error', response.response, 'Updating failed!', 4000);
} }
}, },
error: errorHandler error: errorHandler
}, beforeComplete(loader))); }, beforeComplete(loader)));
} }
});
} }
function putPOClose() { function putPOClose() {
loader = $('#overlay, #loader').css('z-index', 1070); loader = $('#overlay, #loader').css('z-index', 1070);

View File

@ -22,7 +22,7 @@
amountUSD.style.display = 'none'; amountUSD.style.display = 'none';
amountUSDLabel.style.display = 'none'; amountUSDLabel.style.display = 'none';
} }
if (UserRights !== 'LLIFINANCE' && UserRights !== 'CnvssAppver' && UserRights !== 'POApprover') { //dont touch && if (UserRights !== 'CnvssAppver' && UserRights !== 'POApprover') { //dont touch &&
btnSubmit.style.display = 'none'; btnSubmit.style.display = 'none';
amountUSDLabel.style.display = 'none'; amountUSDLabel.style.display = 'none';
vatRateLabel.style.display = 'none'; vatRateLabel.style.display = 'none';
@ -36,7 +36,7 @@
//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 == 'CnvssAppver') {
btnSubmit.style.display = 'none'; btnSubmit.style.display = 'none';
btnReject.style.display = 'none'; btnReject.style.display = 'none';
dynamicColumn = colRRFinance; dynamicColumn = colRRFinance;