2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
c.socialName as RazonSocial,
|
|
|
|
c.fi as NIF,
|
|
|
|
io.ref as Factura,
|
|
|
|
io.serial as Serie,
|
|
|
|
io.issued as Fecha,
|
|
|
|
io.amount as Importe,
|
|
|
|
c.id as Id_Cliente,
|
|
|
|
iot.taxableBase as Base,
|
|
|
|
pgc.rate as Tipo,
|
|
|
|
iot.vat as Cuota,
|
|
|
|
pgc.name as Concepto
|
|
|
|
|
|
|
|
FROM vn.invoiceOut io
|
|
|
|
JOIN vn.invoiceOutTax iot ON iot.invoiceOutFk = io.id
|
|
|
|
JOIN vn.client c ON c.id = io.clientFk
|
|
|
|
JOIN vn.pgc ON pgc.code = iot.pgcFk
|
|
|
|
WHERE io.companyFk = vCompany
|
|
|
|
AND io.issued BETWEEN vStarted AND vEnded
|
|
|
|
ORDER BY io.ref DESC;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|