|
|
|
@ -22,7 +22,8 @@ import { |
|
|
|
|
} from '../../../../store/features/Clientes/2096/AmazonInvoices' |
|
|
|
|
// Redux
|
|
|
|
|
import { useDispatch, useSelector } from 'react-redux' |
|
|
|
|
import RtpAmazonPendingInvoicesDetail from './RptAmazonPendingInvoicesDetail' |
|
|
|
|
import RtpAmazonPendingInvoicesDetail from './RptAmazonPendingInvoicesDetail' |
|
|
|
|
import { AiTwotoneFileExcel } from 'react-icons/ai' |
|
|
|
|
export interface IRtpAmazonPendingInvoicesProps {} |
|
|
|
|
|
|
|
|
|
export default function RtpAmazonPendingInvoices( |
|
|
|
@ -62,12 +63,11 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
|
|
|
|
|
const downloadExcel = (id: number) => { |
|
|
|
|
DSAmazon.TerminaFactura(id) |
|
|
|
|
.then((response) => {}) |
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
}) |
|
|
|
|
.then((response) => {}) |
|
|
|
|
.catch((e: Error) => {}) |
|
|
|
|
DSAmazon.GetNoPartesAmazon2SIR(id) |
|
|
|
|
.then((response: any) => { |
|
|
|
|
if (response.status === 200) { |
|
|
|
|
.then((response: any) => { |
|
|
|
|
if (response.status === 200) { |
|
|
|
|
const url = window.URL.createObjectURL(new Blob([response.data])) |
|
|
|
|
const link = document.createElement('a') |
|
|
|
|
link.href = url |
|
|
|
@ -75,15 +75,40 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
document.body.appendChild(link) |
|
|
|
|
link.click() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
setHeader('Error') |
|
|
|
|
setMsg('Ocurrio un error') |
|
|
|
|
setShowMsg(true) |
|
|
|
|
return |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
setHeader('Error') |
|
|
|
|
setMsg('Ocurrio un error') |
|
|
|
|
setShowMsg(true) |
|
|
|
|
return |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const downloadExceptionsFile = (id: number) => { |
|
|
|
|
DSAmazon.TerminaFactura(id) |
|
|
|
|
.then((response) => {}) |
|
|
|
|
.catch((e: Error) => {}) |
|
|
|
|
DSAmazon.Get$ExceptionsFile$Amazon(id) |
|
|
|
|
.then((response: any) => { |
|
|
|
|
if (response.status === 200) { |
|
|
|
|
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') |
|
|
|
|
document.body.appendChild(link) |
|
|
|
|
link.click() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
setHeader('Error') |
|
|
|
|
setMsg('Ocurrio un error') |
|
|
|
|
setShowMsg(true) |
|
|
|
|
return |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
loadReport() |
|
|
|
|
}, []) |
|
|
|
@ -99,6 +124,23 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
window.open('https://www.amazon.com/dp/' + item) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const existsExeptions = (IDMaster: number) => { |
|
|
|
|
const Exceptions = mInvoices |
|
|
|
|
.filter((element) => |
|
|
|
|
element.detail.some((sub) => sub.idHeader === IDMaster) |
|
|
|
|
) |
|
|
|
|
.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) |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
return Exceptions[0].length ? Exceptions[0].length : 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div> |
|
|
|
|
<Card> |
|
|
|
@ -125,13 +167,15 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
<th></th> |
|
|
|
|
<th style={{ width: '50px' }}>id</th> |
|
|
|
|
<th style={{ width: '50px' }}></th> |
|
|
|
|
<th style={{ width: '50px' }}></th> |
|
|
|
|
<th style={{ width: '80px' }}>Commercial Invoice Date</th> |
|
|
|
|
<th style={{ width: '300px' }}>Invoice Number</th> |
|
|
|
|
<th>Trailer Number</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>Payments Terms</th> */} |
|
|
|
|
<th style={{ width: '100px' }}>Incoterms</th> |
|
|
|
|
<th style={{ textAlign: 'center' }}>HAWB</th> |
|
|
|
|
<th>Qty Unit of measure</th> |
|
|
|
@ -183,6 +227,20 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
)} |
|
|
|
|
</td> |
|
|
|
|
<td>{MasterData.id}</td> |
|
|
|
|
<td> |
|
|
|
|
{existsExeptions(MasterData.id) > 0 ? ( |
|
|
|
|
<div |
|
|
|
|
onClick={() => downloadExceptionsFile(MasterData.id)} |
|
|
|
|
title='Archivo de excepciones' |
|
|
|
|
> |
|
|
|
|
<IconContext.Provider |
|
|
|
|
value={{ color: 'orange', size: '20px' }} |
|
|
|
|
> |
|
|
|
|
<FaFileExcel /> |
|
|
|
|
</IconContext.Provider> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
</td> |
|
|
|
|
<td> |
|
|
|
|
{MasterData.estatus === 1 ? ( |
|
|
|
|
<div |
|
|
|
@ -191,7 +249,7 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
<IconContext.Provider |
|
|
|
|
value={{ color: 'green', size: '20px' }} |
|
|
|
|
> |
|
|
|
|
<FaFileExcel /> |
|
|
|
|
<AiTwotoneFileExcel /> |
|
|
|
|
</IconContext.Provider> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
@ -199,10 +257,13 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
<td style={{ width: '80px', textAlign: 'center' }}> |
|
|
|
|
{MasterData.commercialInvoiceDate} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ width: '300px' }}> |
|
|
|
|
<td style={{ width: '150px' }}> |
|
|
|
|
{MasterData.invoiceNumber} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
|
<td style={{ width: '50px', textAlign:'center' }}> |
|
|
|
|
{MasterData.name} |
|
|
|
|
</td> |
|
|
|
|
{/* <td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.trailerNumber} |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
@ -216,7 +277,7 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
</td> |
|
|
|
|
<td style={{ textAlign: 'center' }}> |
|
|
|
|
{MasterData.paymentsTerms} |
|
|
|
|
</td> |
|
|
|
|
</td> */} |
|
|
|
|
<td style={{ width: '100px', textAlign: 'center' }}> |
|
|
|
|
{MasterData.incoterms} |
|
|
|
|
</td> |
|
|
|
@ -476,7 +537,15 @@ export default function RtpAmazonPendingInvoices( |
|
|
|
|
detail.idHeader |
|
|
|
|
) |
|
|
|
|
.map((detail) => { |
|
|
|
|
return <RtpAmazonPendingInvoicesDetail IDMaster={MasterData.id} detail={detail} Habilitado={MasterData.estatus<=1}/>
|
|
|
|
|
return ( |
|
|
|
|
<RtpAmazonPendingInvoicesDetail |
|
|
|
|
IDMaster={MasterData.id} |
|
|
|
|
detail={detail} |
|
|
|
|
Habilitado={ |
|
|
|
|
MasterData.estatus <= 1 |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
})} |
|
|
|
|
</> |
|
|
|
|
) |
|
|
|
|