Introduced exchange into transaction scanner
This commit is contained in:
parent
e01b31ab9a
commit
73aab537e9
Binary file not shown.
@ -1,15 +1,3 @@
|
|||||||
/*
|
|
||||||
id
|
|
||||||
logistics_info_id
|
|
||||||
barcode
|
|
||||||
item_name
|
|
||||||
logistics_info.primary_location.id
|
|
||||||
logistics_info.auto_issue_location.id
|
|
||||||
item_info.uom_quantity
|
|
||||||
item_info.cost
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
WITH passed_id AS (SELECT items.id AS passed_id, barcodes.barcode AS passed_barcode FROM %%site_name%%_barcodes barcodes
|
WITH passed_id AS (SELECT items.id AS passed_id, barcodes.barcode AS passed_barcode FROM %%site_name%%_barcodes barcodes
|
||||||
LEFT JOIN %%site_name%%_items items ON items.item_uuid = barcodes.item_uuid
|
LEFT JOIN %%site_name%%_items items ON items.item_uuid = barcodes.item_uuid
|
||||||
WHERE barcodes.barcode=%s),
|
WHERE barcodes.barcode=%s),
|
||||||
|
|||||||
@ -67,11 +67,14 @@ async function submitScanTransaction(scannedItem) {
|
|||||||
let trans_type = document.getElementById('scan_trans_type').value
|
let trans_type = document.getElementById('scan_trans_type').value
|
||||||
let scan_transaction_item_location_id = 0
|
let scan_transaction_item_location_id = 0
|
||||||
let comparator = 0
|
let comparator = 0
|
||||||
|
let conversion_factor = 1
|
||||||
|
|
||||||
if (trans_type === "Adjust In"){
|
if (trans_type === "Adjust In"){
|
||||||
comparator = scannedItem.primary_location_id
|
comparator = scannedItem.primary_location_id
|
||||||
|
conversion_factor = scannedItem.in_exchange
|
||||||
} else if (trans_type === "Adjust Out"){
|
} else if (trans_type === "Adjust Out"){
|
||||||
comparator = scannedItem.auto_issue_location_id
|
comparator = scannedItem.auto_issue_location_id
|
||||||
|
conversion_factor = scannedItem.out_exchange
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < scannedItem.item_locations.length; i++){
|
for (let i = 0; i < scannedItem.item_locations.length; i++){
|
||||||
@ -79,6 +82,9 @@ async function submitScanTransaction(scannedItem) {
|
|||||||
scan_transaction_item_location_id = scannedItem.item_locations[i].location_id
|
scan_transaction_item_location_id = scannedItem.item_locations[i].location_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let quantity = scannedItem.uom_quantity * conversion_factor
|
||||||
|
|
||||||
const response = await fetch(`/poe/postTransaction`, {
|
const response = await fetch(`/poe/postTransaction`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -90,7 +96,7 @@ async function submitScanTransaction(scannedItem) {
|
|||||||
barcode: scannedItem.barcode,
|
barcode: scannedItem.barcode,
|
||||||
item_name: scannedItem.item_name,
|
item_name: scannedItem.item_name,
|
||||||
transaction_type: document.getElementById('scan_trans_type').value,
|
transaction_type: document.getElementById('scan_trans_type').value,
|
||||||
quantity: scannedItem.uom_quantity,
|
quantity: quantity,
|
||||||
description: "",
|
description: "",
|
||||||
cost: parseFloat(scannedItem.cost),
|
cost: parseFloat(scannedItem.cost),
|
||||||
vendor: 0,
|
vendor: 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user