Finalizacion del reporte GC50

feature/ConsolidarPedimentos_20231229
Felix Morales 11 months ago
parent 0158ae4510
commit b8223e4e10
  1. 2
      src/Components/Corresponsales/TraficoCorresponsales.tsx
  2. 245
      src/Components/ReportesClientes/GC50/ReporteGC50.tsx
  3. 25
      src/DTO/Reportes/GC50/DTOReporteGC50.ts
  4. 14
      src/Services/Reportes/reporteGC50.Service.ts

@ -1153,7 +1153,7 @@ export default function TraficoCorresponsales (props:IProps) {
id: IDTrafico,
idUsuario: UserId,
estatus: TerminaProceso,
comentarios: ComentariosRechazo
comentarios: 'Todo Correcto'
}
saveFinalStep(data)
}else{

@ -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<DTOReporteGC50[]>([])
const [filteredData, setFilteredData] = useState<DTOReporteGC50[]>([])
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<Array<IClientes>>()
const gridRef = React.useRef<any>(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 (
<h1>Reporte</h1>
<div>
<Card>
<Card.Body>
<Row>
<Col xs={3}>
<Form.Label style={{width:'100%', fontSize:'smaller'}}>
Buscar
<Form.Control
type='text'
size='sm'
placeholder='Search...'
onChange={(e) => {
filtraReporte(e)
}}
/>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label style={{width:'100%', fontSize:'smaller'}}>
Inicio
<Form.Control
defaultValue={Inicio}
type='date'
name='Inicio'
placeholder='Inicio'
title='Inicio'
alt='Inicio'
data-date-format='YYYY-mm-dd'
onChange={(e) => setInicio(e.target.value)}
size='sm'
/>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label style={{width:'100%', fontSize:'smaller'}}>
Fin
<Form.Control
defaultValue={Fin}
type='date'
name='Fin'
placeholder='Fin'
title='Fin'
alt='Fin'
onChange={(e) => setFin(e.target.value)}
size='sm'
/>
</Form.Label>
</Col>
<Col lg={4}>
<Form.Label style={{width:'100%', fontSize:'smaller'}}>
Corresponsal
<Form.Control
as='select'
onChange={(e) => {
setCorresponsal(parseInt(e.target.value))
}}
className='form-select form-select-sm'
>
<option value='0'>-SELECCIONE-</option>
{DataCorresponsales
? DataCorresponsales.map((c) => {
return (
<option value={c.id} key={c.id}>
{c.nombre}
</option>
)
})
: null}
</Form.Control>
</Form.Label>
</Col>
</Row>
<Row style={{paddingTop:'10px'}}>
<Col lg={12} style={{textAlign:'end'}}>
<Button
variant='primary'
size='sm'
onClick={() => {
generaReporte()
}}
style={{marginRight:'5px'}}
>
<BsSearch />
&nbsp; Buscar
</Button>
<Button
size='sm'
variant='success'
onClick={() => {
downloadExcel();
}}
style={{marginRight:'5px'}}
>
<BsFileEarmarkExcel />
&nbsp; Excel
</Button>
</Col>
</Row>
</Card.Body>
</Card>
<br />
<div className='ag-theme-alpine' style={{ height: 500, width: '100%' }}>
<AgGridReact
rowData={filteredData}
columnDefs={columnDefs}
pagination={true}
paginationAutoPageSize={true}
ref={gridRef}
rowSelection={'multiple'}
rowMultiSelectWithClick={true}
></AgGridReact>
</div>
</div>
)
}

@ -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;
}

@ -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<DTOReporteGC50[]>(`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();
Loading…
Cancel
Save