Sele agrega al reporte la facultad de filtrar por fechas y en el search a nivel header y detail

AmazonRelease1.1
unknown 2 years ago
parent a1883a025c
commit 5258397b2f
  1. 7
      src/Components/Clientes/CasaCuervo/Reportes/RptPedidos.tsx
  2. 4
      src/Components/Clientes/Heineken/Services/Heineken.Services.ts
  3. 117
      src/Components/Reportes/RptFacturasTxtHeineken.tsx

@ -335,7 +335,12 @@ export const RptPedidos: FC<IProps> = (props) => {
row.estatus.includes(e.target.value) ||
row.comentarioGEMCO.includes(e.target.value) ||
row.fechaCompromiso.includes(e.target.value) ||
row.fechaCruce.includes(e.target.value)
row.fechaCruce.includes(e.target.value) ||
row.factura.includes(e.target.value) ||
row.uuid.includes(e.target.value) ||
row.trafico.includes(e.target.value) ||
row.pedimento.includes(e.target.value) ||
row.patente.includes(e.target.value)
)
})
)

@ -26,8 +26,8 @@ class C1868HeinekenDataService {
console.log(error)
})
}
GetFacturasTxt() {
return http.get<I2206FacturasTxt[]>(`/C2206Reportes/Rpt2206FacturasTxt`);
GetFacturasTxt(Inicio: string, Fin: string) {
return http.get<I2206FacturasTxt[]>(`/C2206Reportes/Rpt2206FacturasTxt?Inicio=${Inicio}&Fin=${Fin}`);
}
}
export default new C1868HeinekenDataService();

@ -17,6 +17,7 @@ import {
BsChevronRight,
BsFillPencilFill,
BsPaperclip,
BsSearch,
BsXLg
} from 'react-icons/bs'
import { HiOutlineRefresh } from 'react-icons/hi'
@ -38,6 +39,10 @@ export const RptFacturasTxtHeineken: FC<IProps> = (props) => {
const [ShowDeleteDialog, setShowDeleteDialog] = useState(false)
const [ShowDocumentsDialog, setShowDocumentsDialog] = useState(false)
const [Data, setData] = useState<I2206FacturasTxt[]>([])
const [DataOriginal, setDataOriginal] = useState<I2206FacturasTxt[]>([])
const [Inicio, setInicio] = useState(currentDate(0))
const [Fin, setFin] = useState(currentDate(0))
const [filtro, setFiltro] = useState('')
const [IDViaje, setIDViaje] = useState(0)
const [IDCliente, setIDCliente] = useState(0)
const [SCliente, setSCliente] = useState('')
@ -45,15 +50,21 @@ export const RptFacturasTxtHeineken: FC<IProps> = (props) => {
const [IDUsuario, setIDUsuario] = useState(0)
const [toggle, setToggle] = useState(false)
const loadEveryting = () => {
loadReport()
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 loadReport = () => {
DSHeineken.GetFacturasTxt()
const loadReport = (Inicio: string, Fin: string) => {
DSHeineken.GetFacturasTxt(Inicio, Fin)
.then((response) => {
console.log(response.data)
setData(response.data)
setDataOriginal(response.data)
})
.catch((e: Error) => {
alert('Ocurrio un error' + e.message.toString())
@ -61,7 +72,7 @@ export const RptFacturasTxtHeineken: FC<IProps> = (props) => {
}
useEffect(() => {
loadEveryting()
loadReport(currentDate(0), currentDate(0))
}, [])
const changeToggle = (row: I2206FacturasTxt) => {
@ -80,11 +91,107 @@ export const RptFacturasTxtHeineken: FC<IProps> = (props) => {
}
}
const filtraReporte = (e: any) => {
setFiltro(e.target.value)
if (e.target.value.length > 0) {
setData(
Data
.filter(function (row) {
return (
row.delivery.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.fecha.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.factura.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.poCliente.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.heineken.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.destino.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.moneda.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.numero4.toString().includes(e.target.value) ||
row.numero5.toString().includes(e.target.value) ||
row.numero6.toString().includes(e.target.value) ||
row.unidad.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.numero7.toString().includes(e.target.value) ||
row.numero8.toString().includes(e.target.value) ||
row.incoterm.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.incoterm2.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.pedidoSAP.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.transportista.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.caja.toLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
row.numero12.toString().includes(e.target.value) ||
row.detail.filter (det =>
det.seisDigitos.toString().includes(e.target.value) ||
det.veinteDigitos.toString().includes(e.target.value) ||
det.descripcion.toLocaleLowerCase().includes(e.target.value.toLocaleLowerCase()) ||
det.medida.toString().includes(e.target.value) ||
det.num1.toString().includes(e.target.value) ||
det.num2.toString().includes(e.target.value) ||
det.num3.toString().includes(e.target.value) ||
det.unidad.toLowerCase().includes(e.target.value.toLowerCase()) ||
det.hNumero4.toString().includes(e.target.value) ||
det.hNumero6.toString().includes(e.target.value) ||
det.hNumero7.toString().includes(e.target.value) ||
det.hNumero8.toString().includes(e.target.value)
).length>0
)
})
)
} else {
setData(DataOriginal)
}
}
return (
<div>
<Card>
<Card.Body>
<Row>
<Col xs={3}>
<Card.Title>Reporte de facturas TXT: Heineken</Card.Title>
</Col>
<Col xs={1} style={{textAlign:'right'}}>Inicio</Col>
<Col xs={1}><Form.Control
defaultValue={Inicio}
type="date"
name="Inicio"
placeholder="Inicio"
title="Inicio"
alt="Inicio"
data-date-format="YYYY-mm-dd"
onChange={(e) => setInicio(e.target.value)}
size="sm"
/></Col>
<Col xs={1} style={{textAlign:'right'}}>Hasta</Col>
<Col xs={1}><Form.Control
defaultValue={Fin}
type="date"
name="Inicio"
placeholder="Inicio"
title="Inicio"
alt="Inicio"
data-date-format="YYYY-mm-dd"
onChange={(e) => setFin(e.target.value)}
size="sm"
/></Col>
<Col xs={1}><Button
variant="primary"
size="sm"
onClick={() => {
loadReport(Inicio, Fin)
}}
>
<BsSearch />
Buscar
</Button></Col>
<Col xs={4}>
<Form.Control
type="text"
size="sm"
placeholder="Search..."
onChange={(e) => {
filtraReporte(e)
}}
/>
</Col>
</Row>
</Card.Body>
</Card>
<Row>

Loading…
Cancel
Save