Agregar campos para capturar la rectificacion en modal de pedimentos consolidados

feature/Agregar_Multiples_Rectificaciones_Al_Mismo_Trafico_20240109
Felix Morales 9 months ago
parent d1cab4f725
commit aed2edbc47
  1. 118
      src/Components/Corresponsales/PedimentosConsolidados/PedimentosConsolidados.tsx
  2. 9
      src/Components/Corresponsales/TraficoCorresponsales.tsx

@ -36,6 +36,13 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
const [Pedimento, setPedimento] = useState(0) const [Pedimento, setPedimento] = useState(0)
const [ClavePedimento, setClavePedimento] = useState(''); const [ClavePedimento, setClavePedimento] = useState('');
const [FechaPago, setFechaPago] = useState('') const [FechaPago, setFechaPago] = useState('')
const [AduanaH, setAduanaH] = useState(0)
const [PatenteH, setPatenteH] = useState(0)
const [PedimentoH, setPedimentoH] = useState(0)
const [ClavePedimentoH, setClavePedimentoH] = useState('')
const [FechaPagoH, setFechaPagoH] = useState('')
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 [columnDefs] = useState([
props.Depto === 'Corresponsalias' ? props.Depto === 'Corresponsalias' ?
@ -80,15 +87,29 @@ export const PedimentosConsolidados:React.FC<IProps> = (props) => {
{ field: 'pedimento', width: 120, sortable: true, filter: true }, { field: 'pedimento', width: 120, sortable: true, filter: true },
{ field: 'clave', width: 100, sortable: true, filter: true }, { field: 'clave', width: 100, sortable: true, filter: true },
{ {
field: 'fechaPago', field: 'fechaPago',
sortable: true, sortable: true,
filter: true, filter: true,
flex: 1, //Se encarga de llenar el espacio sobrante de las columnas cellRenderer: (params: any) => {
cellRenderer: (params: any) => { if (params.value) return params.value.substring(0, 10)
if (params.value) return params.value.substring(0, 10) else return ''
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 [Data, setData] = useState<DTOPedimentosConsolidados[]>()
@ -135,6 +156,7 @@ 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)
@ -175,12 +197,31 @@ 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 <Col
xs={1} xs={1}
style={{ style={{
@ -282,6 +323,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='ag-theme-alpine' style={{ height: 400, width: '100%'}}>
<AgGridReact <AgGridReact

@ -336,8 +336,7 @@ export default function TraficoCorresponsales (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 [CentroCostos, setCentroCostos] = useState<string>(''); const [CentroCostos, setCentroCostos] = useState<string>('');
const [ClaveClienteFacturacion, setClaveClienteFacturacion] = useState(0); const [ClaveClienteFacturacion, setClaveClienteFacturacion] = useState(0);
const [NombreClienteFacturacion, setNombreClienteFacturacion] = useState('') const [NombreClienteFacturacion, setNombreClienteFacturacion] = useState('')
@ -798,8 +797,7 @@ export default function TraficoCorresponsales (props:IProps) {
.then((response) => { .then((response) => {
if (response.data.id > 0) { if (response.data.id > 0) {
setEncabezadoPedimento1("Pedimento Rectificado") setEncabezadoPedimento1("Pedimento Master 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())
@ -2162,7 +2160,7 @@ export default function TraficoCorresponsales (props:IProps) {
</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} style={{visibility: (IDTrafico>0 && !(AduanaH.length>0 && PatenteH.length>0 && PedimentoH.length>0 && FechaPagoH.length>0)) ? 'visible' : 'hidden' }}>
<Button variant="success" disabled={Depto !== 'Corresponsalias'} onClick={()=>{generaRectificacion()}}>Generar rectificacion</Button> <Button variant="success" disabled={Depto !== 'Corresponsalias'} onClick={()=>{generaRectificacion()}}>Generar rectificacion</Button>
@ -4210,6 +4208,7 @@ export default function TraficoCorresponsales (props:IProps) {
? 'modal-90w' ? 'modal-90w'
: LoadComponent === 13 ? 'modal-70w' : 'modal-50w' : LoadComponent === 13 ? 'modal-70w' : 'modal-50w'
} }
style={{backdropFilter: 'brightness(0.5)'}}
> >
<Modal.Body> <Modal.Body>
{LoadComponent === 1 ? ( {LoadComponent === 1 ? (

Loading…
Cancel
Save