A component is created for querying Alen’s account statements. An indicator is added to the billing department dashboard to access the Alen account statements component. The styling issue with the indicator of operations with charges in dollars in the accounting department dashboard is fixed.

main
Felix Morales 3 months ago
parent 27a1e46ee8
commit ac6a8d1ae6
  1. 11
      src/App.tsx
  2. 9
      src/Components/Dashboard/Dashboard.tsx
  3. 125
      src/Components/Dashboard/DashboardClientes.tsx
  4. 11
      src/Components/Dashboard/DashboardContabilidad.tsx
  5. 34
      src/Components/Dashboard/DashboardFacturacion.tsx
  6. 500
      src/Components/EstadosCuenta/EstadosCuenta.tsx
  7. 26
      src/Components/Login/login.tsx
  8. 3
      src/Components/Logout/logout.tsx
  9. 48
      src/DTO/EstadosCuenta/DTOEstadoCuentaAlen.ts
  10. 10
      src/DTO/EstadosCuenta/DTOEstadosCuentaAlenFilters.ts
  11. 41
      src/Services/EstadosCuenta/EstadosCuentaAlen.Service.ts
  12. 10
      src/Services/Utils/FileManager.Services.ts
  13. 2
      src/index.tsx
  14. 11
      src/store/features/userStatusSlice/userStatusSlice.ts

