select custPackingSlipJour.SalesId,custPackingSlipJour.PACKINGSLIPID
from custPackingSlipJour
join salesTable
on salesTable.SalesId = custPackingSlipJour.SalesId
join CUSTPACKINGSLIPTRANS
on CUSTPACKINGSLIPTRANS.PACKINGSLIPID = custPackingSlipJour.PACKINGSLIPID
and custPackingSlipJour.inventLocationId = 'W03'
--and custPackingSlipJour.DeliveryDate >= '2023-1-1'
--and custPackingSlipJour.DeliveryDate <= '2023-8-31'
where CUSTPACKINGSLIPTRANS.QTY >= 0
and CUSTPACKINGSLIPTRANS.VALUEMST >= 0
group by
custPackingSlipJour.PACKINGSLIPID,custPackingSlipJour.SalesId
else if(LocationId != "" && salesPoolIdFilter == "")
{
insert_recordset dtPODReportTmp(SalesId,OrderAccount,PackingSlipId,DTDeliveryRequestId,PackingSlipDate,PackingSlipRecId,Company,inventLocationId,ShipCarrierWaybill,PlateNum, DlvMode,ShipCarrierPhone,WorkerSalesTaker)
select SalesId,OrderAccount,PackingSlipId,DeliveryRequestId,DeliveryDate,RecId,DataAreaId,inventLocationId,ShipCarrierWaybill,PlateNum, DlvMode,ShipCarrierPhone from custPackingSlipJour
join WorkerSalesResponsible from salesTable
where salesTable.SalesId == custPackingSlipJour.SalesId
&& custPackingSlipJour.inventLocationId == LocationId
&& custPackingSlipJour.DeliveryDate >= fromDateFilter
&& custPackingSlipJour.DeliveryDate <= toDateFilter;
}
André Arnaud de Cal...
292,187
Super User 2025 Season 1
Martin Dráb
230,966
Most Valuable Professional
nmaenpaa
101,156