Fixing Qty submission in Item Cart and adding Item no searching in item management
This commit is contained in:
parent
a188699c56
commit
ee0f853a85
@ -14,7 +14,7 @@ namespace CPRNIMS.Domain.Contracts.Items
|
||||
public interface IItem
|
||||
{
|
||||
Task<List<Departments>> GetDepartment(ItemCodeDto itemCode);
|
||||
Task<List<ItemList>> GetItemList(ItemCodeDto itemCode);
|
||||
Task<PagedResult<ItemList>> GetItemList(ItemCodeDto itemCode);
|
||||
Task<List<ItemCart>> GetItemCart(ItemDto itemDto);
|
||||
Task<List<Item>> GetItemDetail(ItemDto itemDto);
|
||||
Task<List<ItemLocalization>> GetItemLocalization(ItemDto itemDto);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using CPRNIMS.Infrastructure.Dto.PR;
|
||||
using CPRNIMS.Infrastructure.Dto.Items;
|
||||
using CPRNIMS.Infrastructure.Dto.PR;
|
||||
using CPRNIMS.Infrastructure.Entities.Common;
|
||||
using CPRNIMS.Infrastructure.Entities.Purchasing;
|
||||
using CPRNIMS.Infrastructure.Entities.SMTP;
|
||||
@ -19,20 +20,21 @@ namespace CPRNIMS.Domain.Contracts.PR
|
||||
Task<List<ForReceiving>> GetForReceiving(PRDto PRDto);
|
||||
Task<List<Dashboard>> GetDashBoard(PRDto PRDto);
|
||||
Task<List<ItemApproval>> GetMyPR(PRDto PRDto);
|
||||
Task<List<Infrastructure.Entities.Purchasing.PRList>> GetAllPR(PRDto PRDto);
|
||||
Task<PagedResult<DetailedPRTracking>> GetDetailedPRTracking(PRDto PRDto);
|
||||
Task<PagedResult<Infrastructure.Entities.Purchasing.PRList>> GetAllPR(PRDto PRDto);
|
||||
Task<PagedResult<Infrastructure.Entities.Purchasing.PRList>> GetPRArchived(PRDto pRDto);
|
||||
Task<List<Infrastructure.Entities.Canvass.PRList>> GetPRListByPRNo(PRDto PRDto);
|
||||
Task<List<NotifUserKey>> GetNotifUserKey(PRDto PRDto);
|
||||
Task<List<PRItemList>> GetPRDetailByPRNo(PRDto PRDto);
|
||||
Task<List<PRTracking>> GetPRStatusById(PRDto PRDto);
|
||||
Task<List<RRReport>> GetDetailedPRTracking(PRDto PRDto);
|
||||
Task<List<AlternativeOffer>> GetSupplierAlternativeOffer(PRDto PRDto);
|
||||
Task<List<AlternativeOfferDetails>> GetSupplierAlterOfferDetails(PRDto PRDto);
|
||||
Task<List<NotificationById>> GetNotificationById(PRDto PRDto);
|
||||
Task<List<PRDto>> GetApproverName(PRDto PRDto);
|
||||
Task<List<PRDto>> GetApproverNameByPRNo(PRDto PRDto);
|
||||
Task<List<ProjectCodes>> GetProjectCodes(PRDto pRDto);
|
||||
Task<List<RemovedPR>> GetRemovedPR(PRDto pRDto);
|
||||
Task<List<ApprovedPR>> GetApprovedPR(PRDto pRDto);
|
||||
Task<PagedResult<DeletedPR>> GetDeletedPR(PRDto pRDto);
|
||||
Task<PagedResult<ApprovedPR>> GetApprovedPR(PRDto pRDto);
|
||||
Task<MessageResponse> PRItemRemoval(PRDto pRDto);
|
||||
Task<PRDetails> PostPRApproveReject(PRDto PRDto);
|
||||
Task<PRDetails> PostPutReceiving(PRDto PRDto);
|
||||
|
||||
@ -132,16 +132,66 @@ namespace CPRNIMS.Domain.Services.Items
|
||||
return allItems ?? new List<Infrastructure.Entities.Items.Item>();
|
||||
}
|
||||
|
||||
public async Task<List<ItemList>> GetItemList(ItemCodeDto itemCode)
|
||||
public async Task<PagedResult<ItemList>> GetItemList(ItemCodeDto dto)
|
||||
{
|
||||
var allItems = await _dbContext.ItemList
|
||||
.FromSqlRaw($"EXEC GetItemList @UserId",
|
||||
new SqlParameter("@UserId",itemCode.UserId))
|
||||
.ToListAsync();
|
||||
var parameters = new[]
|
||||
{
|
||||
new SqlParameter("@UserId", dto.UserId),
|
||||
new SqlParameter("@SearchItemNo", dto.SearchItemNo ?? ""),
|
||||
new SqlParameter("@SearchItemName", dto.SearchItemName ?? ""),
|
||||
new SqlParameter("@SearchCategory", dto.SearchCategory ?? ""),
|
||||
new SqlParameter("@PageNumber", dto.PageNumber),
|
||||
new SqlParameter("@PageSize", dto.PageSize)
|
||||
};
|
||||
|
||||
return allItems ?? new List<ItemList>();
|
||||
int totalCount = 0;
|
||||
var items = new List<ItemList>();
|
||||
var categoryList = new List<string>();
|
||||
|
||||
// Use ADO.NET to read two result sets
|
||||
var conn = _dbContext.Database.GetDbConnection();
|
||||
await conn.OpenAsync();
|
||||
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = "EXEC GetItemList @UserId, @SearchItemNo,@SearchItemName,@SearchCategory, @PageNumber, @PageSize";
|
||||
foreach (var p in parameters) cmd.Parameters.Add(p);
|
||||
cmd.CommandTimeout = 60;
|
||||
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
while (await reader.ReadAsync())
|
||||
categoryList.Add(reader.GetString(0));
|
||||
|
||||
await reader.NextResultAsync();
|
||||
|
||||
if (await reader.ReadAsync())
|
||||
totalCount = reader.GetInt32(0);
|
||||
|
||||
await reader.NextResultAsync();
|
||||
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
items.Add(new ItemList
|
||||
{
|
||||
ItemCodeId = Convert.ToInt64(reader["ItemCodeId"]),
|
||||
ItemNo = Convert.ToInt64(reader["ItemNo"]),
|
||||
ItemName = reader["ItemName"]?.ToString(),
|
||||
ItemDescription = reader["ItemDescription"]?.ToString(),
|
||||
ItemCategoryName = reader["ItemCategoryName"]?.ToString(),
|
||||
CartItemCount = Convert.ToInt32(reader["CartItemCount"])
|
||||
});
|
||||
}
|
||||
await conn.CloseAsync();
|
||||
|
||||
return new PagedResult<ItemList>
|
||||
{
|
||||
Data = items,
|
||||
TotalCount = totalCount,
|
||||
CategoryList= categoryList,
|
||||
PageNumber = dto.PageNumber,
|
||||
PageSize = dto.PageSize
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<List<ItemColor>> GetItemColor(ItemDto itemDto)
|
||||
{
|
||||
var colors = await _dbContext.ItemColors
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using CPRNIMS.Domain.Contracts.PR;
|
||||
using CPRNIMS.Infrastructure.Database;
|
||||
using CPRNIMS.Infrastructure.Dto.Items;
|
||||
using CPRNIMS.Infrastructure.Dto.PR;
|
||||
using CPRNIMS.Infrastructure.Entities.Common;
|
||||
using CPRNIMS.Infrastructure.Entities.Purchasing;
|
||||
@ -40,31 +41,353 @@ namespace CPRNIMS.Domain.Services.PR
|
||||
{
|
||||
return await _dbContext.ProjectCodes.ToListAsync();
|
||||
}
|
||||
public async Task<List<RemovedPR>> GetRemovedPR(PRDto pRDto)
|
||||
public async Task<PagedResult<DeletedPR>> GetDeletedPR(PRDto dto)
|
||||
{
|
||||
var allItems = await _dbContext.RemovedPRs
|
||||
.FromSqlRaw("EXEC GetRemovedPR @UserId",
|
||||
new SqlParameter("@UserId", pRDto.UserId)).ToListAsync();
|
||||
var parameters = new[]
|
||||
{
|
||||
new SqlParameter("@UserId", dto.UserId),
|
||||
new SqlParameter("@IsArchived", dto.IsArchived),
|
||||
new SqlParameter("@SearchPRNo", dto.SearchPRNo ?? ""),
|
||||
new SqlParameter("@SearchItemName", dto.SearchItemName ?? ""),
|
||||
new SqlParameter("@SearchDept", dto.SearchDept ?? ""),
|
||||
new SqlParameter("@PageNumber", dto.PageNumber),
|
||||
new SqlParameter("@PageSize", dto.PageSize)
|
||||
};
|
||||
|
||||
return allItems ?? new List<RemovedPR>();
|
||||
int totalCount = 0;
|
||||
var items = new List<DeletedPR>();
|
||||
|
||||
var conn = _dbContext.Database.GetDbConnection();
|
||||
await conn.OpenAsync();
|
||||
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"EXEC GetDeletedPR @UserId,
|
||||
@SearchPRNo, @SearchItemName, @SearchDept,
|
||||
@PageNumber, @PageSize";
|
||||
foreach (var p in parameters) cmd.Parameters.Add(p);
|
||||
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
// First result set = total count
|
||||
if (await reader.ReadAsync())
|
||||
totalCount = reader.GetInt32(0);
|
||||
|
||||
// Second result set = paged rows
|
||||
await reader.NextResultAsync();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
items.Add(new DeletedPR
|
||||
{
|
||||
PRId = reader["PRId"] as long? ?? 0,
|
||||
PRNo = reader["PRNo"] as long? ?? 0,
|
||||
PRDetailsId = reader["PRDetailsId"] as long? ?? 0,
|
||||
ItemNo = reader["ItemNo"] as long? ?? 0,
|
||||
ItemName = reader["ItemName"]?.ToString(),
|
||||
Department = reader["Department"]?.ToString(),
|
||||
Remarks = reader["Remarks"]?.ToString(),
|
||||
DateNeeded = reader["DateNeeded"] as DateTime? ?? DateTime.UtcNow,
|
||||
CreatedDate = reader["CreatedDate"] as DateTime? ?? DateTime.UtcNow,
|
||||
AttestedDate = reader["AttestedDate"]?.ToString(),
|
||||
ApprovedDate = reader["ApprovedDate"]?.ToString(),
|
||||
ApprovedBy = reader["ApprovedBy"]?.ToString(),
|
||||
AttestedBy = reader["AttestedBy"]?.ToString(),
|
||||
CreatedBy = reader["CreatedBy"]?.ToString(),
|
||||
Qty = Convert.ToDecimal(reader["Qty"])
|
||||
});
|
||||
}
|
||||
|
||||
await conn.CloseAsync();
|
||||
|
||||
return new PagedResult<DeletedPR>
|
||||
{
|
||||
Data = items,
|
||||
TotalCount = totalCount,
|
||||
PageNumber = dto.PageNumber,
|
||||
PageSize = dto.PageSize
|
||||
};
|
||||
}
|
||||
public async Task<List<ApprovedPR>> GetApprovedPR(PRDto pRDto)
|
||||
public async Task<PagedResult<DetailedPRTracking>> GetDetailedPRTracking(PRDto dto)
|
||||
{
|
||||
var allItems = await _dbContext.ApprovedPrs
|
||||
.FromSqlRaw("EXEC GetApprovedPR @UserId",
|
||||
new SqlParameter("@UserId", pRDto.UserId)).ToListAsync();
|
||||
var parameters = new[]
|
||||
{
|
||||
new SqlParameter("@UserId", dto.UserId),
|
||||
new SqlParameter("@SearchPRNo", dto.SearchPRNo ?? ""),
|
||||
new SqlParameter("@SearchItemNo", dto.SearchItemNo ?? ""),
|
||||
new SqlParameter("@SearchItemName", dto.SearchItemName ?? ""),
|
||||
new SqlParameter("@SearchDept", dto.SearchDept ?? ""),
|
||||
new SqlParameter("@SearchStatusName", dto.SearchStatusName ?? ""),
|
||||
new SqlParameter("@PageNumber", dto.PageNumber),
|
||||
new SqlParameter("@PageSize", dto.PageSize)
|
||||
};
|
||||
|
||||
return allItems ?? new List<ApprovedPR>();
|
||||
var statusList = new List<string>();
|
||||
int totalCount = 0;
|
||||
var items = new List<DetailedPRTracking>();
|
||||
|
||||
var conn = _dbContext.Database.GetDbConnection();
|
||||
await conn.OpenAsync();
|
||||
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"EXEC GetDetailedPRTracking @UserId,
|
||||
@SearchPRNo, @SearchItemNo, @SearchItemName, @SearchDept, @SearchStatusName,
|
||||
@PageNumber, @PageSize";
|
||||
foreach (var p in parameters) cmd.Parameters.Add(p);
|
||||
cmd.CommandTimeout = 60;
|
||||
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
while (await reader.ReadAsync())
|
||||
statusList.Add(reader.GetString(0));
|
||||
|
||||
await reader.NextResultAsync();
|
||||
if (await reader.ReadAsync())
|
||||
totalCount = reader.GetInt32(0);
|
||||
|
||||
await reader.NextResultAsync();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
items.Add(new DetailedPRTracking
|
||||
{
|
||||
PRNo = Convert.ToInt64(reader["PRNo"]),
|
||||
PRDetailsId = Convert.ToInt64(reader["PRDetailsId"]),
|
||||
PRBy = reader["PRBy"]?.ToString(),
|
||||
PRTypeName = reader["PRTypeName"]?.ToString(),
|
||||
PRDate = reader["PRDate"] as DateTime? ?? DateTime.UtcNow,
|
||||
AttestedBy = reader["AttestedBy"]?.ToString(),
|
||||
ApprovedBy = reader["ApprovedBy"]?.ToString(),
|
||||
CanvassDate = reader["CanvassDate"]?.ToString(),
|
||||
CanvassBy = reader["CanvassBy"]?.ToString(),
|
||||
CanvassNo = reader["CanvassNo"]?.ToString(),
|
||||
PONo = reader["PONo"]?.ToString(),
|
||||
POBy = reader["POBy"]?.ToString(),
|
||||
POQty = Convert.ToDecimal(reader["POQty"]),
|
||||
PODate = reader["PODate"]?.ToString(),
|
||||
RRDate = reader["RRDate"]?.ToString(),
|
||||
ReceivedDate = reader["ReceivedDate"]?.ToString(),
|
||||
ReceivedBy = reader["ReceivedBy"]?.ToString(),
|
||||
AcknowledgeBy = reader["AcknowledgeBy"]?.ToString(),
|
||||
AcknowledgeDate = reader["AcknowledgeDate"]?.ToString(),
|
||||
Specification = reader["Specification"]?.ToString(),
|
||||
RRNo = Convert.ToInt64(reader["RRNo"]),
|
||||
Department = reader["Department"]?.ToString(),
|
||||
ItemCategoryName = reader["ItemCategoryName"]?.ToString(),
|
||||
ItemName = reader["ItemName"]?.ToString(),
|
||||
ItemDescription = reader["ItemDescription"]?.ToString(),
|
||||
Status = Convert.ToInt16(reader["Status"]),
|
||||
StatusName = reader["StatusName"]?.ToString(),
|
||||
NewPRNo = reader["NewPRNo"]?.ToString(),
|
||||
DateNeeded = reader["DateNeeded"] as DateTime? ?? DateTime.UtcNow,
|
||||
ItemNo = Convert.ToInt64(reader["ItemNo"]),
|
||||
Qty = Convert.ToDecimal(reader["Qty"]),
|
||||
QuantityReceived = Convert.ToDecimal(reader["QuantityReceived"]),
|
||||
UOMName = reader["UOMName"]?.ToString(),
|
||||
ItemAttachPath = reader["ItemAttachPath"]?.ToString(),
|
||||
Remarks = reader["Remarks"]?.ToString(),
|
||||
});
|
||||
}
|
||||
|
||||
await conn.CloseAsync();
|
||||
|
||||
return new PagedResult<DetailedPRTracking>
|
||||
{
|
||||
Data = items,
|
||||
TotalCount = totalCount,
|
||||
PageNumber = dto.PageNumber,
|
||||
PageSize = dto.PageSize,
|
||||
StatusList = statusList
|
||||
};
|
||||
}
|
||||
public async Task<List<Infrastructure.Entities.Purchasing.PRList>> GetAllPR(PRDto PRDto)
|
||||
public async Task<PagedResult<ApprovedPR>> GetApprovedPR(PRDto dto)
|
||||
{
|
||||
var allItems = await _dbContext.PRLists
|
||||
.FromSqlRaw($"EXEC GetAllPR @UserId,@IsArchived",
|
||||
new SqlParameter("@UserId", PRDto.UserId),
|
||||
new SqlParameter("@IsArchived", PRDto.IsArchived))
|
||||
.ToListAsync();
|
||||
var parameters = new[]
|
||||
{
|
||||
new SqlParameter("@UserId", dto.UserId),
|
||||
new SqlParameter("@SearchPRNo", dto.SearchPRNo ?? ""),
|
||||
new SqlParameter("@SearchItemName", dto.SearchItemName ?? ""),
|
||||
new SqlParameter("@SearchDept", dto.SearchDept ?? ""),
|
||||
new SqlParameter("@SearchStatusName", dto.SearchStatusName ?? ""),
|
||||
new SqlParameter("@PageNumber", dto.PageNumber),
|
||||
new SqlParameter("@PageSize", dto.PageSize)
|
||||
};
|
||||
|
||||
return allItems ?? new List<Infrastructure.Entities.Purchasing.PRList>();
|
||||
var statusList = new List<string>();
|
||||
int totalCount = 0;
|
||||
var items = new List<ApprovedPR>();
|
||||
|
||||
var conn = _dbContext.Database.GetDbConnection();
|
||||
await conn.OpenAsync();
|
||||
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"EXEC GetApprovedPR @UserId,
|
||||
@SearchPRNo, @SearchItemName, @SearchDept, @SearchStatusName,
|
||||
@PageNumber, @PageSize";
|
||||
foreach (var p in parameters) cmd.Parameters.Add(p);
|
||||
cmd.CommandTimeout = 60;
|
||||
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
// Result set 1 — distinct status list
|
||||
while (await reader.ReadAsync())
|
||||
statusList.Add(reader.GetString(0));
|
||||
|
||||
// Result set 2 — total count
|
||||
await reader.NextResultAsync();
|
||||
if (await reader.ReadAsync())
|
||||
totalCount = reader.GetInt32(0);
|
||||
|
||||
// Result set 3 — paged rows
|
||||
await reader.NextResultAsync();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
items.Add(new ApprovedPR
|
||||
{
|
||||
PRId = reader["PRId"] as long? ?? 0,
|
||||
PRNo = reader["PRNo"] as long? ?? 0,
|
||||
PRDetailsId = reader["PRDetailsId"] as long? ?? 0,
|
||||
ItemNo = reader["ItemNo"] as long? ?? 0,
|
||||
ItemName = reader["ItemName"]?.ToString(),
|
||||
Department = reader["Department"]?.ToString(),
|
||||
StatusName = reader["StatusName"]?.ToString(),
|
||||
DateNeeded = reader["DateNeeded"] as DateTime? ?? DateTime.UtcNow,
|
||||
CreatedDate = reader["CreatedDate"] as DateTime? ?? DateTime.UtcNow,
|
||||
AttestedDate = reader["AttestedDate"]?.ToString(),
|
||||
ApprovedDate = reader["ApprovedDate"]?.ToString(),
|
||||
Qty = Convert.ToDecimal(reader["Qty"]),
|
||||
ApprovedBy = reader["ApprovedBy"]?.ToString(),
|
||||
AttestedBy = reader["AttestedBy"]?.ToString(),
|
||||
CreatedBy = reader["CreatedBy"]?.ToString(),
|
||||
RemainingDays = reader["RemainingDays"] as int? ?? 0,
|
||||
});
|
||||
}
|
||||
|
||||
await conn.CloseAsync();
|
||||
|
||||
return new PagedResult<ApprovedPR>
|
||||
{
|
||||
Data = items,
|
||||
TotalCount = totalCount,
|
||||
PageNumber = dto.PageNumber,
|
||||
PageSize = dto.PageSize,
|
||||
StatusList = statusList
|
||||
};
|
||||
}
|
||||
public async Task<PagedResult<Infrastructure.Entities.Purchasing.PRList>> GetAllPR(PRDto dto)
|
||||
{
|
||||
var parameters = new[]
|
||||
{
|
||||
new SqlParameter("@UserId", dto.UserId),
|
||||
new SqlParameter("@SearchPRNo", dto.SearchPRNo ?? ""),
|
||||
new SqlParameter("@SearchItemName", dto.SearchItemName ?? ""),
|
||||
new SqlParameter("@SearchDept", dto.SearchDept ?? ""),
|
||||
new SqlParameter("@PageNumber", dto.PageNumber),
|
||||
new SqlParameter("@PageSize", dto.PageSize)
|
||||
};
|
||||
|
||||
int totalCount = 0;
|
||||
var items = new List<Infrastructure.Entities.Purchasing.PRList>();
|
||||
|
||||
var conn = _dbContext.Database.GetDbConnection();
|
||||
await conn.OpenAsync();
|
||||
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"EXEC GetAllPR @UserId,
|
||||
@SearchPRNo, @SearchItemName, @SearchDept,
|
||||
@PageNumber, @PageSize";
|
||||
foreach (var p in parameters) cmd.Parameters.Add(p);
|
||||
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
if (await reader.ReadAsync())
|
||||
totalCount = reader.GetInt32(0);
|
||||
|
||||
await reader.NextResultAsync();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
items.Add(new Infrastructure.Entities.Purchasing.PRList
|
||||
{
|
||||
PRId = reader["PRId"] as long? ?? 0,
|
||||
PRNo = reader["PRNo"] as long? ?? 0,
|
||||
NewPRNo = reader["NewPRNo"]?.ToString(),
|
||||
AggreItemName = reader["AggreItemName"]?.ToString(),
|
||||
CreatedDate = reader["NewPRNo"] as DateTime? ?? DateTime.UtcNow,
|
||||
DateNeeded = reader["DateNeeded"] as DateTime? ?? DateTime.UtcNow,
|
||||
CreatedBy = reader["CreatedBy"]?.ToString(),
|
||||
Department = reader["Department"]?.ToString(),
|
||||
ApprovedBy = reader["ApprovedBy"]?.ToString(),
|
||||
AttestedBy = reader["AttestedBy"]?.ToString(),
|
||||
Remarks = reader["Remarks"]?.ToString(),
|
||||
Status = reader["Status"] as short? ?? 0,
|
||||
});
|
||||
}
|
||||
|
||||
await conn.CloseAsync();
|
||||
|
||||
return new PagedResult<Infrastructure.Entities.Purchasing.PRList>
|
||||
{
|
||||
Data = items,
|
||||
TotalCount = totalCount,
|
||||
PageNumber = dto.PageNumber,
|
||||
PageSize = dto.PageSize
|
||||
};
|
||||
}
|
||||
public async Task<PagedResult<Infrastructure.Entities.Purchasing.PRList>> GetPRArchived(PRDto dto)
|
||||
{
|
||||
var parameters = new[]
|
||||
{
|
||||
new SqlParameter("@UserId", dto.UserId),
|
||||
new SqlParameter("@SearchPRNo", dto.SearchPRNo ?? ""),
|
||||
new SqlParameter("@SearchItemName", dto.SearchItemName ?? ""),
|
||||
new SqlParameter("@SearchDept", dto.SearchDept ?? ""),
|
||||
new SqlParameter("@PageNumber", dto.PageNumber),
|
||||
new SqlParameter("@PageSize", dto.PageSize)
|
||||
};
|
||||
|
||||
int totalCount = 0;
|
||||
var items = new List<Infrastructure.Entities.Purchasing.PRList>();
|
||||
|
||||
var conn = _dbContext.Database.GetDbConnection();
|
||||
await conn.OpenAsync();
|
||||
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"EXEC GetPRArchived @UserId,
|
||||
@SearchPRNo, @SearchItemName, @SearchDept,
|
||||
@PageNumber, @PageSize";
|
||||
foreach (var p in parameters) cmd.Parameters.Add(p);
|
||||
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
if (await reader.ReadAsync())
|
||||
totalCount = reader.GetInt32(0);
|
||||
|
||||
await reader.NextResultAsync();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
items.Add(new Infrastructure.Entities.Purchasing.PRList
|
||||
{
|
||||
PRId = reader["PRId"] as long? ?? 0,
|
||||
PRNo = reader["PRNo"] as long? ?? 0,
|
||||
NewPRNo = reader["NewPRNo"]?.ToString(),
|
||||
AggreItemName = reader["AggreItemName"]?.ToString(),
|
||||
CreatedDate = reader["NewPRNo"] as DateTime? ?? DateTime.UtcNow,
|
||||
DateNeeded = reader["DateNeeded"] as DateTime? ?? DateTime.UtcNow,
|
||||
CreatedBy = reader["CreatedBy"]?.ToString(),
|
||||
Department = reader["Department"]?.ToString(),
|
||||
ApprovedBy = reader["ApprovedBy"]?.ToString(),
|
||||
AttestedBy = reader["AttestedBy"]?.ToString(),
|
||||
Remarks = reader["Remarks"]?.ToString(),
|
||||
Status = reader["Status"] as short? ?? 0,
|
||||
});
|
||||
}
|
||||
|
||||
await conn.CloseAsync();
|
||||
|
||||
return new PagedResult<Infrastructure.Entities.Purchasing.PRList>
|
||||
{
|
||||
Data = items,
|
||||
TotalCount = totalCount,
|
||||
PageNumber = dto.PageNumber,
|
||||
PageSize = dto.PageSize
|
||||
};
|
||||
}
|
||||
public async Task<List<PRDto>> GetApproverNameByPRNo(PRDto PRDto)
|
||||
{
|
||||
@ -90,7 +413,6 @@ namespace CPRNIMS.Domain.Services.PR
|
||||
|
||||
return new List<PRDto>();
|
||||
}
|
||||
|
||||
public async Task<List<PRDto>> GetApproverName(PRDto PRDto)
|
||||
{
|
||||
var result = await _dbContext.Approved
|
||||
@ -206,14 +528,6 @@ namespace CPRNIMS.Domain.Services.PR
|
||||
|
||||
return new List<Infrastructure.Entities.Canvass.PRList>();
|
||||
}
|
||||
public async Task<List<RRReport>> GetDetailedPRTracking(PRDto PRDto)
|
||||
{
|
||||
var allItems = await _dbContext.DetailedPRTrackings
|
||||
.FromSqlRaw("EXEC GetDetailedPRTracking @UserId",
|
||||
new SqlParameter("@UserId", PRDto.UserId)).ToListAsync();
|
||||
|
||||
return allItems ?? new List<RRReport>();
|
||||
}
|
||||
public async Task<List<AlternativeOffer>> GetSupplierAlternativeOffer(PRDto PRDto)
|
||||
{
|
||||
var rfq = await _dbContext.AlternativeOffers
|
||||
|
||||
@ -13,7 +13,8 @@ namespace CPRNIMS.Domain.UIContracts.Items
|
||||
{
|
||||
public interface IItem
|
||||
{
|
||||
Task<List<ItemVM>> GetItemList(User user, ItemVM viewModel);
|
||||
Task<PagedResult<ItemVM>> GetItemList(
|
||||
User user, ItemVM viewModel);
|
||||
Task<List<ItemVM>> GetItemDetail(User user, ItemVM viewModel);
|
||||
Task<List<ItemVM>> GetItemCateg(User user, ItemVM viewModel);
|
||||
Task<List<ItemVM>> GetItemLocalization(User userd, ItemVM viewModel);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using CPRNIMS.Infrastructure.Models.Account;
|
||||
using CPRNIMS.Infrastructure.Dto.Items;
|
||||
using CPRNIMS.Infrastructure.Models.Account;
|
||||
using CPRNIMS.Infrastructure.ViewModel.PR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,9 +12,11 @@ namespace CPRNIMS.Domain.UIContracts.PR
|
||||
public interface IPRequest
|
||||
{
|
||||
#region Get
|
||||
Task<List<PRVM>> GetAllPR(User user, PRVM viewModel);
|
||||
Task<List<PRVM>?> GetApprovedPR(User user, PRVM viewModels);
|
||||
Task<List<PRVM>?> GetRemovedPR(User user, PRVM viewModels);
|
||||
Task<PagedResult<PRVM>> GetAllPR(User user, PRVM viewModel);
|
||||
Task<PagedResult<PRVM>> GetDetailedPRTracking(User user, PRVM viewModel);
|
||||
Task<PagedResult<PRVM>> GetPRArchived(User user, PRVM viewModel);
|
||||
Task<PagedResult<PRVM>> GetApprovedPR(User user, PRVM viewModels);
|
||||
Task<PagedResult<PRVM>> GetDeletedPR(User user, PRVM viewModels);
|
||||
Task<List<PRVM>?> GetApproverName(User user, PRVM viewModels);
|
||||
Task<List<PRVM>?> GetApproverNameByPRNo(User user, PRVM viewModels);
|
||||
Task<List<PRVM>> GetForReceiving(User user, PRVM viewModel);
|
||||
@ -22,11 +25,9 @@ namespace CPRNIMS.Domain.UIContracts.PR
|
||||
Task<List<PRVM>> GetPRByRRId(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetRRDetailByPO(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetPRStatusById(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetPRArchived(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetMyPR(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetPRDetailByPRNo(User user, PRVM viewModel);
|
||||
Task<List<PRVM>?> GetPRListByPRNo(User user, PRVM viewModels);
|
||||
Task<List<PRVM>?> GetDetailedPRTracking(User user, PRVM viewModel);
|
||||
Task<List<PRVM>?> GetSupplierAlternativeOffer(User user, PRVM viewModel);
|
||||
Task<List<PRVM>?> GetSupplierAlterOfferDetails(User user, PRVM viewModel);
|
||||
Task<List<PRVM>?> GetProjectCodes(User user, PRVM viewModels);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using CPRNIMS.Domain.UIContracts.Common;
|
||||
using CPRNIMS.Domain.UIContracts.Items;
|
||||
using CPRNIMS.Infrastructure.Dto.Items;
|
||||
using CPRNIMS.Infrastructure.Helper;
|
||||
using CPRNIMS.Infrastructure.Models.Account;
|
||||
using CPRNIMS.Infrastructure.Models.Common;
|
||||
@ -31,7 +32,61 @@ namespace CPRNIMS.Domain.UIServices.Items
|
||||
_apiConfigurationService = apiConfigurationService;
|
||||
}
|
||||
#region SendRequest service
|
||||
public async Task<PagedResult<ItemVM>> GetItemList(
|
||||
Infrastructure.Models.Account.User user, ItemVM viewModel)
|
||||
{
|
||||
return await SendGetPageListApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:ItemMgmt:GetItemList"]);
|
||||
}
|
||||
public async Task<PagedResult<ItemVM>> SendGetPageListApiRequest
|
||||
(Infrastructure.Models.Account.User user,ItemVM viewModel,string apiEndpoint)
|
||||
{
|
||||
var token = await _tokenHelper.GetValidTokenAsync();
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
// Handle token retrieval failure
|
||||
return null;
|
||||
}
|
||||
|
||||
viewModel.UserId = user.UserId;
|
||||
var jsonContent = JsonSerializer.Serialize(viewModel);
|
||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||
|
||||
using (var httpClient = _apiConfigurationService.CreateHttpClientWithDefaultHeaders(token))
|
||||
{
|
||||
HttpResponseMessage response;
|
||||
|
||||
response = await httpClient.PostAsync(apiEndpoint, content);
|
||||
var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
};
|
||||
viewModel.messCode = 1;
|
||||
var myArtWork = JsonSerializer.Deserialize<PagedResult<ItemVM>>(jsonResponse, options);
|
||||
return myArtWork;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var myArtWork = JsonSerializer.Deserialize<PagedResult<ItemVM>>(jsonResponse);
|
||||
viewModel.messCode = 0;
|
||||
viewModel.message = "Bad request";
|
||||
return myArtWork;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public async Task<ItemVM> SendPostApiRequest(Infrastructure.Models.Account.User user,
|
||||
ItemVM viewModel, string apiEndpoint)
|
||||
{
|
||||
@ -146,13 +201,13 @@ namespace CPRNIMS.Domain.UIServices.Items
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:ItemMgmt:GetItemCart"]);
|
||||
}
|
||||
public async Task<List<ItemVM>> GetItemList(Infrastructure.Models.Account.User user,
|
||||
/* public async Task<List<ItemVM>> GetItemList(Infrastructure.Models.Account.User user,
|
||||
ItemVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:ItemMgmt:GetItemList"]);
|
||||
}
|
||||
|
||||
*/
|
||||
public async Task<List<ItemVM>> GetItemCateg(Infrastructure.Models.Account.User user, ItemVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using CPRNIMS.Domain.UIContracts.Common;
|
||||
using CPRNIMS.Domain.UIContracts.PR;
|
||||
using CPRNIMS.Infrastructure.Dto.Items;
|
||||
using CPRNIMS.Infrastructure.Helper;
|
||||
using CPRNIMS.Infrastructure.Models.Account;
|
||||
using CPRNIMS.Infrastructure.Models.Common;
|
||||
@ -130,10 +131,80 @@ namespace CPRNIMS.Domain.UIServices.PR
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetApproverNameByPRNo"]);
|
||||
}
|
||||
public async Task<List<PRVM>> GetAllPR(User user, PRVM viewModel)
|
||||
public async Task<PagedResult<PRVM>> GetAllPR(
|
||||
User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetAllPR"]);
|
||||
return await SendGetPageListApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetAllPR"]);
|
||||
}
|
||||
public async Task<PagedResult<PRVM>> GetPRArchived(
|
||||
User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetPageListApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetPRArchived"]);
|
||||
}
|
||||
public async Task<PagedResult<PRVM>> GetDeletedPR(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetPageListApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetDeletedPR"]);
|
||||
}
|
||||
public async Task<PagedResult<PRVM>> GetApprovedPR(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetPageListApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetApprovedPR"]);
|
||||
}
|
||||
public async Task<PagedResult<PRVM>> GetDetailedPRTracking(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetPageListApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetDetailedPRTracking"]);
|
||||
}
|
||||
public async Task<PagedResult<PRVM>> SendGetPageListApiRequest
|
||||
(User user, PRVM viewModel, string apiEndpoint)
|
||||
{
|
||||
var token = await _tokenHelper.GetValidTokenAsync();
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
viewModel.UserId = user.UserId;
|
||||
var jsonContent = JsonSerializer.Serialize(viewModel);
|
||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||
|
||||
using (var httpClient = _apiConfigurationService.CreateHttpClientWithDefaultHeaders(token))
|
||||
{
|
||||
HttpResponseMessage response;
|
||||
|
||||
response = await httpClient.PostAsync(apiEndpoint, content);
|
||||
var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
};
|
||||
viewModel.messCode = 1;
|
||||
var myArtWork = JsonSerializer.Deserialize<PagedResult<PRVM>>(jsonResponse, options);
|
||||
return myArtWork;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var myArtWork = JsonSerializer.Deserialize<PagedResult<PRVM>>(jsonResponse);
|
||||
viewModel.messCode = 0;
|
||||
viewModel.message = "Bad request";
|
||||
return myArtWork;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public async Task<List<PRVM>> GetMyPR(User user, PRVM viewModel)
|
||||
{
|
||||
@ -175,21 +246,11 @@ namespace CPRNIMS.Domain.UIServices.PR
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetDashBoard"]);
|
||||
}
|
||||
public async Task<List<PRVM>> GetPRArchived(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetPRArchived"]);
|
||||
}
|
||||
public async Task<List<PRVM>?> GetPRListByPRNo(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetPRListByPRNo"]);
|
||||
}
|
||||
public async Task<List<PRVM>?> GetDetailedPRTracking(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetDetailedPRTracking"]);
|
||||
}
|
||||
public async Task<List<PRVM>?> GetSupplierAlternativeOffer(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
@ -200,17 +261,6 @@ namespace CPRNIMS.Domain.UIServices.PR
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetSupplierAlterOfferDetails"]);
|
||||
}
|
||||
public async Task<List<PRVM>?> GetApprovedPR(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetApprovedPR"]);
|
||||
}
|
||||
|
||||
public async Task<List<PRVM>?> GetRemovedPR(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetRemovedPR"]);
|
||||
}
|
||||
#endregion
|
||||
#region POST PUT
|
||||
public async Task<PRVM> PostPRApproveReject(User user, PRVM viewModel)
|
||||
|
||||
@ -45,7 +45,7 @@ namespace CPRNIMS.Infrastructure.Database
|
||||
public virtual DbSet<PR> PRs { get; set; }
|
||||
public virtual DbSet<Approved> Approved { get; set; }
|
||||
public virtual DbSet<ApprovedPR> ApprovedPrs { get; set; }
|
||||
public virtual DbSet<RemovedPR> RemovedPRs { get; set; }
|
||||
public virtual DbSet<DeletedPR> DeletedPRs { get; set; }
|
||||
public virtual DbSet<SMTPCredential> SMTPCredentials { get; set; }
|
||||
public virtual DbSet<PRDetails> PRDetails { get; set; }
|
||||
public virtual DbSet<PRItemList> PRItemLists { get; set; }
|
||||
@ -115,7 +115,7 @@ namespace CPRNIMS.Infrastructure.Database
|
||||
public virtual DbSet<PaymentTerm> PaymentTerms { get; set; }
|
||||
public virtual DbSet<Incoterm> Incoterms { get; set; }
|
||||
public virtual DbSet<CentralPONo> CentralPONos { get; set; }
|
||||
public virtual DbSet<RRReport> DetailedPRTrackings { get; set; }
|
||||
public virtual DbSet<DetailedPRTracking> DetailedPRTrackings { get; set; }
|
||||
public DbSet<IncomingShipment> IncomingShipments { get; set; }
|
||||
public virtual DbSet<IncomingShipmentDto> IncomingShipmentDtos { get; set; }
|
||||
|
||||
@ -135,7 +135,7 @@ namespace CPRNIMS.Infrastructure.Database
|
||||
.Property(e => e.CanvassSupplierId)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
modelBuilder.Entity<RRReport>(b =>
|
||||
modelBuilder.Entity<DetailedPRTracking>(b =>
|
||||
{
|
||||
b.ToTable("DetailsedPRTracking");
|
||||
b.HasNoKey();
|
||||
|
||||
@ -23,5 +23,11 @@ namespace CPRNIMS.Infrastructure.Dto.Items
|
||||
public string? FileName { get; set; }
|
||||
public short Status { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public int PageNumber { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public string? SearchTerm { get; set; }
|
||||
public string? SearchItemNo { get; set; }
|
||||
public string? SearchItemName { get; set; }
|
||||
public string? SearchCategory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,5 +119,7 @@ namespace CPRNIMS.Infrastructure.Dto.Items
|
||||
public long PRId { get; set; }
|
||||
public string? FileName { get; set; }
|
||||
public string? OrigFileName { get; set; }
|
||||
public int PageNumber { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
}
|
||||
}
|
||||
|
||||
18
CPRNIMS.Infrastructure/Dto/Items/PagedResult.cs
Normal file
18
CPRNIMS.Infrastructure/Dto/Items/PagedResult.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CPRNIMS.Infrastructure.Dto.Items
|
||||
{
|
||||
public class PagedResult<T>
|
||||
{
|
||||
public List<T> Data { get; set; }= new List<T>();
|
||||
public int TotalCount { get; set; }
|
||||
public int PageNumber { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public List<string> StatusList { get; set; }= new List<string>();
|
||||
public List<string> CategoryList { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
@ -134,5 +134,12 @@ namespace CPRNIMS.Infrastructure.Dto.PR
|
||||
public long PRId { get; set; }
|
||||
public string? FileName { get; set; }
|
||||
public string? OrigFileName { get; set; }
|
||||
public string SearchPRNo { get; set; } = "";
|
||||
public string SearchItemName { get; set; } = "";
|
||||
public string SearchDept { get; set; } = "";
|
||||
public int PageNumber { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
public string SearchItemNo { get; set; } = string.Empty;
|
||||
public string? SearchStatusName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,16 +15,12 @@ namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
public long PRId { get; set; }
|
||||
public long ItemNo { get; set; }
|
||||
public string? ItemName { get; set; }
|
||||
public string? ItemDescription { get; set; }
|
||||
public string? Department { get; set; }
|
||||
public string? ItemCategoryName { get; set; }
|
||||
public string? Remarks { get; set; }
|
||||
public string? StatusName { get; set; }
|
||||
public DateTime DateNeeded { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string? AttestedDate { get; set; }
|
||||
public string? ApprovedDate { get; set; }
|
||||
public string? UOMName { get; set; }
|
||||
public decimal Qty { get; set; }
|
||||
public string? ApprovedBy { get; set; }
|
||||
public string? AttestedBy { get; set; }
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
{
|
||||
public class RemovedPR
|
||||
public class DeletedPR
|
||||
{
|
||||
[Key]
|
||||
public long PRDetailsId { get; set; }
|
||||
@ -15,16 +15,12 @@ namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
public long PRId { get; set; }
|
||||
public long ItemNo { get; set; }
|
||||
public string? ItemName { get; set; }
|
||||
public string? ItemDescription { get; set; }
|
||||
public string? Department { get; set; }
|
||||
public string? ItemCategoryName { get; set; }
|
||||
public string? Remarks { get; set; }
|
||||
public string? StatusName { get; set; }
|
||||
public DateTime DateNeeded { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string? AttestedDate { get; set; }
|
||||
public string? ApprovedDate { get; set; }
|
||||
public string? UOMName { get; set; }
|
||||
public decimal Qty { get; set; }
|
||||
public string? ApprovedBy { get; set; }
|
||||
public string? AttestedBy { get; set; }
|
||||
@ -8,12 +8,14 @@ using System.Threading.Tasks;
|
||||
namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
{
|
||||
[Keyless]
|
||||
public class RRReport
|
||||
public class DetailedPRTracking
|
||||
{
|
||||
public long PRDetailsId { get; set; }
|
||||
public string? PRBy { get; set; }
|
||||
public string? PRTypeName { get; set; }
|
||||
public DateTime PRDate { get; set; }
|
||||
public long PRNo { get; set; }
|
||||
public decimal Qty { get; set; }
|
||||
public string? AttestedBy { get; set; }
|
||||
public string? ApprovedBy { get; set; }
|
||||
public string? CanvassDate { get; set; }
|
||||
@ -21,6 +23,7 @@ namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
public string? CanvassNo { get; set; }
|
||||
public string? PONo { get; set; }
|
||||
public string? POBy { get; set; }
|
||||
public decimal POQty { get; set; }
|
||||
public string? PODate { get; set; }
|
||||
public string? RRDate { get; set; }
|
||||
public string? ReceivedDate { get; set; }
|
||||
@ -38,11 +41,10 @@ namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
public string? NewPRNo { get; set; }
|
||||
public DateTime DateNeeded { get; set; }
|
||||
public long ItemNo { get; set; }
|
||||
public decimal Qty { get; set; }
|
||||
public decimal QuantityReceived { get; set; }
|
||||
public string? UOMName { get; set; }
|
||||
public string? ItemAttachPath { get; set; }
|
||||
public long PRNo { get; set; }
|
||||
|
||||
public string? Remarks { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,30 +11,17 @@ namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
public class PRList : CommonProperties
|
||||
{
|
||||
[Key]
|
||||
public long PRDetailsId { get; set; }
|
||||
public long ItemCodeId { get; set; }
|
||||
public short ItemClassId { get; set; }
|
||||
public long PRId { get; set; }
|
||||
public long PRNo { get; set; }
|
||||
public string? Department { get; set; }
|
||||
public string? ItemCategoryName { get; set; }
|
||||
public string? UserId { get; set; }
|
||||
public string? AttestedBy { get; set; }
|
||||
public string? ApprovedBy { get; set; }
|
||||
public decimal TotalAmount { get; set; }
|
||||
public string? ItemDescription { get; set; }
|
||||
public short Status { get; set; }
|
||||
public string? StatusName { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public long ItemNo { get; set; }
|
||||
public string? ItemLocalName { get; set; }
|
||||
public decimal Qty { get; set; }
|
||||
public string? NewPRNo { get; set; }
|
||||
public string? ItemClassName { get; set; }
|
||||
public string? UOMName { get; set; }
|
||||
public string? ItemColorName { get; set; }
|
||||
public long PRNo { get; set; }
|
||||
public long PRId { get; set; }
|
||||
public string? Remarks { get; set; }
|
||||
public DateTime DateNeeded { get; set; }
|
||||
public string? AggreItemName { get; set; }
|
||||
public string? Remarks { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,5 +61,12 @@ namespace CPRNIMS.Infrastructure.ViewModel.Items
|
||||
public string? ProjectCode { get; set; }
|
||||
public string? OrigFileName { get; set; }
|
||||
public string? ProjectName { get; set; }
|
||||
public string SearchTerm { get; set; } = "";
|
||||
public int PageNumber { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
public int TotalCount { get; set; }
|
||||
public string SearchItemNo { get; set; }=string.Empty;
|
||||
public string SearchItemName { get; set; } = string.Empty;
|
||||
public string SearchCategory { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ namespace CPRNIMS.Infrastructure.ViewModel.PR
|
||||
public class PRVM : CommonProperties
|
||||
{
|
||||
public byte messCode;
|
||||
public string message =string.Empty;
|
||||
public long ItemCodeId { get; set; }
|
||||
public long PRDetailsId { get; set; }
|
||||
public string? PRBy { get; set; }
|
||||
@ -22,6 +23,7 @@ namespace CPRNIMS.Infrastructure.ViewModel.PR
|
||||
public string? CanvassBy { get; set; }
|
||||
public string? PONo { get; set; }
|
||||
public string? PODate { get; set; }
|
||||
public decimal POQty { get; set; }
|
||||
public string? RRDate { get; set; }
|
||||
public string? ReceivedDate { get; set; }
|
||||
public string? ReceivedBy { get; set; }
|
||||
@ -135,6 +137,14 @@ namespace CPRNIMS.Infrastructure.ViewModel.PR
|
||||
public string? AttestedDate { get; set; }
|
||||
public string? ApprovedDate { get; set; }
|
||||
public int RemainingDays { get; set; }
|
||||
public string SearchPRNo { get; set; } = "";
|
||||
public string SearchItemName { get; set; } = "";
|
||||
public string SearchDept { get; set; } = "";
|
||||
public int PageNumber { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
public string SearchTerm { get; set; } = string.Empty;
|
||||
public string SearchStatusName { get; set; } = string.Empty;
|
||||
public string SearchItemNo { get; set; } = string.Empty;
|
||||
public ItemReceivingList? ItemList { get; set; }
|
||||
public PRList? PRList { get; set; }
|
||||
public PRItemListRequest? PRItemListRequest { get; set; }
|
||||
|
||||
@ -108,7 +108,7 @@ namespace CPRNIMS.WebApi.Controllers.Items
|
||||
PRId = dto.PRId
|
||||
};
|
||||
await _item.PostPutAttachment(attachment);
|
||||
await SendNotificationEmail(dto);
|
||||
//await SendNotificationEmail(dto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
|
||||
@ -327,11 +327,14 @@ namespace CPRNIMS.WebApps.Controllers.Items
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetItemList(string searchTerm = "", int pageNumber = 1, int pageSize = 10)
|
||||
public async Task<IActionResult> GetItemList(string searchItemNo = "", string searchItemName = "", string searchCategory = "",
|
||||
string searchStatusName = "", int pageNumber = 1, int pageSize = 10)
|
||||
{
|
||||
var viewModel = new ItemVM
|
||||
{
|
||||
SearchTerm = searchTerm,
|
||||
SearchItemName = searchItemName,
|
||||
SearchItemNo = searchItemNo,
|
||||
SearchCategory= searchCategory,
|
||||
PageNumber = pageNumber,
|
||||
PageSize = pageSize
|
||||
};
|
||||
@ -343,7 +346,8 @@ namespace CPRNIMS.WebApps.Controllers.Items
|
||||
draw = Request.Query["draw"].ToString(),
|
||||
recordsTotal = result.TotalCount,
|
||||
recordsFiltered = result.TotalCount,
|
||||
data = result.Data
|
||||
data = result.Data,
|
||||
categoryList = result.CategoryList
|
||||
});
|
||||
}
|
||||
public async Task<IActionResult> GetItemCateg(ItemVM viewModels)
|
||||
@ -574,34 +578,5 @@ namespace CPRNIMS.WebApps.Controllers.Items
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Commented
|
||||
//private DriveService _driveService;
|
||||
//public async Task<IActionResult> Index()
|
||||
//{
|
||||
// var filePath = "D:\\sourcecode\\test.txt";
|
||||
// var fileName = Path.GetFileName(filePath);
|
||||
// var mimeType = "text/plain"; // Assuming the file is a text file
|
||||
|
||||
// try
|
||||
// {
|
||||
// GoogleCredential credential = GoogleCredential.FromFile("path/to/service-account-key.json")
|
||||
// .CreateScoped(DriveService.ScopeConstants.Drive);
|
||||
|
||||
// // Create the Drive service using the service account credential
|
||||
// _driveService = new DriveService(new BaseClientService.Initializer
|
||||
// {
|
||||
// HttpClientInitializer = credential,
|
||||
// ApplicationName = "Your Application Name"
|
||||
// });
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// // Log the error or handle it appropriately
|
||||
// // For example, you can throw an exception or set _driveService to null
|
||||
// _driveService = null;
|
||||
// }
|
||||
// return View();
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,12 +72,13 @@ namespace CPRNIMS.WebApps.Controllers.PR
|
||||
});
|
||||
}
|
||||
public async Task<IActionResult> GetDetailedPRTracking(
|
||||
string searchPRNo = "", string searchItemName = "", string searchDept = "", string searchStatusName = "",
|
||||
string searchPRNo = "",string srchItemNo ="", string searchItemName = "", string searchDept = "", string searchStatusName = "",
|
||||
int pageNumber = 1, int pageSize = 10)
|
||||
{
|
||||
var dto = new PRVM
|
||||
{
|
||||
SearchPRNo = searchPRNo,
|
||||
SearchItemNo = srchItemNo,
|
||||
SearchItemName = searchItemName,
|
||||
SearchDept = searchDept,
|
||||
SearchStatusName = searchStatusName,
|
||||
|
||||
@ -10,28 +10,54 @@
|
||||
Add new
|
||||
</button>
|
||||
<br />
|
||||
<!-- Replace your existing customSearch input with this -->
|
||||
<div class="search-wrapper">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="customSearch" type="text"
|
||||
class="search-input"
|
||||
placeholder="Search by item name, description or category…"
|
||||
autocomplete="off" />
|
||||
<span class="search-clear" id="searchClear" title="Clear">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
|
||||
<path d="M18 6 6 18M6 6l12 12" />
|
||||
</svg>
|
||||
</span>
|
||||
<div class="d-flex flex-wrap gap-2 mb-2">
|
||||
|
||||
<div class="search-wrapper" style="min-width:150px; flex:1;">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="srchItemNo" class="search-input"
|
||||
placeholder="Item Number…" autocomplete="off" />
|
||||
<span class="search-clear aprv-search-clear"
|
||||
data-target="#srchItemNo" title="Clear">✕</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Item Name -->
|
||||
<div class="search-wrapper" style="min-width:200px; flex:2;">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="srchItem" class="search-input"
|
||||
placeholder="Item Name…" autocomplete="off" />
|
||||
<span class="search-clear aprv-search-clear"
|
||||
data-target="#srchItem" title="Clear">✕</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-wrapper" style="min-width:170px; flex:1;">
|
||||
<div class="search-inner" style="padding-right:4px;">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<path d="M3 6h18M7 12h10M11 18h2" />
|
||||
</svg>
|
||||
</span>
|
||||
<select id="srchCategory" class="search-input" style="cursor:pointer;">
|
||||
<option value="">All Categories</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-hint" id="searchHint">Start typing to search items…</div>
|
||||
</div>
|
||||
<table id="ItemTable" class="row-border" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
@ -258,7 +284,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="~/JsFunctions/Items/ItemManagementV9.js"></script>
|
||||
<script src="~/JsFunctions/Items/ItemManagement.js"></script>
|
||||
@await Html.PartialAsync("PagesView/Item/_Scripts")
|
||||
</div>
|
||||
|
||||
|
||||
@ -139,5 +139,5 @@
|
||||
</div>
|
||||
<link href="~/css/item/cartv2.css" rel="stylesheet" />
|
||||
@await Html.PartialAsync("PagesView/Item/_Scripts")
|
||||
<script src="~/JsFunctions/Items/ItemCartV3.js"></script>
|
||||
<script src="~/JsFunctions/Items/ItemCartV4.js"></script>
|
||||
</body>
|
||||
@ -33,28 +33,54 @@
|
||||
<h2 class="modal-title" id="addItemLabel">Item List</h2>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<!-- Inside #viewItemList modal, above the table -->
|
||||
<div class="search-wrapper mb-2">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="modalSearchInput" type="text"
|
||||
class="search-input"
|
||||
placeholder="Search by item name, description or category…"
|
||||
autocomplete="off" />
|
||||
<span class="search-clear" id="modalSearchClear" title="Clear">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
|
||||
<path d="M18 6 6 18M6 6l12 12" />
|
||||
</svg>
|
||||
</span>
|
||||
<div class="d-flex flex-wrap gap-2 mb-2">
|
||||
|
||||
<div class="search-wrapper" style="min-width:150px; flex:1;">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="srchItemNo" class="search-input"
|
||||
placeholder="Item Number…" autocomplete="off" />
|
||||
<span class="search-clear aprv-search-clear"
|
||||
data-target="#srchItemNo" title="Clear">✕</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Item Name -->
|
||||
<div class="search-wrapper" style="min-width:200px; flex:2;">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="srchIteName" class="search-input"
|
||||
placeholder="Item Name…" autocomplete="off" />
|
||||
<span class="search-clear aprv-search-clear"
|
||||
data-target="#srchIteName" title="Clear">✕</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-wrapper" style="min-width:170px; flex:1;">
|
||||
<div class="search-inner" style="padding-right:4px;">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<path d="M3 6h18M7 12h10M11 18h2" />
|
||||
</svg>
|
||||
</span>
|
||||
<select id="srchCategory" class="search-input" style="cursor:pointer;">
|
||||
<option value="">All Categories</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-hint" id="modalSearchHint">Start typing to search items…</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom:5px">
|
||||
|
||||
@ -40,6 +40,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-wrapper" style="min-width:150px; flex:1;">
|
||||
<div class="search-inner">
|
||||
<span class="search-icon">
|
||||
<svg width="14" height="14" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" stroke-width="2.5">
|
||||
<circle cx="11" cy="11" r="8" />
|
||||
<path d="m21 21-4.35-4.35" />
|
||||
</svg>
|
||||
</span>
|
||||
<input id="srchItemNo" class="search-input"
|
||||
placeholder="Item Number…" autocomplete="off" />
|
||||
<span class="search-clear aprv-search-clear"
|
||||
data-target="#srchItemNo" title="Clear">✕</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Item Name -->
|
||||
<div class="search-wrapper" style="min-width:200px; flex:2;">
|
||||
<div class="search-inner">
|
||||
@ -101,6 +117,7 @@
|
||||
<th >PONo</th>
|
||||
<th >POBy</th>
|
||||
<th >PODate</th>
|
||||
<th>POQty</th>
|
||||
<th >RRNo</th>
|
||||
<th >RRBy</th>
|
||||
<th >RRDate</th>
|
||||
@ -115,6 +132,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<link href="~/css/pr/trackingdetail.css" rel="stylesheet" />
|
||||
<script src="~/jsfunctions/pr/DetailedPRTrackingV9.js"></script>
|
||||
<script src="~/jsfunctions/pr/DetailedPRTracking.js"></script>
|
||||
@await Html.PartialAsync("PagesView/PR/_PRScripts")
|
||||
</body>
|
||||
@ -7,10 +7,12 @@
|
||||
<link href="~/css/common/rowhighlighter.css" rel="stylesheet" />
|
||||
<script src="~/jsfunctions/items/itemvar.js"></script>
|
||||
<script src="~/jsfunctions/items/ItemViewV7.js"></script>
|
||||
<script src="~/jsfunctions/items/PostPutItemV4.js"></script>
|
||||
<script src="~/jsfunctions/items/itemcolumns.js"></script>
|
||||
<script src="~/jsfunctions/items/PostPutItemV5.js"></script>
|
||||
<script src="~/microsoft-signalr/signalr.min.js"></script>
|
||||
<script src="~/jsfunctions/updater/CartUpdater.js"></script>
|
||||
|
||||
<script src="~/jsfunctions/utilities/exportcsvexcelv2.js"></script>
|
||||
<script src="~/jsfunctions/utilities/NewStyle.js"></script>
|
||||
<script src="~/jsfunctions/utilities/utilsV3.js"></script>
|
||||
<script src="~/jsfunctions/utilities/StylesV3.js"></script>
|
||||
@ -4,8 +4,8 @@
|
||||
<link href="~/css/item/item.css" rel="stylesheet" />
|
||||
<link href="~/css/common/rowhighlighter.css" rel="stylesheet" />
|
||||
|
||||
<script src="~/jsfunctions/pr/PRColumnV9.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRViewV9.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRColumn.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRView.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRPostPut.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRButtonv3.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRVarV3.js"></script>
|
||||
@ -16,7 +16,7 @@
|
||||
<script src="~/jsfunctions/tracking/tracking.js"></script>
|
||||
|
||||
<script src="~/jsfunctions/utilities/NewStyle.js"></script>
|
||||
<script src="~/jsfunctions/utilities/exportcsvexcel.js"></script>
|
||||
<script src="~/jsfunctions/utilities/ExportCSVExcelV2.js"></script>
|
||||
<script src="~/jsfunctions/utilities/utilsV3.js"></script>
|
||||
<script src="~/jsfunctions/utilities/StylesV3.js"></script>
|
||||
<script src="~/jsfunctions/utilities/searchengine.js"></script>
|
||||
|
||||
@ -62,9 +62,10 @@
|
||||
"PostPutAttachment": "api/PRMgmt/PostPutAttachment/",
|
||||
"ApprovedSelectedPRItem": "api/PRMgmt/ApprovedSelectedPRItem/",
|
||||
"PostPutProjectCode": "api/PRMgmt/PostPutProjectCode/",
|
||||
"PostItemInPR": "api/PRMgmt/PostItemInPR/",
|
||||
"GetAllPR": "api/PRMgmt/GetAllPR/",
|
||||
"GetApprovedPR": "api/PRMgmt/GetApprovedPR/",
|
||||
"GetRemovedPR": "api/PRMgmt/GetRemovedPR/",
|
||||
"GetDeletedPR": "api/PRMgmt/GetDeletedPR/",
|
||||
"GetPRArchived": "api/PRMgmt/GetPRArchived/",
|
||||
"GetMyPR": "api/PRMgmt/GetMyPR/",
|
||||
"GetApproverName": "api/PRMgmt/GetApproverName/",
|
||||
|
||||
@ -64,6 +64,7 @@ $(document).ready(function () {
|
||||
}, 'selected-row', '.select-all-item-checkbox');
|
||||
|
||||
tableElement = $(tableName);
|
||||
|
||||
tableDestroy(tableElement);
|
||||
|
||||
UserRights = document.getElementById("roleRights").value;
|
||||
@ -99,7 +100,6 @@ $(document).ready(function () {
|
||||
var data = api.ajax.json();
|
||||
|
||||
if (!data || !data.data || data.data === "No Data") {
|
||||
// Display the "No record available" message
|
||||
$('.dataTables_empty').html("No record available");
|
||||
}
|
||||
updateSubmitButtonVisibility();
|
||||
@ -129,26 +129,24 @@ $(document).ready(function () {
|
||||
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": [5], // Index of the 'qty' column (0-based)
|
||||
"targets": [5],
|
||||
"render": function (data, type, row) {
|
||||
// Render the 'qty' column as an input field
|
||||
return '<input type="number" class="editable-qty" style="width:60px;" value="' + data + '" />';
|
||||
}
|
||||
}
|
||||
],
|
||||
rowCallback: function (row, data) {
|
||||
var cartItemCount = data.cartItemCount; // Retrieve the cart item count from the data object
|
||||
var itemCount = parseInt(cartItemCount, 10); // Parse the text content as an integer
|
||||
var cartItemCount = data.cartItemCount;
|
||||
var itemCount = parseInt(cartItemCount, 10);
|
||||
|
||||
var prTypeIdCell = $('td:eq(4)', row);
|
||||
var PRTypeId = prTypeIdCell.text();
|
||||
var PRTypeIdNumer = parseInt(PRTypeId, 10);
|
||||
// console.log('ItemCartIds', ItemCartId);
|
||||
// Check if the parsed integer is a valid number
|
||||
|
||||
if (!isNaN(itemCount)) {
|
||||
$('#cartCount').text(itemCount); // Update the cart count in the navbar
|
||||
$('#cartCount').text(itemCount);
|
||||
} else {
|
||||
$('#cartCount').text('0'); // If the parsed integer is NaN, set the cart count to 0
|
||||
$('#cartCount').text('0');
|
||||
}
|
||||
if (!isNaN(PRTypeIdNumer)) {
|
||||
if (PRTypeIdNumer === 1) {
|
||||
@ -158,23 +156,16 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
},
|
||||
//responsive: true,
|
||||
|
||||
order: [[0, 'desc']],
|
||||
language: {
|
||||
emptyTable: "No record available"
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
console.log('DataTables error:', error);
|
||||
console.log('Status:', Status);
|
||||
console.log('Details:', xhr.responseText);
|
||||
window.location.href = '/Home/Logout';
|
||||
}
|
||||
error: errorHandler
|
||||
});
|
||||
// Function to update the visibility of the submit button
|
||||
function updateSubmitButtonVisibility() {
|
||||
var isEmpty = itemTable.data().length === 0; // Check if the table is empty
|
||||
|
||||
// Toggle the visibility of the submit button based on whether the table is empty or not
|
||||
function updateSubmitButtonVisibility() {
|
||||
var isEmpty = itemTable.data().length === 0;
|
||||
submitButton.toggle(!isEmpty);
|
||||
}
|
||||
})
|
||||
12
CPRNIMS.WebApps/wwwroot/JsFunctions/Items/ItemColumns.js
Normal file
12
CPRNIMS.WebApps/wwwroot/JsFunctions/Items/ItemColumns.js
Normal file
@ -0,0 +1,12 @@
|
||||
var colOnItemList = [
|
||||
{ data: 'itemNo' },
|
||||
{ data: 'itemName' },
|
||||
{ data: 'itemDescription' },
|
||||
{ data: 'itemCategoryName' },
|
||||
{
|
||||
data: null,
|
||||
render: function (data, type, row) {
|
||||
return renderItembtns(data, row);
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -41,47 +41,59 @@ function isFullFilled() {
|
||||
|
||||
$(document).ready(function () {
|
||||
loader = $('#overlay, #loader');
|
||||
const reportTitle = `Item List - as of ${getFormattedDateTime()}`;
|
||||
let cartItemCount = $('#cartItemCount').val();
|
||||
$('#cartCount').text(cartItemCount);
|
||||
|
||||
const endpoint = '/ItemMgmt/GetItemList';
|
||||
itemTable = $('#ItemTable').DataTable({
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
searching: false, // disable built-in search box (we drive it manually)
|
||||
|
||||
searching: false,
|
||||
ordering: false,
|
||||
ajax: {
|
||||
url: '/ItemMgmt/GetItemList',
|
||||
url: endpoint,
|
||||
type: 'GET',
|
||||
data: function (d) {
|
||||
var searchVal = $('#customSearch').length ? $('#customSearch').val() : '';
|
||||
|
||||
return {
|
||||
draw: d.draw,
|
||||
searchTerm: (searchVal || '').trim(),
|
||||
searchItemNo: ($('#srchItemNo').val() || '').trim(),
|
||||
searchItemName: ($('#srchItem').val() || '').trim(),
|
||||
searchCategory: ($('#srchCategory').val() || '').trim(),
|
||||
pageNumber: Math.floor(d.start / d.length) + 1,
|
||||
pageSize: d.length
|
||||
};
|
||||
},
|
||||
dataSrc: function (json) {
|
||||
return json.data; // ← extract data array here
|
||||
const $sel = $('#srchCategory');
|
||||
if ($sel.find('option').length <= 1 && json.categoryList?.length) {
|
||||
json.categoryList.forEach(function (s) {
|
||||
$sel.append(`<option value="${s}">${s}</option>`);
|
||||
});
|
||||
}
|
||||
return json.data;
|
||||
},
|
||||
beforeSend: function () { loader.show(); },
|
||||
complete: function () { loader.hide(); },
|
||||
},
|
||||
|
||||
columns: [
|
||||
{ data: 'itemNo' },
|
||||
{ data: 'itemName' },
|
||||
{ data: 'itemDescription' },
|
||||
{ data: 'itemCategoryName' },
|
||||
dom: 'lBfrtip',
|
||||
buttons: [
|
||||
{
|
||||
data: null,
|
||||
render: function (data, type, row) {
|
||||
return renderItembtns(data, row);
|
||||
}
|
||||
text: '<i class="fas fa-file-csv"></i> CSV',
|
||||
className: 'btn btn-sm btn-secondary',
|
||||
action: function () { exportAllData('csv', endpoint, loader, reportTitle, colOnItemList); }
|
||||
},
|
||||
{
|
||||
text: '<i class="fas fa-file-excel"></i> Excel',
|
||||
className: 'btn btn-sm btn-success',
|
||||
action: function () { exportAllData('excel', endpoint, loader, reportTitle, colOnItemList); }
|
||||
},
|
||||
{
|
||||
text: '<i class="fas fa-file-pdf"></i> PDF',
|
||||
className: 'btn btn-sm btn-danger',
|
||||
action: function () { exportAllData('pdf', endpoint, loader, reportTitle, colOnItemList); }
|
||||
}
|
||||
],
|
||||
|
||||
columns: colOnItemList,
|
||||
order: [[0, 'desc']],
|
||||
responsive: true,
|
||||
|
||||
@ -90,7 +102,6 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
// Debounce helper
|
||||
function debounce(fn, delay) {
|
||||
let t;
|
||||
return function (...args) {
|
||||
@ -99,21 +110,33 @@ $(document).ready(function () {
|
||||
};
|
||||
}
|
||||
|
||||
// Custom search box
|
||||
$('#customSearch').on('keyup', debounce(function () {
|
||||
if ($(this).val().trim().length === 0) {
|
||||
itemTable.clear().draw(); // show nothing until user types
|
||||
return;
|
||||
}
|
||||
itemTable.ajax.reload(); // triggers new server call with searchTerm
|
||||
}, 400));
|
||||
$('#srchItem, #srchItemNo')
|
||||
.on('keyup', debounce(() => itemTable.ajax.reload(null, false), 400));
|
||||
|
||||
$('#srchCategory').on('change', function () {
|
||||
itemTable.ajax.reload(null, false);
|
||||
});
|
||||
$('.aprv-search-clear').on('click', function () {
|
||||
$($(this).data('target')).val('').trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
function getFormattedDateTime() {
|
||||
const now = new Date();
|
||||
const yyyy = now.getFullYear();
|
||||
const mm = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const dd = String(now.getDate()).padStart(2, '0');
|
||||
const hh = String(now.getHours()).padStart(2, '0');
|
||||
const min = String(now.getMinutes()).padStart(2, '0');
|
||||
const ss = String(now.getSeconds()).padStart(2, '0');
|
||||
return `${yyyy}-${mm}-${dd}_${hh}${min}${ss}`;
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const triggers = Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
||||
triggers.forEach(el => {
|
||||
new bootstrap.Tooltip(el, {
|
||||
container: 'body', // append tooltip to body
|
||||
boundary: 'window', // prevent clipping
|
||||
container: 'body',
|
||||
boundary: 'window',
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -12,10 +12,19 @@
|
||||
}
|
||||
|
||||
const requestData = selectedItems.map(item => {
|
||||
const row = itemTable.rows().nodes().toArray().find(row => {
|
||||
const rowData = itemTable.row(row).data();
|
||||
return rowData.itemNo === item.itemNo;
|
||||
});
|
||||
|
||||
const updatedQty = row
|
||||
? parseFloat($(row).find('.editable-qty').val()) || item.qty
|
||||
: item.qty;
|
||||
|
||||
return {
|
||||
ItemCartId: item.itemCartId,
|
||||
ItemNo: item.itemNo,
|
||||
Qty: item.qty
|
||||
Qty: updatedQty
|
||||
};
|
||||
});
|
||||
|
||||
@ -45,31 +54,28 @@
|
||||
cancelText: 'No'
|
||||
}).then((confirmed) => {
|
||||
if (confirmed) {
|
||||
// Create FormData to handle file upload
|
||||
|
||||
var formData = new FormData();
|
||||
|
||||
// Append file if exists
|
||||
var fileInput = document.getElementById('fileAttachment');
|
||||
if (fileInput.files.length > 0) {
|
||||
formData.append('file', fileInput.files[0]);
|
||||
}
|
||||
|
||||
// Append other data
|
||||
formData.append('DateNeeded', DateNeeded);
|
||||
formData.append('RequestTypeId', RequestTypeId);
|
||||
formData.append('ChargeTo', ChargeTo || '');
|
||||
formData.append('Remarks', Remarks || '');
|
||||
formData.append('ProjectCodeId', ProjectCodeId || 0);
|
||||
|
||||
// Append array data - serialize as JSON
|
||||
formData.append('ItemCartIds', JSON.stringify(requestData));
|
||||
|
||||
$.ajax({
|
||||
url: '/ItemMgmt/PostPurchRequest',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false, // Important: Don't process the data
|
||||
contentType: false, // Important: Don't set content type
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
itemTable.ajax.reload();
|
||||
@ -78,7 +84,6 @@
|
||||
var totalSelectedLabel = $('#totalSelected');
|
||||
totalSelectedLabel.text('');
|
||||
|
||||
// Clear form after successful submission
|
||||
clearFormData();
|
||||
} else {
|
||||
itemTable.ajax.reload();
|
||||
@ -96,8 +101,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function putItemDetails() {
|
||||
loader = $('#overlay, #loader');
|
||||
const itemPictureImageInput = document.getElementById("itemPictureImageInput");
|
||||
@ -14,6 +14,7 @@
|
||||
return {
|
||||
draw: d.draw,
|
||||
searchPRNo: ($('#srchPRNo').val() || '').trim(),
|
||||
srchItemNo: ($('#srchItemNo').val() || '').trim(),
|
||||
searchItemName: ($('#srchItem').val() || '').trim(),
|
||||
searchDept: ($('#srchDept').val() || '').trim(),
|
||||
searchStatusName: ($('#srchStatus').val() || '').trim(),
|
||||
@ -57,6 +58,8 @@
|
||||
}
|
||||
],
|
||||
columns: colOnPRtracking,
|
||||
pageLength: 5,
|
||||
lengthMenu: [[5, 10, 25, 50, 100], [5, 10, 25, 50, 100]],
|
||||
rowCallback: rowStatusColorCallback,
|
||||
language: { emptyTable: "No approved records available" }
|
||||
});
|
||||
@ -69,7 +72,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
$('#srchPRNo, #srchItem, #srchDept')
|
||||
$('#srchPRNo, #srchItemNo, #srchItem, #srchDept')
|
||||
.on('keyup', debounce(() => prTable.ajax.reload(), 400));
|
||||
|
||||
$('#srchStatus').on('change', function () {
|
||||
@ -50,6 +50,12 @@ var colOnPRtracking = [
|
||||
{ data: 'poNo', title: 'PONo' },
|
||||
{ data: 'poBy', title: 'POBy' },
|
||||
{ data: 'poDate', title: 'PODate' },
|
||||
{
|
||||
data: 'poQty', title: 'POQty',
|
||||
render: function (data, type, row, meta) {
|
||||
return numberWithCommas(data);
|
||||
}
|
||||
},
|
||||
{ data: 'rrNo', title: 'RRNo' },
|
||||
{ data: 'receivedBy', title: 'ReceivedBy' },
|
||||
{ data: 'rrDate', title: 'RRDate' },
|
||||
@ -23,19 +23,24 @@
|
||||
url: '/ItemMgmt/GetItemList',
|
||||
type: 'GET',
|
||||
data: function (d) {
|
||||
var searchVal = $('#modalSearchInput').length
|
||||
? $('#modalSearchInput').val()
|
||||
: '';
|
||||
return {
|
||||
draw: d.draw,
|
||||
searchTerm: (searchVal || '').trim(),
|
||||
searchItemNo: ($('#srchItemNo').val() || '').trim(),
|
||||
searchItemName: ($('#srchIteName').val() || '').trim(),
|
||||
searchCategory: ($('#srchCategory').val() || '').trim(),
|
||||
pageNumber: Math.floor(d.start / d.length) + 1,
|
||||
pageSize: d.length
|
||||
};
|
||||
},
|
||||
dataSrc: function (json) {
|
||||
const $sel = $('#srchCategory');
|
||||
if ($sel.find('option').length <= 1 && json.categoryList?.length) {
|
||||
json.categoryList.forEach(function (s) {
|
||||
$sel.append(`<option value="${s}">${s}</option>`);
|
||||
});
|
||||
}
|
||||
return json.data;
|
||||
}
|
||||
},
|
||||
},
|
||||
responsive: true,
|
||||
language: {
|
||||
@ -87,7 +92,6 @@
|
||||
error: errorHandler
|
||||
});
|
||||
|
||||
// Debounce helper (local scope)
|
||||
function debounce(fn, delay) {
|
||||
let t;
|
||||
return function (...args) {
|
||||
@ -96,23 +100,14 @@
|
||||
};
|
||||
}
|
||||
|
||||
// Search input handler
|
||||
$('#modalSearchInput').off('keyup').on('keyup', debounce(function () {
|
||||
const val = $(this).val().trim();
|
||||
$('#modalSearchHint').text(val.length ? `Searching for "${val}"…` : 'Start typing to search items…');
|
||||
itemListTable.ajax.reload();
|
||||
}, 400));
|
||||
$('#srchIteName, #srchItemNo')
|
||||
.on('keyup', debounce(() => itemListTable.ajax.reload(null, false), 400));
|
||||
|
||||
// Show/hide clear button
|
||||
$('#modalSearchInput').off('input').on('input', function () {
|
||||
$('#modalSearchClear').css('display', $(this).val().length ? 'flex' : 'none');
|
||||
$('#srchCategory').on('change', function () {
|
||||
itemListTable.ajax.reload(null, false);
|
||||
});
|
||||
|
||||
// Clear button handler
|
||||
$('#modalSearchClear').off('click').on('click', function () {
|
||||
$('#modalSearchInput').val('').trigger('input');
|
||||
$('#modalSearchHint').text('Start typing to search items…');
|
||||
itemListTable.ajax.reload();
|
||||
$('.aprv-search-clear').on('click', function () {
|
||||
$($(this).data('target')).val('').trigger('change');
|
||||
});
|
||||
|
||||
// Editable qty handler
|
||||
@ -1,6 +1,7 @@
|
||||
function exportAllData(format, api, loader, reportTitle, column) {
|
||||
const params = new URLSearchParams({
|
||||
searchPRNo: ($('#srchPRNo').val() || '').trim(),
|
||||
searchItemNo: ($('#srchItemNo').val() || '').trim(),
|
||||
searchItemName: ($('#srchItem').val() || '').trim(),
|
||||
searchDept: ($('#srchDept').val() || '').trim(),
|
||||
searchStatusName: ($('#srchStatus').val() || '').trim(),
|
||||
Loading…
Reference in New Issue
Block a user