Notice: Undefined index: empresa in C:\xampp\htdocs\WAKOLIMA\Receiving\getReceivingList.php on line 10

Notice: Undefined index: bodega in C:\xampp\htdocs\WAKOLIMA\Receiving\getReceivingList.php on line 11

Notice: Undefined index: UID in C:\xampp\htdocs\WAKOLIMA\Receiving\getReceivingList.php on line 12
Error in executing query. SELECT wms.ItemID as 'itemID', wms.TRANSREFID as 'UID', sum(wms.QTY) as 'qty', itm.unitid as 'type', id.INVENTSERIALID as 'country' ,(SELECT TOP 1 bar.ITEMBARCODE FROM dbo.InventItemBarcode bar WHERE wms.Itemid = bar.Itemid and wms.dataareaid = bar.dataareaid ) as 'barcode',wms.ITEMID as 'Description', MAX(wms.INVENTTRANSID) as 'Line',AVG(unit.factor) as 'factor' from dbo.INVENTTRANS wms inner join dbo.InventDim id on wms.InventDimid = id.InventDimid and wms.dataareaid = id.dataareaid LEFT JOIN INVENTTABLEMODULE itm ON wms.itemid= itm.ITEMID and MODULETYPE='1' AND itm.DATAAREAID=WMS.DATAAREAID left JOIN UNITCONVERT unit on itm.unitid=unit.FROMUNIT and unit.TOUNIT='und' and id.DATAAREAID=unit.dataareaid and unit.ITEMID=wms.ITEMID where wms.TRANSREFID = and wms.dataareaid = AND wms.TRANSTYPE='3' GROUP BY wms.itemid,wms.TRANSREFID,itm.unitid,id.INVENTSERIALID,wms.DATAAREAID order by wms.itemid
Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 156 [code] => 156 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'and'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'and'. ) )