feature creacion del reporte mensual de newell

feature/ConsolidarPedimentos_20231229
Felix Morales 1 year ago
parent 68b77d7918
commit d6be08190b
  1. 10
      src/Classes/Corresponsales/CCorresponsalesTrafico.ts
  2. 254
      src/Components/Corresponsales/TraficoCorresponsales.tsx
  3. 174
      src/Components/ReportesClientes/ReporteMensualNewell.tsx
  4. 6
      src/Components/ReportesClientes/ReporteSemanalNewel.tsx
  5. 4
      src/Components/Utils/FileManager/FileManager.tsx
  6. 4
      src/Interfaces/Corresponsales/ICorresponsalTrafico.ts
  7. 2
      src/Interfaces/ReportesClientes/IReporteOperacionesNewell.ts
  8. 4
      src/Services/Corresponsalias/Corresponsales.Trafico.Services.ts
  9. 10
      src/Services/Reportes/reportesNewell.services.ts
  10. 4
      src/Services/Utils/FileManager.Services.ts
  11. 5
      src/css/generic01.css
  12. 2
      src/index.tsx
  13. 4
      src/store/features/Corresponsales/CorresponsalesTraficoSlice.ts

@ -43,6 +43,8 @@ export default class CCorresponsalesTrafico implements ICorresponsalTrafico {
estatusCode: number; estatusCode: number;
activo?: number; activo?: number;
idTipoMercancia: number | null; idTipoMercancia: number | null;
cargoA: number;
causaRectificacion: string;
constructor() { constructor() {
this.id=0 this.id=0
@ -87,6 +89,8 @@ export default class CCorresponsalesTrafico implements ICorresponsalTrafico {
this.estatusCode=0; this.estatusCode=0;
this.activo=1 this.activo=1
this.idTipoMercancia=null; this.idTipoMercancia=null;
this.cargoA = 0;
this.causaRectificacion = ''
} }
public getEmptyObject(): ICorresponsalTrafico { public getEmptyObject(): ICorresponsalTrafico {
@ -132,7 +136,9 @@ export default class CCorresponsalesTrafico implements ICorresponsalTrafico {
noRecti:0, noRecti:0,
estatusCode:0, estatusCode:0,
activo :1 , activo :1 ,
idTipoMercancia: null idTipoMercancia: null,
cargoA: 0,
causaRectificacion: ''
} }
} }
@ -180,6 +186,8 @@ export default class CCorresponsalesTrafico implements ICorresponsalTrafico {
estatusCode: data.estatusCode, estatusCode: data.estatusCode,
activo : data.activo, activo : data.activo,
idTipoMercancia: data.idTipoMercancia, idTipoMercancia: data.idTipoMercancia,
cargoA: data.cargoA,
causaRectificacion: data.causaRectificacion
} }
} }
} }

