Creacion del funcionamiento para agregar varias rectificaciones a un mismo trafico

feature/Agregar_Multiples_Rectificaciones_Al_Mismo_Trafico_20240109
Felix Morales 9 months ago
parent 5ebde71d32
commit 8a798d2249
  1. 688
      src/Components/Clientes/Traficos/TraficoCliente.tsx
  2. 248
      src/Components/Corresponsales/PedimentosConsolidados/PedimentosConsolidados.tsx
  3. 85
      src/Components/Corresponsales/Rectificaciones/HistorialRectificaciones.tsx
  4. 348
      src/Components/Corresponsales/Rectificaciones/NuevaRectificacion.tsx
  5. 94
      src/Components/Corresponsales/TraficoCorresponsales.tsx
  6. 13
      src/DTO/Corresponsales/DTORectificacionHistorico.ts
  7. 3
      src/Interfaces/Corresponsales/ICorresponsalRectificacionHistorico.ts
  8. 4
      src/Services/Corresponsalias/Corresponsales.Trafico.Services.ts
  9. 40
      src/store/features/Corresponsales/CorresponsalesPedimentosRectificacionesSlice.ts
  10. 4
      src/store/store.ts

@ -80,6 +80,11 @@ import FileManager from "../../Utils/FileManager/FileManager"
import { MFileManager } from "../../Utils/MFileManager/MFileManager" import { MFileManager } from "../../Utils/MFileManager/MFileManager"
import { MsgInformativo } from "../../Utils/Toast/msgInformativo" import { MsgInformativo } from "../../Utils/Toast/msgInformativo"
import DatePicker from 'react-datepicker' import DatePicker from 'react-datepicker'
import { populateRectificaciones } from "../../../store/features/Corresponsales/CorresponsalesPedimentosRectificacionesSlice"
import { NuevaRectificacion } from "../../Corresponsales/Rectificaciones/NuevaRectificacion"
import { PedimentosConsolidados } from "../../Corresponsales/PedimentosConsolidados/PedimentosConsolidados"
import { populatePedimentos } from "../../../store/features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice"
import PedimentosConsolidadosService from '../../../Services/Corresponsalias/Corresponsales.Trafico.Pedimento.Consolidados.Service'
interface IProps { interface IProps {
IDTrafico: number IDTrafico: number
onClose: (val: boolean) => void onClose: (val: boolean) => void
@ -138,6 +143,9 @@ export default function TraficoCliente(props:IProps){
(state: RootState) => (state: RootState) =>
state.CCueCompEstatus.CorresponsalesCuentasComplementariasEstatus state.CCueCompEstatus.CorresponsalesCuentasComplementariasEstatus
) )
const mCPedimentosConsolidados = useSelector(
(state:RootState) => state.CPedimentosConsolidados.PedimentosConsolidados
)
const mCProveedores = useSelector((state:RootState) => state.CatProveedores.CatalogoProveedores) const mCProveedores = useSelector((state:RootState) => state.CatProveedores.CatalogoProveedores)
const [ModalSize, setModalSize] = useState('sm') const [ModalSize, setModalSize] = useState('sm')
@ -207,6 +215,8 @@ export default function TraficoCliente(props:IProps){
'Facturas pagos a terceros' 'Facturas pagos a terceros'
) )
const [LblAnticipos, setLblAnticipos] = useState('Anticipos') const [LblAnticipos, setLblAnticipos] = useState('Anticipos')
const [LblPedimentos, setLblPedimentos] = useState('Pedimentos Consolidados')
const [LblRectificaciones, setLblRectificaciones] = useState('Ped. Rectificados')
const [StatusTrafico, setStatusTrafico] = useState(1) const [StatusTrafico, setStatusTrafico] = useState(1)
const [StatusColor, setStatusColor] = useState('#FFFFFF') const [StatusColor, setStatusColor] = useState('#FFFFFF')
const [PagosaTerceros, setPagosaTerceros] = useState(0) const [PagosaTerceros, setPagosaTerceros] = useState(0)
@ -282,7 +292,7 @@ export default function TraficoCliente(props:IProps){
const [nextStepModalBody, setNextStepModalBody] = useState<string>(""); const [nextStepModalBody, setNextStepModalBody] = useState<string>("");
const [CargoPara, setCargoPara] = useState(0); const [CargoPara, setCargoPara] = useState(0);
const [CausaRectificacion, setCausaRectificacion] = useState(''); const [CausaRectificacion, setCausaRectificacion] = useState('');
const [EncabezadoPedimento1, setEncabezadoPedimento1] = useState("Pedimento"); const [EncabezadoPedimento1, setEncabezadoPedimento1] = useState("Pedimentos");
const [EncabezadoPedimento2, setEncabezadoPedimento2] = useState("."); const [EncabezadoPedimento2, setEncabezadoPedimento2] = useState(".");
const [CentroCostos, setCentroCostos] = useState<string>(''); const [CentroCostos, setCentroCostos] = useState<string>('');
const [ClaveClienteFacturacion, setClaveClienteFacturacion] = useState(0); const [ClaveClienteFacturacion, setClaveClienteFacturacion] = useState(0);
@ -726,6 +736,10 @@ export default function TraficoCliente(props:IProps){
setShowMsg(true) setShowMsg(true)
return return
}) })
PedimentosConsolidadosService.GetAll(IDTrafico)
.then((resp) => {
dispatch(populatePedimentos(resp.data))
})
loadRectificacionHistorico() loadRectificacionHistorico()
DoesThe2ZipFileExists() DoesThe2ZipFileExists()
} }
@ -733,15 +747,15 @@ export default function TraficoCliente(props:IProps){
const loadRectificacionHistorico = () => { const loadRectificacionHistorico = () => {
CTrafDataService.GetRectificacionHistorico(IDTrafico) CTrafDataService.GetRectificacionHistorico(IDTrafico)
.then((response) => { .then((response) => {
dispatch(populateRectificaciones(response.data))
if (response.data.id > 0) { if (response.data.length > 0) {
setEncabezadoPedimento1("Pedimento Rectificado") let ultimaRectificacion = response.data[response.data.length-1]
setEncabezadoPedimento2("Pedimento Original") setEncabezadoPedimento1("Pedimento Master Rectificado")
setAduanaH(response.data.aduana.toString()) setAduanaH(ultimaRectificacion.aduana.toString())
setPatenteH(response.data.patente.toString()) setPatenteH(ultimaRectificacion.patente.toString())
setPedimentoH(response.data.pedimento.toString()) setPedimentoH(ultimaRectificacion.pedimento.toString())
setClavePedimentoH(response.data.clave) setClavePedimentoH(ultimaRectificacion.clave)
setFechaPagoH(response.data.fechaPago) setFechaPagoH(ultimaRectificacion.fechaPago)
} }
}) })
.catch((e: Error) => { .catch((e: Error) => {
@ -1035,6 +1049,12 @@ export default function TraficoCliente(props:IProps){
setValorFacturasDls(total) setValorFacturasDls(total)
}, [mCFacturas, IDTrafico, IDCliente]) }, [mCFacturas, IDTrafico, IDCliente])
useEffect(() => {
let ant = mCPedimentosConsolidados.filter(x => x.id > 0)
let label = `Pedimentos Consolidados (${ant.length})`
setLblPedimentos(label)
}, [mCPedimentosConsolidados])
function calculateDaysBetweenDates(date1: Date, date2: Date) { function calculateDaysBetweenDates(date1: Date, date2: Date) {
var oneDay = 24 * 60 * 60 * 1000 var oneDay = 24 * 60 * 60 * 1000
var date1InMillis = date1.getTime() var date1InMillis = date1.getTime()
@ -1186,37 +1206,6 @@ export default function TraficoCliente(props:IProps){
return time.getHours() > 12 ? 'text-success' : 'text-error' return time.getHours() > 12 ? 'text-success' : 'text-error'
} }
const generaRectificacion = () => {
if (Aduana && Patente && Pedimento && ClavePedimento.length>0 && FechaPago) {
const data : DTORectificacionHistorico = {
IdTrafico: IDTrafico,
IdUsuario: UserId
}
CTrafDataService.AppendRectificacionHistorico(data)
.then((response) => {
console.log(response);
if(response.data) loadRectificacionHistorico()
else{
setHeader('Error')
setMsg('Para poder generar la rectificación asegurese de GUARDAR los datos: Patente, Aduana, Pedimento, Clave, Fecha pago')
setShowMsg(true)
return
}
})
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrio un error: ' + e)
setShowMsg(true)
return
})
} else {
setHeader('Error')
setMsg('Parea poder generar este proceso es necesario que los siguientes campos tengan informacion: Patente, Aduana, Pedimento, Clave, Fecha pago')
setShowMsg(true)
return
}
}
const concatFacturasPedidos = (facturas: ICorresponsalFacturas[]) => { const concatFacturasPedidos = (facturas: ICorresponsalFacturas[]) => {
let pedidos = ""; let pedidos = "";
facturas.forEach((factura, index) => { facturas.forEach((factura, index) => {
@ -1309,6 +1298,10 @@ export default function TraficoCliente(props:IProps){
link.click(); link.click();
} }
const showHistorialRectificaciones = () => {
setLoadComponent(14);
setShowModal(true);
}
return ( return (
<div style={{height:'100%', overflowY:'scroll'}}> <div style={{height:'100%', overflowY:'scroll'}}>
<Card className="labelSize13px" style={{borderStyle:'none', height:'100%'}}> <Card className="labelSize13px" style={{borderStyle:'none', height:'100%'}}>
@ -1342,10 +1335,7 @@ export default function TraficoCliente(props:IProps){
<Row> <Row>
<Col sm={3} md={2} lg={4}> <Col sm={3} md={2} lg={4}>
<Form.Label <Form.Label
onClick={() => { style={{ display: 'flex'}}
showModalBox(11)
}}
style={{ cursor: 'pointer', display: 'flex'}}
> >
<IconContext.Provider <IconContext.Provider
value={{ color: 'blue', size: '15px' }} value={{ color: 'blue', size: '15px' }}
@ -1485,34 +1475,6 @@ export default function TraficoCliente(props:IProps){
</Form.Label> </Form.Label>
</Col> </Col>
<Col sm={6} md={6} lg={8}> <Col sm={6} md={6} lg={8}>
<Form.Label style={{ width:'100%' }}>
<IconContext.Provider value={{ color: 'blue', size: '15px' }}>
<span onClick={() => {showModalBox(10)}}
style={{ cursor: 'pointer' }}>
<FcTimeline />&nbsp;Precuenta
</span>
</IconContext.Provider>
<Form.Control
as="select"
disabled={true}
onChange={(e) => {
setIDTabulador(parseInt(e.target.value))
}}
value={IDTabulador}
className="form-select form-select-sm"
>
<option value="0">-SELECCIONE-</option>
{Tabuladores
? Tabuladores.map((t) => {
return (
<option key={t.id} value={t.id}>
{t.nombre}
</option>
)
})
: null}
</Form.Control>
</Form.Label>
</Col> </Col>
</Row> </Row>
</Col> </Col>
@ -1579,14 +1541,7 @@ export default function TraficoCliente(props:IProps){
<Col sm={12} md={12} lg={6}> <Col sm={12} md={12} lg={6}>
<Row> <Row>
<Col sm={4} md={4} lg={4}> <Col sm={4} md={4} lg={4}>
<Form.Label <Form.Label>
onClick={() => {
return Depto === 'Corresponsalias'
? showModalBox(1)
: ''
}}
style={{ cursor: 'pointer' }}
>
<IconContext.Provider <IconContext.Provider
value={{ color: 'blue', size: '15px' }} value={{ color: 'blue', size: '15px' }}
> >
@ -1789,168 +1744,181 @@ export default function TraficoCliente(props:IProps){
<Col sm={12} md={12} lg={6}> <Col sm={12} md={12} lg={6}>
<fieldset className='border p-2'> <fieldset className='border p-2'>
<legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>{EncabezadoPedimento1}</legend> <legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>{EncabezadoPedimento1}</legend>
<Row className='justify-content-between' style={{alignItems:'center'}}> <Row className='justify-content-between' style={{alignItems:'center'}}>
<Col sm={3} md={3} lg={3}> <Col sm={5} md={5} lg={5}>
<Form.Label> <Button variant="success"
Trafico onClick={()=>{setLoadComponent(13);setShowModal(true);}}
<Form.Control style={{width:'100%', padding:'6px'}}
type="text" >
id="Trafico" {LblPedimentos}
</Button>
</Col>
<Col sm={3} md={3} lg={3}>
<Form.Label>
Trafico
<Form.Control
type="text"
id="Trafico"
size="sm"
value={Trafico}
disabled={
Depto !== 'Corresponsalias' ? true : false
}
onChange={(e) => {
setTrafico(e.target.value)
}}
/>
</Form.Label>
</Col>
<Col sm={2} md={3} lg={2}>
<Form.Label>
Aduana
<Form.Control
type="text"
id="Aduana"
size="sm"
disabled={true}
value={Aduana}
/>
</Form.Label>
</Col>
<Col sm={2} md={3} lg={2}>
<Form.Label>
Patente
<Form.Control
type="text"
id="Patente"
size="sm"
disabled={true}
value={Patente}
/>
</Form.Label>
</Col>
</Row>
<Row className='justify-content-between' style={{alignItems:'center'}}>
<Col sm={2} md={2} lg={3}>
<Form.Label>
<span>
Pedimento
</span>
<CurrencyFormat
value={Pedimento}
displayType='input'
readOnly= {Depto !== 'Corresponsalias' ? true : false}
format={'### ####'}
mask="_"
onValueChange={(values: any) => {
const { value } = values
if(value.length === 7 ){
CTrafDataService.ValidaTraficoDuplicado(Aduana, Patente, value, IDTrafico).then( response => {
if(response.data !== ""){
setHeader('Informativo')
setMsg(`Pedimento Duplicado.\n\rLa referencia ${response.data} ya cuenta con los mismos datos de aduana, patente y pedimento`)
setShowMsg(true)
return
}
setPedimento(value.length === 0 ? 0 : value)
})
}
}}
style={{
fontSize: '18px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}}
/>
</Form.Label>
</Col>
<Col sm={3} md={3} lg={2}>
<Form.Label>
Clave
<Form.Control
as="select"
id="CmbClavePedimento"
onChange={(e) => {
setClavePedimento(e.target.value)
}}
className="form-select form-select-sm"
value={ClavePedimento}
disabled={(Depto !== 'Corresponsalias')}
>
<option value="-Seleccione-">-Seleccione-</option>
{ClavesPedimentos
? ClavesPedimentos.map((item, index) => {
return (
<option key={item.id} value={item.clave}>
{item.clave}
</option>
)
})
: ''}
</Form.Control>
</Form.Label>
</Col>
<Col sm={3} md={3}>
<Form.Label>
Fec. Pago
<Form.Control
type="date"
id="FechaPago"
size="sm" size="sm"
value={Trafico} value={FechaPago}
disabled={ disabled={
Depto !== 'Corresponsalias' ? true : false Depto !== 'Corresponsalias' ? true : false
} }
onChange={(e) => { onChange={(e) => setFechaPago(e.target.value)}
setTrafico(e.target.value) />
}} </Form.Label>
/> </Col>
</Form.Label> <Col xs={3}>
</Col> <Form.Label style={{width:'100%', visibility: AduanaH === '' ? 'hidden':'visible'}}>
<Col sm={2} md={3} lg={2}> Cargo A
<Form.Label> <Form.Control
Aduana as="select"
<Form.Control className="form-select form-select-sm"
type="text" value={CargoPara}
id="Aduana" disabled={
size="sm" Depto !== 'Corresponsalias' ? true : false
disabled={true} }
value={Aduana} onChange={(e) => {
/> setCargoPara(parseInt(e.target.value))
</Form.Label> }}
</Col>
<Col sm={2} md={3} lg={2}> >
<Form.Label> <option value="0">-SELECCIONE-</option>
Patente <option value="1">CLIENTE</option>
<option value="2">CORRESPONSAL</option>
</Form.Control>
</Form.Label>
</Col>
</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 <Form.Control
type="text" as="textarea"
id="Patente" id="Observacion"
size="sm" size="sm"
disabled={true} value={CausaRectificacion}
value={Patente} disabled={Depto !== 'Corresponsalias'}
onChange={(e) => setCausaRectificacion(e.target.value)}
style={{visibility: AduanaH === '' ? 'hidden':'visible'}}
/> />
</Form.Label> </Col>
</Col> </Row>
<Col sm={2} md={2} lg={3}>
<Form.Label>
<span
onClick={() => {
openSOIA()
}}
style={{ cursor: 'pointer' }}
>
Pedimento
</span>
<CurrencyFormat
value={Pedimento}
displayType='input'
readOnly= {Depto !== 'Corresponsalias' ? true : false}
format={'### ####'}
mask="_"
onValueChange={(values: any) => {
const { value } = values
setPedimento(value.length === 0 ? 0 : value)
}}
style={{
fontSize: '18px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}}
/>
</Form.Label>
</Col>
</Row>
<Row className='justify-content-between' style={{alignItems:'center'}}>
<Col sm={3} md={3} lg={3}>
<Form.Label>
Clave
<Form.Control
as="select"
id="CmbClavePedimento"
onChange={(e) => {
setClavePedimento(e.target.value)
}}
className="form-select form-select-sm"
value={ClavePedimento}
disabled={(Depto !== 'Corresponsalias')}
>
<option value="-Seleccione-">-Seleccione-</option>
{ClavesPedimentos
? ClavesPedimentos.map((item, index) => {
return (
<option key={item.id} value={item.clave}>
{item.clave}
</option>
)
})
: ''}
</Form.Control>
</Form.Label>
</Col>
<Col sm={3} md={3}>
<Form.Label>
Fec. Pago
<Form.Control
type="date"
id="FechaPago"
size="sm"
value={FechaPago}
disabled={
Depto !== 'Corresponsalias' ? true : false
}
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>
</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>
</Row>
</fieldset> </fieldset>
</Col> </Col>
<Col sm={12} md={12} lg={6}> <Col sm={12} md={12} lg={6}>
<fieldset className='border p-2' style={{height:'100%'}}> <fieldset className='border p-2' style={{height:'100%'}}>
<legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>{EncabezadoPedimento2}</legend> <legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>Última Rectificación</legend>
<Row className='justify-content-between' style={{alignItems:'center', paddingTop:'15px'}}> <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}>
<Button variant="success" disabled={Depto !== 'Corresponsalias'} onClick={()=>{generaRectificacion()}}>Generar rectificacion</Button> <Button variant="success" style={{width:'100%', padding:'6px'}} onClick={() => {showHistorialRectificaciones()}}>{LblRectificaciones}</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>
@ -1997,7 +1965,7 @@ export default function TraficoCliente(props:IProps){
</Row> </Row>
<Row className='justify-content-between' style={{alignItems:'center', paddingTop:'15px'}}> <Row className='justify-content-between' style={{alignItems:'center', paddingTop:'15px'}}>
<Col sm={2} md={2} lg={2}> <Col sm={2} md={2} lg={2}>
<Form.Label style={{ cursor: 'pointer' }}> <Form.Label>
Pedimento Pedimento
</Form.Label> </Form.Label>
</Col> </Col>
@ -3277,240 +3245,6 @@ export default function TraficoCliente(props:IProps){
</Col> </Col>
</Row> </Row>
</Tab> </Tab>
<Tab
eventKey="CuentasComplementarias"
title="Cuentas complementarias"
tabClassName={Perfil === 'Corresponsales' ? 'd-none' : ''}
>
<Row>
<Col xs={12}>
<CuentasComplementarias
IDTrafico={IDTrafico}
UserId={UserId}
/>
</Col>
</Row>
</Tab>
<Tab
eventKey="Rectificaciones"
title="Rectificaciones"
tabClassName={Perfil === 'Corresponsales' ? 'd-none' : ''}
>
{/* <Card>
<Row>
<Col xs={1}>Pedimento</Col>
<Col xs={1}>
<CurrencyFormat
value={PedimentoRectificado}
displayType={Depto === 'Corresponsalias' ? 'input' : 'text'}
format={'### ####'}
mask='_'
onValueChange={(values: any) => {
const { value } = values
setPedimento(value.length === 0 ? 0 : value)
}}
style={
Depto === 'Corresponsalias'
? {
fontSize: '18px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100px',
textAlign: 'right',
borderRadius: '10px',
}
: {
fontSize: '16px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100px',
textAlign: 'right',
borderRadius: '10px',
}
}
/>
</Col>
<Col xs={1}>Fecha pago</Col>
<Col xs={1}></Col>
<Col xs={1}>Motivo</Col>
<Col xs={7}></Col>
</Row>
</Card> */}
</Tab>
<Tab
eventKey="ComprobantesFacturacion"
title="Comprobantes Facturacion"
tabClassName={Proceso >= 3 ? '' : 'd-none'}
>
<Card>
<Card.Body>
<Row>
<Col xs={4}>
<Form.Label>PDF Cuenta Mexicana</Form.Label>
</Col>
<Col xs={4}>
<Form.Label>XML Cuenta Mexicana</Form.Label>
</Col>
<Col xs={4}>
<Row>
<Col sm={6}>Total Honorarios A.A</Col>
<Col sm={6}>Total Gastos Terceros</Col>
</Row>
</Col>
</Row>
<Row>
<Col xs={4}>
<FileManager
IDUser={UserId}
width={'100%'}
height={100}
IDProcess={37}
IdFile={IDTrafico}
FileName={''}
canDelete={
Depto === 'Facturacion' && Proceso === 3
}
FileType={['pdf']}
Leyenda={`Seleccione el PDF para subirlo al servidor...`}
onAppendFM={function (idFile: number ): void {}}
/>
</Col>
<Col xs={4}>
<FileManager
IDUser={UserId}
width={'100%'}
height={100}
IDProcess={38}
IdFile={IDTrafico}
FileName={''}
canDelete={
Depto === 'Facturacion' && Proceso === 3
}
FileType={['xml']}
Leyenda={`Seleccione el XML para subirlo al servidor...`}
onAppendFM={function (idFile: number): void {}}
/>
</Col>
<Col xs={4}>
<Row>
<Col sm={6}>
<CurrencyFormat
value={TotalHonorariosAA}
displayType='input'
readOnly={Depto !== 'Facturacion' || Proceso !== 3}
thousandSeparator={true}
onValueChange={(values: any) => {
const { value } = values
setTotalHonorariosAA(value)
}}
style={{
fontSize: '18px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100%',
textAlign: 'right',
borderRadius: '10px',
paddingLeft: '20px',
paddingRight: '10px',
}}
/>
</Col>
<Col sm={6}>
<CurrencyFormat
value={TotalGastosTerceros}
thousandSeparator={true}
displayType='input'
readOnly={Depto !== 'Facturacion' || Proceso !== 3}
onValueChange={(values: any) => {
const { value } = values
setTotalGastosTerceros(value)
}}
style={{
fontSize: '18px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100%',
textAlign: 'right',
borderRadius: '10px',
paddingLeft: '20px',
paddingRight: '10px',
}}
/>
</Col>
</Row>
</Col>
</Row>
<Row>
<Col xs={4}>
<Form.Label>PDF de Gastos a Terceros</Form.Label>
</Col>
<Col xs={4}>
<Form.Label>Archivos Adicionales</Form.Label>
</Col>
<Col xs={4}>
<Form.Label></Form.Label>
</Col>
</Row>
<Row>
<Col xs={4}>
<FileManager
IDUser={UserId}
width={'100%'}
height={100}
IDProcess={41}
IdFile={IDTrafico}
FileName={''}
canDelete={
Depto === 'Facturacion' && Proceso === 3
}
FileType={['pdf']}
Leyenda={`Seleccione el PDF de las notas de cargos para subirlo al servidor...`}
onAppendFM={function (idFile: number): void {
}}
/>
</Col>
<Col xs={4}>
<FileManager
IDUser={UserId}
width={'100%'}
height={100}
IDProcess={39}
IdFile={IDTrafico}
FileName={''}
canDelete={
Depto === 'Facturacion' && Proceso === 3
}
FileType={['zip']}
Leyenda={`Seleccione el zip con los archivos adicionales para subirlo al servidor...`}
onAppendFM={function (idFile: number): void {
}}
/>
</Col>
</Row>
<Row className='justify-content-end'>
<Col xs={3} style={{display:'flex', justifyContent:'end'}}>
<Button
variant='primary'
onClick={GetClientesZip}
disabled={Proceso < 4}
style={{marginRight:'10px'}}
>
Descargar Zip
</Button>
<Button
variant='primary'
onClick={cerrarTrafico}
disabled={Proceso === 4}
>
Cerrar Cuenta
</Button>
</Col>
</Row>
</Card.Body>
</Card>
</Tab>
</Tabs> </Tabs>
</Card.Body> </Card.Body>
</Card> </Card>
@ -3521,7 +3255,7 @@ export default function TraficoCliente(props:IProps){
dialogClassName={ dialogClassName={
LoadComponent === 1 || LoadComponent === 2 || LoadComponent === 9 LoadComponent === 1 || LoadComponent === 2 || LoadComponent === 9
? 'modal-90w' ? 'modal-90w'
: 'modal-50w' : LoadComponent === 13 || LoadComponent === 14 ? 'modal-70w' : 'modal-50w'
} }
> >
<Modal.Body> <Modal.Body>
@ -3602,6 +3336,26 @@ export default function TraficoCliente(props:IProps){
/> />
</div> </div>
) : null} ) : null}
{LoadComponent === 13 ? (
<div style={{ height: '600px', overflow: 'auto' }}>
<PedimentosConsolidados IdTrafico={props.IDTrafico} Aduana={Aduana!} Patente={Patente!} ClavesPedimento={ClavesPedimentos} Depto={Depto}/>
</div>
) : null}
{LoadComponent === 14? (
<div style={{ height: '550px', overflow: 'hidden' }}>
<NuevaRectificacion
IdTrafico={props.IDTrafico}
Aduana={Aduana!}
Patente={Patente!}
ClavesPedimento={ClavesPedimentos}
Depto={Depto}
UserId={UserId}
Pedimentos={mCPedimentosConsolidados}
onAppendRectificacion={function (data: DTORectificacionHistorico): void {
throw new Error("Function not implemented.")
} }/>
</div>
) : null}
</Modal.Body> </Modal.Body>
</Modal> </Modal>
<MsgInformativo <MsgInformativo

@ -1,8 +1,7 @@
import { Button, Card, Col, Form, FormControl, FormLabel, Row } from "react-bootstrap" import { Button, Card, Col, Form, FormControl, FormLabel, Modal, Row, Table } from "react-bootstrap"
import CurrencyFormat from "react-currency-format" import CurrencyFormat from "react-currency-format"
import { ICatClavesPedimentos } from "../../../Interfaces/Catalogos/ICatClavesPedimentos" import { ICatClavesPedimentos } from "../../../Interfaces/Catalogos/ICatClavesPedimentos"
import { useEffect, useState } from "react" import { useEffect, useState } from "react"
import CorresponsalesTraficoServices from "../../../Services/Corresponsalias/Corresponsales.Trafico.Services"
import { AgGridReact } from "ag-grid-react" import { AgGridReact } from "ag-grid-react"
import { DTOPedimentosConsolidados } from "../../../DTO/Corresponsales/DTOPedimentosConsolidados" import { DTOPedimentosConsolidados } from "../../../DTO/Corresponsales/DTOPedimentosConsolidados"
import PedimentosConsolidadosService from "../../../Services/Corresponsalias/Corresponsales.Trafico.Pedimento.Consolidados.Service" import PedimentosConsolidadosService from "../../../Services/Corresponsalias/Corresponsales.Trafico.Pedimento.Consolidados.Service"
@ -14,6 +13,12 @@ import { RootState } from "../../../store/store"
import { addPedimento, deletePedimento, updatePedimento } from "../../../store/features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice" import { addPedimento, deletePedimento, updatePedimento } from "../../../store/features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice"
import { MsgInformativo } from "../../Utils/Toast/msgInformativo" import { MsgInformativo } from "../../Utils/Toast/msgInformativo"
import { FaEraser } from "react-icons/fa" import { FaEraser } from "react-icons/fa"
import DTORectificacionHistorico from "../../../DTO/Corresponsales/DTORectificacionHistorico"
import CTrafDataService from "../../../Services/Corresponsalias/Corresponsales.Trafico.Services"
import { addRectificacion } from "../../../store/features/Corresponsales/CorresponsalesPedimentosRectificacionesSlice"
import { HistorialRectificaciones } from "../Rectificaciones/HistorialRectificaciones"
import ICorresponsalRectificacionHistorico from "../../../Interfaces/Corresponsales/ICorresponsalRectificacionHistorico"
import '../../../css/generic01.css'
interface IProps { interface IProps {
IdTrafico: number IdTrafico: number
@ -30,6 +35,9 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
const [msg, setMsg] = useState('') const [msg, setMsg] = useState('')
const msgColor = 'primary' const msgColor = 'primary'
const [showModal, setShowModal] = useState(false)
const [LoadComponent, setLoadComponent] = useState(0)
const [Id, setId] = useState(0) const [Id, setId] = useState(0)
const [Aduana, setAduana] = useState(props.Aduana) const [Aduana, setAduana] = useState(props.Aduana)
const [Patente, setPatente] = useState(props.Patente) const [Patente, setPatente] = useState(props.Patente)
@ -37,6 +45,7 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
const [ClavePedimento, setClavePedimento] = useState(''); const [ClavePedimento, setClavePedimento] = useState('');
const [FechaPago, setFechaPago] = useState('') const [FechaPago, setFechaPago] = useState('')
const [IdPedimentoH, setIdPedimentoH] = useState(0)
const [AduanaH, setAduanaH] = useState(0) const [AduanaH, setAduanaH] = useState(0)
const [PatenteH, setPatenteH] = useState(0) const [PatenteH, setPatenteH] = useState(0)
const [PedimentoH, setPedimentoH] = useState(0) const [PedimentoH, setPedimentoH] = useState(0)
@ -44,74 +53,8 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
const [FechaPagoH, setFechaPagoH] = useState('') const [FechaPagoH, setFechaPagoH] = useState('')
const [isRectificacion, setIsRectificacion] = useState(false) const [isRectificacion, setIsRectificacion] = useState(false)
const mCPedimentosConsolidados = useSelector((state:RootState) => state.CPedimentosConsolidados.PedimentosConsolidados) const mCPedimentosConsolidados = useSelector((state:RootState) => state.CPedimentosConsolidados.PedimentosConsolidados)
const [columnDefs] = useState([ const mcRectificaciones = useSelector((state:RootState) => state.CRectificaciones.RectificacionesPedimentos)
props.Depto === 'Corresponsalias' ? const [Rectificaciones, setRectificaciones] = useState<ICorresponsalRectificacionHistorico[]>([]);
{
field: 'id',
headerName: 'Acciones',
width: 120,
sortable: true,
filter: true,
cellRenderer: (params: any) => {
return (
<div>
<IconContext.Provider value={{ color: 'blue', size: '18px' }}>
<BsPencilFill
onClick={() => {
loadRow(params.data)
}}
style={{ cursor: 'pointer' }}
/>
</IconContext.Provider>
&nbsp;&nbsp;&nbsp;
<IconContext.Provider value={{ color: 'red', size: '20px' }}>
<BsTrash
onClick={() => {
Delete(params.data.id)
}}
style={{ cursor: 'pointer' }}
/>
</IconContext.Provider>
</div>
)
}
} : {
field: 'id',
headerName: 'Acciones',
width: 110,
sortable: true,
filter: true,
},
{ field: 'patente', width: 110, sortable: true, filter: true },
{ field: 'aduana', width: 110, sortable: true, filter: true },
{ field: 'pedimento', width: 120, sortable: true, filter: true },
{ field: 'clave', width: 100, sortable: true, filter: true },
{
field: 'fechaPago',
sortable: true,
filter: true,
cellRenderer: (params: any) => {
if (params.value) return params.value.substring(0, 10)
else return ''
},
},props.Depto === 'Corresponsalias' ?
{
field: 'id',
headerName: '',
width: 120,
sortable: true,
filter: true,
flex: 1, //Se encarga de llenar el espacio sobrante de las columnas
cellRenderer: (params: any) => {
return (
<div style={{display:'flex', height:'100%', padding:'5px'}}>
<Button size="sm" onClick={() => PrepareRectificacion(params.data)}>Generar Rectificación</Button>
</div>
)
}
} : {}
])
const [Data, setData] = useState<DTOPedimentosConsolidados[]>()
const cleanForm = () => { const cleanForm = () => {
setId(0) setId(0)
@ -156,16 +99,16 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
}).then(resp => { }).then(resp => {
if(Id > 0){ if(Id > 0){
dispatch(updatePedimento(resp.data)) dispatch(updatePedimento(resp.data))
cleanForm()
setHeader('Informativo') setHeader('Informativo')
setMsg('Datos actualizados correctamente') setMsg('Datos actualizados correctamente')
setShowMsg(true) setShowMsg(true)
return }else{
dispatch(addPedimento(resp.data))
setHeader('Informativo')
setMsg('Pedimento guardado correctamente')
setShowMsg(true)
} }
dispatch(addPedimento(resp.data)) cleanForm()
setHeader('Informativo')
setMsg('Pedimento guardado correctamente')
setShowMsg(true)
return return
}).catch((e) => { }).catch((e) => {
setHeader('Error') setHeader('Error')
@ -197,31 +140,13 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
return return
}) })
} }
const PrepareRectificacion = (pedimento: DTOPedimentosConsolidados) => {
setIsRectificacion(true)
setAduanaH(pedimento.aduana)
setPatenteH(pedimento.patente)
setPedimentoH(pedimento.pedimento)
setClavePedimentoH(pedimento.clave)
setFechaPagoH(pedimento.fechaPago)
}
const CancelIsRectificacion = () => {
setIsRectificacion(false)
setAduanaH(0)
setPatenteH(0)
setPedimentoH(0)
setClavePedimentoH('')
setFechaPagoH('')
}
return ( return (
<> <>
<Card style={{height:'100%'}}> <Card style={{height:'100%'}}>
<Card.Body> <Card.Body>
{props.Depto === 'Corresponsalias' ? <> {props.Depto === 'Corresponsalias' ? <>
<Row className="justify-content-end align-items-center"> <Row className="justify-content-end align-items-center">
<Col xs={1} style={{visibility: isRectificacion ? 'visible' : 'hidden'}}><span style={{wordWrap:'normal'}}>Rectificación</span></Col> <Col xs={1}></Col>
<Col <Col
xs={1} xs={1}
style={{ style={{
@ -260,7 +185,7 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
onValueChange={(values: any) => { onValueChange={(values: any) => {
const { value } = values const { value } = values
if(value.length === 7 ){ if(value.length === 7 ){
CorresponsalesTraficoServices.ValidaTraficoDuplicado(Aduana, Patente, value, props.IdTrafico).then( response => { CTrafDataService.ValidaTraficoDuplicado(Aduana, Patente, value, props.IdTrafico).then( response => {
if(response.data !== ""){ if(response.data !== ""){
setHeader('Informativo') setHeader('Informativo')
setMsg(`Pedimento Duplicado.\n\rLa referencia ${response.data} ya cuenta con los mismos datos de aduana, patente y pedimento`) setMsg(`Pedimento Duplicado.\n\rLa referencia ${response.data} ya cuenta con los mismos datos de aduana, patente y pedimento`)
@ -323,86 +248,65 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
<Button onClick={() => Append()}>Agregar</Button> <Button onClick={() => Append()}>Agregar</Button>
</Col> </Col>
</Row> </Row>
<Row className="justify-content-end align-items-center" style={{display: isRectificacion ? 'flex' : 'none'}}>
<Col xs={1}><span>Original</span></Col>
<Col xs={1}>
</Col>
<Col xs={1}>
<FormLabel>
Aduana
<FormControl type='text' size='sm' disabled value={AduanaH}></FormControl>
</FormLabel>
</Col>
<Col xs={1}>
<FormLabel>
Patente
<FormControl type='text' size='sm' disabled value={PatenteH}></FormControl>
</FormLabel>
</Col>
<Col xs={2}>
<FormLabel>
Pedimento
<CurrencyFormat
value={PedimentoH}
displayType='input'
format={'### ####'}
mask="_"
readOnly={true}
style={{
fontSize: '18px',
backgroundColor: '#e9ecef',
border: '2px solid #ced4da',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}}
/>
</FormLabel>
</Col>
<Col xs={2}>
<Form.Label>
Clave
<FormControl type='text' size='sm' disabled value={ClavePedimentoH}></FormControl>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label>
Fec. Pago
<Form.Control
type="date"
id="FechaPago"
size="sm"
value={setDate(FechaPagoH)}
readOnly={true}
disabled={true}
/>
</Form.Label>
</Col>
<Col xs={2}>
<Button variant="danger" onClick={() => CancelIsRectificacion()}>Cancelar</Button>
</Col>
</Row>
<hr /></> : ("") } <hr /></> : ("") }
<div className='ag-theme-alpine' style={{ height: 400, width: '100%'}}> <div className="table-wrapper" style={{width:'100%', maxHeight:'100%'}}>
<AgGridReact <Table
rowData={mCPedimentosConsolidados} hover
columnDefs={columnDefs} size='sm'
pagination={true} >
paginationAutoPageSize={true} <thead>
rowSelection={'multiple'} <tr><th>#</th>{props.Depto === 'Corresponsalias' ? <th>Acciones</th> : ''}<th>Aduana</th><th>Patente</th><th>Pedimento</th><th>Clave</th><th>Fecha de Pago</th></tr>
rowMultiSelectWithClick={true} </thead>
></AgGridReact> <tbody>
{mCPedimentosConsolidados
? mCPedimentosConsolidados.map((item, index) => {
return item.id > 0 ?
<tr>
<td>{index}</td>
{props.Depto === 'Corresponsalias' ?
<td><div>
<IconContext.Provider value={{ color: 'blue', size: '18px' }}>
<BsPencilFill
onClick={() => {
loadRow(item)
}}
style={{ cursor: 'pointer' }}
/>
</IconContext.Provider>
&nbsp;&nbsp;&nbsp;
<IconContext.Provider value={{ color: 'red', size: '20px' }}>
<BsTrash
onClick={() => {
Delete(item.id)
}}
style={{ cursor: 'pointer' }}
/>
</IconContext.Provider>
</div></td> : ''
}
<td>{item.aduana}</td>
<td>{item.patente}</td>
<td><div style={{display:'flex', alignItems:'start'}}>{item.pedimento} {item.id === 0 ? <span style={{fontSize:'8px'}}>{'⭐'}</span> : ''}</div></td>
<td>{item.clave}</td>
<td>{item.fechaPago ? item.fechaPago.substring(0,10) : ''}</td>
</tr>
: ''
})
: ''}
</tbody>
</Table>
</div> </div>
</Card.Body> </Card.Body>
</Card> </Card>
<MsgInformativo <MsgInformativo
show={show} show={show}
msg={msg} msg={msg}
header={header} header={header}
msgColor={msgColor} msgColor={msgColor}
closeToast={() => { closeToast={() => {
setShowMsg(false) setShowMsg(false)
}} }}
/></> />
</>
) )
} }

@ -0,0 +1,85 @@
import { useEffect, useState } from "react"
import { Alert, Card, Col, Row, Table } from "react-bootstrap"
import { useSelector } from "react-redux"
import { RootState } from "../../../store/store"
import { AgGridReact } from "ag-grid-react"
import ICorresponsalRectificacionHistorico from "../../../Interfaces/Corresponsales/ICorresponsalRectificacionHistorico"
interface IProps{
//pedimento: number
IdPedimentoConsolidado: string
}
export const HistorialRectificaciones: React.FC<IProps> = (props) => {
const [columnDefs] = useState([
{ field: 'patente', width: 110, sortable: true, filter: true },
{ field: 'aduana', width: 110, sortable: true, filter: true },
{ field: 'pedimento', width: 120, sortable: true, filter: true },
{ field: 'clave', width: 100, sortable: true, filter: true },
{
field: 'fechaPago',
sortable: true,
filter: true,
cellRenderer: (params: any) => {
if (params.value) return params.value.substring(0, 10)
else return ''
},
},
{
field: 'fhCreacion',
sortable: true,
filter: true,
cellRenderer: (params: any) => {
if (params.value) return params.value
else return ''
},
flex:1
},
])
const mcRectificaciones = useSelector((state:RootState) => state.CRectificaciones.RectificacionesPedimentos)
const [Rectificaciones, setRectificaciones] = useState<ICorresponsalRectificacionHistorico[]>([]);
useEffect(()=>{
if(props.IdPedimentoConsolidado !== '#')
setRectificaciones(mcRectificaciones.filter(x => x.idPedimentoConsolidado === + props.IdPedimentoConsolidado))
else
setRectificaciones(mcRectificaciones)
},[mcRectificaciones, props.IdPedimentoConsolidado])
return(
<div>
<Row>
<Col xs={12}>
<b>Historial de Pedimentos Rectificados</b>
</Col>
</Row>
<br/>
<div className="table-wrapper" style={{width:'100%', maxHeight:'100%'}}>
<Table
className="table table-earnings table-earnings__challenge"
hover
size="sm"
>
<thead>
<tr><th>#</th><th>Aduana</th><th>Patente</th><th>Pedimento</th><th>Clave</th><th>Fecha de Pago</th></tr>
</thead>
<tbody>
{Rectificaciones
? Rectificaciones.map((item, index) => {
return(
<tr>
<td>{index + 1}</td>
<td>{item.aduana}</td>
<td>{item.patente}</td>
<td>{item.pedimento}</td>
<td>{item.clave}</td>
<td>{item.fechaPago ? item.fechaPago.substring(0,10) : ''}</td>
</tr>
)
})
: ''}
</tbody>
</Table>
</div>
</div>
)
}

@ -0,0 +1,348 @@
import { useState } from "react";
import { Button, Card, Col, Form, FormControl, FormLabel, Row } from "react-bootstrap"
import CurrencyFormat from "react-currency-format";
import { IconContext } from "react-icons";
import { FaEraser } from "react-icons/fa";
import CTrafDataService from "../../../Services/Corresponsalias/Corresponsales.Trafico.Services"
import { useDispatch, useSelector } from "react-redux";
import { ICatClavesPedimentos } from "../../../Interfaces/Catalogos/ICatClavesPedimentos";
import { DTOPedimentosConsolidados } from "../../../DTO/Corresponsales/DTOPedimentosConsolidados";
import DTORectificacionHistorico from "../../../DTO/Corresponsales/DTORectificacionHistorico";
import { updatePedimento } from "../../../store/features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice";
import { addRectificacion } from "../../../store/features/Corresponsales/CorresponsalesPedimentosRectificacionesSlice";
import ICorresponsalRectificacionHistorico from "../../../Interfaces/Corresponsales/ICorresponsalRectificacionHistorico";
import { RootState } from "../../../store/store";
import { HistorialRectificaciones } from "./HistorialRectificaciones";
import { MsgInformativo } from "../../Utils/Toast/msgInformativo";
interface IProps {
IdTrafico: number
Aduana: number
Patente: number
ClavesPedimento: ICatClavesPedimentos[]
Pedimentos: DTOPedimentosConsolidados[]
Depto: string
UserId: number
onAppendRectificacion: (data: DTORectificacionHistorico) => void
}
export const NuevaRectificacion:React.FC<IProps> = (props) => {
const dispatch = useDispatch()
const [header, setHeader] = useState('')
const [show, setShowMsg] = useState(false)
const [msg, setMsg] = useState('')
const msgColor = 'primary'
const [showHistorial, setShowHistorial] = useState(false)
const [Id, setId] = useState(0)
const [Aduana, setAduana] = useState(props.Aduana)
const [Patente, setPatente] = useState(props.Patente)
const [Pedimento, setPedimento] = useState(0)
const [ClavePedimento, setClavePedimento] = useState('');
const [FechaPago, setFechaPago] = useState('')
const [IdPedimentoH, setIdPedimentoH] = useState(0)
const [AduanaH, setAduanaH] = useState(props.Aduana)
const [PatenteH, setPatenteH] = useState(props.Patente)
const [PedimentoH, setPedimentoH] = useState(0)
const [ClavePedimentoH, setClavePedimentoH] = useState('')
const [FechaPagoH, setFechaPagoH] = useState('')
const [IdPedimentoConsolidadoSelected, setIdPedimentoConsolidadoSelected] = useState("#")
function setDate(fecha: string | undefined): string {
if (!fecha) return ''
else {
var dd = fecha?.substring(8, 10)
var mm = fecha?.substring(5, 7)
var yyyy = fecha?.substring(0, 4)
return yyyy + '-' + mm + '-' + dd
}
}
const generaRectificacion = () => {
if (Aduana && Patente && Pedimento && ClavePedimento.length>0 && FechaPago) {
const data : DTORectificacionHistorico = {
IdTrafico: props.IdTrafico,
IdUsuario: props.UserId,
IdPedimento: IdPedimentoH,
Aduana: Aduana,
Patente: Patente,
Pedimento: Pedimento,
Clave: ClavePedimento,
FechaPago: FechaPago,
AduanaH: AduanaH,
PatenteH: PatenteH,
PedimentoH: PedimentoH,
ClaveH: ClavePedimentoH,
FechaPagoH: FechaPagoH
}
CTrafDataService.AppendRectificacionHistorico(data)
.then((response) => {
setHeader('Informativo')
setMsg('La rectificación se creó correctamente')
setShowMsg(true)
dispatch(
updatePedimento({
id: data.IdPedimento,
idTrafico: data.IdTrafico,
aduana: data.Aduana,
patente: data.Patente,
pedimento: data.Pedimento,
clave: data.Clave,
fechaPago: data.FechaPago
})
)
dispatch(
addRectificacion({
id: response.data.id,
usuario: response.data.usuario,
idTrafico: response.data.idTrafico,
aduana: response.data.aduana,
patente: response.data.patente,
pedimento: response.data.pedimento,
clave: response.data.clave,
fechaPago: response.data.fechaPago,
fhCreacion: response.data.fhCreacion,
activo: response.data.activo,
idPedimentoConsolidado: response.data.idPedimentoConsolidado
})
)
cleanForm()
props.onAppendRectificacion(data)
return
})
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrió un error al crear la rectificación. Favor de actualizar la página e intentarlo nuevamente.')
setShowMsg(true)
return
})
} else {
setHeader('Error')
setMsg('Parea poder generar este proceso es necesario que los siguientes campos tengan informacion: Patente, Aduana, Pedimento, Clave, Fecha pago')
setShowMsg(true)
return
}
}
const PrepareRectificacion = (idPedimentoConsolidado: number) => {
var dto = props.Pedimentos.filter(x => x.id === idPedimentoConsolidado)[0]
setIdPedimentoH(dto.id)
setAduanaH(dto.aduana)
setPatenteH(dto.patente)
setPedimentoH(dto.pedimento)
setClavePedimentoH(dto.clave)
setFechaPagoH(dto.fechaPago)
setShowHistorial(true)
}
const CancelIsRectificacion = () => {
setAduanaH(0)
setPatenteH(0)
setPedimentoH(0)
setClavePedimentoH('')
setFechaPagoH('')
setIdPedimentoH(0)
}
const cleanForm = () => {
setIdPedimentoConsolidadoSelected("#")
setIdPedimentoH(0)
setPedimentoH(0)
setClavePedimentoH('')
setFechaPagoH('')
setId(0)
setPedimento(0)
setClavePedimento('')
setFechaPago('')
}
return (
<Card style={{height:'100%'}}>
<Card.Body style={{overflowY:'scroll'}}>
{ props.Depto === 'Corresponsalias' ? <>
<Row className="justify-content-end align-items-center">
<Col xs={1}><span>Original</span></Col>
<Col xs={1}>
</Col>
<Col xs={1}>
<FormLabel>
Aduana
<FormControl type='text' size='sm' disabled value={AduanaH}></FormControl>
</FormLabel>
</Col>
<Col xs={1}>
<FormLabel>
Patente
<FormControl type='text' size='sm' disabled value={PatenteH}></FormControl>
</FormLabel>
</Col>
<Col xs={2}>
<FormLabel>
Pedimento
<Form.Control
as="select"
id="CmbCliente"
onChange={(e) => {
setIdPedimentoConsolidadoSelected(e.target.value)
PrepareRectificacion(+e.target.value)
}}
value={IdPedimentoConsolidadoSelected}
className="form-select form-select-sm"
>
<option value="#">-SELECCIONE-</option>
{props.Pedimentos
? props.Pedimentos.map((p) => {
return (
<option key={p.id} value={p.id}>
{p.pedimento}
</option>
)
})
: null}
</Form.Control>
</FormLabel>
</Col>
<Col xs={2}>
<Form.Label>
Clave
<FormControl type='text' size='sm' disabled value={ClavePedimentoH}></FormControl>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label>
Fec. Pago
<Form.Control
type="date"
id="FechaPago"
size="sm"
value={setDate(FechaPagoH)}
readOnly={true}
disabled={true}
/>
</Form.Label>
</Col>
<Col xs={2}>
<Button onClick={() => generaRectificacion()}>Agregar</Button>
</Col>
</Row>
<Row className="justify-content-end align-items-center">
<Col xs={1}><span style={{wordWrap:'normal'}}>Rectificación</span></Col>
<Col
xs={1}
style={{
textAlign: 'right',
paddingTop: '5px',
cursor: 'pointer',
}}
onClick={() => {
cleanForm();
}}
>
<IconContext.Provider value={{ color: 'orange', size: '25px' }}>
<FaEraser />
</IconContext.Provider>
</Col>
<Col xs={1}>
<FormLabel>
Aduana
<FormControl type='text' size='sm' disabled value={Aduana} onChange={(e) => setAduana(+e.target.value)}></FormControl>
</FormLabel>
</Col>
<Col xs={1}>
<FormLabel>
Patente
<FormControl type='text' size='sm' disabled value={Patente} onChange={(e) => setPatente(+e.target.value)}></FormControl>
</FormLabel>
</Col>
<Col xs={2}>
<FormLabel>
Pedimento
<CurrencyFormat
value={Pedimento}
displayType='input'
format={'### ####'}
mask="_"
onValueChange={(values: any) => {
const { value } = values
if(value.length === 7 ){
CTrafDataService.ValidaTraficoDuplicado(Aduana, Patente, value, props.IdTrafico).then( response => {
if(response.data !== ""){
setHeader('Informativo')
setMsg(`Pedimento Duplicado.\n\rLa referencia ${response.data} ya cuenta con los mismos datos de aduana, patente y pedimento`)
setShowMsg(true)
return
}
setPedimento(value.length === 0 ? 0 : value)
})
}
}}
style={{
fontSize: '18px',
backgroundColor: '#FEFDF5',
border: '2px solid #837F5D',
width: '100%',
textAlign: 'right',
borderRadius: '10px'
}}
/>
</FormLabel>
</Col>
<Col xs={2}>
<Form.Label>
Clave
<Form.Control
as="select"
id="CmbClavePedimento"
onChange={(e) => {
setClavePedimento(e.target.value)
}}
className="form-select form-select-sm"
value={ClavePedimento}
>
<option value="-Seleccione-">-Seleccione-</option>
{props.ClavesPedimento
? props.ClavesPedimento.map((item, index) => {
return (
<option key={item.id} value={item.clave}>
{item.clave}
</option>
)
})
: ''}
</Form.Control>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label>
Fec. Pago
<Form.Control
type="date"
id="FechaPago"
size="sm"
value={FechaPago}
onChange={(e) => setFechaPago(e.target.value)}
/>
</Form.Label>
</Col>
<Col xs={2}></Col>
</Row>
<hr/> </>: '' }
<HistorialRectificaciones IdPedimentoConsolidado={IdPedimentoConsolidadoSelected} ></HistorialRectificaciones>
<MsgInformativo
show={show}
msg={msg}
header={header}
msgColor={msgColor}
closeToast={() => {
setShowMsg(false)
}}
/>
</Card.Body>
</Card>
)
}

@ -110,7 +110,6 @@ import ICorresponsalesCatTraficoEstatus from '../../Interfaces/Corresponsales/IC
import ICorresponsalCatMediosEmbarque from '../../Interfaces/Corresponsales/ICorresponsalCatMediosEmbarque' import ICorresponsalCatMediosEmbarque from '../../Interfaces/Corresponsales/ICorresponsalCatMediosEmbarque'
import { CuentasComplementarias } from './CuentasComplementarias/CuentasComplementarias' import { CuentasComplementarias } from './CuentasComplementarias/CuentasComplementarias'
import DTOTraficoCompleto from '../../DTO/Corresponsales/DTOTraficoCompleto' import DTOTraficoCompleto from '../../DTO/Corresponsales/DTOTraficoCompleto'
import DTORectificacionHistorico from '../../DTO/Corresponsales/DTORectificacionHistorico'
import moment from 'moment' import moment from 'moment'
import ICorresponsalContenedores from '../../Interfaces/Corresponsales/ICorresponsalContenedores' import ICorresponsalContenedores from '../../Interfaces/Corresponsales/ICorresponsalContenedores'
import ICorresponsalFacturas from '../../Interfaces/Corresponsales/ICorresponsalFacturas' import ICorresponsalFacturas from '../../Interfaces/Corresponsales/ICorresponsalFacturas'
@ -127,6 +126,9 @@ import CorresponsalesFacturasServices from '../../Services/Corresponsalias/Corre
import { PedimentosConsolidados } from './PedimentosConsolidados/PedimentosConsolidados' import { PedimentosConsolidados } from './PedimentosConsolidados/PedimentosConsolidados'
import PedimentosConsolidadosService from '../../Services/Corresponsalias/Corresponsales.Trafico.Pedimento.Consolidados.Service' import PedimentosConsolidadosService from '../../Services/Corresponsalias/Corresponsales.Trafico.Pedimento.Consolidados.Service'
import { populatePedimentos } from '../../store/features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice' import { populatePedimentos } from '../../store/features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice'
import { populateRectificaciones } from '../../store/features/Corresponsales/CorresponsalesPedimentosRectificacionesSlice'
import { NuevaRectificacion } from './Rectificaciones/NuevaRectificacion'
import DTORectificacionHistorico from '../../DTO/Corresponsales/DTORectificacionHistorico'
interface IProps { interface IProps {
IDTrafico: number IDTrafico: number
@ -261,6 +263,9 @@ export default function TraficoCorresponsales (props:IProps) {
const [LblPedimentos, setLblPedimentos] = useState(() => { const [LblPedimentos, setLblPedimentos] = useState(() => {
return Depto === 'Corresponsalias' ? 'Consolidar Pedimentos' : 'Pedimentos Consolidados' return Depto === 'Corresponsalias' ? 'Consolidar Pedimentos' : 'Pedimentos Consolidados'
}) })
const [LblRectificaciones, setLblRectificaciones] = useState(() => {
return Depto === 'Corresponsalias' ? 'Agregar Rectificaciones' : 'Ped. Rectificados'
})
const [StatusTrafico, setStatusTrafico] = useState(1) const [StatusTrafico, setStatusTrafico] = useState(1)
const [StatusColor, setStatusColor] = useState('#FFFFFF') const [StatusColor, setStatusColor] = useState('#FFFFFF')
const [PagosaTerceros, setPagosaTerceros] = useState(0) const [PagosaTerceros, setPagosaTerceros] = useState(0)
@ -543,6 +548,9 @@ export default function TraficoCorresponsales (props:IProps) {
} }
}) })
.catch((e: Error) => { .catch((e: Error) => {
setTimeout(() => {
setIsDisabled(false)
}, 5000);
setHeader('Error') setHeader('Error')
setMsg('Ocurrio un error: ' + e) setMsg('Ocurrio un error: ' + e)
setShowMsg(true) setShowMsg(true)
@ -795,14 +803,15 @@ export default function TraficoCorresponsales (props:IProps) {
const loadRectificacionHistorico = () => { const loadRectificacionHistorico = () => {
CTrafDataService.GetRectificacionHistorico(IDTrafico) CTrafDataService.GetRectificacionHistorico(IDTrafico)
.then((response) => { .then((response) => {
dispatch(populateRectificaciones(response.data))
if (response.data.id > 0) { if (response.data.length > 0) {
let ultimaRectificacion = response.data[response.data.length-1]
setEncabezadoPedimento1("Pedimento Master Rectificado") setEncabezadoPedimento1("Pedimento Master Rectificado")
setAduanaH(response.data.aduana.toString()) setAduanaH(ultimaRectificacion.aduana.toString())
setPatenteH(response.data.patente.toString()) setPatenteH(ultimaRectificacion.patente.toString())
setPedimentoH(response.data.pedimento.toString()) setPedimentoH(ultimaRectificacion.pedimento.toString())
setClavePedimentoH(response.data.clave) setClavePedimentoH(ultimaRectificacion.clave)
setFechaPagoH(response.data.fechaPago) setFechaPagoH(ultimaRectificacion.fechaPago)
} }
}) })
.catch((e: Error) => { .catch((e: Error) => {
@ -1080,8 +1089,8 @@ export default function TraficoCorresponsales (props:IProps) {
}, [mCAnticipos]) }, [mCAnticipos])
useEffect(() => { useEffect(() => {
let ant = mCPedimentosConsolidados.length let ant = mCPedimentosConsolidados.filter(x => x.id > 0)
let label = Depto === 'Corresponsalias' ? `Consolidar Pedimentos (${ant})` : `Pedimentos Consolidados (${ant})` let label = Depto === 'Corresponsalias' ? `Consolidar Pedimentos (${ant.length})` : `Pedimentos Consolidados (${ant.length})`
setLblPedimentos(label) setLblPedimentos(label)
}, [mCPedimentosConsolidados]) }, [mCPedimentosConsolidados])
@ -1255,37 +1264,6 @@ export default function TraficoCorresponsales (props:IProps) {
return time.getHours() > 12 ? 'text-success' : 'text-error' return time.getHours() > 12 ? 'text-success' : 'text-error'
} }
const generaRectificacion = () => {
if (Aduana && Patente && Pedimento && ClavePedimento.length>0 && FechaPago) {
const data : DTORectificacionHistorico = {
IdTrafico: IDTrafico,
IdUsuario: UserId
}
CTrafDataService.AppendRectificacionHistorico(data)
.then((response) => {
console.log(response);
if(response.data) loadRectificacionHistorico()
else{
setHeader('Error')
setMsg('Para poder generar la rectificación asegurese de GUARDAR los datos: Patente, Aduana, Pedimento, Clave, Fecha pago')
setShowMsg(true)
return
}
})
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrio un error: ' + e)
setShowMsg(true)
return
})
} else {
setHeader('Error')
setMsg('Parea poder generar este proceso es necesario que los siguientes campos tengan informacion: Patente, Aduana, Pedimento, Clave, Fecha pago')
setShowMsg(true)
return
}
}
const uploadAlenTxt = (file: File) => { const uploadAlenTxt = (file: File) => {
const formData = new FormData() const formData = new FormData()
formData.append('name', file.name) formData.append('name', file.name)
@ -1484,6 +1462,11 @@ export default function TraficoCorresponsales (props:IProps) {
return return
}) })
} }
const showHistorialRectificaciones = () => {
setLoadComponent(14);
setShowModal(true);
}
return ( return (
<div style={{height:'100%', overflowY:'scroll'}}> <div style={{height:'100%', overflowY:'scroll'}}>
<Card className="labelSize13px" style={{borderStyle:'none', height:'100%'}}> <Card className="labelSize13px" style={{borderStyle:'none', height:'100%'}}>
@ -2162,8 +2145,8 @@ export default function TraficoCorresponsales (props:IProps) {
<fieldset className='border p-2' style={{height:'100%'}}> <fieldset className='border p-2' style={{height:'100%'}}>
<legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>Última Rectificación</legend> <legend className='w-auto' style={{float:'none', fontSize:'1rem'}}>Última Rectificación</legend>
<Row className='justify-content-between' style={{alignItems:'center', paddingTop:'15px'}}> <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}>
<Button variant="success" disabled={Depto !== 'Corresponsalias'} onClick={()=>{generaRectificacion()}}>Generar rectificacion</Button> <Button variant="success" style={{width:'100%', padding:'6px'}} onClick={() => {showHistorialRectificaciones()}}>{LblRectificaciones}</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>
@ -4206,7 +4189,7 @@ export default function TraficoCorresponsales (props:IProps) {
dialogClassName={ dialogClassName={
LoadComponent === 1 || LoadComponent === 2 || LoadComponent === 9 LoadComponent === 1 || LoadComponent === 2 || LoadComponent === 9
? 'modal-90w' ? 'modal-90w'
: LoadComponent === 13 ? 'modal-70w' : 'modal-50w' : LoadComponent === 13 || LoadComponent === 14 ? 'modal-70w' : 'modal-50w'
} }
style={{backdropFilter: 'brightness(0.5)'}} style={{backdropFilter: 'brightness(0.5)'}}
> >
@ -4293,6 +4276,29 @@ export default function TraficoCorresponsales (props:IProps) {
<PedimentosConsolidados IdTrafico={props.IDTrafico} Aduana={Aduana!} Patente={Patente!} ClavesPedimento={ClavesPedimentos} Depto={Depto}/> <PedimentosConsolidados IdTrafico={props.IDTrafico} Aduana={Aduana!} Patente={Patente!} ClavesPedimento={ClavesPedimentos} Depto={Depto}/>
</div> </div>
) : null} ) : null}
{LoadComponent === 14? (
<div style={{ height: '550px', overflow: 'hidden' }}>
<NuevaRectificacion
IdTrafico={props.IDTrafico}
Aduana={Aduana!}
Patente={Patente!}
ClavesPedimento={ClavesPedimentos}
Depto={Depto}
UserId={UserId}
Pedimentos={mCPedimentosConsolidados}
onAppendRectificacion={function (data: DTORectificacionHistorico): void {
setPedimento(data.Pedimento)
setClavePedimento(data.Clave)
setFechaPago(setDate(data.FechaPago))
setAduanaH(data.AduanaH.toString())
setPatenteH(data.PatenteH.toString())
setPedimentoH(data.PedimentoH.toString())
setClavePedimentoH(data.ClaveH)
setFechaPagoH(data.FechaPagoH)
} }
/>
</div>
) : null}
</Modal.Body> </Modal.Body>
</Modal> </Modal>
<MsgInformativo <MsgInformativo

@ -1,4 +1,15 @@
export default interface DTORectificacionHistorico { export default interface DTORectificacionHistorico {
IdTrafico: number, IdTrafico: number,
IdUsuario: number IdUsuario: number,
IdPedimento: number,
Aduana: number,
Patente:number,
Pedimento: number,
Clave: string,
FechaPago: string,
AduanaH: number,
PatenteH: number,
PedimentoH: number,
ClaveH: string,
FechaPagoH: string
} }

@ -8,5 +8,6 @@ export default interface ICorresponsalRectificacionHistorico {
clave: string clave: string
fechaPago: string fechaPago: string
fhCreacion: string fhCreacion: string
activo: number activo: number,
idPedimentoConsolidado: number
} }

@ -33,10 +33,10 @@ class Corresponsales_Trafico_DataService {
return http.put<IRespuesta>(`/Corresponsalias/Traficos/ValidateComplete/${data.id}`,data); return http.put<IRespuesta>(`/Corresponsalias/Traficos/ValidateComplete/${data.id}`,data);
} }
AppendRectificacionHistorico(data: DTORectificacionHistorico) { AppendRectificacionHistorico(data: DTORectificacionHistorico) {
return http.post<Boolean>(`Corresponsalias/Traficos/Rectificacion/Historico/Append`,data); return http.post<ICorresponsalRectificacionHistorico>(`Corresponsalias/Traficos/Rectificacion/Historico/Append`,data);
} }
GetRectificacionHistorico(IdTrafico: number) { GetRectificacionHistorico(IdTrafico: number) {
return http.get<ICorresponsalRectificacionHistorico>(`Corresponsalias/Traficos/Rectificacion/Historico/Get?IdTrafico=${IdTrafico}`); return http.get<ICorresponsalRectificacionHistorico[]>(`Corresponsalias/Traficos/Rectificacion/Historico/Get?IdTrafico=${IdTrafico}`);
} }
ValidaTraficoDuplicado(aduana: number | undefined, patente: number | undefined, pedimento:number | undefined, IdTrafico: number | undefined){ ValidaTraficoDuplicado(aduana: number | undefined, patente: number | undefined, pedimento:number | undefined, IdTrafico: number | undefined){

@ -0,0 +1,40 @@
import ICorresponsalRectificacionHistorico from "../../../Interfaces/Corresponsales/ICorresponsalRectificacionHistorico";
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
const RectificacionesPedimentos: ICorresponsalRectificacionHistorico[] = []
const initialState = {RectificacionesPedimentos};
export const RectificacionesPedimentosSlice = createSlice({
name: 'RectificacionesPedimentos',
initialState: initialState,
reducers: {
populateRectificaciones : (state, action: PayloadAction<ICorresponsalRectificacionHistorico[]>) => {
state.RectificacionesPedimentos = []
state.RectificacionesPedimentos.push(... action.payload)
},
addRectificacion : (state, action: PayloadAction<ICorresponsalRectificacionHistorico>) => {
var Existe = state.RectificacionesPedimentos.find(function(item) {
return item.id === action.payload.id;
});
if (!Existe) state.RectificacionesPedimentos.push(action.payload)
},
updateRectificacion : (state, action: PayloadAction<ICorresponsalRectificacionHistorico>) => {
const i = state.RectificacionesPedimentos.findIndex(_element => _element.id === action.payload.id);
if (i > -1) state.RectificacionesPedimentos[i] = action.payload;
else state.RectificacionesPedimentos.push(action.payload);
},
deleteRectificacion : (state, action: PayloadAction<number>) => {
const newArr = state.RectificacionesPedimentos.filter(data => data.id != action.payload);
state.RectificacionesPedimentos=newArr
},
}
})
export const { populateRectificaciones,
addRectificacion,
updateRectificacion,
deleteRectificacion,
} = RectificacionesPedimentosSlice.actions;
export default RectificacionesPedimentosSlice.reducer;

@ -11,6 +11,7 @@ import CorresponsalesGuiasSlice from './features/Corresponsales/CorresponsalesGu
import CorresponsalesPartidasSlice from './features/Corresponsales/CorresponsalesPartidasSlice' import CorresponsalesPartidasSlice from './features/Corresponsales/CorresponsalesPartidasSlice'
import CorresponsalesCuentasComplementariasEstatusSlice from './features/Corresponsales/CorresponsalesCuentasComplementariasEstatusSlice' import CorresponsalesCuentasComplementariasEstatusSlice from './features/Corresponsales/CorresponsalesCuentasComplementariasEstatusSlice'
import PedimentosConsolidadosSlice from './features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice' import PedimentosConsolidadosSlice from './features/Corresponsales/CorresponsalesPedimentosConsolidadosSlice'
import RectificacionesPedimentosSlice from './features/Corresponsales/CorresponsalesPedimentosRectificacionesSlice'
export const store = configureStore({ export const store = configureStore({
@ -26,7 +27,8 @@ export const store = configureStore({
CGuias: CorresponsalesGuiasSlice, CGuias: CorresponsalesGuiasSlice,
CPartidas: CorresponsalesPartidasSlice, CPartidas: CorresponsalesPartidasSlice,
CCueCompEstatus : CorresponsalesCuentasComplementariasEstatusSlice, CCueCompEstatus : CorresponsalesCuentasComplementariasEstatusSlice,
CPedimentosConsolidados: PedimentosConsolidadosSlice CPedimentosConsolidados: PedimentosConsolidadosSlice,
CRectificaciones: RectificacionesPedimentosSlice
} }
}) })

Loading…
Cancel
Save