|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
import { useEffect, useState } from 'react' |
|
|
|
|
import { Button, Card, Col, Form, Row, Table } from 'react-bootstrap' |
|
|
|
|
import { Alert, Button, Card, Col, Form, FormCheck, Modal, Row, Table } from 'react-bootstrap' |
|
|
|
|
import { IconContext } from 'react-icons' |
|
|
|
|
import { BsChevronDown, BsChevronRight, BsSearch } from 'react-icons/bs' |
|
|
|
|
import { FaCheckCircle, FaFileExcel, FaQuestionCircle } from 'react-icons/fa' |
|
|
|
@ -37,7 +37,9 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
const [Fin, setFin] = useState(currentDate(0)) |
|
|
|
|
const [filtro, setFiltro] = useState('') |
|
|
|
|
const [header, setHeader] = useState('') |
|
|
|
|
const [IDFactura, setIDFactura] = useState(0) |
|
|
|
|
const [show, setShowMsg] = useState(false) |
|
|
|
|
const [ShowModal, setShowModal] = useState(false) |
|
|
|
|
const [msg, setMsg] = useState('') |
|
|
|
|
const msgColor = 'primary' |
|
|
|
|
|
|
|
|
@ -84,7 +86,6 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const downloadExceptionsFile = (id: number) => { |
|
|
|
|
DSAmazon.TerminaFactura(id) |
|
|
|
|
.then((response) => {}) |
|
|
|
@ -95,7 +96,10 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
const url = window.URL.createObjectURL(new Blob([response.data])) |
|
|
|
|
const link = document.createElement('a') |
|
|
|
|
link.href = url |
|
|
|
|
link.setAttribute('download', 'Formato de consultas (Exceptions Handling 2021).xlsx') |
|
|
|
|
link.setAttribute( |
|
|
|
|
'download', |
|
|
|
|
'Formato de consultas (Exceptions Handling 2021).xlsx' |
|
|
|
|
) |
|
|
|
|
document.body.appendChild(link) |
|
|
|
|
link.click() |
|
|
|
|
} |
|
|
|
@ -108,7 +112,6 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
loadReport() |
|
|
|
|
}, []) |
|
|
|
@ -132,15 +135,38 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
.map((element) => { |
|
|
|
|
let newElt = Object.assign({}, element) // copies element
|
|
|
|
|
return newElt.detail.filter( |
|
|
|
|
(child) => |
|
|
|
|
(child.idHeader === IDMaster) && |
|
|
|
|
(child.autorizado) && |
|
|
|
|
(child.destinationHTSCode.toString().replaceAll('.','') !== child.fraccionGEMCO) |
|
|
|
|
(child) => child.idHeader === IDMaster && !child.autorizado |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
console.log(JSON.stringify(Exceptions[0])) |
|
|
|
|
return Exceptions[0].length ? Exceptions[0].length : 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const facturaTerminada = (row: I2096Headers) => { |
|
|
|
|
DSAmazon.Se$Puede$Terminar$Factura(row.id) |
|
|
|
|
.then((response) => { |
|
|
|
|
if (response.data.respuesta.includes('lista')) { |
|
|
|
|
setIDFactura(row.id) |
|
|
|
|
setShowModal(true) |
|
|
|
|
return |
|
|
|
|
} else { |
|
|
|
|
setIDFactura(0) |
|
|
|
|
setHeader('Informativo') |
|
|
|
|
setMsg(response.data.respuesta) |
|
|
|
|
setShowMsg(true) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
setIDFactura(0) |
|
|
|
|
setHeader('Error') |
|
|
|
|
setMsg('Ocurrio un error') |
|
|
|
|
setShowMsg(true) |
|
|
|
|
return |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div> |
|
|
|
|
<Card> |
|
|
|
@ -168,14 +194,10 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
<th style={{ width: '50px' }}>id</th> |
|
|
|
|
<th style={{ width: '50px' }}></th> |
|
|
|
|
<th style={{ width: '50px' }}></th> |
|
|
|
|
<th style={{ width: '50px' }}></th> |
|
|
|
|
<th style={{ width: '80px' }}>Commercial Invoice Date</th> |
|
|
|
|
<th style={{ width: '150px' }}>Invoice Number</th> |
|
|
|
|
<th style={{ width: '50px' }}>Name</th> |
|
|
|
|
{/* <th>Trailer Number</th> |
|
|
|
|
<th>Trailer Id</th> |
|
|
|
|
<th>Por Of Loading</th> |
|
|
|
|
<th>Port of entry</th> |
|
|
|
|
<th>Payments Terms</th> */} |
|
|
|
|
<th style={{ width: '100px' }}>Incoterms</th> |
|
|
|
|
<th style={{ textAlign: 'center' }}>HAWB</th> |
|
|
|
|
<th>Qty Unit of measure</th> |
|
|
|
@ -226,12 +248,15 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
</IconContext.Provider> |
|
|
|
|
)} |
|
|
|
|
</td> |
|
|
|
|
|
|
|
|
|
<td>{MasterData.id}</td> |
|
|
|
|
<td> |
|
|
|
|
{existsExeptions(MasterData.id) > 0 ? ( |
|
|
|
|
<div |
|
|
|
|
onClick={() => downloadExceptionsFile(MasterData.id)} |
|
|
|
|
title='Archivo de excepciones' |
|
|
|
|
onClick={() => |
|
|
|
|
downloadExceptionsFile(MasterData.id) |
|
|
|
|
} |
|
|
|
|
title="Archivo de excepciones" |
|
|
|
|
> |
|
|
|
|
<IconContext.Provider |
|
|
|
|
value={{ color: 'orange', size: '20px' }} |
|
|
|
@ -254,6 +279,19 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
<FormCheck |
|
|
|
|
className="form-check form-switch form-control-sm" |
|
|
|
|
id="switchEnabled" |
|
|
|
|
type="switch" |
|
|
|
|
checked={false} |
|
|
|
|
onChange={() => { |
|
|
|
|
facturaTerminada(MasterData) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
label="" |
|
|
|
|
/> |
|
|
|
|
</td> |
|
|
|
|
<td style={{ width: '80px', textAlign: 'center' }}> |
|
|
|
|
{MasterData.commercialInvoiceDate} |
|
|
|
|
</td> |
|
|
|
@ -263,21 +301,6 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
<td style={{ width: '50px', textAlign: 'center' }}> |
|
|
|
|
{MasterData.name} |
|
|
|
|
</td> |
|
|
|
|
{/* <td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.trailerNumber} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.trailerId} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.porOfLoading} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.portOfEntry} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.paymentsTerms} |
|
|
|
|
</td> */} |
|
|
|
|
<td style={{ width: '100px', textAlign: 'center' }}> |
|
|
|
|
{MasterData.incoterms} |
|
|
|
|
</td> |
|
|
|
@ -357,7 +380,7 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
</th> |
|
|
|
|
<th |
|
|
|
|
style={{ |
|
|
|
|
width: '120px', |
|
|
|
|
width: '200px', |
|
|
|
|
backgroundColor: '#D3E0EA', |
|
|
|
|
color: '#346288', |
|
|
|
|
textAlign: 'center' |
|
|
|
@ -564,6 +587,50 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
</div> |
|
|
|
|
</Card.Body> |
|
|
|
|
</Card> |
|
|
|
|
<Modal |
|
|
|
|
show={ShowModal} |
|
|
|
|
onHide={() => { |
|
|
|
|
setShowModal(false) |
|
|
|
|
}} |
|
|
|
|
size={'sm'} |
|
|
|
|
dialogClassName={'modal-50w'} |
|
|
|
|
> |
|
|
|
|
<Modal.Body> |
|
|
|
|
<div style={{ height: '180px' }}> |
|
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
|
<Col xs={1}></Col> |
|
|
|
|
<Col xs={10}> |
|
|
|
|
<Alert key={'danger'} variant={'danger'}> |
|
|
|
|
La factura esta lista para terminarse, desea terminarla? |
|
|
|
|
</Alert> |
|
|
|
|
</Col> |
|
|
|
|
<Col xs={1}></Col> |
|
|
|
|
</Row> |
|
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
|
<Col xs={6} style={{ textAlign: 'center' }}> |
|
|
|
|
<Button |
|
|
|
|
variant="secondary" |
|
|
|
|
onClick={() => { |
|
|
|
|
setShowModal(false) |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
No |
|
|
|
|
</Button> |
|
|
|
|
</Col> |
|
|
|
|
<Col xs={6} style={{ textAlign: 'center' }}> |
|
|
|
|
<Button |
|
|
|
|
variant="danger" |
|
|
|
|
onClick={() => { |
|
|
|
|
downloadExcel(IDFactura) |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
Si |
|
|
|
|
</Button> |
|
|
|
|
</Col> |
|
|
|
|
</Row> |
|
|
|
|
</div> |
|
|
|
|
</Modal.Body> |
|
|
|
|
</Modal> |
|
|
|
|
<MsgInformativo |
|
|
|
|
show={show} |
|
|
|
|
msg={msg} |
|
|
|
|