 SELECT 
	SRBPRG.PGPRDC,
    SRBPRG.PGDESC,
    SRBSRO.SRSROM as Bodega,
    SRBSRO.SRSTHQ AS Existencia,
    SRBSRO.SRPICQ AS Reservado,
	SRBSRO.SRSTHQ-SRBSRO.SRPICQ as Disponible,
    SRBSRO.SRPURQ as EnOCs,
    SRBSRO.SRBIN1 as Localizacion,
    (	select max(ITDATE)
		from SROITR
		where ITPRDC=SRBSRO.SRPRDC and ITSROM=SRBSRO.SRSROM) 
		as UltimoTraslado,
    SRBSRO.SRPRDC as Referencia,
    SRBPRG.PGPCA2,
    SRBPRG.PGPCA4,
    SRBPRG.PGPCA6,
    SRBPRG.PGCOUN
FROM SRBPRG, SRBPRS , SRBSRO
WHERE (SRBPRG.PGPRDC = SRBPRS.PSPRDC)
	and SRBSRO.SRPRDC=SRBPRG.PGPRDC
     and (SRBPRG.PGPRDC='<$0$>' or SRBPRG.PGDESC like '<$0$>%')
     and SRBSRO.SRSROM='<$1$>'
