fixing the receiving for finance
This commit is contained in:
parent
e5e4f315ac
commit
efd7017476
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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>
|
||||
</body>
|
||||
<script src="~/JsFunctions/Receiving/Receiving.js"></script>
|
||||
@await Html.PartialAsync("PagesView/Receiving/_ReceivingScripts")
|
||||
@ -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>
|
||||
@ -16,8 +16,7 @@
|
||||
|
||||
var myControllerAccess = await _account.GetLandingPageByUserId(userCred);
|
||||
var groupedElements = myControllerAccess.GroupBy(e => e.ElementMenuName).ToList();
|
||||
|
||||
// Pass the data to the view
|
||||
|
||||
ViewBag.TempDataElements = groupedElements;
|
||||
|
||||
}
|
||||
|
||||
@ -63,8 +63,7 @@ var colDefForReceivingSKU = [
|
||||
UserRights == 'LITCRequestor' && UserRights == 'LPCRequestor'
|
||||
&& 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?');
|
||||
} else {
|
||||
// Non-admin users get a readonly input
|
||||
return '<input readonly class="editable-qty" style="width:120px;text-align:center;" value="' + formattedData + '" />';
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
@ -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;
|
||||
Loading…
Reference in New Issue
Block a user