diff --git a/src/Components/Corresponsales/TraficoCorresponsales.tsx b/src/Components/Corresponsales/TraficoCorresponsales.tsx index d69eafe..4401671 100644 --- a/src/Components/Corresponsales/TraficoCorresponsales.tsx +++ b/src/Components/Corresponsales/TraficoCorresponsales.tsx @@ -1153,7 +1153,7 @@ export default function TraficoCorresponsales (props:IProps) { id: IDTrafico, idUsuario: UserId, estatus: TerminaProceso, - comentarios: ComentariosRechazo + comentarios: 'Todo Correcto' } saveFinalStep(data) }else{ diff --git a/src/Components/ReportesClientes/GC50/ReporteGC50.tsx b/src/Components/ReportesClientes/GC50/ReporteGC50.tsx index c52891f..7fdcd22 100644 --- a/src/Components/ReportesClientes/GC50/ReporteGC50.tsx +++ b/src/Components/ReportesClientes/GC50/ReporteGC50.tsx @@ -1,5 +1,248 @@ +import moment from "moment" +import React, { useEffect } from "react" +import { useState } from "react" +import { Button, Card, Col, Form, ProgressBar, Row } from "react-bootstrap" +import { IconContext } from "react-icons" +import { BsCheckCircleFill, BsFileEarmarkExcel, BsFillXCircleFill, BsSearch } from "react-icons/bs" +import DTORptCorresponsalesTraficos from "../../../DTO/Corresponsales/DTORptCorresponsalesTraficos" +import ICatCorresponsales from "../../../Interfaces/Catalogos/ICatCorresponsales" +import IClientes from "../../../Interfaces/Catalogos/IClientes" +import ICorresponsalTrafico from "../../../Interfaces/Corresponsales/ICorresponsalTrafico" +import reporteGC50Service from "../../../Services/Reportes/reporteGC50.Service" +import CorresponsalesDataService from '../../../Services/Catalogos/Corresponsales.Services' +import { AgGridReact } from "ag-grid-react" +import { DTOReporteGC50 } from "../../../DTO/Reportes/GC50/DTOReporteGC50" + export const ReporteGC50: React.FC = () => { + const [UserId, setUserId] = useState(() => { + const stickyValue = window.localStorage.getItem('UserId') + return stickyValue !== null ? JSON.parse(stickyValue) : 0 + }) + const [Data, setData] = useState([]) + const [filteredData, setFilteredData] = useState([]) + const [Inicio, setInicio] = useState(currentDate(-365)) + const [Fin, setFin] = useState(currentDate(0)) + const [Corresponsal, setCorresponsal] = useState(() => { + const stickyValue = window.localStorage.getItem('IdCorresponsal') + return stickyValue !== null ? JSON.parse(stickyValue) : 0 + }) + const [Clientes, setClientes] = useState>() + const gridRef = React.useRef(null) + const [DataCorresponsales, setDataCorresponsales] = useState< + ICatCorresponsales[] + >([]) + const [columnDefs] = useState([ + { field: 'trafico', headerName: 'Trafico', minWidth: 70, sortable: true, resizable: true}, + { field: 'corresponsal', headerName: 'Corresponsal', minWidth: 70, sortable: true, resizable: true}, + { field: 'aduana', headerName: 'Aduana', minWidth: 70, sortable: true, resizable: true}, + { field: 'patente', headerName: 'Patente', minWidth: 70, sortable: true, resizable: true}, + { field: 'pedimentoCorresponsal', headerName: 'Pedimento Corresponsal', minWidth: 70, sortable: true, resizable: true}, + { field: 'pedimentoCorresponsalR1', headerName: 'Pedimento Corresponsal R1', minWidth: 70, sortable: true, resizable: true}, + { field: 'fechaPago', headerName: 'Fecha Pago', minWidth: 70, sortable: true, resizable: true}, + { field: 'fechaAnticipo', headerName: 'Fecha Anticipo', minWidth: 70, sortable: true, resizable: true}, + { field: 'sumaAnticipoCorresponsalFinanciado', headerName: 'Suma Anticipo Corresponsal Financiado', minWidth: 70, maxWidth:350, sortable: true, resizable: true}, + { field: 'fechaAlta', headerName: 'Fecha Alta', minWidth: 70, sortable: true, resizable: true}, + { field: 'usuarioAlta', headerName: 'Usuario Alta', minWidth: 70, sortable: true, resizable: true}, + { field: 'cliente', headerName: 'Cliente', minWidth: 70, sortable: true, resizable: true}, + { field: 'nombreCliente', headerName: 'Nombre Cliente', minWidth: 70, sortable: true, resizable: true}, + { field: 'cuenta', headerName: 'Cuenta', minWidth: 70, sortable: true, resizable: true}, + { field: 'tipoOperacion', headerName: 'Tipo Operacion', minWidth: 70, sortable: true, resizable: true}, + { field: 'terminado', headerName: 'Terminado', minWidth: 70, sortable: true, resizable: true}, + { field: 'fechaTerminado', headerName: 'Fecha Terminado', minWidth: 70, sortable: true, resizable: true}, + { field: 'fechaRegistroContabilizar', headerName: 'Fecha Registro Contabilizar', minWidth: 70, sortable: true, resizable: true}, + { field: 'fechaContabilizado', headerName: 'Fecha Contabilizado', minWidth: 70, sortable: true, resizable: true}, + { field: 'fechaFacturaCorresponsal', headerName: 'Fecha Factura Corresponsal', minWidth: 70, sortable: true, resizable: true}, + { field: 'motivoCuentaRechazada', headerName: 'Motivo Cuenta Rechazada', minWidth: 70, sortable: true, resizable: true}, + { field: 'estatusOperacion', headerName: 'Estatus Operacion', minWidth: 70, sortable: true, resizable: true}, + { field: 'cargoShipper', headerName: 'Cargo Shipper', minWidth: 70, sortable: true, resizable: true} + ]) + + function currentDate(days: number): string { + var today = new Date() + today.setDate(today.getDate() + days) + var dd = String(today.getDate()).padStart(2, '0') + var mm = String(today.getMonth() + 1).padStart(2, '0') + var yyyy = today.getFullYear() + return yyyy + '-' + mm + '-' + dd + } + + useEffect(() => { + CorresponsalesDataService.getAll() + .then((response) => { + setDataCorresponsales(response.data) + }) + .catch((e: Error) => { + return + }) + generaReporte() + }, []) + + const generaReporte = () => { + const data: DTORptCorresponsalesTraficos = { + Inicio: moment(Inicio).format('YYYY-MM-DD'), + Fin: moment(Fin).format('YYYY-MM-DD'), + TipoOperacion: 0, + NoCliente: 0, + IdCorresponsal: Corresponsal, + Pedimento: 0, + Aduana: 0, + Patente: 0, + Proceso: 0, + Modo: 0, + } + reporteGC50Service + .GetReporteGC50(data) + .then((response) => { + setData(response.data) + setFilteredData(response.data) + }) + .catch((e: Error) => { + return + }) + } + + const filtraReporte = (e: any) => { + gridRef.current.api.setQuickFilter(e.target.value) + } + + const downloadExcel = () => { + const data: DTORptCorresponsalesTraficos = { + Inicio: moment(Inicio).format('YYYY-MM-DD'), + Fin: moment(Fin).format('YYYY-MM-DD'), + TipoOperacion: 0, + NoCliente: 0, + IdCorresponsal: Corresponsal, + Pedimento: 0, + Aduana: 0, + Patente: 0, + Proceso: 0, + Modo: 0, + } + reporteGC50Service.DownloadExcel(data) + .then(resp => { + const url = window.URL.createObjectURL(new Blob([resp.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', `ReporteGC50.xlsx`); + document.body.appendChild(link); + link.click(); + }) + } + return ( -

Reporte

- ) +
+ + + + + + Buscar + { + filtraReporte(e) + }} + /> + + + + + Inicio + setInicio(e.target.value)} + size='sm' + /> + + + + + Fin + setFin(e.target.value)} + size='sm' + /> + + + + + Corresponsal + { + setCorresponsal(parseInt(e.target.value)) + }} + className='form-select form-select-sm' + > + + {DataCorresponsales + ? DataCorresponsales.map((c) => { + return ( + + ) + }) + : null} + + + + + + + + + + + + +
+
+ +
+
+ ) + } \ No newline at end of file diff --git a/src/DTO/Reportes/GC50/DTOReporteGC50.ts b/src/DTO/Reportes/GC50/DTOReporteGC50.ts new file mode 100644 index 0000000..12d144b --- /dev/null +++ b/src/DTO/Reportes/GC50/DTOReporteGC50.ts @@ -0,0 +1,25 @@ +export interface DTOReporteGC50{ + trafico: string; + corresponsal: string; + aduana: number; + patente: number; + pedimentoCorreponsal: string; + pedimentoCorresponsalR1: string; + fechaPago: string; + fechaAnticipo: string; + sumaanticipoCorresponsalFinanciado: number; + fechaAlta: string; + usuarioAlta: string; + cliente: number; + nombrecliente:number; + cuenta: string; + tipoOperacion: string; + terminado: string; + fechaTerminado: string; + fechaRegistroContabilizar: string; + fechaContabilizado: string; + fechaFacturaCorresponsal: string; + motivoCuentaRechazada: string; + estatusOperacion: string; + cargoShipper: string; +} \ No newline at end of file diff --git a/src/Services/Reportes/reporteGC50.Service.ts b/src/Services/Reportes/reporteGC50.Service.ts new file mode 100644 index 0000000..b1d7c9b --- /dev/null +++ b/src/Services/Reportes/reporteGC50.Service.ts @@ -0,0 +1,14 @@ +import DTORptCorresponsalesTraficos from "../../DTO/Corresponsales/DTORptCorresponsalesTraficos"; +import { DTOReporteGC50 } from "../../DTO/Reportes/GC50/DTOReporteGC50"; +import http from "../common/http-common"; +class ReporteGC50Service{ + GetReporteGC50(data: DTORptCorresponsalesTraficos){ + return http.get(`reporteGC50?Inicio=${data.Inicio}&Fin=${data.Fin}&TipoOperacion=${data.TipoOperacion}&NoCliente=${data.NoCliente}&IdCorresponsal=${data.IdCorresponsal}&Pedimento=${data.Pedimento}&Aduana=${data.Aduana}&Patente=${data.Patente}&Proceso=${data.Proceso}&Modo=${data.Modo}`); + } + + DownloadExcel(data: DTORptCorresponsalesTraficos){ + return http.get(`reporteGC50/ExcelGc50?Inicio=${data.Inicio}&Fin=${data.Fin}&TipoOperacion=${data.TipoOperacion}&NoCliente=${data.NoCliente}&IdCorresponsal=${data.IdCorresponsal}&Pedimento=${data.Pedimento}&Aduana=${data.Aduana}&Patente=${data.Patente}&Proceso=${data.Proceso}&Modo=${data.Modo}`, {responseType: 'blob'}); + } +} + +export default new ReporteGC50Service(); \ No newline at end of file