|
|
@ -22,14 +22,16 @@ import { |
|
|
|
populateInvoices, |
|
|
|
populateInvoices, |
|
|
|
updateInvoice |
|
|
|
updateInvoice |
|
|
|
} from '../../../../../../store/features/Clientes/2096/AmazonInvoices' |
|
|
|
} from '../../../../../../store/features/Clientes/2096/AmazonInvoices' |
|
|
|
|
|
|
|
import loadingImg from '../../../../../../images/ajaxloader.gif' |
|
|
|
|
|
|
|
|
|
|
|
// Redux
|
|
|
|
// Redux
|
|
|
|
import { useDispatch, useSelector } from 'react-redux' |
|
|
|
import { useDispatch, useSelector } from 'react-redux' |
|
|
|
import RtpPendingAnswerFromAmazonDetail from './RptPendingAnswerFromAmazonDetail' |
|
|
|
import RtpPendingAnswerFromAmazonDetail from './RptPendingAnswerFromAmazonDetail' |
|
|
|
import { AiFillFileUnknown, AiTwotoneFileExcel } from 'react-icons/ai' |
|
|
|
import { AiFillFileUnknown, AiTwotoneFileExcel } from 'react-icons/ai' |
|
|
|
import DTO2096PerfilesParecidos from '../../../DTO/DTO2096PerfilesParecidos' |
|
|
|
import DTO2096PerfilesParecidos from '../../../DTO/DTO2096PerfilesParecidos' |
|
|
|
import FileManager from '../../../../../Utils/FileManager/FileManager' |
|
|
|
|
|
|
|
import { MFileManager } from '../../../../../Utils/MFileManager/MFileManager' |
|
|
|
import { MFileManager } from '../../../../../Utils/MFileManager/MFileManager' |
|
|
|
|
|
|
|
import { setEmitFlags } from 'typescript' |
|
|
|
|
|
|
|
import DTO2096RELParteFactura from '../../../DTO/DTO2096RELParteFactura' |
|
|
|
export interface IRptPendingAnswerFromAmazonProps {} |
|
|
|
export interface IRptPendingAnswerFromAmazonProps {} |
|
|
|
|
|
|
|
|
|
|
|
export default function RptPendingAnswerFromAmazon( |
|
|
|
export default function RptPendingAnswerFromAmazon( |
|
|
@ -44,11 +46,15 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
return stickyValue !== null ? JSON.parse(stickyValue) : 0 |
|
|
|
return stickyValue !== null ? JSON.parse(stickyValue) : 0 |
|
|
|
}) |
|
|
|
}) |
|
|
|
const [Data, setData] = useState<DTO2096PerfilesParecidos[]>([]) |
|
|
|
const [Data, setData] = useState<DTO2096PerfilesParecidos[]>([]) |
|
|
|
|
|
|
|
const [ResumeData, setResumeData] = useState<DTO2096RELParteFactura[]>([]) |
|
|
|
const [header, setHeader] = useState('') |
|
|
|
const [header, setHeader] = useState('') |
|
|
|
const [IDFactura, setIDFactura] = useState(0) |
|
|
|
const [IDFactura, setIDFactura] = useState(0) |
|
|
|
|
|
|
|
const [Factura, setFactura] = useState('') |
|
|
|
const [IDProcess, setIDProcess] = useState(25) |
|
|
|
const [IDProcess, setIDProcess] = useState(25) |
|
|
|
const [show, setShowMsg] = useState(false) |
|
|
|
const [show, setShowMsg] = useState(false) |
|
|
|
const [ShowModal, setShowModal] = useState(false) |
|
|
|
const [ShowModal, setShowModal] = useState(false) |
|
|
|
|
|
|
|
const [WaitingDialog, setWaitingDialog] = useState(false) |
|
|
|
|
|
|
|
const [WaitingMessage, setWaitingMessage] = useState('Generando...') |
|
|
|
const [ShowModalAnswerFile, setShowModalAnswerFile] = useState(false) |
|
|
|
const [ShowModalAnswerFile, setShowModalAnswerFile] = useState(false) |
|
|
|
const [msg, setMsg] = useState('') |
|
|
|
const [msg, setMsg] = useState('') |
|
|
|
const msgColor = 'primary' |
|
|
|
const msgColor = 'primary' |
|
|
@ -74,18 +80,34 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const generateResume = (id: number) => { |
|
|
|
|
|
|
|
DSAmazon.RELParteFacturasGET(id) |
|
|
|
|
|
|
|
.then((response) => { |
|
|
|
|
|
|
|
setResumeData(response.data) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((e: Error) => { |
|
|
|
|
|
|
|
setHeader('Error') |
|
|
|
|
|
|
|
setMsg('Ocurrio un error') |
|
|
|
|
|
|
|
setShowMsg(true) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const downloadExceptionsFile = (id: number, Factura: string) => { |
|
|
|
const downloadExceptionsFile = (id: number, Factura: string) => { |
|
|
|
|
|
|
|
setWaitingDialog(true) |
|
|
|
|
|
|
|
generateResume(id) |
|
|
|
|
|
|
|
setFactura(Factura) |
|
|
|
DSAmazon.ExceptionsFileAmazonGET(id) |
|
|
|
DSAmazon.ExceptionsFileAmazonGET(id) |
|
|
|
.then((response: any) => { |
|
|
|
.then((response: any) => { |
|
|
|
if (response.status === 200) { |
|
|
|
if (response.status === 200) { |
|
|
|
const url = window.URL.createObjectURL(new Blob([response.data])) |
|
|
|
const url = window.URL.createObjectURL(new Blob([response.data])) |
|
|
|
const link = document.createElement('a') |
|
|
|
const link = document.createElement('a') |
|
|
|
link.href = url |
|
|
|
link.href = url |
|
|
|
link.setAttribute('download', 'Excepciones '+Factura+'.xlsx') |
|
|
|
link.setAttribute('download', 'Excepciones ' + Factura + '.xlsx') |
|
|
|
document.body.appendChild(link) |
|
|
|
document.body.appendChild(link) |
|
|
|
link.click() |
|
|
|
link.click() |
|
|
|
setShowModal(false) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setWaitingMessage('') |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((e: Error) => { |
|
|
|
.catch((e: Error) => { |
|
|
|
setHeader('Error') |
|
|
|
setHeader('Error') |
|
|
@ -153,7 +175,9 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
//alert(response.data.estatus)
|
|
|
|
//alert(response.data.estatus)
|
|
|
|
if (response.data.estatus === 0) { |
|
|
|
if (response.data.estatus === 0) { |
|
|
|
setHeader('Error') |
|
|
|
setHeader('Error') |
|
|
|
setMsg('Verifique que todas las partidas esten checadas por usted y que cuente con el archivo de respuesta') |
|
|
|
setMsg( |
|
|
|
|
|
|
|
'Verifique que todas las partidas esten checadas por usted y que cuente con el archivo de respuesta' |
|
|
|
|
|
|
|
) |
|
|
|
setShowMsg(true) |
|
|
|
setShowMsg(true) |
|
|
|
return |
|
|
|
return |
|
|
|
} else if (response.data.estatus === 1) { |
|
|
|
} else if (response.data.estatus === 1) { |
|
|
@ -198,8 +222,8 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
<Card.Title> |
|
|
|
<Card.Title> |
|
|
|
<IconContext.Provider value={{ color: '#F6C34F', size: '8%' }}> |
|
|
|
<IconContext.Provider value={{ color: '#F6C34F', size: '8%' }}> |
|
|
|
<FaAmazon /> |
|
|
|
<FaAmazon /> |
|
|
|
</IconContext.Provider>{' '} |
|
|
|
</IconContext.Provider> |
|
|
|
CLASIFICACION : facturas{' '} |
|
|
|
CLASIFICACION : facturas |
|
|
|
<span |
|
|
|
<span |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
fontStyle: 'italic', |
|
|
|
fontStyle: 'italic', |
|
|
@ -208,7 +232,7 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
pendientes |
|
|
|
pendientes |
|
|
|
</span>{' '} |
|
|
|
</span> |
|
|
|
de respuesta |
|
|
|
de respuesta |
|
|
|
</Card.Title> |
|
|
|
</Card.Title> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
@ -291,7 +315,10 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
{existsExeptions(MasterData.id) > 0 ? ( |
|
|
|
{existsExeptions(MasterData.id) > 0 ? ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
onClick={() => |
|
|
|
onClick={() => |
|
|
|
downloadExceptionsFile(MasterData.id, MasterData.invoiceNumber) |
|
|
|
downloadExceptionsFile( |
|
|
|
|
|
|
|
MasterData.id, |
|
|
|
|
|
|
|
MasterData.invoiceNumber |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
title="Archivo de excepciones" |
|
|
|
title="Archivo de excepciones" |
|
|
|
> |
|
|
|
> |
|
|
@ -319,7 +346,8 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
<div |
|
|
|
<div |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
setIDFactura(MasterData.id) |
|
|
|
setIDFactura(MasterData.id) |
|
|
|
setShowModalAnswerFile(!ShowModalAnswerFile) }} |
|
|
|
setShowModalAnswerFile(!ShowModalAnswerFile) |
|
|
|
|
|
|
|
}} |
|
|
|
title="Archivo de respuesta" |
|
|
|
title="Archivo de respuesta" |
|
|
|
> |
|
|
|
> |
|
|
|
<IconContext.Provider |
|
|
|
<IconContext.Provider |
|
|
@ -695,7 +723,11 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
<div style={{ height: '330px' }}> |
|
|
|
<div style={{ height: '330px' }}> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Col xs={12}> |
|
|
|
<Col xs={12}> |
|
|
|
<Alert key={'danger'} variant={'danger'} style={{textAlign:'center'}}> |
|
|
|
<Alert |
|
|
|
|
|
|
|
key={'danger'} |
|
|
|
|
|
|
|
variant={'danger'} |
|
|
|
|
|
|
|
style={{ textAlign: 'center' }} |
|
|
|
|
|
|
|
> |
|
|
|
Proporcione el archivo de respuesta de Amazon |
|
|
|
Proporcione el archivo de respuesta de Amazon |
|
|
|
</Alert> |
|
|
|
</Alert> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
@ -703,26 +735,64 @@ export default function RptPendingAnswerFromAmazon( |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Row style={{ paddingTop: '15px' }}> |
|
|
|
<Col></Col> |
|
|
|
<Col></Col> |
|
|
|
<Col xs={10} style={{ textAlign: 'center' }}> |
|
|
|
<Col xs={10} style={{ textAlign: 'center' }}> |
|
|
|
{/* <FileManager |
|
|
|
<MFileManager |
|
|
|
IDUser={UserId} |
|
|
|
IDTrafico={IDFactura} |
|
|
|
width={650} |
|
|
|
Proceso={IDProcess} |
|
|
|
height={100} |
|
|
|
showPreview={3} |
|
|
|
IDProcess={IDProcess} |
|
|
|
canEdit={true} |
|
|
|
IdFile={IDFactura} |
|
|
|
Leyenda="Sube archivos de respuesta de Amazon" |
|
|
|
FileName={'Answer'} |
|
|
|
/> |
|
|
|
canDelete={true} |
|
|
|
|
|
|
|
FileType={['xlsx']} |
|
|
|
|
|
|
|
Leyenda={`Seleccione el archivo de respuesta de Amazon, arrastrelo hasta aqui y sueltelo para subirlo al servidor...`} |
|
|
|
|
|
|
|
onAppendFM={function (idFile: number): void { relacionaIDArchivoRespuestaConFactura(idFile)}} |
|
|
|
|
|
|
|
/> */} |
|
|
|
|
|
|
|
<MFileManager IDTrafico={IDFactura} Proceso={IDProcess} showPreview={3} canEdit={true} Leyenda='Sube archivos de respuesta de Amazon'/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
<Col></Col> |
|
|
|
<Col></Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Modal.Body> |
|
|
|
</Modal.Body> |
|
|
|
</Modal> |
|
|
|
</Modal> |
|
|
|
|
|
|
|
<Modal |
|
|
|
|
|
|
|
show={WaitingDialog} |
|
|
|
|
|
|
|
onHide={() => { |
|
|
|
|
|
|
|
setWaitingDialog(false) |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
backdrop="static" |
|
|
|
|
|
|
|
keyboard={false} |
|
|
|
|
|
|
|
size="sm" |
|
|
|
|
|
|
|
dialogClassName={'modal-50w'} |
|
|
|
|
|
|
|
centered |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<Modal.Header closeButton> |
|
|
|
|
|
|
|
<Modal.Title></Modal.Title> |
|
|
|
|
|
|
|
</Modal.Header> |
|
|
|
|
|
|
|
<Modal.Body> |
|
|
|
|
|
|
|
<img |
|
|
|
|
|
|
|
src={loadingImg} |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
height: WaitingMessage === 'Generando...' ? '150px' : '0px', |
|
|
|
|
|
|
|
width: WaitingMessage === 'Generando...' ? '150px' : '0px' |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
alt="proccessing" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
{WaitingMessage} |
|
|
|
|
|
|
|
<div style={{overflow:'auto'}}> |
|
|
|
|
|
|
|
<table> |
|
|
|
|
|
|
|
<tr> |
|
|
|
|
|
|
|
<td style={{backgroundColor:'#6095BF', color: '#FFFFFF'}}>Parte</td> |
|
|
|
|
|
|
|
<td style={{backgroundColor:'#6095BF', color: '#FFFFFF'}}>Lista de facturas</td> |
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
{ResumeData |
|
|
|
|
|
|
|
? ResumeData.map((data) => { |
|
|
|
|
|
|
|
return <> |
|
|
|
|
|
|
|
<tr> |
|
|
|
|
|
|
|
<td>{data.parte}</td> |
|
|
|
|
|
|
|
<td>{data.facturas.replaceAll(Factura,'')}</td> |
|
|
|
|
|
|
|
</tr> |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
: ''} |
|
|
|
|
|
|
|
</table> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</Modal.Body> |
|
|
|
|
|
|
|
<Modal.Footer></Modal.Footer> |
|
|
|
|
|
|
|
</Modal> |
|
|
|
<MsgInformativo |
|
|
|
<MsgInformativo |
|
|
|
show={show} |
|
|
|
show={show} |
|
|
|
msg={msg} |
|
|
|
msg={msg} |
|
|
|