Primer version funcional del reporte de Amazon

AmazonRelease1.1
unknown 2 years ago
parent e72f805d4a
commit 4a112b8c14
  1. 140
      src/Components/Clientes/Amazon/Components/ComboSelect/ComboSelect.tsx
  2. 3
      src/Components/Clientes/Amazon/Components/TextBoxFraccion/TextBoxFraccion.tsx
  3. 4
      src/Components/Clientes/Amazon/DTO/DTO2096Fraccion.ts
  4. 35
      src/Components/Clientes/Amazon/Interfaces/I2096Detail.ts
  5. 1
      src/Components/Clientes/Amazon/Interfaces/I2096Header.ts
  6. 104
      src/Components/Clientes/Amazon/Reportes/RptAmazonPendingInvoices.tsx
  7. 9
      src/Components/Clientes/Amazon/Services/Amazon.Services.ts

@ -1,19 +1,137 @@
import * as React from 'react'; import * as React from 'react'
import { Form } from 'react-bootstrap'; import { useState } from 'react'
import { Button, Col, Form, Modal, Row } from 'react-bootstrap'
import * as CurrencyFormat from 'react-currency-format'
import { MsgInformativo } from '../../../../Utils/Toast/msgInformativo'
import DTO2096Fraccion from '../../DTO/DTO2096Fraccion'
import DSAmazon from '../../Services/Amazon.Services'
export interface IComboSelectProps { export interface IComboSelectProps {
IDDetail: number
FraccionOriginal: string
} }
export function ComboSelect (props: IComboSelectProps) { export function ComboSelect(props: IComboSelectProps) {
const [Validacion, setValidacion] = useState(0)
const [showModal, setShowModal] = useState(false)
const [Fraccion, setFraccion] = useState('')
const [header, setHeader] = useState('')
const [show, setShowMsg] = useState(false)
const [msg, setMsg] = useState('')
const msgColor = 'primary'
const changeValidacion = (e: number) => {
setValidacion(e)
if (e === 2) {
setShowModal(true)
}
if (e === 1) {
const data: DTO2096Fraccion = {
id: props.IDDetail,
fraccion: props.FraccionOriginal
}
DSAmazon.SetFraccion(data)
.then((response) => {
alert('Se guardo correctamente la fraccion GEMCO')
})
.catch((e: Error) => {
alert('Ocurrio un error' + e.message.toString())
})
}
}
const saveFraccion = () => {
DSAmazon.GetValidaFraccion(Fraccion)
.then((response) => {
if (response.data.respuesta === 'Si') {
const data: DTO2096Fraccion = {
id: props.IDDetail,
fraccion: Fraccion
}
DSAmazon.SetFraccion(data)
.then((response) => {
alert('Se guardo correctamente la fraccion GEMCO')
})
.catch((e: Error) => {
alert('Ocurrio un error' + e.message.toString())
})
} else {
alert(
'Esa fraccion no existe, favor de verificarla antes de poder guardar...'
)
return
}
})
.catch((e: Error) => {
alert('Ocurrio un error' + e.message.toString())
})
}
return ( return (
<div> <div>
<Form.Group> <Form.Control
<Form.Select> as="select"
<option value=''> </option> className="form-select form-select-sm"
<option value='1'> = </option> onChange={(e) => changeValidacion(parseInt(e.target.value))}
<option value='2'> != </option> value={Validacion}
</Form.Select> >
</Form.Group> <option value="0"> </option>
<option value="1"> = </option>
<option value="2"> != </option>
</Form.Control>
<Modal
show={showModal}
onHide={() => {
setShowModal(false)
}}
size={'sm'}
dialogClassName={'modal-50w'}
>
<Modal.Body>
<Row>
<Col xs={2}></Col>
<Col xs={4}>Proporcione la facccion GEMCO</Col>
<Col xs={3}>
<CurrencyFormat
onValueChange={(values: any) => {
const { value } = values
setFraccion(value)
}}
format={'######## ##'}
value={Fraccion}
displayType={'input'}
style={{
fontSize: '18px',
backgroundColor: '#F1EEF9',
border: '2px solid #5923F6',
color: '#5923F6',
width: '120px',
textAlign: 'right',
borderRadius: '10px'
}}
/>
</Col>
<Col xs={3}>
<Button
onClick={() => {
saveFraccion()
}}
>
Guardar
</Button>
</Col>
</Row>
</Modal.Body>
</Modal>
<MsgInformativo
show={show}
msg={msg}
header={header}
msgColor={msgColor}
closeToast={() => {
setShowMsg(false)
}}
/>
</div> </div>
); )
} }

