raghav
11/08/2023, 2:51 PMSELECT
t.entity AS customer_internal_id,
c.entityid AS customer_id,
c.companyName AS customer_name,
t.shipdate AS shipping_date,
l.id AS location_internal_id,
l.name AS location,
shipadd.addrtext AS shipping_address,
COUNT(t.id) AS count_of_order,
SUM(t.custbody_oc_pallet_quantity) AS total_pallet_quantity,
FROM
transaction AS t
INNER JOIN customer AS c ON t.entity = c.id
INNER JOIN TransactionLine AS line ON line.Transaction = t.id
INNER JOIN location AS l ON line.location = l.id
INNER JOIN TransactionShipment AS tranship ON t.ID = tranship.Doc
INNER JOIN transactionShippingAddress AS shipadd ON t.shippingaddress = shipadd.nkey
WHERE
t.type = 'SalesOrd'
AND BUILTIN.DF (t.status) IN (
'Sales Order : Pending Fulfillment'
)
AND line.mainline = 'T'
AND t.shipdate IS NOT NULL
AND tranship.shippingmethod IN ('x1 Carrier', 'x2 Carrier')
GROUP BY
t.entity,
c.entityid,
c.companyName,
t.shipdate,
l.id,
l.name,
shipadd.addrtext
HAVING
SUM(t.custbody_oc_pallet_quantity) > '7'
AND COUNT(t.id) > '1'
ORDER BY
t.shipdate,
shipadd.addrtext
Clay Roper
11/08/2023, 3:00 PMraghav
11/08/2023, 3:05 PM