USE [dbmov]
GO
/****** Object:  StoredProcedure [dbo].[paQryPagos]    Script Date: 16/02/2021 8:06:42 ******/
DROP PROCEDURE [dbo].[paQryPagos]
GO
/****** Object:  StoredProcedure [dbo].[paQryPagos]    Script Date: 16/02/2021 8:06:42 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE
[dbo].[paQryPagos]
/* @pmTipDoc VARCHAR(3),@pmFacturaIni INT,@pmFacturaFin INT,@pmIdCia CHAR(2)*/
 AS
 SELECT PAGOS.PAG_NUM AS NumeroFact,PAGOS.PAG_TIP AS TipoFact,PAGOS.PAG_CIA AS CiaFact,PAGOS.PAG_VAL AS VrPagado,PAGOS.PAG_CHE AS NumCheque,TIPOSPAGO.TIP_DES AS DescPago,BANCOS.BAN_COD AS CodBanco,BAN_DES AS NomBanco
FROM
    dbmov.dbo.PAGOS PAGOS LEFT JOIN dbpar.dbo.TIPOSPAGO TIPOSPAGO ON
        PAGOS.PAG_FOR = TIPOSPAGO.TIP_COD
	LEFT JOIN dbpar.dbo.BANCOS BANCOS ON BANCOS.BAN_COD=PAGOS.PAG_BAN
/*WHERE PAGOS.PAG_TIP=@pmTipDoc AND PAGOS.PAG_NUM BETWEEN @pmFacturaIni AND @pmFacturaFin AND PAGOS.PAG_CIA=@pmIdCia*/
ORDER BY
    PAGOS.PAG_TIP,PAGOS.PAG_NUM,PAGOS.PAG_CIA ASC
GO