@ -136,6 +136,7 @@ interface IAduanas {
export default function TraficoCorresponsales (props:IProps) { export default function TraficoCorresponsales (props:IProps) {
const URL = new TargetURL() const URL = new TargetURL()
const token = localStorage.getItem('token');
const dispatch = useDispatch() const dispatch = useDispatch()
const [UserId, setUserId] = useState(() => { const [UserId, setUserId] = useState(() => {
const stickyValue = window.localStorage.getItem('UserId') const stickyValue = window.localStorage.getItem('UserId')
@ -303,6 +304,10 @@ export default function TraficoCorresponsales (props:IProps) {
const [showNextStepModal, setShowNexStepModal] = useState<boolean>(false); const [showNextStepModal, setShowNexStepModal] = useState<boolean>(false);
const [nextStepModalHeader, setNextStepModalHeader] = useState<string>(""); const [nextStepModalHeader, setNextStepModalHeader] = useState<string>("");
const [nextStepModalBody, setNextStepModalBody] = useState<string>(""); const [nextStepModalBody, setNextStepModalBody] = useState<string>("");
const [CargoPara, setCargoPara] = useState(0);
const [CausaRectificacion, setCausaRectificacion] = useState('');
const [EncabezadoPedimento1, setEncabezadoPedimento1] = useState("Pedimento");
const [EncabezadoPedimento2, setEncabezadoPedimento2] = useState(".");
const FechaRegistro = currentDate() const FechaRegistro = currentDate()
const msgColor = 'primary' const msgColor = 'primary'
@ -400,6 +405,8 @@ export default function TraficoCorresponsales (props:IProps) {
data.fechaCuenta = FechaCuenta data.fechaCuenta = FechaCuenta
data.idTabulador = IDTabulador data.idTabulador = IDTabulador
data.idTipoMercancia = IDTipoMercancia data.idTipoMercancia = IDTipoMercancia
data.cargoA = CargoPara
data.causaRectificacion = CausaRectificacion
CTrafDataService.Append(data) CTrafDataService.Append(data)
.then((response) => { .then((response) => {
if (response.data.estatusCode === 0) { if (response.data.estatusCode === 0) {
@ -689,6 +696,8 @@ export default function TraficoCorresponsales (props:IProps) {
setNoCuenta(response.data.noCuenta) setNoCuenta(response.data.noCuenta)
setFechaCuenta(setDate(response.data.fechaCuenta)) setFechaCuenta(setDate(response.data.fechaCuenta))
setIDTipoMercancia(response.data.idTipoMercancia); setIDTipoMercancia(response.data.idTipoMercancia);
setCargoPara(response.data.cargoA)
setCausaRectificacion(response.data.causaRectificacion)
}) })
.catch((e: Error) => { .catch((e: Error) => {
setHeader('Error') setHeader('Error')
@ -723,7 +732,10 @@ export default function TraficoCorresponsales (props:IProps) {
const loadRectificacionHistorico = () => { const loadRectificacionHistorico = () => {
CTrafDataService.GetRectificacionHistorico(IDTrafico) CTrafDataService.GetRectificacionHistorico(IDTrafico)
.then((response) => { .then((response) => {
if (response.data.id > 0) { if (response.data.id > 0) {
setEncabezadoPedimento1("Pedimento Rectificado")
setEncabezadoPedimento2("Pedimento Original")
setAduanaH(response.data.aduana.toString()) setAduanaH(response.data.aduana.toString())
setPatenteH(response.data.patente.toString()) setPatenteH(response.data.patente.toString())
setPedimentoH(response.data.pedimento.toString()) setPedimentoH(response.data.pedimento.toString())
@ -1296,7 +1308,11 @@ export default function TraficoCorresponsales (props:IProps) {
await axios.post( await axios.post(
URL.get() + URL.get() +
`/FileManager/AppendFileByProcess?IdUsuario=${UserId}&Proceso=${31}&Tags=${IDTrafico}&crud=1`, `/FileManager/AppendFileByProcess?IdUsuario=${UserId}&Proceso=${31}&Tags=${IDTrafico}&crud=1`,
formData formData, {
headers:{
'Authorization': 'Bearer ' + token
}
}
); );
/*const url = URL.createObjectURL(blob); /*const url = URL.createObjectURL(blob);
const link = document.createElement("a"); const link = document.createElement("a");
@ -1522,6 +1538,7 @@ export default function TraficoCorresponsales (props:IProps) {
<option value="2">Ferocarril</option> <option value="2">Ferocarril</option>
<option value="3">Maritimo</option> <option value="3">Maritimo</option>
<option value="4">Terrestre</option> <option value="4">Terrestre</option>
<option value="5">Regularizacion</option>
</Form.Control> </Form.Control>
</Col> </Col>
<Col sm={3} md={3} lg={3}> <Col sm={3} md={3} lg={3}>
@ -1538,6 +1555,7 @@ export default function TraficoCorresponsales (props:IProps) {
<option value="2">Ferocarril</option> <option value="2">Ferocarril</option>
<option value="3">Maritimo</option> <option value="3">Maritimo</option>
<option value="4">Terrestre</option> <option value="4">Terrestre</option>
<option value="5">Regularizacion</option>
</Form.Control> </Form.Control>
</Col> </Col>
</Row> </Row>
@ -1767,11 +1785,12 @@ export default function TraficoCorresponsales (props:IProps) {
</Row> </Row>
<Row style={{padding: "5px 0"}}> <Row style={{padding: "5px 0"}}>
<Col sm={12} md={12} lg={6}> <Col sm={12} md={12} lg={6}>
<Row className='justify-content-around' style={{alignItems:'center'}}> <fieldset className='border p-2'>
<Col sm={2} md={1} lg={1}> <legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>{EncabezadoPedimento1}</legend>
<Form.Label>Trafico</Form.Label> <Row className='justify-content-between' style={{alignItems:'center'}}>
</Col>
<Col sm={3} md={3} lg={3}> <Col sm={3} md={3} lg={3}>
<Form.Label>
Trafico
<Form.Control <Form.Control
type="text" type="text"
id="Trafico" id="Trafico"
@ -1784,11 +1803,11 @@ export default function TraficoCorresponsales (props:IProps) {
setTrafico(e.target.value) setTrafico(e.target.value)
}} }}
/> />
</Col> </Form.Label>
<Col sm={1} md={1} lg={2}>
<Form.Label>Aduana</Form.Label>
</Col> </Col>
<Col sm={2} md={3} lg={2}> <Col sm={2} md={3} lg={2}>
<Form.Label>
Aduana
<Form.Control <Form.Control
type="text" type="text"
id="Aduana" id="Aduana"
@ -1796,11 +1815,11 @@ export default function TraficoCorresponsales (props:IProps) {
disabled={true} disabled={true}
value={Aduana} value={Aduana}
/> />
</Col> </Form.Label>
<Col sm={1} md={1} lg={2}>
<Form.Label>Patente</Form.Label>
</Col> </Col>
<Col sm={2} md={3} lg={2}> <Col sm={2} md={3} lg={2}>
<Form.Label>
Patente
<Form.Control <Form.Control
type="text" type="text"
id="Patente" id="Patente"
@ -1808,27 +1827,22 @@ export default function TraficoCorresponsales (props:IProps) {
disabled={true} disabled={true}
value={Patente} value={Patente}
/> />
</Form.Label>
</Col> </Col>
</Row> <Col sm={2} md={2} lg={3}>
</Col> <Form.Label>
<Col sm={12} md={12} lg={6}> <span
<Row className='justify-content-around' style={{alignItems:'center'}}>
<Col sm={2} md={2}>
<Form.Label
onClick={() => { onClick={() => {
openSOIA() openSOIA()
}} }}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
Pedimento Pedimento
</Form.Label> </span>
</Col>
<Col sm={2} md={2}>
<CurrencyFormat <CurrencyFormat
value={Pedimento} value={Pedimento}
displayType={ displayType='input'
Depto === 'Corresponsalias' ? 'input' : 'text' readOnly= {Depto !== 'Corresponsalias' ? true : false}
}
format={'### ####'} format={'### ####'}
mask="_" mask="_"
onValueChange={(values: any) => { onValueChange={(values: any) => {
@ -1844,31 +1858,22 @@ export default function TraficoCorresponsales (props:IProps) {
}) })
} }
}} }}
style={ style={{
Depto === 'Corresponsalias'
? {
fontSize: '18px', fontSize: '18px',
backgroundColor: '#FEFDF5', backgroundColor: '#FEFDF5',
border: '2px solid #837F5D', border: '2px solid #837F5D',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px' borderRadius: '10px'
} }}
: {
fontSize: '16px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}
}
/> />
</Form.Label>
</Col> </Col>
<Col sm={1} md={1}> </Row>
<Form.Label>Clave</Form.Label> <Row className='justify-content-between' style={{alignItems:'center'}}>
</Col> <Col sm={3} md={3} lg={3}>
<Col sm={3} md={3}> <Form.Label>
Clave
<Form.Control <Form.Control
type="text" type="text"
id="Clave" id="Clave"
@ -1879,11 +1884,11 @@ export default function TraficoCorresponsales (props:IProps) {
} }
onChange={(e) => setClavePedimento(e.target.value)} onChange={(e) => setClavePedimento(e.target.value)}
/> />
</Col> </Form.Label>
<Col sm={1} md={1}>
<Form.Label>Fec. Pago</Form.Label>
</Col> </Col>
<Col sm={3} md={3}> <Col sm={3} md={3}>
<Form.Label>
Fec. Pago
<Form.Control <Form.Control
type="date" type="date"
id="FechaPago" id="FechaPago"
@ -1894,15 +1899,54 @@ export default function TraficoCorresponsales (props:IProps) {
} }
onChange={(e) => setFechaPago(e.target.value)} onChange={(e) => setFechaPago(e.target.value)}
/> />
</Form.Label>
</Col>
<Col xs={6}>
<Form.Label style={{width:'100%', visibility: AduanaH === '' ? 'hidden':'visible'}}>
Cargo A
<Form.Control
as="select"
className="form-select form-select-sm"
value={CargoPara}
disabled={
Depto !== 'Corresponsalias' ? true : false
}
onChange={(e) => {
setCargoPara(parseInt(e.target.value))
}}
>
<option value="0">-SELECCIONE-</option>
<option value="1">CLIENTE</option>
<option value="2">CORRESPONSAL</option>
</Form.Control>
</Form.Label>
</Col> </Col>
</Row> </Row>
<Row className='justify-content-between' style={{alignItems:'center'}}>
<Col sm={3}>
<Form.Label style={{visibility: AduanaH === '' ? 'hidden':'visible'}}>Causa Rectificacion:</Form.Label>
</Col>
<Col sm={9}>
<Form.Control
as="textarea"
id="Observacion"
size="sm"
value={CausaRectificacion}
disabled={Depto !== 'Corresponsalias'}
onChange={(e) => setCausaRectificacion(e.target.value)}
style={{visibility: AduanaH === '' ? 'hidden':'visible'}}
/>
</Col> </Col>
</Row> </Row>
<Row style={{padding: "5px 0"}}> </fieldset>
</Col>
<Col sm={12} md={12} lg={6}> <Col sm={12} md={12} lg={6}>
<Row className='justify-content-around' style={{alignItems:'center'}}> <fieldset className='border p-2' style={{height:'100%'}}>
<legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>{EncabezadoPedimento2}</legend>
<Row className='justify-content-between' style={{alignItems:'center', paddingTop:'15px'}}>
<Col sm={5} md={4} lg={4} style={{visibility: (IDTrafico>0 && !(AduanaH.length>0 && PatenteH.length>0 && PedimentoH.length>0 && FechaPagoH.length>0)) ? 'visible' : 'hidden' }}> <Col sm={5} md={4} lg={4} style={{visibility: (IDTrafico>0 && !(AduanaH.length>0 && PatenteH.length>0 && PedimentoH.length>0 && FechaPagoH.length>0)) ? 'visible' : 'hidden' }}>
<Button variant="success" onClick={()=>{generaRectificacion()}}>Generar rectificacion</Button> <Button variant="success" disabled={Depto !== 'Corresponsalias'} onClick={()=>{generaRectificacion()}}>Generar rectificacion</Button>
</Col> </Col>
<Col sm={1} md={1} lg={2}> <Col sm={1} md={1} lg={2}>
<Form.Label>Aduana</Form.Label> <Form.Label>Aduana</Form.Label>
@ -1919,7 +1963,9 @@ export default function TraficoCorresponsales (props:IProps) {
color: '#5923F6', color: '#5923F6',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px' borderRadius: '10px',
paddingRight: '10px',
paddingLeft: '10px'
}} }}
/> />
</Col> </Col>
@ -1938,20 +1984,20 @@ export default function TraficoCorresponsales (props:IProps) {
color: '#5923F6', color: '#5923F6',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px' borderRadius: '10px',
paddingRight: '10px',
paddingLeft: '10px'
}} }}
/> />
</Col> </Col>
</Row> </Row>
</Col> <Row className='justify-content-between' style={{alignItems:'center', paddingTop:'15px'}}>
<Col sm={12} md={12} lg={6}> <Col sm={2} md={2} lg={2}>
<Row className='justify-content-around' style={{alignItems:'center'}}>
<Col sm={2} md={2}>
<Form.Label style={{ cursor: 'pointer' }}> <Form.Label style={{ cursor: 'pointer' }}>
Pedimento Pedimento
</Form.Label> </Form.Label>
</Col> </Col>
<Col sm={2} md={2}> <Col sm={2} md={2} lg={3}>
<CurrencyFormat <CurrencyFormat
value={PedimentoH} value={PedimentoH}
disabled={true} disabled={true}
@ -1964,14 +2010,16 @@ export default function TraficoCorresponsales (props:IProps) {
color: '#5923F6', color: '#5923F6',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px' borderRadius: '10px',
paddingRight: '10px',
paddingLeft: '10px'
}} }}
/> />
</Col> </Col>
<Col sm={1} md={1}> <Col sm={1} md={1}>
<Form.Label>Clave</Form.Label> <Form.Label>Clave</Form.Label>
</Col> </Col>
<Col sm={3} md={3}> <Col sm={3} md={3}lg={2}>
<Form.Control <Form.Control
type="text" type="text"
id="ClavePedimentoH" id="ClavePedimentoH"
@ -2005,11 +2053,14 @@ export default function TraficoCorresponsales (props:IProps) {
color: '#5923F6', color: '#5923F6',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px' borderRadius: '10px',
paddingRight: '10px',
paddingLeft: '10px'
}} }}
/> />
</Col> </Col>
</Row> </Row>
</fieldset>
</Col> </Col>
</Row> </Row>
<Row style={{padding: "5px 0"}}> <Row style={{padding: "5px 0"}}>
@ -2024,35 +2075,23 @@ export default function TraficoCorresponsales (props:IProps) {
<CurrencyFormat <CurrencyFormat
value={TipoCambio} value={TipoCambio}
prefix={'$'} prefix={'$'}
displayType={ displayType='input'
Depto === 'Corresponsalias' ? 'input' : 'text' readOnly= {Depto !== 'Corresponsalias' ? true : false}
}
thousandSeparator={true} thousandSeparator={true}
onValueChange={(values: any) => { onValueChange={(values: any) => {
const { value } = values const { value } = values
setTipoCambio(value) setTipoCambio(value)
}} }}
style={ style={{
Depto === 'Corresponsalias'
? {
fontSize: '18px',
backgroundColor: '#F5FFED',
border: '2px solid #25D05B',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}
: {
fontSize: '18px', fontSize: '18px',
backgroundColor: '#F5FFED', backgroundColor: '#F5FFED',
border: '2px solid #25D05B', border: '2px solid #25D05B',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px', borderRadius: '10px',
paddingRight: '5px', paddingRight: '10px',
paddingLeft: '5px' paddingLeft: '10px'
} }}
}
/> />
</Col> </Col>
<Col sm={2} md={2} lg={2}> <Col sm={2} md={2} lg={2}>
@ -2064,35 +2103,23 @@ export default function TraficoCorresponsales (props:IProps) {
<CurrencyFormat <CurrencyFormat
value={ValorAduanaMN} value={ValorAduanaMN}
prefix={'$'} prefix={'$'}
displayType={ displayType='input'
Depto === 'Corresponsalias' ? 'input' : 'text' readOnly= {Depto !== 'Corresponsalias' ? true : false}
}
thousandSeparator={true} thousandSeparator={true}
onValueChange={(values: any) => { onValueChange={(values: any) => {
const { value } = values const { value } = values
setValorAduanaMN(value) setValorAduanaMN(value)
}} }}
style={ style={{
Depto === 'Corresponsalias'
? {
fontSize: '18px',
backgroundColor: '#F5FFED',
border: '2px solid #25D05B',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}
: {
fontSize: '18px', fontSize: '18px',
backgroundColor: '#F5FFED', backgroundColor: '#F5FFED',
border: '2px solid #25D05B', border: '2px solid #25D05B',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px', borderRadius: '10px',
paddingRight: '5px', paddingRight: '10px',
paddingLeft: '5px' paddingLeft: '10px'
} }}
}
/> />
</Col> </Col>
</Row> </Row>
@ -2108,35 +2135,23 @@ export default function TraficoCorresponsales (props:IProps) {
<CurrencyFormat <CurrencyFormat
value={TotalPagado} value={TotalPagado}
prefix={'$'} prefix={'$'}
displayType={ displayType='input'
Depto === 'Corresponsalias' ? 'input' : 'text' readOnly= {Depto !== 'Corresponsalias' ? true : false}
}
thousandSeparator={true} thousandSeparator={true}
onValueChange={(values: any) => { onValueChange={(values: any) => {
const { value } = values const { value } = values
setTotalPagado(value) setTotalPagado(value)
}} }}
style={ style={{
Depto === 'Corresponsalias'
? {
fontSize: '18px',
backgroundColor: '#F5FFED',
border: '2px solid #25D05B',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}
: {
fontSize: '18px', fontSize: '18px',
backgroundColor: '#F5FFED', backgroundColor: '#F5FFED',
border: '2px solid #25D05B', border: '2px solid #25D05B',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px', borderRadius: '10px',
paddingRight: '5px', paddingRight: '10px',
paddingLeft: '5px' paddingLeft: '10px'
} }}
}
/> />
</Col> </Col>
<Col sm={2} md={2} lg={2}> <Col sm={2} md={2} lg={2}>
@ -2253,27 +2268,16 @@ export default function TraficoCorresponsales (props:IProps) {
setValorFacturasDls(value) setValorFacturasDls(value)
}} }}
readOnly={true} readOnly={true}
style={ style={{
Depto === 'Corresponsalias'
? {
fontSize: '18px',
backgroundColor: '#F5FFED',
border: '2px solid #25D05B',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}
: {
fontSize: '18px', fontSize: '18px',
backgroundColor: '#F5FFED', backgroundColor: '#F5FFED',
border: '2px solid #25D05B', border: '2px solid #25D05B',
width: '100%', width: '100%',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px', borderRadius: '10px',
paddingRight: '5px', paddingRight: '10px',
paddingLeft: '5px' paddingLeft: '10px'
} }}
}
/> />
</Col> </Col>
</Row> </Row>

@ -0,0 +1,174 @@
import { useEffect, useRef, useState } from "react";
import { Row, Col, Card, Button, Form } from "react-bootstrap";
import { FaRegFileExcel } from "react-icons/fa";
import { MdCloudUpload, MdDeleteForever, MdCloudDownload } from "react-icons/md";
import { MsgInformativo } from "../Utils/Toast/msgInformativo";
import reportesNewellServices from "../../Services/Reportes/reportesNewell.services";
import axios from "axios";
import { TargetURL } from "../../Constants/TargetURL";
import FileManager from "../Utils/FileManager/FileManager";
import FileManagerServices from "../../Services/Utils/FileManager.Services";
export const ReporteMensualNewell: React.FC<{}> = () => {
const [Mes, setMes] = useState('Septiembre')
const [show, setShowMsg] = useState(false)
const [header, setHeader] = useState('')
const [msg, setMsg] = useState('')
const [msgColor, setMsgColor] = useState('primary')
const [UserId, setUserId] = useState(() => {
const stickyValue = window.localStorage.getItem('UserId')
return stickyValue !== null ? JSON.parse(stickyValue) : 0
});
const [IdTrailasFile, setIdTrailasFile] = useState(0);
const [IdOpCdAcunaFile, setIdOpCdAcunaFile] = useState(0);
const [IdOpMyMFile, setIdOpMyMFile] = useState(0);
const GenerarReporteMensualNewell = async () => {
if (IdTrailasFile === 0 || IdOpCdAcunaFile === 0 || IdOpMyMFile === 0){
setHeader('Error')
setMsg('Asegurese de cargar todos los archivos para continuar.')
setShowMsg(true)
return;
}
reportesNewellServices.getReporteMensual(IdTrailasFile, IdOpCdAcunaFile, IdOpMyMFile)
.then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `ReporteMensual_${Mes}.xlsx`);
document.body.appendChild(link);
link.click();
}).catch(error => {
console.log(error);
});
}
const convertFile = (fileId: number, process: number) => {
FileManagerServices.ConvertFile(fileId, process).then((resp: any) => console.log(resp));
}
return (
<>
<Row style={{paddingTop:'7rem'}}></Row>
<Row>
<Col xs={4}></Col>
<Col xs={4}>
<Card style={{width:'100%'}}>
<Card.Header><h4>Reporte Mensual Newell</h4></Card.Header>
<Card.Body>
<Row className="justify-content-center">
<Col xs={6}>
<Form.Label style={{width:'100%'}}>
Mes
<Form.Control
as="select"
id="CmbOpEntrada"
onChange={(e) => setMes(e.target.value)}
value={Mes}
className="form-select form-select-sm"
>
<option value="Enero">Enero</option>
<option value="Febrero">Febrero</option>
<option value="Marzo">Marzo</option>
<option value="Abril">Abril</option>
<option value="Mayo">Mayo</option>
<option value="Junio">Junio</option>
<option value="Julio">Julio</option>
<option value="Agosto">Agosto</option>
<option value="Septiembre">Septiembre</option>
<option value="Octubre">Octubre</option>
<option value="Noviembre">Noviembre</option>
<option value="Diciembre">Diciembre</option>
</Form.Control>
</Form.Label>
</Col>
</Row>
<br/>
<Row style={{justifyContent:'center', alignItems:'center', padding:'0px 20px 0px 20px'}}>
<form
style={{
display: 'flex', flexDirection:'column', justifyContent:'center',
alignItems:'center', height: '280px', width:'500px'
}}
>
<div style={{
width:'100%', padding:'10px', margin:'5px 0', display:'flex', alignItems:'center', justifyContent: 'space-between',
border:'2px dashed rgb(20,117,207)', borderRadius:'5px'
}}>
<FileManager
width={'25rem'}
height={200}
IDProcess={32}
IDUser={UserId}
IdFile={0}
FileName={''}
canDelete={true}
FileType={['xls']}
Leyenda={
'Seleccione el reporte de trailas'
}
onAppendFM={function (idFile: number): void { setIdTrailasFile(idFile); convertFile(idFile, 32);}}
/>
</div>
<div style={{
width:'100%', padding:'10px', margin:'5px 0', display:'flex', alignItems:'center', justifyContent: 'space-between',
border:'2px dashed rgb(20,117,207)', borderRadius:'5px'
}}>
<FileManager
width={'25rem'}
height={200}
IDProcess={33}
IDUser={UserId}
IdFile={0}
FileName={''}
canDelete={true}
FileType={['xls']}
Leyenda={
'Seleccione el excel de operaciones de Cd. Acuña'
}
onAppendFM={function (idFile: number): void { setIdOpCdAcunaFile(idFile); convertFile(idFile, 33); }}
/>
</div>
<div style={{
width:'100%', padding:'10px', margin:'5px 0', display:'flex', alignItems:'center', justifyContent: 'space-between',
border:'2px dashed rgb(20,117,207)', borderRadius:'5px'
}}>
<FileManager
width={'25rem'}
height={200}
IDProcess={34}
IDUser={UserId}
IdFile={0}
FileName={''}
canDelete={true}
FileType={['xlsx']}
Leyenda={
'Seleccione el excel de operaciones de Lazaro Cardenas'
}
onAppendFM={function (idFile: number): void { setIdOpMyMFile(idFile);}}
/>
</div>
</form>
</Row>
</Card.Body>
<Card.Footer style={{textAlign:'end'}}>
<Button className="primary" onClick={GenerarReporteMensualNewell} title="Descargar reporte">
Generar <MdCloudDownload style={{marginLeft:'5px'}}/>
</Button>
</Card.Footer>
</Card>
</Col>
<Col xs={4}></Col>
</Row>
<MsgInformativo
show={show}
msg={msg}
header={header}
msgColor={msgColor}
closeToast={() => {
setShowMsg(false)
}}
/>
</>
)
}

@ -5,7 +5,7 @@ import * as XLSX from 'xlsx'
import CTrafDataService from '../../Services/Corresponsalias/Corresponsales.Trafico.Services' import CTrafDataService from '../../Services/Corresponsalias/Corresponsales.Trafico.Services'
import { MsgInformativo } from "../Utils/Toast/msgInformativo"; import { MsgInformativo } from "../Utils/Toast/msgInformativo";
import { FaRegFileExcel } from "react-icons/fa"; import { FaRegFileExcel } from "react-icons/fa";
import IReporteSemanalNewell from "../../Interfaces/ReportesClientes/IReporteSemanalNewell"; import IReporteOperacionesNewell from "../../Interfaces/ReportesClientes/IReporteOperacionesNewell";
export const ReporteSemanalNewell: React.FC<{}> = () => { export const ReporteSemanalNewell: React.FC<{}> = () => {
@ -56,14 +56,14 @@ export const ReporteSemanalNewell: React.FC<{}> = () => {
const oldWorkSheetName = oldWorkBook.SheetNames[0]//se toma el nombre de la primer hoja del archivo const oldWorkSheetName = oldWorkBook.SheetNames[0]//se toma el nombre de la primer hoja del archivo
const oldWorkSheet = oldWorkBook.Sheets[oldWorkSheetName]//Se crea una referencia a la misma hoja const oldWorkSheet = oldWorkBook.Sheets[oldWorkSheetName]//Se crea una referencia a la misma hoja
XLSX.utils.sheet_add_aoa(oldWorkSheet,encabezadosTemp,{origin:'A1'});//Se cambian los encabezados originales por los temporales para que las columnas coincidan con las propiedades del dto IReporteSemanalNewell XLSX.utils.sheet_add_aoa(oldWorkSheet,encabezadosTemp,{origin:'A1'});//Se cambian los encabezados originales por los temporales para que las columnas coincidan con las propiedades del dto IReporteSemanalNewell
const rows = XLSX.utils.sheet_to_json<IReporteSemanalNewell>(oldWorkSheet)//aqui es donde los renglones pasan a ser un array de objetos const rows = XLSX.utils.sheet_to_json<IReporteOperacionesNewell>(oldWorkSheet)//aqui es donde los renglones pasan a ser un array de objetos
//Se obtienen los datos faltantes del reporte //Se obtienen los datos faltantes del reporte
let newWorkBookData = await getDataByPedimento(rows); let newWorkBookData = await getDataByPedimento(rows);
await exportReporteSemanal(newWorkBookData); await exportReporteSemanal(newWorkBookData);
} }
} }
const getDataByPedimento = async (rows: IReporteSemanalNewell[]) => { const getDataByPedimento = async (rows: IReporteOperacionesNewell[]) => {
let data = [...rows]; let data = [...rows];
data=[]; data=[];
await Promise.all( await Promise.all(

@ -19,7 +19,7 @@ interface IProps {
Leyenda: string Leyenda: string
canDelete: boolean canDelete: boolean
FileType: string[] FileType: string[]
width: number width: number | string
height: number height: number
onDelete?: (val: boolean) => void onDelete?: (val: boolean) => void
setBackgroundColor?: number setBackgroundColor?: number
@ -206,7 +206,7 @@ export const FileManager: FC<IProps> = (props) => {
</div> </div>
<Container className='labelSize13px'> <Container className='labelSize13px'>
{Archivo?.nombreArchivo ? ( {Archivo?.nombreArchivo ? (
<Alert variant='primary'> <Alert variant='primary' style={{margin:'0px'}}>
<Row> <Row>
<Col xs={11}> <Col xs={11}>
<span style={{ fontWeight: 'bold' }}>{props.Prefijo ? props.Prefijo : 'Archivo'}</span> : &nbsp; <span style={{ fontWeight: 'bold' }}>{props.Prefijo ? props.Prefijo : 'Archivo'}</span> : &nbsp;

@ -40,5 +40,7 @@ export default interface ICorresponsalTrafico {
noRecti: number, noRecti: number,
estatusCode: number, estatusCode: number,
activo?: number, activo?: number,
idTipoMercancia: number | null idTipoMercancia: number | null,
cargoA: number,
causaRectificacion: string,
} }

@ -1,4 +1,4 @@
export default interface IReporteSemanalNewell{ export default interface IReporteOperacionesNewell{
aduana: number; patente: number; pedimento: number; fechaDeEntrada: string|Date; fechaDePago: string|Date; aduana: number; patente: number; pedimento: number; fechaDeEntrada: string|Date; fechaDePago: string|Date;
valorComercialMxn: number; valorComercialDlls: number; valorAduana: number; clave: string; iva: number; valorComercialMxn: number; valorComercialDlls: number; valorAduana: number; clave: string; iva: number;
dta: number; prv: number; lgi: number; factura: string; tc: number; proveedor: string; taxId: number; producto: string; dta: number; prv: number; lgi: number; factura: string; tc: number; proveedor: string; taxId: number; producto: string;

@ -6,7 +6,7 @@ import DTOTraficoCompleto from "../../DTO/Corresponsales/DTOTraficoCompleto";
import IRespuesta from "../../Interfaces/IRespuesta"; import IRespuesta from "../../Interfaces/IRespuesta";
import ICorresponsalRectificacionHistorico from "../../Interfaces/Corresponsales/ICorresponsalRectificacionHistorico"; import ICorresponsalRectificacionHistorico from "../../Interfaces/Corresponsales/ICorresponsalRectificacionHistorico";
import DTORectificacionHistorico from "../../DTO/Corresponsales/DTORectificacionHistorico"; import DTORectificacionHistorico from "../../DTO/Corresponsales/DTORectificacionHistorico";
import IReporteSemanalNewell from "../../Interfaces/ReportesClientes/IReporteSemanalNewell"; import IReporteOperacionesNewell from "../../Interfaces/ReportesClientes/IReporteOperacionesNewell";
class Corresponsales_Trafico_DataService { class Corresponsales_Trafico_DataService {
GetAll(id: number) { GetAll(id: number) {
@ -14,7 +14,7 @@ class Corresponsales_Trafico_DataService {
} }
GetByPedimento(pedimento: number) { GetByPedimento(pedimento: number) {
return http.get<IReporteSemanalNewell>(`/Corresponsalias/Traficos/GetByPedimento?pedimento=${pedimento}`); return http.get<IReporteOperacionesNewell>(`/Corresponsalias/Traficos/GetByPedimento?pedimento=${pedimento}`);
} }
Append(data: ICorresponsalTrafico) { Append(data: ICorresponsalTrafico) {

@ -0,0 +1,10 @@
import http from "../common/http-common";
class ReportesNewellService{
getReporteMensual(IdTrailasFile: number, IdOpCdAcunaFile: number, IdOpMyMFile: number){
return http.get(`reportesNewell/ReporteMensual?idTrailasFile=${IdTrailasFile}&idRptCdAcunaFile=${IdOpCdAcunaFile}&idRptLazaroCardenasFile=${IdOpMyMFile}`, {responseType: 'blob'});
}
}
export default new ReportesNewellService();

@ -23,5 +23,9 @@ class FileManagerDataService {
return http.delete<IRespuesta>(`/FileManager/DeleteById/${id}`); return http.delete<IRespuesta>(`/FileManager/DeleteById/${id}`);
} }
ConvertFile(fileId: number, process: number){
return http.get<IFileManager>(`/FileManager/ConvertExcel2New?id=${fileId}&Proceso=${process}`);
}
} }
export default new FileManagerDataService(); export default new FileManagerDataService();

@ -65,9 +65,10 @@
tr:nth-child(odd) { background-color: #f5f5f5; } tr:nth-child(odd) { background-color: #f5f5f5; }
.hideDiv { .hideDiv {
visibility: 'hidden'; display: none;
/*visibility: 'hidden';
height: '0px'; height: '0px';
width: '0px'; width: '0px';*/
} }
.hideRow { .hideRow {

@ -21,6 +21,7 @@ import PIN from './Components/Login/PIN'
import UserControl from './Components/UserControl/UserControl' import UserControl from './Components/UserControl/UserControl'
import ResetCredentials from './Components/Login/ResetCredentials' import ResetCredentials from './Components/Login/ResetCredentials'
import { ReporteSemanalNewell } from './Components/ReportesClientes/ReporteSemanalNewel' import { ReporteSemanalNewell } from './Components/ReportesClientes/ReporteSemanalNewel'
import { ReporteMensualNewell } from './Components/ReportesClientes/ReporteMensualNewell'
require (`./css/${process.env.REACT_APP_ENVIRONMENT}-home.css`) require (`./css/${process.env.REACT_APP_ENVIRONMENT}-home.css`)
function PageNotFound() { function PageNotFound() {
@ -73,6 +74,7 @@ root.render(
<Route path="/CatTabuladores" element={<CatTabuladores />} /> <Route path="/CatTabuladores" element={<CatTabuladores />} />
<Route path="*" element={<PageNotFound />} /> <Route path="*" element={<PageNotFound />} />
<Route path='newellSemanal' element={<ReporteSemanalNewell/>}/> <Route path='newellSemanal' element={<ReporteSemanalNewell/>}/>
<Route path='newellMensual' element={<ReporteMensualNewell/>}/>
</Route> </Route>
</Routes> </Routes>
</HashRouter> </HashRouter>

@ -42,7 +42,9 @@ const CorresponsalesTrafico: ICorresponsalTrafico[] = [{
noRecti:0, noRecti:0,
estatusCode:0, estatusCode:0,
activo: 0, activo: 0,
idTipoMercancia:0 idTipoMercancia:0,
cargoA: 0,
causaRectificacion: ''
}] }]
const initialState = { CorresponsalesTrafico } const initialState = { CorresponsalesTrafico }

Loading…
Cancel
Save