refactor(datamart): changes to customer inventory to include specific whse
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
import { query } from "../../sqlServer/prodSqlServer.js";
|
||||
import { customerInvNoHold } from "../../sqlServer/querys/dataMart/customerInventoryQuerys.js";
|
||||
|
||||
export const getCurrentCustomerInv = async (customer: any | null) => {
|
||||
export const getCurrentCustomerInv = async (data: any | null) => {
|
||||
//console.log(data.customer[0]);
|
||||
|
||||
let updatedQuery = customerInvNoHold;
|
||||
|
||||
if (customer) {
|
||||
if (data.customer) {
|
||||
//console.log(data.customer);
|
||||
updatedQuery = customerInvNoHold.replaceAll(
|
||||
"--and IdAdressen",
|
||||
`and IdAdressen = ${customer}`
|
||||
`and IdAdressen = ${data.customer[0]}`
|
||||
);
|
||||
}
|
||||
|
||||
if (data.whseToInclude) {
|
||||
updatedQuery = updatedQuery.replaceAll(
|
||||
"--and x.IdWarenlager in (14,15)",
|
||||
`and x.IdWarenlager in (${data.whseToInclude[0]})`
|
||||
);
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user