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.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;
|
||||||
@ -23,19 +22,11 @@ namespace CPRNIMS.Domain.Services.Finance
|
|||||||
}
|
}
|
||||||
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}'")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -51,21 +42,13 @@ namespace CPRNIMS.Domain.Services.Finance
|
|||||||
|
|
||||||
public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto)
|
public async Task<RRDetail> PostPutPayment(RRDetailsDto itemDto)
|
||||||
{
|
{
|
||||||
try
|
await _dbContext.Database
|
||||||
{
|
.ExecuteSqlRawAsync("EXEC PostPutPayment @UserId, @PONo, @POTypeId, @PRDetailsId",
|
||||||
await _dbContext.Database
|
new SqlParameter("@UserId", itemDto.UserId),
|
||||||
.ExecuteSqlRawAsync("EXEC PostPutPayment @UserId, @PONo, @POTypeId, @PRDetailsId",
|
new SqlParameter("@PONo", itemDto.PONo),
|
||||||
new SqlParameter("@UserId", itemDto.UserId),
|
new SqlParameter("@POTypeId", itemDto.POTypeId),
|
||||||
new SqlParameter("@PONo", itemDto.PONo),
|
new SqlParameter("@PRDetailsId", itemDto.PRDetailsId));
|
||||||
new SqlParameter("@POTypeId", itemDto.POTypeId),
|
return new RRDetail();
|
||||||
new SqlParameter("@PRDetailsId", itemDto.PRDetailsId));
|
|
||||||
return new RRDetail();
|
|
||||||
}
|
|
||||||
catch (SqlException ex)
|
|
||||||
{
|
|
||||||
ex.ToString();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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();
|
||||||
{
|
return Ok(roles);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
[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)
|
||||||
|
|||||||
@ -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")
|
||||||
@ -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>
|
||||||
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 + '" />';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
@ -83,26 +83,32 @@
|
|||||||
return;
|
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) {
|
showToast('success', 'Item Received Successfully!', 'Receiving', 4000);
|
||||||
$.ajax($.extend({
|
} else {
|
||||||
url: '/Receiving/PostPutReceiving',
|
showToast('error', response.response, 'Updating failed!', 4000);
|
||||||
type: 'POST',
|
}
|
||||||
data: { ItemList, POTypeId, EmailAddress, PONo, DocTypeId, Remarks, DRNo, ReceivedDate, RRNo, IsCompleted },
|
},
|
||||||
success: function (response) {
|
error: errorHandler
|
||||||
if (response.success) {
|
}, beforeComplete(loader)));
|
||||||
$('#viewRRDetailByPO').modal('hide');
|
}
|
||||||
receivingTable.ajax.reload();
|
});
|
||||||
|
|
||||||
alert('Item Received Successfully!');
|
|
||||||
} else {
|
|
||||||
alert('Failed: ' + response.response);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: errorHandler
|
|
||||||
}, beforeComplete(loader)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function putPOClose() {
|
function putPOClose() {
|
||||||
loader = $('#overlay, #loader').css('z-index', 1070);
|
loader = $('#overlay, #loader').css('z-index', 1070);
|
||||||
@ -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;
|
||||||
Loading…
Reference in New Issue
Block a user