@ -19,7 +19,8 @@ function App() {
const dispatch = useDispatch()
let _menu: ItemMenu[] = []
const [mainMenu, setMainMenu] = useState(_menu)
const userLogued = useSelector((state: RootState) => state.userStatus.value)
const userLogued = useSelector((state: RootState) => state.userStatus.isLogged)
const isAlenUser = useSelector((state: RootState) => state.userStatus.isAlenUser)
const [show, setShow] = useState(false)
const [msg, setMsg] = useState('')
const [header, setHeader] = useState('')
@ -71,8 +72,12 @@ function App() {
if(Perfil === 'Corresponsales'){
navigate('/RptCorresponsalesTraficos/proc=1/modo=1')
}else if(Perfil === 'Clientes'){
navigate('/Clientes/Traficos')
}else{
if(isAlenUser){
navigate('/')
}else{
navigate('/Clientes/Traficos')
}
} else{
navigate('/')
}
}

@ -3,10 +3,14 @@ import DashboardCorresponsales from './DashboardCorresponsales'
import { DashboardContabilidad } from './DashboardContabilidad'
import { Col, Container, Row } from 'react-bootstrap'
import { DashboardFacturacion } from './DashboardFacturacion'
import DashboardClientes from './DashboardClientes'
import { useSelector } from 'react-redux'
import { RootState } from '../../store/store'
interface IProps {}
export default function Dashboard(props: IProps) {
const isAlenUser = useSelector((state: RootState) => state.userStatus.isAlenUser)
const [Depto, setDepto] = useState(() => {
const stickyValue = window.localStorage.getItem('Departamento')
return stickyValue !== null ? JSON.parse(stickyValue) : 0
@ -35,6 +39,11 @@ export default function Dashboard(props: IProps) {
{[['Direccion', 'Sistemas', 'Facturacion'].includes(Depto) ? <DashboardFacturacion Depto={Depto} Perfil={Perfil}/> : ''].map((item) => {
return <React.Fragment>{item}</React.Fragment>
})}
{[isAlenUser ? <DashboardClientes /> : ''].map(
(item) => {
return <React.Fragment>{item}</React.Fragment>
}
)}
</Row>
</Container>
</div>

@ -0,0 +1,125 @@
import { FC, useEffect, useState } from 'react';
import { Card, Col, Row } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import { IconContext } from 'react-icons';
import { FcSurvey } from 'react-icons/fc';
import { FaCcMastercard } from 'react-icons/fa';
import ClientesServices from '../../Services/Catalogos/Clientes.Services';
import { AxiosError } from 'axios';
import IClientes from '../../Interfaces/Catalogos/IClientes';
import { MsgInformativo } from '../Utils/Toast/msgInformativo';
export default function DashboardClientes() {
const [UserId, setUserId] = useState(() => {
const stickyValue = window.localStorage.getItem('UserId')
return stickyValue !== null ? JSON.parse(stickyValue) : 0
})
//const [ShowEstadosCuenta, setShowEstadosCuenta] = useState(false)
const [show, setShow] = useState(false)
const [msg, setMsg] = useState('')
const [header, setHeader] = useState('')
const [msgColor, setMsgColor] = useState('primary')
//
const [clientes, setClientes] = useState<IClientes[]>([])
/* useEffect(() => {
ClientesServices.getUsuariosAsignados(UserId)
.then(resp => {
setClientes(resp.data)
let cliente = resp.data.filter((x) => x.sClave===1896 && x.agrupado===1)
if(cliente.length > 0){
setShowEstadosCuenta(true)
}
})
.catch((err: AxiosError)=>{
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return
})
}, []) */
return (
<>
<Col>
<Card style={{ width: '18rem' }} className='dashboardComponentFont'>
<Card.Header style={{fontSize:'15.9px'}}>
Clientes
</Card.Header>
<Card.Body style={{ paddingBottom: '50px' }}>
<Card.Title>
Traficos
<br />
<br />
</Card.Title>
<Card.Img variant='top' src='' onClick={() => {}} />
<div style={{ fontSize: '6em' }} className='text-center'>
<FcSurvey />
</div>
</Card.Body>
<Card.Footer>
<Row>
<Col xs={6} style={{ paddingRight: '5px' }}>
{/* <Link
to={`../RptCorresponsalesTraficosHst?proc=0&status=0`}
style={{ textDecoration: 'none', float: 'right', paddingRight: '10px' }}
>
Buscar
</Link> */}
{/* <span style={{ fontWeight: 'bold' }}>Tipo cambio: ${TipoCambio}</span> */}
</Col>
{/* <Col xs={3}></Col> */}
<Col xs={6} style={{ paddingRight: '5px' }}>
<Link
to={`../Clientes/Traficos`}
style={{
textDecoration: 'none',
float: 'right',
paddingRight: '10px',
}}
>
Ver mas...
</Link>
</Col>
</Row>
</Card.Footer>
</Card>
</Col>
<Col>
<Card style={{ width: '18rem' }} className='dashboardComponentFont'>
<Card.Header>Clientes</Card.Header>
<Card.Body style={{ paddingBottom: '50px' }}>
<Card.Title>
Estados de cuenta
<br />
<br />
</Card.Title>
<Card.Img variant='top' src='' onClick={() => {}} />
<div style={{ fontSize: '6em' }} className='text-center'>
<IconContext.Provider value={{ color: 'orange' }}>
<FaCcMastercard />
</IconContext.Provider>
</div>
</Card.Body>
<Card.Footer style={{ paddingRight: '5px' }}>
<Link
to='../Clientes/EstadosCuenta'
style={{ textDecoration: 'none', float: 'right', paddingRight: '10px' }}
>
Ver mas...
</Link>
</Card.Footer>
</Card>
</Col>
<MsgInformativo
show={show}
msg={msg}
header={header}
msgColor={msgColor}
closeToast={function (arg: boolean): void {
setShow(false)
}}
/>
</>
);
};

@ -154,18 +154,17 @@ export const DashboardContabilidad: FC<IProps> = (props) => {
</Card>
</Col>
<Col>
<Card style={{ width: '18rem' }} className='dashboardComponentFont'>
<Card style={{ width: '18rem', maxHeight:'100%', height:'100%' }} className='dashboardComponentFont'>
<Card.Header>Contabilidad </Card.Header>
<Card.Body style={{ paddingBottom: '50px' }}>
<Card.Title>&nbsp;Traficos Con Cargos de Dlls<br/><br/></Card.Title>
<Card.Img variant='top' src='' onClick={() => {}} />
<Card.Body style={{ paddingBottom: '0px' }}>
<Card.Title>&nbsp;Traficos Con Cargos de Dlls<br/></Card.Title>
<div style={{ fontSize: '6em' }} className='text-center'>
<IconContext.Provider value={{ color: '#428d00' }}>
<FcSurvey style={{fontSize:'larger'}}/>
<FaMoneyBillAlt style={{fontSize:'60px', margin:'0 0 0 -4rem', position:"absolute", bottom: '6rem'}}/>
<FaMoneyBillAlt style={{fontSize:'80px', margin:'0 0 0 -3rem', position:"absolute", bottom: '9rem'}}/>
</IconContext.Provider>
{TraficosConCargos}
</div>
<div style={{fontSize:'60px', textAlign:'center'}}>{TraficosConCargos}</div>
</Card.Body>
<Card.Footer style={{ paddingRight: '5px' }}>
<Link

@ -7,7 +7,7 @@ import DashboardFacturacionDataService from '../../Services/Dashboard/Dashboard.
import DashboardContaDataService from '../../Services/Dashboard/Dashboard.Contabilidad.Service'
import { ApexOptions } from 'apexcharts'
import ReactApexChart from 'react-apexcharts'
import { FaReply } from 'react-icons/fa'
import { FaCcMastercard, FaReply } from 'react-icons/fa'
import { FcSurvey } from 'react-icons/fc'
import DashboardCorresponsales from './DashboardCorresponsales'
import { MdTimer } from 'react-icons/md'
@ -164,7 +164,8 @@ export const DashboardFacturacion: FC<IProps> = (props) => {
</Card>
</Col> : ""
}
{props.Perfil === 'Sup. Facturacion' ?
{props.Perfil === 'Sup. Facturacion' || props.Perfil === 'Administrador'?
<>
<Col>
<Card style={{ width: '18rem' }} className='dashboardComponentFont'>
<Card.Header>Facturación </Card.Header>
@ -187,7 +188,34 @@ export const DashboardFacturacion: FC<IProps> = (props) => {
</Link>
</Card.Footer>
</Card>
</Col> : ""
</Col>
<Col>
<Card style={{ width: '18rem' }} className='dashboardComponentFont'>
<Card.Header>Alen</Card.Header>
<Card.Body style={{ paddingBottom: '50px' }}>
<Card.Title>
Estados de cuenta
<br />
<br />
</Card.Title>
<Card.Img variant='top' src='' onClick={() => {}} />
<div style={{ fontSize: '6em' }} className='text-center'>
<IconContext.Provider value={{ color: 'orange' }}>
<FaCcMastercard />
</IconContext.Provider>
</div>
</Card.Body>
<Card.Footer style={{ paddingRight: '5px' }}>
<Link
to='../Clientes/EstadosCuenta'
style={{ textDecoration: 'none', float: 'right', paddingRight: '10px' }}
>
Ver mas...
</Link>
</Card.Footer>
</Card>
</Col>
</> : ""
}
</>
)

@ -0,0 +1,500 @@
import { useEffect, useRef, useState } from "react"
import { Button, Card, Col, Row, Form } from "react-bootstrap"
import ClientesServices from "../../Services/Catalogos/Clientes.Services"
import IClientes from "../../Interfaces/Catalogos/IClientes"
import { AxiosError } from "axios"
import { MsgInformativo } from "../Utils/Toast/msgInformativo"
import { AgGridReact } from "ag-grid-react"
import EstadosCuentaAlenService from "../../Services/EstadosCuenta/EstadosCuentaAlen.Service"
import { DTOEstadoCuentaAlen } from "../../DTO/EstadosCuenta/DTOEstadoCuentaAlen"
import { ColDef, ILargeTextEditorParams } from "ag-grid-community"
import { BsFileEarmarkExcelFill } from "react-icons/bs"
import { DTOEstadoCuentaAlenFilters } from "../../DTO/EstadosCuenta/DTOEstadosCuentaAlenFilters"
import { FaDownload } from "react-icons/fa"
import { IconContext } from "react-icons"
import FileManagerServices from "../../Services/Utils/FileManager.Services"
export const EstadosCuenta:React.FC = () => {
const [Perfil, setPerfil] = useState(() => {
const stickyValue = window.localStorage.getItem('Perfil')
return stickyValue !== null ? JSON.parse(stickyValue) : ''
})
const [Cuentas, setCuentas] = useState<DTOEstadoCuentaAlen[]> ([])
const [show, setShow] = useState(false)
const [msg, setMsg] = useState('')
const [header, setHeader] = useState('')
const [msgColor, setMsgColor] = useState('primary')
const hiddenFileInputRef = useRef<HTMLInputElement>(null);
const [showSpinner, setShowSpinner] = useState(false)
const [File, setFile] = useState<File | null>();
//Estados de los filtros
const [Remitentes, setRemitentes] = useState<string[]>([])
const [Trafico, setTrafico] = useState('')
const [Aduana, setAduana] = useState('')
const [Patente, setPatente] = useState('')
const [Pedimento, setPedimento] = useState('')
const [TipoOperacion, setTipoOperacion] = useState('')
const [Fecha, setFecha] = useState('')
const [Remitente, setRemitente] = useState('')
const [Programado, setProgramado] = useState(0)
//
const [columnDefs] = useState<ColDef[]>([
{
field:'serie', headerName:'Serie',
valueGetter: ({data}:any) => {return data.serie + data.noMovimiento},
width:100,
filter: true
},/* {
field:'noMovimiento', headerName:'Movimiento'
}, */{
field:'fecha', filter: true
},{
field:'trafico', width:150, sortable: true, filter: true
},{
field:'aduana', width:100, filter: true
},{
field:'patente', width:100, filter: true
},{
field:'pedimento', width:120, filter: true
},{
field:'clave', headerName:'Cve. Pedim', width:120, filter: true
},{
field:'impexp', headerName: 'Impo/Expo', width:120, filter: true
},{
field:'noCliente', headerName: 'No. Cte.', width:100, filter: true
},{
field:'nombre', headerName: 'Nombre Cliente', width:300, filter: true
},{
field:'cargos', width:100, filter: true
},{
field:'abonos', width:100, filter: true
},{
field:'saldoFinal', width:120, filter: true
},{
field:'ivaAl', headerName: '% IVA', width:100, filter: true
},{
field:'descripcion', width:300, wrapText:true, autoHeight: true, filter: true
},{
field:'remitente', width:300, wrapText:true, autoHeight: true, filter: true
},{
field:'pedido', width:300, wrapText:true, autoHeight: true, filter: true
},{
field:'ordenCompra', editable: true, filter: true, wrapText: true, autoHeight:true
}
,{
field:'tipoMercancia', headerName: 'Tipo Mcia', filter: true
},
{
field:'idPdf', headerName: 'PDF',
cellRenderer: ({data}:any)=>{
return (
<IconContext.Provider value={{color: 'blue', size:'20px'}}>
<FaDownload style={{cursor:'pointer'}} onClick={() => {
if(data.trafico[data.trafico.length-1].toUpperCase() === 'C')
getCorresponsaliasFile(data.idPdf, 37, data.pdf)
else
getAEO(data.serie, data.noMovimiento, 'pdf', data.trafico);
}
}/>
</IconContext.Provider>
)
}
},
{
field:'idXml', headerName: 'XML',
cellRenderer: ({data}:any)=>{
return (
<IconContext.Provider value={{color: 'blue', size:'20px'}}>
<FaDownload style={{cursor:'pointer'}} onClick={() => {
if(data.trafico[data.trafico.length-1].toUpperCase() === 'C')
getCorresponsaliasFile(data.idXml, 38, data.xml)
else
getAEO(data.serie, data.noMovimiento, 'xml', data.trafico);
}
}/>
</IconContext.Provider>
)
}
},
{
field: "observaciones",
editable:true,
filter: true,
wrapText: true,
cellEditor: "agLargeTextCellEditor",
cellEditorPopup: true,
cellEditorParams: {
rows: 5,
maxLength: 1000
} as ILargeTextEditorParams,
autoHeight:true
},
/* {
field:'idNotasCargo', headerName: 'Notas de Cargo',
cellRenderer: ({data}:any)=>{
return (
data.idNotasCargo !== 0 ?
<IconContext.Provider value={{color: 'blue', size:'20px'}}>
<FaDownload style={{cursor:'pointer'}} onClick={() => {
if(data.trafico[data.trafico.length-1].toUpperCase() === 'C')
getCorresponsaliasFile(data.idNotasCargo, 41, data.notasCargo)
/* else
getAEO(data.serie, data.noMovimiento);
}
}/>
</IconContext.Provider> : ''
)
}
}, */
])
useEffect(() => {
getCuentas();
},[])
function currentDate(days: number): string {
var today = new Date()
today.setDate(today.getDate() + days)
var dd = String(today.getDate()).padStart(2, '0')
var mm = String(today.getMonth() + 1).padStart(2, '0')
var yyyy = today.getFullYear()
return yyyy + '-' + mm + '-' + dd
}
const uploadFile = (file: File) => {
setShowSpinner(true)
const formData = new FormData()
formData.append('name', file.name)
formData.append('file', file)
if(Perfil === 'Administrador'){
EstadosCuentaAlenService.Append(formData)
.then((res) => {
hiddenFileInputRef.current!.value = ''
setCuentas(res.data)
setShowSpinner(false)
})
.catch((err: AxiosError) => {
setShowSpinner(false)
hiddenFileInputRef.current!.value = ''
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return
})
}
if(['Facturacion', 'Sup. Facturacion'].includes(Perfil)){
EstadosCuentaAlenService.AppendProgramacionesPago(formData)
.then((res) => {
hiddenFileInputRef.current!.value = ''
setCuentas(res.data)
setShowSpinner(false)
})
.catch((err: AxiosError) => {
setShowSpinner(false)
hiddenFileInputRef.current!.value = ''
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return
})
}
}
const getCuentas = () => {
var filters: DTOEstadoCuentaAlenFilters = {
Trafico: Trafico,
Impexp: TipoOperacion,
Aduana: Aduana,
Patente: Patente,
Pedimento: Pedimento,
Fecha: Fecha,
Remitente: Remitente,
Programado: Programado
}
EstadosCuentaAlenService.GetAll(filters)
.then(resp => {
setCuentas(resp.data)
if(resp.data.length === 0){
setShow(true)
setMsg("No se encontraron registros")
setHeader('Informativo')
return;
}
if(Remitentes.length === 0){
let remitentes = resp.data.map((x:any) => {
if(x.remitente==='' || x.remitente===null) x.remitente = 'SIN REMITENTE'
return x.remitente
})
setRemitentes(remitentes.filter(function(elem, index, self) {
return index === self.indexOf(elem);
}).sort((a,b) => (a < b ? -1 : 1)))
}
})
.catch((err: AxiosError) => {
setShowSpinner(false)
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return
})
}
const selectFile = () => {
hiddenFileInputRef.current?.click()
}
const downloadEstadosCuenta = () => {
EstadosCuentaAlenService.ExportEstadosCuenta(Cuentas)
.then((resp:any) => {
const url = window.URL.createObjectURL(new Blob([resp.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', "EstadosDeCuenta.xlsx")
document.body.appendChild(link)
link.click()
}).catch((err:AxiosError) => {
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return;
})
}
const getRowStyle = (params: any) => {
var styles = {
backgroundColor:'',
border: '0.5px solid #aaaaaa',
}
/* if (params.data.programado === 1) {
styles.backgroundColor = 'rgb(98, 190, 255, 0.5)';
} */
if(params.data.programado === true){
styles.backgroundColor = "rgb(255, 193, 7, 0.5)";
}
return styles;
};
const getCorresponsaliasFile = (id:number, proceso: number, fileName: string) => {
FileManagerServices.getFileContent(id, proceso)
.then((resp: any) => {
const url = window.URL.createObjectURL(new Blob([resp.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', fileName)
document.body.appendChild(link)
link.click()
}).catch((err:AxiosError) => {
setShow(true)
setMsg("No se encontró el archivo solicitado")
setHeader('Error')
return;
})
}
const getAEO = (serie: string, noMovimiento: string, mime: string, trafico: string) => {
FileManagerServices.getAEO(serie, noMovimiento, mime, trafico)
.then((resp: any) => {
const url = window.URL.createObjectURL(new Blob([resp.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', `EstadoCuenta_${serie}${noMovimiento}.${mime}`)
document.body.appendChild(link)
link.click()
}).catch((err:AxiosError) => {
setShow(true)
setMsg("No se encontró el archivo solicitado")
setHeader('Error')
return;
})
}
const onCellValueChanged = (event: any) => {
var data: DTOEstadoCuentaAlen = event.data;
let ColDef = event.colDef;
if(ColDef.field === 'ordenCompra'){
EstadosCuentaAlenService.AppendOrdenCompra(data)
.then(() => getCuentas())
.catch((err:AxiosError) => {
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return;
})
}
if(ColDef.field === 'observaciones'){
EstadosCuentaAlenService.AppendObservaciones(data)
.then(() => getCuentas())
.catch((err:AxiosError) => {
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return;
})
}
}
return (
<div>
<Card>
<Card.Body>
<Row>
<Col xs={2}>
<Form.Label style={{width:'100%'}}>
Trafico
<Form.Control
size="sm"
type="text"
value={Trafico}
onChange={(e) => setTrafico(e.target.value)}
>
</Form.Control>
</Form.Label>
</Col>
<Col xs={1}>
<Form.Label style={{width:'100%'}}>
Aduana
<Form.Control
size="sm"
type="text"
value={Aduana}
onChange={(e) => setAduana(e.target.value)}
>
</Form.Control>
</Form.Label>
</Col>
<Col xs={1}>
<Form.Label style={{width:'100%'}}>
Patente
<Form.Control
size="sm"
type="text"
value={Patente}
onChange={(e) => setPatente(e.target.value)}
>
</Form.Control>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label style={{width:'100%'}}>
Pedimento
<Form.Control
size="sm"
type="text"
value={Pedimento}
onChange={(e) => setPedimento(e.target.value)}
>
</Form.Control>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label style={{width:'100%'}}>
Fecha
<Form.Control
defaultValue={Fecha}
type='date'
name='Fecha'
placeholder='Fecha'
title='Fecha'
alt='Fecha'
onChange={(e) => setFecha(e.target.value)}
size='sm'
/>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label style={{width:'100%'}}>
Remitente
<Form.Control
as='select'
value={Remitente!}
onChange={(e) => {
setRemitente(e.target.value)
}}
className='form-select form-select-sm'
>
<option value={''}>- SELECCIONE -</option>
{Remitentes.map((r) => {
return (
<option key={r} value={r}>{r}</option>
)
})}
</Form.Control>
</Form.Label>
</Col>
<Col xs={2}>
<Form.Label style={{width:'100%'}}>
Tipo Operacion
<Form.Control
as='select'
value={TipoOperacion!}
onChange={(e) => {
setTipoOperacion(e.target.value)
}}
className='form-select form-select-sm'
>
<option value={''} key={'0'}>- SELECCIONE -</option>
<option value={'I'} key={'I'}>IMPORTACION</option>
<option value={'E'} key={'E'}>EXPORTACION</option>
</Form.Control>
</Form.Label>
</Col>
</Row>
<Row className="justify-content-between justify-items-end">
<Col xs={2}>
<Form.Label style={{width:'100%'}}>
Estado
<Form.Control
as='select'
value={Programado!}
onChange={(e) => {
setProgramado(+e.target.value)
}}
className='form-select form-select-sm'
>
<option value={0} key={0}>- SELECCIONE -</option>
<option value={1} key={1}>EN PLATAFORMA</option>
<option value={2} key={2}>NO EN PLATAFORMA</option>
</Form.Control>
</Form.Label>
</Col>
<Col xs={4} className="d-flex align-items-end">
<div style={{textAlign:'end', width:'100%'}}>
<Button variant='primary' onClick={() => getCuentas()} style={{marginRight:'10px'}}>Buscar</Button>
{['Administrador', 'Facturacion', 'Sup. Facturacion'].includes(Perfil) ? <Button variant='primary' onClick={() => {selectFile()}} style={{marginRight:'10px'}}>Cargar Estados</Button> : ''}
<Button variant='success' onClick={() => {downloadEstadosCuenta()}} style={{marginRight:'10px'}}><BsFileEarmarkExcelFill/> Excel</Button>
<input type="file" ref={hiddenFileInputRef} style={{display:'none'}}
onChange={(e:any) => {
uploadFile(e.target.files[0]);
setFile(e.target.files[0]);
}}
/>
</div>
</Col>
</Row>
</Card.Body>
</Card>
<br />
<div className='ag-theme-alpine' style={{ height: 500, width: '100%' }}>
<AgGridReact
rowData={Cuentas}
columnDefs={columnDefs}
pagination={true}
paginationAutoPageSize={true}
//ref={gridRef}
/* rowSelection={'multiple'}
rowMultiSelectWithClick={true} */
getRowStyle={getRowStyle}
onCellValueChanged={onCellValueChanged}
></AgGridReact>
</div>
<MsgInformativo
show={show}
msg={msg}
header={header}
msgColor={msgColor}
closeToast={function (arg: boolean): void {
setShow(false)
}}
/>
</div>
)
}

@ -1,7 +1,7 @@
import * as React from 'react'
import { useNavigate } from 'react-router-dom'
import { useSelector, useDispatch } from 'react-redux'
import { logued } from '../../store/features/userStatusSlice/userStatusSlice'
import { IsAlenUser, logued } from '../../store/features/userStatusSlice/userStatusSlice'
import ILogin from '../../Interfaces/Ilogin'
import ItemMenu from '../../Interfaces/Catalogos/IItemMenu'
import '../../css/login.css'
@ -17,13 +17,14 @@ import AuthDS from '../../Services/Auth/Auth.Service'
import UserDS from '../../Services/Catalogos/Usuarios.Services'
import { useEffect } from 'react'
import Info from '../../../package.json'
import ClientesServices from '../../Services/Catalogos/Clientes.Services'
export const Login: React.FC<{}> = () => {
const dispatch = useDispatch()
const navigate = useNavigate()
let _menu: ItemMenu[] = []
const [mainMenu, setMainMenu] = React.useState(_menu)
const userLogued = useSelector((state: RootState) => state.userStatus.value)
const userLogued = useSelector((state: RootState) => state.userStatus.isLogged)
const [show, setShow] = React.useState(false)
const [Usuario, setUsuario] = React.useState('')
const [Contrasenia, setContrasenia] = React.useState('')
@ -59,7 +60,7 @@ export const Login: React.FC<{}> = () => {
if(values.Perfil === 'Corresponsales'){
navigate('/RptCorresponsalesTraficos/proc=1/modo=1')
}else if(values.Perfil === 'Clientes'){
navigate('/Clientes/Traficos')
checkForAlenUser(values.UserId)
}else{
navigate('/')
}
@ -105,6 +106,25 @@ export const Login: React.FC<{}> = () => {
})
}, [dispatch, navigate])
const checkForAlenUser = (UserId: number) => {
ClientesServices.getUsuariosAsignados(UserId)
.then(resp => {
let cliente = resp.data.filter((x) => x.sClave===1896 && x.agrupado===1)
if(cliente.length > 0){
dispatch(IsAlenUser(true))
navigate('/')
}else{
navigate('/Clientes/Traficos')
}
})
.catch((err: AxiosError)=>{
setShow(true)
setMsg(err.request.responseText)
setHeader('Error')
return
})
}
return (
<div>
{!userLogued ? (

@ -1,7 +1,7 @@
import { FC, useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { useDispatch } from 'react-redux'
import { logued } from '../../store/features/userStatusSlice/userStatusSlice'
import { IsAlenUser, logued } from '../../store/features/userStatusSlice/userStatusSlice'
interface IProps {}
@ -12,6 +12,7 @@ const Logout: FC<IProps> = (props) => {
useEffect(() => {
window.localStorage.clear()
dispatch(logued(false))
dispatch(IsAlenUser(false))
navigate('/')
})

@ -0,0 +1,48 @@
export interface DTOEstadoCuentaAlen{
id: number,
tipoMovimiento: string
noSerie: string
noMovimiento: string
trafico: string
impexp: string
aduana: string
patente: string
pedimento: string
clave: string
noCliente: string
noCentro: string
subCentro: string
nombre: string
subCtaNombre: string
tipoRangos: string
cargos: string
abonos: string
fecha: string
fechaPedimento: string
fechaRev: string
diasPedimCta: string
diasCtaRev: string
diasRev: string
ivaAl: string
totalFacturado: string
saldoFinal: string
anticipo: string
uuid: string
descripcion: string
remitente: string
pedido: string
tipoMercancia: string
campoAdicional5: string
idPdf:number
pdf: string
idXml:number
xml: number
idNotasCargo: number
notasCargo: string
programado: boolean
serie: string
idOrdenCompra: number
ordenCompra: string
idObservaciones: number
observaciones: string
}

@ -0,0 +1,10 @@
export interface DTOEstadoCuentaAlenFilters{
Trafico: string,
Impexp: string,
Aduana: string,
Patente: string,
Pedimento: string,
Fecha: string,
Remitente: string,
Programado: number
}

@ -0,0 +1,41 @@
import { DTOEstadoCuentaAlen } from "../../DTO/EstadosCuenta/DTOEstadoCuentaAlen";
import { DTOEstadoCuentaAlenFilters } from "../../DTO/EstadosCuenta/DTOEstadosCuentaAlenFilters";
import http from "../common/http-common";
class EstadosCuentaAlenService {
Append(formData: FormData){
return http.post<DTOEstadoCuentaAlen[]>(`ReporteEstadosCuentaAlen/Append`,formData,{
headers:{
"Content-Type":'multipart/form-data'
}
})
}
AppendOrdenCompra(data:DTOEstadoCuentaAlen){
return http.post<DTOEstadoCuentaAlen[]>(`ReporteEstadosCuentaAlen/AppendOrdenCompra`,data)
}
AppendObservaciones(data:DTOEstadoCuentaAlen){
return http.post<DTOEstadoCuentaAlen[]>(`ReporteEstadosCuentaAlen/AppendObservaciones`,data)
}
AppendProgramacionesPago(formData: FormData){
return http.post<DTOEstadoCuentaAlen[]>(`ReporteEstadosCuentaAlen/AppendProgramacionesPago`,formData,{
headers:{
"Content-Type":'multipart/form-data'
}
})
}
GetAll(filters: DTOEstadoCuentaAlenFilters){
return http.get<DTOEstadoCuentaAlen[]>(`ReporteEstadosCuentaAlen/GetAll`, {
params:filters
})
}
ExportEstadosCuenta(cuentas: DTOEstadoCuentaAlen[]){
return http.post(`ReporteEstadosCuentaAlen/Export`, cuentas, {responseType: 'arraybuffer'})
}
}
export default new EstadosCuentaAlenService();

@ -43,5 +43,15 @@ class FileManagerDataService {
getFileListByreferencia(referencia: string) {
return http.get<IFileManager[]>(`/FileManager/FileListByReferencia?Referencia=${referencia}`)
}
getAEO(serie: string, noMovimiento: string, mime: string, trafico: string) {
return http.get(`/FileManager/GetAEO?serie=${serie}&noMovimiento=${noMovimiento}&fileMime=${mime}&trafico=${trafico}`, {responseType: 'arraybuffer'})
.then(function (response) {
return response
})
.catch(function (error) {
console.log(error)
})
}
}
export default new FileManagerDataService();

@ -31,6 +31,7 @@ import { RelacionFacturas } from './Components/ReportesClientes/Alen/RelacionFac
import { ReporteFacturasConsolidados } from './Components/ReportesClientes/Alen/ReporteFacturasConsolidados'
import { CuentasCerradas } from './Components/ReportesClientes/CuentasCerradas.tsx/CuentasCerradas'
import { ReporteArchivoElectronico } from './Components/ReportesClientes/ReporteArchivoElectronico'
import { EstadosCuenta } from './Components/EstadosCuenta/EstadosCuenta'
require (`./css/${process.env.REACT_APP_ENVIRONMENT}-home.css`)
function PageNotFound() {
@ -102,6 +103,7 @@ root.render(
</Route>
</Route>
<Route path='/Clientes/Traficos/' element={<RptClientesTraficos/>}/>
<Route path='/Clientes/EstadosCuenta/' element={<EstadosCuenta/>}/>
</Route>
</Route>
</Routes>

@ -2,7 +2,8 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import type { RootState } from '../../store'
const initialState = {
value: false
isLogged: false,
isAlenUser: false,
}
export const userStatusSlice = createSlice({
@ -10,11 +11,15 @@ export const userStatusSlice = createSlice({
initialState,
reducers: {
logued: (state, action: PayloadAction<boolean>) => {
state.value = action.payload;
state.isLogged = action.payload;
},
IsAlenUser: (state, action: PayloadAction<boolean>) => {
state.isAlenUser = action.payload;
}
},
})
export const { logued } = userStatusSlice.actions;
export const selectuserStatus = (state: RootState) => state.userStatus.value
export const { IsAlenUser } = userStatusSlice.actions;
//export const selectuserStatus = (state: RootState) => state.userStatus.value
export default userStatusSlice.reducer;

Loading…
Cancel
Save