diff --git a/src/Components/ReportesClientes/Alen/ReporteFacturasConsolidados.tsx b/src/Components/ReportesClientes/Alen/ReporteFacturasConsolidados.tsx new file mode 100644 index 0000000..8b006bf --- /dev/null +++ b/src/Components/ReportesClientes/Alen/ReporteFacturasConsolidados.tsx @@ -0,0 +1,71 @@ +import { useState } from "react" +import { Button, Card, Col, Form, Row } from "react-bootstrap" +import ReportesAlenService from "../../../Services/Reportes/ReportesAlen.Service" +import { MsgInformativo } from "../../Utils/Toast/msgInformativo" + +export const ReporteFacturasConsolidados:React.FC = () => { + const [Referencia, setReferencia] = useState('') + const [show, setShowMsg] = useState(false) + const [header, setHeader] = useState('') + const [msg, setMsg] = useState('') + const [msgColor, setMsgColor] = useState('primary') + + const GetExcel = () => { + if(Referencia !== ''){ + ReportesAlenService.getFacturasConsolidados(Referencia) + .then(resp => { + const url = window.URL.createObjectURL(new Blob([resp.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', `${Referencia}.xlsx`); + document.body.appendChild(link); + link.click(); + }).catch(e => { + setHeader('Error') + setMsg('Ocurrio un error al generar el reporte. Por favor, intentelo de nuevo.') + setShowMsg(true) + return + }) + }else{ + setHeader('Error') + setMsg('Favor de capturar la referencia para generar el reporte.') + setShowMsg(true) + return + } + } + return( + <> + + + +

Reporte de Facturas

+ + + setReferencia(e.target.value)} + /> + + + + + +
+ + +
+ { + setShowMsg(false) + }} + /> + + ) +} \ No newline at end of file diff --git a/src/Services/Reportes/ReportesAlen.Service.ts b/src/Services/Reportes/ReportesAlen.Service.ts index 526793e..f7eaa93 100644 --- a/src/Services/Reportes/ReportesAlen.Service.ts +++ b/src/Services/Reportes/ReportesAlen.Service.ts @@ -5,6 +5,9 @@ class ReportesAlenService{ getRelacionFacturas(referencia: string){ return http.get(`ReportesAlen/RelacionFacturas?referencia=${referencia}`, {responseType: 'blob'}); } + getFacturasConsolidados(referencia: string){ + return http.get(`ReportesAlen/FacturasConsolidados?referencia=${referencia}`, {responseType: 'blob'}); + } } export default new ReportesAlenService(); \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index d404845..656d3ad 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -28,6 +28,7 @@ import { ClientesExternos } from './Components/Clientes/Clientes' import { ReporteGC50 } from './Components/ReportesClientes/GC50/ReporteGC50' import RptClientesTraficos from './Components/Clientes/Traficos/RptClientesTraficos' import { RelacionFacturas } from './Components/ReportesClientes/Alen/RelacionFacturas' +import { ReporteFacturasConsolidados } from './Components/ReportesClientes/Alen/ReporteFacturasConsolidados' require (`./css/${process.env.REACT_APP_ENVIRONMENT}-home.css`) function PageNotFound() { @@ -87,6 +88,7 @@ root.render( }/> }> }/> + }/> }>{/*Aqui van todas las rutas relacionadas a los clientes */}