@ -12,13 +12,14 @@ export function TextBoxFraccion(props: ITextBoxFraccionProps) {
<CurrencyFormat <CurrencyFormat
value={Fraccion} value={Fraccion}
disabled={true} disabled={true}
format={'######## ##'}
displayType={'input'} displayType={'input'}
style={{ style={{
fontSize: '18px', fontSize: '18px',
backgroundColor: '#F1EEF9', backgroundColor: '#F1EEF9',
border: '2px solid #5923F6', border: '2px solid #5923F6',
color: '#5923F6', color: '#5923F6',
width: '70px', width: '115px',
textAlign: 'right', textAlign: 'right',
borderRadius: '10px' borderRadius: '10px'
}} }}

@ -0,0 +1,4 @@
export default interface DTO2096Fraccion {
id: number,
fraccion: string
}

@ -0,0 +1,35 @@
export default interface I2096Detail {
id: number
idHeader: number
invoiceNumber: string
amazonShipmentReferenceId: string
trailerId: string
itemId: string
itemIdType: string
itemDescription: string
pedimentoDescription: string
destinationHTSCode: string
validaFraccionOriginal: number
fraccionGEMCO: string
sourceHTSCode: string
eccn: string
licEx: string
countryOfOrigin: string
productGroup: string
upc: string
brand: string
model: string
itemQuantityUnitOfMeasure: string
quantity: number
netWeightUnitOfMeasure: string
weightValue: string
actualUnitCostChargeOrAllowance: string
actualUnitCostCurrencyISOCode: string
actualUnitCostMonetaryAmount: string
totalUnitValueChargeOrAllowance: string
totalUnitValueCurrencyISOCode: string
totalUnitValueMonetaryAmount: string
archivo: string
fCreacion: string
estatus: number
}

@ -35,6 +35,7 @@ interface Detail {
itemDescription: string itemDescription: string
pedimentoDescription: string pedimentoDescription: string
destinationHTSCode: string destinationHTSCode: string
validaFraccionOriginal: number
fraccionGEMCO: string fraccionGEMCO: string
sourceHTSCode: string sourceHTSCode: string
eccn: string eccn: string

@ -2,7 +2,11 @@ import * as React from 'react'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { Button, Card, Col, Form, Row, Table } from 'react-bootstrap' import { Button, Card, Col, Form, Row, Table } from 'react-bootstrap'
import { IconContext } from 'react-icons' import { IconContext } from 'react-icons'
import { AiTwotoneQuestionCircle } from 'react-icons/ai'
import { BsChevronDown, BsChevronRight, BsSearch } from 'react-icons/bs' import { BsChevronDown, BsChevronRight, BsSearch } from 'react-icons/bs'
import { FaCheckCircle, FaQuestionCircle, FaWindowClose } from 'react-icons/fa'
import { FcQuestions } from 'react-icons/fc'
import { ImCross } from "react-icons/im";
import { ComboSelect } from '../Components/ComboSelect/ComboSelect' import { ComboSelect } from '../Components/ComboSelect/ComboSelect'
import { TextBoxFraccion } from '../Components/TextBoxFraccion/TextBoxFraccion' import { TextBoxFraccion } from '../Components/TextBoxFraccion/TextBoxFraccion'
import I2096Headers from '../Interfaces/I2096Header' import I2096Headers from '../Interfaces/I2096Header'
@ -75,7 +79,7 @@ export default function RtpAmazonPendingInvoices(
} }
const openLink = (item: string) => { const openLink = (item: string) => {
window.open("https://www.amazon.com/dp/"+item); window.open('https://www.amazon.com/dp/' + item)
} }
return ( return (
@ -157,7 +161,7 @@ export default function RtpAmazonPendingInvoices(
<th>Port of entry</th> <th>Port of entry</th>
<th>Payments Terms</th> <th>Payments Terms</th>
<th style={{ width: '100px' }}>Incoterms</th> <th style={{ width: '100px' }}>Incoterms</th>
<th style={{textAlign:'center'}}>HAWB</th> <th style={{ textAlign: 'center' }}>HAWB</th>
<th>Qty Unit of measure</th> <th>Qty Unit of measure</th>
<th>Tot Qty</th> <th>Tot Qty</th>
<th>Weight unit of measure</th> <th>Weight unit of measure</th>
@ -237,12 +241,18 @@ export default function RtpAmazonPendingInvoices(
<td style={{ textAlign: 'center' }}> <td style={{ textAlign: 'center' }}>
{MasterData.totalInvoiceQuantityUnitOfMeasure} {MasterData.totalInvoiceQuantityUnitOfMeasure}
</td> </td>
<td style={{ textAlign: 'center' }}>{MasterData.totalInvoiceQuantity}</td> <td style={{ textAlign: 'center' }}>
{MasterData.totalInvoiceQuantity}
</td>
<td style={{ textAlign: 'center' }}> <td style={{ textAlign: 'center' }}>
{MasterData.totalInvoiceWeightUnitOfMeasure} {MasterData.totalInvoiceWeightUnitOfMeasure}
</td> </td>
<td style={{ textAlign: 'center' }}>{MasterData.totalInvoiceWeight}</td> <td style={{ textAlign: 'center' }}>
<td style={{ textAlign: 'center' }}>{MasterData.totalInvoiceValueChargeOrAllowance}</td> {MasterData.totalInvoiceWeight}
</td>
<td style={{ textAlign: 'center' }}>
{MasterData.totalInvoiceValueChargeOrAllowance}
</td>
<td style={{ textAlign: 'center' }}> <td style={{ textAlign: 'center' }}>
{MasterData.totalInvoiceValueCurrencyISOCode} {MasterData.totalInvoiceValueCurrencyISOCode}
</td> </td>
@ -309,6 +319,16 @@ export default function RtpAmazonPendingInvoices(
> >
Destination HTS Code Destination HTS Code
</th> </th>
<th
style={{
width: '120px',
backgroundColor: '#D3E0EA',
color: '#346288',
textAlign: 'center'
}}
>
Valida
</th>
<th <th
style={{ style={{
width: '120px', width: '120px',
@ -318,7 +338,7 @@ export default function RtpAmazonPendingInvoices(
}} }}
> >
Confirme Confirme
</th> </th>
<th <th
style={{ style={{
width: '120px', width: '120px',
@ -328,7 +348,7 @@ export default function RtpAmazonPendingInvoices(
}} }}
> >
Fraccion GEMCO Fraccion GEMCO
</th> </th>
<th <th
style={{ style={{
width: '70px', width: '70px',
@ -437,10 +457,13 @@ export default function RtpAmazonPendingInvoices(
</th> </th>
<td <td
style={{ style={{
textAlign: 'center', cursor: 'pointer' textAlign: 'center',
cursor: 'pointer'
}} }}
className="DetailData" className="DetailData"
onClick={()=>openLink(detail.itemId)} onClick={() =>
openLink(detail.itemId)
}
> >
{detail.itemId} {detail.itemId}
</td> </td>
@ -476,7 +499,44 @@ export default function RtpAmazonPendingInvoices(
}} }}
className="DetailData" className="DetailData"
> >
<ComboSelect/> {detail.validaFraccionOriginal ===
0 ? (
<IconContext.Provider
value={{
color: 'orange',
size: '20px'
}}
>
<FaQuestionCircle />
</IconContext.Provider>
) : detail.validaFraccionOriginal ===
1 ? (
<IconContext.Provider
value={{
color: 'green',
size: '20px'
}}
>
<FaCheckCircle />
</IconContext.Provider>
) : (
<IconContext.Provider
value={{
color: 'red',
size: '20px'
}}
>
<ImCross />
</IconContext.Provider>
)}
</td>
<td
style={{
textAlign: 'center'
}}
className="DetailData"
>
<ComboSelect IDDetail={detail.id} FraccionOriginal={detail.destinationHTSCode}/>
</td> </td>
<td <td
style={{ style={{
@ -484,7 +544,13 @@ export default function RtpAmazonPendingInvoices(
}} }}
className="DetailData" className="DetailData"
> >
<TextBoxFraccion Fraccion={detail.fraccionGEMCO ? detail.fraccionGEMCO : ''}/> <TextBoxFraccion
Fraccion={
detail.fraccionGEMCO
? detail.fraccionGEMCO
: ''
}
/>
</td> </td>
<td <td
style={{ style={{
@ -524,7 +590,9 @@ export default function RtpAmazonPendingInvoices(
}} }}
className="DetailData" className="DetailData"
> >
{detail.itemQuantityUnitOfMeasure} {
detail.itemQuantityUnitOfMeasure
}
</td> </td>
<td <td
style={{ style={{
@ -540,7 +608,9 @@ export default function RtpAmazonPendingInvoices(
}} }}
className="DetailData" className="DetailData"
> >
{detail.netWeightUnitOfMeasure} {
detail.netWeightUnitOfMeasure
}
</td> </td>
<td <td
style={{ style={{
@ -548,7 +618,9 @@ export default function RtpAmazonPendingInvoices(
}} }}
className="DetailData" className="DetailData"
> >
{detail.actualUnitCostMonetaryAmount} {
detail.actualUnitCostMonetaryAmount
}
</td> </td>
<td <td
style={{ style={{
@ -556,7 +628,9 @@ export default function RtpAmazonPendingInvoices(
}} }}
className="DetailData" className="DetailData"
> >
{detail.totalUnitValueMonetaryAmount} {
detail.totalUnitValueMonetaryAmount
}
</td> </td>
</tr> </tr>
) )

@ -1,9 +1,18 @@
import http from '../../../../Services/common/http-common' import http from '../../../../Services/common/http-common'
import I2096Headers from '../Interfaces/I2096Header' import I2096Headers from '../Interfaces/I2096Header'
import IRespuesta from '../../../../Interfaces/IRespuesta'
import DTO2096Fraccion from '../DTO/DTO2096Fraccion'
import I2096Detail from '../Interfaces/I2096Detail'
class AmazonDataService { class AmazonDataService {
GetPendingInvoice() { GetPendingInvoice() {
return http.get<I2096Headers[]>(`/AmazonInvoice/C2096PendingInvoiceGet`) return http.get<I2096Headers[]>(`/AmazonInvoice/C2096PendingInvoiceGet`)
} }
GetValidaFraccion(Fraccion: string) {
return http.get<IRespuesta>(`/AmazonInvoice/C2096ValidaFraccion?Fraccion=${Fraccion}`)
}
SetFraccion(data: DTO2096Fraccion) {
return http.post<I2096Detail>(`/AmazonInvoice/C2096FraccionSet`, data)
}
} }
export default new AmazonDataService() export default new AmazonDataService()

Loading…
Cancel
Save