diff --git a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml index 29686f4..909df47 100644 --- a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml +++ b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml @@ -20,6 +20,7 @@
+

Item Movement List

@* *@
@@ -286,175 +287,82 @@ this.itemDatatable = $('#itemDatatable').DataTable({ "data": this.items, "columns": [ - { - "title": "Unique Id", - "data": "id", - "createdCell": function (td, cellData, rowData, row, col) { - // Assign a unique ID to the element - $(td).attr('id', `qr${cellData}`); - }, - }, - { - "title": "Print", - "data": "item.itemId", - "render": function (data, type, full, meta) { - var printButton = ``; - return printButton; - }, - "className": "align-middle", - }, - { - "title": "To User", - "data": "item.toUser", - }, - { - "title": "Last User", - "data": "item.lastUser", - }, - { - "title": "Action", - "data": "item.action", - }, - { - "title": "Latest Status", - "data": "item.latestStatus", - }, - { - "title": "Quantity", - "data": "item.quantity", - }, - { - "title": "To Station", - "data": "item.toStation", - }, - { - "title": "To Store", - "data": "item.toStore", - }, - { - "title": "To Other", - "data": "item.toOther", - }, - { - "title": "Remark", - "data": "item.remark", - }, - { - "title": "Note", - "data": "item.consignmentNote", - "render": function (data, type, full, meta) { - if (!data) { - return "No Document"; - } + { title: "Unique Id", data: "id" }, + { title: "Product Code", data: "uniqueID" }, + { title: "From User", data: "toUserName" }, + { title: "Last User", data: "lastUserName" }, + { title: "From Station", data: "toStationName" }, + { title: "Last Station", data: "lastStationName" }, + { title: "From Store", data: "toStoreName" }, + { title: "Last Store", data: "lastStoreName" }, + { title: "Action", data: "action" }, + { title: "Start Status", data: "toOther" }, + { title: "Latest Status", data: "latestStatus" }, + { title: "Qty", data: "quantity" }, + { title: "Send Date", data: "sendDate" }, + { title: "Receive Date", data: "receiveDate" }, + { title: "Note", + data: "consignmentNote", + render: function (data, type, full, meta) { + if (!data) { + return "No Document"; + } - // Check if the document is an image based on file extension - var isImage = /\.(jpeg|jpg|png|gif)$/i.test(data); - var isPdf = /\.pdf$/i.test(data); + // Check if the document is an image based on file extension + var isImage = /\.(jpeg|jpg|png|gif)$/i.test(data); + var isPdf = /\.pdf$/i.test(data); - if (isImage) { - return ` - Image - `; - } else if (isPdf) { - return ` - PDF Document -
View PDF -
`; - } else { - return `Download File`; - } + if (isImage) { + return ` + Image + `; + } + else if (isPdf) { + return ` + PDF Document +
View PDF +
`; + } else { + return `Download File`; + } + }, }, - - }, - { - "title": "Send Date", - "data": "item.date", - }, - { - "title": "Last User", - "data": "item.lastUser", - }, - { - "title": "Last Store", - "data": "item.lastStore", - }, - { - "title": "Last Station", - "data": "item.lastStation", - }, - { - "title": "Latest Status", - "data": "item.latestStatus", - }, - { - "title": "Receive Date", - "data": "item.date", - }, + { title: "Remark", data: "remark" }, { "title": "Completion", - "data": "item.movementComplete", + "data": "movementComplete", }, - - // { - // "title": "Warranty Until", - // "data": "warranty", - // "render": function (data, type, full, meta) { - // if (data > 0) { return full.endWDate } - // else { return data } - // } - // }, - // { - // "title": "Location", - // "data": "currentUser", - // "render": function (data, type, full, meta) { - // currentUser = data ?? null; - // currentStore = full.currentStore ?? 'N/A'; - // currentStation = full.currentStation ?? 'N/A'; - // return `User: ${currentUser}
- // Store: ${currentStore}
- // Station: ${currentStation}` - // } - // }, - // { - // "title": "Delete", - // "data": "itemID", - // "render": function (data) { - // var deleteButton = ``; - // return deleteButton; - // }, - // "className": "align-middle", - // } ], responsive: true, drawCallback: function (settings) { // Generate QR codes after rows are rendered - const api = this.api(); - api.rows().every(function () { - const data = this.data(); - const containerId = `qr${data.id}`; //containerid is by increments from API - const container = $(`#${containerId}`); + // const api = this.api(); + // api.rows().every(function () { + // const data = this.data(); + // const containerId = `qr${data.id}`; containerid is by increments from API + // const container = $(`#${containerId}`); - container.empty(); - container.append(`${data.item.itemId}`); + // container.empty(); + // container.append(`${data.item.itemId}`); - if (container.length) { + // if (container.length) { - new QRCode(container[0], { - text: data.qrString, - width: 100, - height: 100, - colorDark: "#000000", - colorLight: "#ffffff", - correctLevel: QRCode.CorrectLevel.M, - }); - } + // new QRCode(container[0], { + // text: data.qrString, + // width: 100, + // height: 100, + // colorDark: "#000000", + // colorLight: "#ffffff", + // correctLevel: QRCode.CorrectLevel.M, + // }); + // } // container.on('click', function() { // window.open(data.qrString, '_blank'); // }); - }); + // }); }, }) diff --git a/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml b/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml index 777447f..ec50f74 100644 --- a/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml +++ b/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml @@ -231,7 +231,6 @@ "title": "User ID", "data": "userName", }, - { "title": "Product Category", "data": "productCategory", @@ -348,6 +347,10 @@ "title": "Product Name", "data": "productName", }, + { + "title": "User ID", + "data": "userName", + }, { "title": "Product Category", "data": "productCategory", diff --git a/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml b/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml index a96c141..cbe36b4 100644 --- a/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml +++ b/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml @@ -684,6 +684,7 @@ zx
ItemMovementList() { - var itemMovementList = await _centralDbContext.ItemMovements.Include(i => i.NextUser).ToListAsync(); + //var itemMovementList = await _centralDbContext.ItemMovements.Include(i => i.NextUser).Include(i => i.Item).ThenInclude(i => i.Product).ToListAsync(); + + var itemMovementList = await _centralDbContext.ItemMovements + .Include(i => i.Item) + .ThenInclude(i => i.Product) + .Include(i => i.FromStore) + .Include(i => i.FromStation) + .Include(i => i.FromUser) + .Include(i => i.NextStore) + .Include(i => i.NextStation) + .Include(i => i.NextUser) + .ToListAsync(); //var itemList = await _centralDbContext.Items.ToListAsync(); int itemrow = 0; @@ -559,13 +570,55 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory id = itemrow++, item, // Includes all properties of the original item QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String - userName = item.NextUser?.FullName + ProductName = item.Item?.Product?.ProductName, + toUserName = item.NextUser?.FullName, + lastUserName = item.FromUser?.FullName }).ToList(); //Console.WriteLine(Json(itemMovementList)); //return Json(itemMovementList); - return Json(itemMovementListWithQR); + //return Json(itemMovementListWithQR); + + return Json(itemMovementList.Select(i => new + { + i.Id, + i.ItemId, + i.ToStation, + i.ToStore, + i.ToUser, + UniqueID = i.Item?.UniqueID, + ProductName = i.Item?.Product?.ProductName, + LastUserName = i.FromUser?.FullName, + LastStoreName = i.FromStore?.StoreName, + LastStationName = i.FromStation?.StationName, + ToUserName = i.NextUser?.FullName, + ToStoreName = i.NextStore?.StoreName, + ToStationName = i.NextStation?.StationName, + i.ToOther, + i.sendDate, + i.Action, + i.Quantity, + i.Remark, + i.ConsignmentNote, + i.Date, + i.LastUser, + i.LastStore, + i.LastStation, + i.LatestStatus, + i.receiveDate, + i.MovementComplete + })); + + //return Json(itemMovementList.Select(item => new + //{ + // id = itemrow++, + // item, + // QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String + // ProductName = item.Item?.Product?.ProductName, + // toUserName = item.NextUser?.FullName, + // lastUserName = item.FromUser?.FullName + //})); } [HttpPost("AddItemMovement")]