diff --git a/src/Components/Clientes/Amazon/Reportes/Payed/RptAmazonPayedOperations.tsx b/src/Components/Clientes/Amazon/Reportes/Payed/RptAmazonPayedOperations.tsx index 0727d63..c0b3a37 100644 --- a/src/Components/Clientes/Amazon/Reportes/Payed/RptAmazonPayedOperations.tsx +++ b/src/Components/Clientes/Amazon/Reportes/Payed/RptAmazonPayedOperations.tsx @@ -28,6 +28,7 @@ import { FaAmazon } from 'react-icons/fa' import loadingImg from '../../../../../images/ajaxloader.gif' import { MFileManager } from '../../../../Utils/MFileManager/MFileManager' import DTO2096RptPayedOperations from '../../DTO/DTO2096RptPayedOperations' +import { GoGear } from "react-icons/go"; export interface IRptAmazonPayedOpereationsProps {} @@ -191,6 +192,33 @@ export default function RptAmazonPayedOpereations( }) } + const createACKFile = (referencia: string) => { + DSAmazon.CreateACKFile(referencia) + .then((response: any) => { + DSAmazon.UploadACKFile2Amazon(referencia) + .then((response: any) => { + setHeader('Informativo') + setMsg('Se envio el archivo ACK a Amazon') + setShowMsg(true) + loadReport() + return + }) + .catch((e: Error) => { + console.log(JSON.stringify(e)) + setHeader('Error') + setMsg('Ocurrio un error '+e) + setShowMsg(true) + return + }) + }) + .catch((e: Error) => { + setHeader('Error') + setMsg('Ocurrio un error') + setShowMsg(true) + return + }) + } + useEffect(() => { loadReport() }, []) @@ -448,6 +476,19 @@ export default function RptAmazonPayedOpereations( {MasterData.pedimento} + {MasterData.archivoACK==='' ? + +
{ createACKFile(MasterData.referencia) }} + > + + + +
+ + : { @@ -456,6 +497,8 @@ export default function RptAmazonPayedOpereations( > {getOnlyDate(MasterData.fhArchivoACK)} + } + ) diff --git a/src/Components/Clientes/Amazon/Services/Amazon.Services.ts b/src/Components/Clientes/Amazon/Services/Amazon.Services.ts index 300b590..da94b34 100644 --- a/src/Components/Clientes/Amazon/Services/Amazon.Services.ts +++ b/src/Components/Clientes/Amazon/Services/Amazon.Services.ts @@ -163,8 +163,15 @@ class AmazonDataService { }) .catch(function (error) { console.log(error) + return error }) } + CreateACKFile(referencia: string) { + return http.get(`/AmazonInvoice/createACKFile?Referencia=`+referencia) + } + UploadACKFile2Amazon(referencia: string) { + return http.get(`/AmazonInvoice/UploadACKFile2Amazon?Referencia=`+referencia) + } AsignaFacturasReferencia(data: DTO2096LinkInvoice2Reference) { return http.post(`/AmazonInvoice/AsignaFacturasReferencia`, data) } diff --git a/src/Components/Utils/MFileManager/MFileManager.tsx b/src/Components/Utils/MFileManager/MFileManager.tsx index 40eb233..7013488 100644 --- a/src/Components/Utils/MFileManager/MFileManager.tsx +++ b/src/Components/Utils/MFileManager/MFileManager.tsx @@ -106,13 +106,15 @@ export const MFileManager: FC = (props) => { const blob = new Blob([response.data], { type: 'image/png' }) const url = window.URL.createObjectURL(blob) window.open(url) - } else if ( - row.nombreArchivo.toLowerCase().endsWith('.xls') || - row.nombreArchivo.toLowerCase().endsWith('.xlsx') - ) { + } else if (row.nombreArchivo.toLowerCase().endsWith('.xlsx')) { const blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) const url = window.URL.createObjectURL(blob) window.open(url) + } else if ( + row.nombreArchivo.toLowerCase().endsWith('.xls')) { + const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' }) + const url = window.URL.createObjectURL(blob) + window.open(url) } else { const url = window.URL.createObjectURL(new Blob([response.data])) const link = document.createElement('a') diff --git a/src/Services/common/http-common.ts b/src/Services/common/http-common.ts index ac2cd83..4679c04 100644 --- a/src/Services/common/http-common.ts +++ b/src/Services/common/http-common.ts @@ -30,7 +30,7 @@ instance.interceptors.response.use( 409 === error.response.status && error.response.data.respuesta.indexOf('factura') ) { - console.log(JSON.stringify(error.response)) + //console.log(JSON.stringify(error.response)) if (error.response.data.registro.factura) { error.response.data.registro.id === -1 ? alert(