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.Infrastructure.Database;
using CPRNIMS.Infrastructure.Dto.Finance;
using CPRNIMS.Infrastructure.Dto.Items;
using CPRNIMS.Infrastructure.Entities.Finance;
using CPRNIMS.Infrastructure.Entities.Purchasing;
using Microsoft.Data.SqlClient;
@ -23,19 +22,11 @@ namespace CPRNIMS.Domain.Services.Finance
}
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}'")
.ToListAsync();
return allItems ?? new List<ForPayment>();
}
catch (SqlException ex)
{
ex.ToString();
throw;
}
return allItems ?? new List<ForPayment>();
}
public async Task<List<ReceivingDetail>> GetRRDetailByPO(RRDetailsDto itemDto)
{
@ -51,21 +42,13 @@ namespace CPRNIMS.Domain.Services.Finance
public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto)
{
try
{
await _dbContext.Database
.ExecuteSqlRawAsync("EXEC PostPutPayment @UserId, @PONo, @POTypeId, @PRDetailsId",
new SqlParameter("@UserId", itemDto.UserId),
new SqlParameter("@PONo", itemDto.PONo),
new SqlParameter("@POTypeId", itemDto.POTypeId),
new SqlParameter("@PRDetailsId", itemDto.PRDetailsId));
return new RRDetail();
}
catch (SqlException ex)
{
ex.ToString();
throw;
}
await _dbContext.Database
.ExecuteSqlRawAsync("EXEC PostPutPayment @UserId, @PONo, @POTypeId, @PRDetailsId",
new SqlParameter("@UserId", itemDto.UserId),
new SqlParameter("@PONo", itemDto.PONo),
new SqlParameter("@POTypeId", itemDto.POTypeId),
new SqlParameter("@PRDetailsId", itemDto.PRDetailsId));
return new RRDetail();
}
}
}

View File

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

View File

@ -49,7 +49,7 @@
</div>
<link href="~/css/pr/receiving.css" rel="stylesheet" />
@await Html.PartialAsync("PagesView/Receiving/_Receiving")
<script src="~/JsFunctions/Receiving/Receiving.js"></script>
@await Html.PartialAsync("PagesView/Receiving/_ReceivingScripts")
</div>
</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>
<script src="~/jsfunctions/receiving/receivingvar.js"></script>
<script src="~/jsfunctions/receiving/receivingcolumn.js"></script>
<script src="~/jsfunctions/receiving/ReceivingViewV2.js"></script>
<script src="~/jsfunctions/receiving/ReceivingColumnV2.js"></script>
<script src="~/jsfunctions/receiving/ReceivingViewV4.js"></script>
<script src="~/jsfunctions/receiving/receivingcallback.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/stylesv3.js"></script>
<script src="~/jsfunctions/utilities/utilsV3.js"></script>

View File

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

View File

@ -64,7 +64,6 @@ var colDefForReceivingSKU = [
&& UserRights == 'Approver1' && UserRights == 'Approver2') {
return '<input type="text" class="editable-qty" style="width:120px;text-align:center;" value="' + formattedData + '" />';
} else {
console.log('ELSE PASOK BA?');
// Non-admin users get a readonly input
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;
var poTypeId = $('#potype-cancel').val();
console.log('PodId', PodId);
if (!UOMId || !Specification || !Qty || !UnitPrice || !PaymentTermsId || PaymentTermsId == 0 || !ItemDescription) {
showToast('warning', 'Please fill the required fields !', 'Updating failed!', 4000);
if (!UOMId) {

View File

@ -83,26 +83,32 @@
return;
}
const confirmation = confirm('Are you sure you want to proceed?');
showConfirmation({
title: 'Receiving',
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({
url: '/Receiving/PostPutReceiving',
type: 'POST',
data: { ItemList, POTypeId, EmailAddress, PONo, DocTypeId, Remarks, DRNo, ReceivedDate, RRNo, IsCompleted },
success: function (response) {
if (response.success) {
$('#viewRRDetailByPO').modal('hide');
receivingTable.ajax.reload();
if (confirmation) {
$.ajax($.extend({
url: '/Receiving/PostPutReceiving',
type: 'POST',
data: { ItemList, POTypeId, EmailAddress, PONo, DocTypeId, Remarks, DRNo, ReceivedDate, RRNo, IsCompleted },
success: function (response) {
if (response.success) {
$('#viewRRDetailByPO').modal('hide');
receivingTable.ajax.reload();
alert('Item Received Successfully!');
} else {
alert('Failed: ' + response.response);
}
},
error: errorHandler
}, beforeComplete(loader)));
}
showToast('success', 'Item Received Successfully!', 'Receiving', 4000);
} else {
showToast('error', response.response, 'Updating failed!', 4000);
}
},
error: errorHandler
}, beforeComplete(loader)));
}
});
}
function putPOClose() {
loader = $('#overlay, #loader').css('z-index', 1070);

View File

@ -22,7 +22,7 @@
amountUSD.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';
amountUSDLabel.style.display = 'none';
vatRateLabel.style.display = 'none';
@ -36,7 +36,7 @@
//let btnIncomplete = document.getElementById('btnIncomplete');
let btnClosePO = document.getElementById('btnClosePO');
btnPayment.style.display = 'none';
if (UserRights == 'POApprover' || UserRights == 'LLIFINANCE' || UserRights == 'CnvssAppver') {
if (UserRights == 'POApprover' || UserRights == 'CnvssAppver') {
btnSubmit.style.display = 'none';
btnReject.style.display = 'none';
dynamicColumn = colRRFinance;