function LoginClienteRemuneraciones(model) {
const [result, setResult] = React.useState('');
const contrasenaRef = React.useRef('');
const resultadoRef = React.useRef('');
const usuarioRef = React.useRef('');
function login(e) {
setResult('');
e.preventDefault();
try {
let faltaUsuario = usuarioRef.current.value === null || usuarioRef.current.value === "";
let faltaPass = contrasenaRef.current.value === null || contrasenaRef.current.value === "";
if (faltaUsuario) {
setResult((result) => result+ " \n se debe ingresar usuario");
}
if (faltaPass) {
setResult((result) => result + " \n se debe ingresar contrasena");
}
// alert('user :' + usuarioRef.current.value + ' pass :' + contrasenaRef.current.value);
if (!faltaUsuario && !faltaPass)
{
let json = JSON.stringify({
inputEmail: usuarioRef.current.value,
inputPassword: contrasenaRef.current.value, RecordarUsuario: 1
});
fetch('./LoginRemuneracionesReact/index?json=' + json, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
if (data.Redirect === "ListarRemuneracionesColegiosReact")
{
window.location.href = "/ListarRemuneracionesColegiosReact";
}
})
.catch((err) => {
console.log(err.message);
});
}
} catch (ex) {
}
};
function focus(e) {
//e.preventDefault();
try {
//alert('amska');
} catch (ex) {
}
};
return (
)
}
function ListarRemuneracionesColegiosReact(model) {
const [selectedListColegio, setSelectedColegioValue] = React.useState('');
const [ListaHistorial, setListaHistorial] = React.useState(null);
const [selectedListPeriodo, setSelectedPeriodoValue] = React.useState('');
const [Lista, setLista] = React.useState(null);
const [ListaPeriodos, setListaPeriodos] = React.useState(null);
const [PeriodoHabilitado, setPeriodoHabilitado] = React.useState(false);
const handleChangeColegio = (e) => {
setSelectedColegioValue(e.target.value);
//var select = document.getElementById("dropdownPeriodos");
//while (select.options.length > 1) {
// select.lastChild.remove()
//}
if (e.target.value === '0' || e.target.value === '') { error = 'Seleccione periodo'; }
else {
fetch('./ListarRemuneracionesColegiosReact/ObtenerPeriodosColegio?idColegio=' + e.target.value, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
//model.ListaPeriodos = [];
//var count = data.length -1;
//for (let x = 0; x <= count; x++) {
// model.ListaPeriodos[x] = data[x];
//}
//setListaPeriodos(null);
setListaPeriodos(data);
// console.log('respuesta buscar periodos '+ model.ListaPeriodos);
})
.catch((err) => {
console.log(err.message);
});
}
};
const handleChangePeriodo = (e) => {
setSelectedPeriodoValue(e.target.value);
};
const PintarListaColegio = model.ListaColegios.map(colegio => {
return ()
});
const PintarListaPeriodos = () => ListaPeriodos !== null ? ListaPeriodos.map(periodo => {
return ()
}) : '';
const buscar = () => {
if (selectedListPeriodo === '' || selectedListColegio === '') {
let error = '';
if (selectedListPeriodo === '') { error = 'Seleccione periodo' }
if (selectedListColegio === '') {
error = error + ' Seleccione colegio'
alert(error)
setLista(null);
} else {
let json = JSON.stringify({
IdColegio: selectedListColegio,
Periodo: selectedListPeriodo.trim()
});
fetch('./ListarRemuneracionesColegiosReact/Index?json=' + json, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
if (data.MensajeError === "Usuario no logeado") {
window.location.href = "/LoginRemuneracionesReact";
}
setLista(data);
})
.catch((err) => {
console.log(err.message);
});
IsPeriodoHabilitado()
}
};
let indice = 1
const PintarListaRemuneraciones = () => Lista.ListaGrilla.map(remuneracion => {
return (
{indice++}
|
{remuneracion.EmpleadoCodigoNacional}
|
{remuneracion.NombreEmpleado}
|
{remuneracion.CantidadHoras}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.RBMN)}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.TotalImponibles)}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.SubTotalHaberes)}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.MontoTributable)}
|
{remuneracion.DiasTrabajados}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.SueldoLiquido)}
|
|
)
});
const BuscarHistorial = (rutEmpleado, idColegio) => {
getHistorial(rutEmpleado, idColegio);
}
function getHistorial(rutEmpleado, idColegio) {
fetch('./ListarRemuneracionesColegiosReact/ListaHistorialRemuneracionesEmpleado?empleadoCodigoNacional=' + rutEmpleado + '&idColegio=' + idColegio, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setListaHistorial(data);
})
.catch((err) => {
console.log(err.message);
});
}
const PintarLista = () => {
if (Lista !== null) {
return (
<>Cantidad Docentes: {Lista.TotalCantidadDocentes}(horas: {Lista.TotalHorasDocentes}) - Cantidad no Docentes: {Lista.TotalCantidadNoDocentes}(horas: {Lista.TotalHorasNoDocentes})
{ListarReportes()}
#
|
Rut
|
Nombre
|
Horas
|
Integracion
|
Imponible
|
No Imponible
|
Tributable
|
Dias
|
Liquido
|
Acciones
|
{PintarListaRemuneraciones()}
>
)
}
}
const AllToPDF = () => {
window.open("./ListarRemuneracionesColegiosReact/ConvertThisPageToPdfAllv2?periodo=" + selectedListPeriodo + "&idColegio=" + selectedListColegio);
}
const PDF = (idCabecera) => {
window.open("./ListarRemuneracionesColegiosReact/ConvertThisPageToPdfv2?idCabecera=" + idCabecera);
}
const InformeGastosMensuales = () => {
fetch('./ListarRemuneracionesColegiosReact/InformeGastosMensuales?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
if (data !== "") {
window.location.href = data;
}
})
.catch((err) => {
console.log(err.message);
});
}
const BuscarCSVDireccionDelTrabajo = () => {
fetch('./ListarRemuneracionesColegiosReact/CsvDireccionDelTrabajo?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
if (data !== "") {
window.location.href = data;
}
})
.catch((err) => {
console.log(err.message);
});
}
const BuscarCSVSuperintendencia = () => {
fetch('./ListarRemuneracionesColegiosReact/CsvSuperIntendencia?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
if (data !== "") {
window.location.href = data;
}
})
.catch((err) => {
console.log(err.message);
});
}
const BurcarLibro = () => {
fetch('./ListarRemuneracionesColegiosReact/ImprimirLibroColegioPeriodo?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
if (data !== "") {
window.location.href = data;
}
})
.catch((err) => {
console.log(err.message);
});
}
const Leyes19410933 = () => {
fetch('./ListarRemuneracionesColegiosReact/ResumenAnualPagoLeyes?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
if (data !== "") {
window.location.href = data;
}
})
.catch((err) => {
console.log(err.message);
});
}
const IsPeriodoHabilitado = () => {
fetch('./ListarRemuneracionesColegiosReact/PeriodoHabilitado?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
setPeriodoHabilitado(data === "False" ? false : true)
})
.catch((err) => {
console.log(err.message);
});
}
const HabilitarPeriodo = () => {
fetch('./ListarRemuneracionesColegiosReact/habilitarPeriodo?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
const buscar = document.getElementById('buscar')
buscar.click();
})
.catch((err) => {
console.log(err.message);
});
}
const AbrirPeriodo = () => {
fetch('./ListarRemuneracionesColegiosReact/AbrirPeriodo?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
const buscar = document.getElementById('buscar')
buscar.click();
})
.catch((err) => {
console.log(err.message);
});
}
const CerrarPeriodo = () => {
fetch('./ListarRemuneracionesColegiosReact/CerrarPeriodo?periodo=' + selectedListPeriodo + '&idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
const buscar = document.getElementById('buscar')
buscar.click();
})
.catch((err) => {
console.log(err.message);
});
}
const ListarReportes = () => {
return (
<>
{!PeriodoHabilitado ? <>> :
(Lista.Cerrada ? <>>
: <>>)}
>
)
}
function HitorialRemuneracionesEmpleadoColegio() {
var indice = 1;
const PintarListaRemuneracionesHistorial = () => ListaHistorial.map(remuneracion => {
return (
{indice++}
|
{remuneracion.Periodo}
|
{remuneracion.EmpleadoCodigoNacional}
|
{remuneracion.NombreEmpleado}
|
{remuneracion.CantidadHoras}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.RBMN)}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.TotalImponibles)}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.SubTotalHaberes)}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.MontoTributable)}
|
{remuneracion.DiasTrabajados}
|
${new Intl.NumberFormat(["ban", "id"]).format(remuneracion.SueldoLiquido)}
|
|
)
});
const PintarListaHistorial = () => {
return (
<>
#
|
Periodo
|
Rut
|
Nombre
|
Horas
|
Integracion
|
Imponible
|
No Imponible
|
Tributable
|
Dias
|
Liquido
|
Acciones
|
{PintarListaRemuneracionesHistorial()}
>
)
}
return (PintarListaHistorial())
}
return (
<>
{ListaHistorial !== null ? HitorialRemuneracionesEmpleadoColegio() : 'Cargando'}
{Lista !== null ? PintarLista() : ''}
>
)
}
}
function ResultadoSimulacion(model)
{
const [MensajeError, setMensajeError] = React.useState(null);
const Volver = () => {
window.history.back();
}
const GrabarSimulacion = () => {
fetch('./GrabarSimulacionColegio', {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) =>
response.json()
)
.then((data) => {
console.log(data);
if (data.MensajeExito !== null) {
window.location.href = "/SimularRemuneracionColegioReact";
}
else
{
setMensajeError(data.MensajeError);
}
})
.catch((err) => {
console.log(err.message);
});
}
return (<>
||
{MensajeError != null ?
model.MensajeError
: ''}
>)
}
function SimularRemuneracionColegio(model) {
const Mapeo = () =>
{
model.Model.Adelantos = Adelantos.current.value ?? 0;
model.Model.AguinaldoDesempenoDificil = AguinaldoDesempenoDificil.current.value ?? 0;
model.Model.AguinaldoNavidad = AguinaldoNavidad.current.value ?? 0;
model.Model.AguinaldoSeptiembre = AguinaldoSeptiembre.current.value ?? 0;
model.Model.AguinaldoVacaciones = AguinaldoVacaciones.current.value ?? 0;
model.Model.AjusteDiferenciaSueldo = AjusteDiferenciaSueldo.current.value ?? 0;
model.Model.AsignacionFamiliarRetroactiva = AsignacionFamiliarRetroactiva.current.value ?? 0;
model.Model.BonoCumplimiento = BonoCumplimiento.current.value ?? 0;
model.Model.BonoDesempenoDificilRetroactivo = BonoDesempenoDificilRetroactivo.current.value ?? 0;
model.Model.BonoEscolar = BonoEscolar.current.value ?? 0;
model.Model.BonoExtraordinario = BonoExtraordinario.current.value ?? 0;
model.Model.BonoReemplazo = BonoReemplazo.current.value ?? 0;
model.Model.CajaCompensacionCreditosPersonales = CajaCompensacionCreditosPersonales.current.value ?? 0;
model.Model.CajaCompensacionDescuentoDental = CajaCompensacionDescuentoDental.current.value ?? 0;
model.Model.CajaCompensacionDescuentoSeguroVida = CajaCompensacionDescuentoSeguroVida.current.value ?? 0;
model.Model.CajaCompensacionOtrosDescuentos = CajaCompensacionOtrosDescuentos.current.value ?? 0;
model.Model.CantidadDiasInasistencias = CantidadDiasInasistencias.current.value ?? 0;
model.Model.CantidadDiasLicencia = CantidadDiasLicencia.current.value ?? 0;
model.Model.DescuentoAhorroVivienda = DescuentoAhorroVivienda.current.value ?? 0;
model.Model.DescuentoPrestamoEmpresa = DescuentoPrestamoEmpresa.current.value ?? 0;
model.Model.HorasDescuento = HorasDescuento.current.value ?? 0;
model.Model.Ley19410NoImponible = Ley19410NoImponible.current.value ?? 0;
model.Model.Ley19464NoImponible = Ley19464NoImponible.current.value ?? 0;
model.Model.Ley19933NoImponible = Ley19933NoImponible.current.value ?? 0;
model.Model.MinutosDescuento = MinutosDescuento.current.value ?? 0;
model.Model.OtroBono = OtroBono.current.value ?? 0;
model.Model.PrestamoFonasa = PrestamoFonasa.current.value ?? 0;
model.Model.RutEmpleado = selectedEmpleado;
model.Model.Periodo = selectedListPeriodo;
model.Model.IdColegio = selectedListColegio;
model.Model.TramoAsignacionFamiliar = selectedListTramoAsignacionFamiliar;
model.Model.CajaCompensacionDescuentoLeasing = CajaCompensacionDescuentoLeasing.current.value ?? 0;
}
let CantidadDiasInasistencias = React.useRef(0);
let CantidadDiasLicencia = React.useRef(0);
let HorasDescuento = React.useRef(0);
let MinutosDescuento = React.useRef(0);
let AguinaldoSeptiembre = React.useRef(0);
let OtroBono = React.useRef(0);
let BonoEscolar = React.useRef(0);
let AsignacionFamiliarRetroactiva = React.useRef(0);
let AguinaldoNavidad = React.useRef(0);
let AguinaldoVacaciones = React.useRef(0);
let BonoExtraordinario = React.useRef(0);
let Ley19933NoImponible = React.useRef(0);
let Ley19464NoImponible = React.useRef(0);
let Ley19410NoImponible = React.useRef(0);
let AjusteDiferenciaSueldo = React.useRef(0);
let BonoReemplazo = React.useRef(0);
let BonoCumplimiento = React.useRef(0);
let BonoDesempenoDificilRetroactivo = React.useRef(0);
let AguinaldoDesempenoDificil = React.useRef(0);
let Adelantos = React.useRef(0);
let DescuentoPrestamoEmpresa = React.useRef(0);
let DescuentoAhorroVivienda = React.useRef(0);
let PrestamoFonasa = React.useRef(0);
let CajaCompensacionCreditosPersonales = React.useRef(0);
let CajaCompensacionDescuentoDental = React.useRef(0);
let CajaCompensacionDescuentoSeguroVida = React.useRef(0);
let CajaCompensacionOtrosDescuentos = React.useRef(0);
let CajaCompensacionDescuentoLeasing = React.useRef(0);
const [selectedListColegio, setSelectedColegioValue] = React.useState('');
const [selectedEmpleado, setSelectedEmpleadoValue] = React.useState('');
const [selectedListPeriodo, setSelectedPeriodoValue] = React.useState('');
const [selectedListTramoAsignacionFamiliar, setSelectedTramoAsignacionFamiliarValue] = React.useState('');
const [ListaEmpleados, setListaEmpleados] = React.useState(null);
const PintarListaColegio = () =>
model.ListaColegios.map(colegio => {
return ()
})
;
const PintarListaPeriodos = () => model.ListaPeriodos !== null ? model.ListaPeriodos.map(periodo => {
return ()
}) : '';
const PintarListaTramoAsignacionFamiliar = () => model.ListaTramoAsignacionFamiliar !== null ? model.ListaTramoAsignacionFamiliar.map(Tramo => {
return ()
}) : '';
const handleChangePeriodo = (e) => {
setSelectedPeriodoValue(e.target.value);
};
const handleChangeEmpleado = (e) => {
setSelectedEmpleadoValue(e.target.value);
};
const handleChangeTramo = (e) => {
setSelectedTramoAsignacionFamiliarValue(e.target.value);
};
const handleChangeColegio = (e) => {
setSelectedColegioValue(e.target.value);
//var select = document.getElementById("dropdownPeriodos");
//while (select.options.length > 1) {
// select.lastChild.remove()
//}
if (e.target.value === '0' || e.target.value === '') { error = 'Seleccione colegio'; }
else {
fetch('./SimularRemuneracionColegioReact/GetListaEmpleadosPorIdColegio?idColegio=' + e.target.value, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
//model.ListaPeriodos = [];
//var count = data.length -1;
//for (let x = 0; x <= count; x++) {
// model.ListaPeriodos[x] = data[x];
//}
//setListaPeriodos(null);
setListaEmpleados(data);
// console.log('respuesta buscar periodos '+ model.ListaPeriodos);
})
.catch((err) => {
console.log(err.message);
});
}
};
const PintarListaEmpleados = () => ListaEmpleados !== null ? ListaEmpleados.map(empleado => {
return ()
}) : '';
const Simular = () =>
{
if (/*selectedListTramoAsignacionFamiliar === '0' || selectedListTramoAsignacionFamiliar === ''*/false) { error = 'Seleccione tramo'; }
else {
Mapeo();
let json = JSON.stringify(model.Model);
fetch('./SimularRemuneracionColegioReact/Index?json=' + json, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
if (data.MensajeError === null)
{
window.location.href = "/SimularRemuneracionColegioReact/ResultadoSimulacion";
}
else
{
if (data.MensajeError === "NoLogin")
{
window.location.href = "/LoginRemuneracionesReact";
}
else
{
alert(data.MensajeError);
}
}
})
.catch((err) => {
console.log(err.message);
});
}
}
return (<>
Simular
{model.Model.MensajeExito != null ?
{model.Model.MensajeExito}
: ''}
Colegio |
|
|
Empleado |
|
|
Periodo |
|
|
Tramo Asignacion Familiar |
|
|
Descuentos Caja de Compensaci�n
>)
}
function MantenendorAFPReact(periodos)
{
const [SelectedPeriodo, setSelectedPeriodo] = React.useState('');
const [listaPeriodo, setListaPeriodo] = React.useState('');
const [model, setModel] = React.useState(undefined);
const handleChangePeriodo = (e) => {
setSelectedPeriodo(e.target.value);
};
const PintarListaPeriodos = () => {
if (listaPeriodo === '')
{
GetListaPeriodos()
}
return listaPeriodo.map(periodo => {
return ()
})
}
const GetListaPeriodos = () => {
let json = null;
fetch('./MantenedorAFP/ListaPeriodos', {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
setListaPeriodo( data)
})
.catch((err) => {
console.log(err.message);
});
}
const buscar = () => {
if (SelectedPeriodo === '' ) {
let error = '';
if (SelectedPeriodo === '') { error = 'Seleccione periodo' }
alert(error)
setLista(null);
} else {
setModel(undefined)
fetch('./MantenedorAFP/BuscarPeriodo?periodo=' + SelectedPeriodo, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setModel(data);
setBusqueda(true)
})
.catch((err) => {
console.log(err.message);
});
}
};
const [Busqueda, setBusqueda] = React.useState(false);
React.useEffect(() => {
if (listaPeriodo === '')
{
GetListaPeriodos()
console.log(listaPeriodo)
}
});
function getJsonCrear() {
let stringLista = [];
inputRefs.forEach((item, index, arr) => {
stringLista.push( {
"AFP": model.Lista[index].AFP,
"Periodo": model.Lista[index].Periodo,
"TasaDependiente": item[0].current.value,
"SISDependiente": item[1].current.value,
"TasaIndependiente": item[2].current.value
})
});
let jsonFinal = {
"MensajeExito": "",
"MensajeError": "",
"Periodo": SelectedPeriodo,
"Lista": stringLista
}
return (JSON.stringify(jsonFinal))
}
function Grabar() {
console.log(inputRefs)
let json = getJsonCrear()
console.log(json)
fetch('./MantenedorAFP/InsertarAFP?json='+json, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
})
.catch((err) => {
console.log(err.message);
});
}
let inputRefs;
function PintarTD() {
let indice = 1
inputRefs = new Array(model.Lista.length).fill().map(() => new Array(3).fill(0));;
return (
model.Lista.map((item, index) => {
inputRefs[index][0]=React.createRef('')
inputRefs[index][1]=React.createRef('')
inputRefs[index][2]=React.createRef('')
return (
{indice++} |
{item.AFP} |
|
|
|
)
})
)
}
function PintarFormulario() {
return (<>
>)
}
return (
<>
{model !== undefined ? PintarFormulario() : ''}
>
)
}
function MantenedorEmpleadosReact(model) {
function PintarHead2() {
return (
#
|
Rut
|
Nombre
|
Inicio
|
Hrs
|
Contrato
|
Base
|
Sep
|
Integracion
|
AFP
|
Salud
|
|
)
}
indiceHabilitado = 1
function PintarEmpleadosHabilitados(Lista) {
return Lista.map(empleado => {
return (empleado.Habilitado ?
{indiceHabilitado++}
|
{empleado.Rut} - {empleado.DigitoVerificador}
|
{empleado.ApellidoPaterno} {empleado.Nombres}
|
{new Date(empleado.FechaInicioContrato).toLocaleDateString('en-GB', { timeZone: 'UTC' })}
|
{empleado.CantidadHorasPactadas}
|
{empleado.TipoContrato}
|
${new Intl.NumberFormat(["ban", "id"]).format(empleado.SueldoBase)}
|
${new Intl.NumberFormat(["ban", "id"]).format(empleado.CargoSEP)}
|
${new Intl.NumberFormat(["ban", "id"]).format(empleado.Integracion)}
|
{empleado.AFP} {empleado.PorcentajeActualAFP} %
|
{empleado.Isapre} {empleado.PorcentajeActualIsapre} %
|
|
: '');
});
}
indiceDeshabilitado = 1
function PintarEmpleadosDeshabilitados(Lista) {
return (Lista.map(empleado => {
return (empleado.Habilitado === false ? < tr >
{indiceDeshabilitado++}
|
{empleado.Rut} - {empleado.DigitoVerificador}
|
{empleado.ApellidoPaterno} {empleado.Nombres}
|
{new Date(empleado.FechaInicioContrato).toLocaleDateString('en-GB', { timeZone: 'UTC' })}
|
{empleado.CantidadHorasPactadas}
|
{empleado.TipoContrato}
|
${new Intl.NumberFormat(["ban", "id"]).format(empleado.SueldoBase)}
|
${new Intl.NumberFormat(["ban", "id"]).format(empleado.CargoSEP)}
|
${new Intl.NumberFormat(["ban", "id"]).format(empleado.Integracion)}
|
{empleado.AFP} {empleado.PorcentajeActualAFP} %
|
{empleado.Isapre} {empleado.PorcentajeActualIsapre} %
|
|
: '')
}))
}
function Editar(IdEmpleado) {
fetch('./MantenedorEmpleadosReact/BuscarEmpleado?idEmpleado=' + IdEmpleado, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setEntidadEditarEmpleado(data);
})
.catch((err) => {
console.log(err.message);
});
}
function PintarLista(Lista) {
if (Lista !== '') {
return (
<>
{Lista !== undefined && Lista !== '' ?
:
}
{Lista !== undefined && Lista !== '' ?
:
}
>)
} else {
//return ()
return ('')
}
}
const [PrimerEdit, setPrimerEdit] = React.useState(false);
const [MensajeExito, setMensajeExito] = React.useState('');
const [MensajeError, setMensajeError] = React.useState('');
const [EntidadEditarEmpleado, setEntidadEditarEmpleado] = React.useState('');
const [selectedListColegio, setSelectedColegioValue] = React.useState('');
const [listaSexo, setListaSexo] = React.useState('');
const [listaNacionalidad, setListaNacionalidad] = React.useState('');
const [listaTipoContrato, setListaTipoContrato] = React.useState('');
const [listaModalidadPago, setListaModalidadPago] = React.useState('');
const [listaBanco, setListaBanco] = React.useState('');
const [listaInstitucionApv, setListaInstitucionApv] = React.useState('');
const [listaMonedaApv, setListaMonedaApv] = React.useState('');
const [listaIsapre, setListaIsapre] = React.useState('');
const [listaAFP, setListaAFP] = React.useState('');
const [editarEmpleado, setEditarEmpleado] = React.useState('');
const [Lista, setLista] = React.useState('');
const [selectedTipoContrato, setSelectedTipoContrato] = React.useState('');
const [selectedSexo, setSelectedSexo] = React.useState('');
const [selectedNacionalidad, setSelectedNacionalidad] = React.useState('');
const [selectedInstitucion, setSelectedInstitucion] = React.useState('');
const [selectedMoneda, setSelectedMoneda] = React.useState('');
const [selectedAFP, setSelectedAFP] = React.useState('');
const [selectedIsapre, setSelectedIsapre] = React.useState('');
const [selectedBanco, setSelectedBanco] = React.useState('');
const [selectedModalidadPago, setSelectedModalidadPago] = React.useState('');
const EstadoContrato = React.useRef('');
const NombreInstitucionApvi = React.useRef('');
const CodigoInstitucionApvi = React.useRef('');
const MonedaApvi = React.useRef('');
const DepositosConvenidosApvi = React.useRef('');
const APV = React.useRef('');
const TieneBRP = React.useRef('');
const TieneSNED = React.useRef('');
const TieneDesempeñoDificil = React.useRef('');
const TieneLey19933 = React.useRef('');
const TieneLey19464 = React.useRef('');
const TieneLey19410 = React.useRef('');
const TieneCargoSEP = React.useRef('');
const TieneIntegracion = React.useRef('');
const NombreNacionalidad = React.useRef('');
const Nacionalidad = React.useRef('');
const NumeroFun = React.useRef('');
const NombreSexo = React.useRef('');
const Sexo = React.useRef('');
const SolicitudJovenTrabajador = React.useRef('');
const Rut = React.useRef('');
const EsPensionado = React.useRef('');
const Nombres = React.useRef('');
const ApellidoMaterno = React.useRef('');
const ApellidoPaterno = React.useRef('');
const FechaNacimiento = React.useRef('');
const CantidadCargasFamiliares = React.useRef('');
const Comentarios = React.useRef('');
const CantidadHorasPactadas = React.useRef('');
const AhorroVoluntario = React.useRef('');
const AFP = React.useRef('');
const Isapre = React.useRef('');
const UfPlanIsapre = React.useRef('');
const TipoContrato = React.useRef('');
const NombreTipoContrato = React.useRef('');
const EsGes = React.useRef('');
const PorcentajeActualAFP = React.useRef('');
const Direccion = React.useRef('');
const Celular = React.useRef('');
const Mail = React.useRef('');
const FechaInicioContrato = React.useRef('');
const FechaTerminoContrato = React.useRef('');
const Habilitado = React.useRef('');
const EsDocente = React.useRef('');
const Cargo = React.useRef('');
const ValorContrato = React.useRef('');
const IdColegio = React.useRef('');
const DatosContactoEmergencia = React.useRef('');
const EsProfesional = React.useRef('');
const BonoDirectivo = React.useRef('');
const BonoTaller = React.useRef('');
const BonoMovilizacion = React.useRef('');
const BonoColacion = React.useRef('');
const Integracion = React.useRef('');
const CargoSEP = React.useRef('');
const IdBanco = React.useRef('');
const NombreBanco = React.useRef('');
const IdMedioPago = React.useRef('');
const NombreMedioPago = React.useRef('');
const NumeroCuentaBanco = React.useRef('');
const handleChangeColegio = (e) => {
setSelectedColegioValue(e.target.value)
}
const MapearEntidadToUseRef = () => {
AhorroVoluntario.current.value = EntidadEditarEmpleado.AhorroVoluntario ?? ''
ApellidoMaterno.current.value = EntidadEditarEmpleado.ApellidoMaterno ?? ''
ApellidoPaterno.current.value = EntidadEditarEmpleado.ApellidoPaterno ?? ''
APV.current.value = EntidadEditarEmpleado.APV ?? ''
BonoColacion.current.value = EntidadEditarEmpleado.BonoColacion ?? ''
BonoDirectivo.current.value = EntidadEditarEmpleado.BonoDirectivo ?? ''
BonoMovilizacion.current.value = EntidadEditarEmpleado.BonoMovilizacion ?? ''
BonoTaller.current.value = EntidadEditarEmpleado.BonoTaller ?? ''
CantidadCargasFamiliares.current.value = EntidadEditarEmpleado.CantidadCargasFamiliares ?? ''
CantidadHorasPactadas.current.value = EntidadEditarEmpleado.CantidadHorasPactadas ?? ''
Cargo.current.value = EntidadEditarEmpleado.Cargo ?? ''
CargoSEP.current.value = EntidadEditarEmpleado.CargoSEP ?? ''
Celular.current.value = EntidadEditarEmpleado.Celular ?? ''
if (selectedInstitucion === '' || PrimerEdit) {
setSelectedInstitucion(EntidadEditarEmpleado.CodigoInstitucionApvi === null || EntidadEditarEmpleado.CodigoInstitucionApvi === '' ? '0' : EntidadEditarEmpleado.CodigoInstitucionApvi)
}
Comentarios.current.value = EntidadEditarEmpleado.Comentarios ?? ''
DatosContactoEmergencia.current.value = EntidadEditarEmpleado.DatosContactoEmergencia ?? ''
DepositosConvenidosApvi.current.value = EntidadEditarEmpleado.DepositosConvenidosApvi ?? ''
Direccion.current.value = EntidadEditarEmpleado.Direccion ?? 'false'
EsDocente.current.value = EntidadEditarEmpleado.EsDocente ?? 'false'
//EsGes.current.value=EntidadEditarEmpleado.EsGes ?? 'false'
EsPensionado.current.value = EntidadEditarEmpleado.EsPensionado ?? 'false'
EsProfesional.current.value = EntidadEditarEmpleado.EsProfesional ?? 'false'
EstadoContrato.current.value = EntidadEditarEmpleado.EstadoContrato ?? ''
FechaInicioContrato.current.value = new Date(EntidadEditarEmpleado.FechaInicioContrato).toISOString().substring(0, 10) ?? ''
FechaNacimiento.current.value = new Date(EntidadEditarEmpleado.FechaNacimiento).toISOString().substring(0, 10) ?? ''
FechaTerminoContrato.current.value = new Date(EntidadEditarEmpleado.FechaTerminoContrato).toISOString().substring(0, 10) ?? ''
Habilitado.current.value = EntidadEditarEmpleado.Habilitado ?? 'false'
if (selectedBanco === '' || PrimerEdit) {
setSelectedBanco(EntidadEditarEmpleado.IdBanco === null || EntidadEditarEmpleado.IdBanco === '' ? '0' : EntidadEditarEmpleado.IdBanco)
}
if (selectedModalidadPago === '' || PrimerEdit) {
setSelectedModalidadPago(EntidadEditarEmpleado.IdMedioPago === null || EntidadEditarEmpleado.IdMedioPago === '' ? '0' : EntidadEditarEmpleado.IdMedioPago)
}
Integracion.current.value = EntidadEditarEmpleado.Integracion ?? ''
if (selectedIsapre === '' || PrimerEdit) {
setSelectedIsapre(EntidadEditarEmpleado.Isapre === null || EntidadEditarEmpleado.Isapre === '' ? '0' : EntidadEditarEmpleado.Isapre)
}
Mail.current.value = EntidadEditarEmpleado.Mail ?? ''
if (selectedMoneda === '' || PrimerEdit) {
setSelectedMoneda(EntidadEditarEmpleado.MonedaApvi === null || EntidadEditarEmpleado.MonedaApvi === '' ? '0' : EntidadEditarEmpleado.MonedaApvi)
}
if (selectedNacionalidad === '' || PrimerEdit) {
setSelectedNacionalidad(EntidadEditarEmpleado.Nacionalidad === null || EntidadEditarEmpleado.Nacionalidad === '' ? '0' : EntidadEditarEmpleado.Nacionalidad)
}
Nombres.current.value = EntidadEditarEmpleado.Nombres ?? ''
NumeroCuentaBanco.current.value = EntidadEditarEmpleado.NumeroCuentaBanco ?? ''
NumeroFun.current.value = EntidadEditarEmpleado.NumeroFun ?? ''
PorcentajeActualAFP.current.value = selectedAFP !== EntidadEditarEmpleado.AFP && selectedAFP !== '' ? PorcentajeActualAFP.current.value : EntidadEditarEmpleado.PorcentajeActualAFP ?? ''
if (selectedAFP === '' || PrimerEdit) {
setSelectedAFP(EntidadEditarEmpleado.AFP === null || EntidadEditarEmpleado.AFP === '' ? '0' : EntidadEditarEmpleado.AFP)
}
Rut.current.value = EntidadEditarEmpleado.Rut ?? ''
if (selectedSexo === '' || PrimerEdit) {
setSelectedSexo(EntidadEditarEmpleado.Sexo === null || EntidadEditarEmpleado.Sexo === '' ? '0' : EntidadEditarEmpleado.Sexo)
}
SolicitudJovenTrabajador.current.value = EntidadEditarEmpleado.SolicitudJovenTrabajador ?? 'false'
if (selectedTipoContrato === '' || PrimerEdit) {
setSelectedTipoContrato(EntidadEditarEmpleado.TipoContrato === null || EntidadEditarEmpleado.TipoContrato === '' ? '0' : EntidadEditarEmpleado.TipoContrato)
}
UfPlanIsapre.current.value = EntidadEditarEmpleado.UfPlanIsapre ?? ''
ValorContrato.current.value = EntidadEditarEmpleado.ValorContrato ?? ''
}
const MapearUseRefToEntidad = () => {
var json = JSON.stringify(
{
"EsDocente": EsDocente.current.checked,
"Direccion": Direccion.current.value,
"DepositosConvenidosApvi": DepositosConvenidosApvi.current.value,
"DatosContactoEmergencia": DatosContactoEmergencia.current.value,
"Comentarios": Comentarios.current.value,
"CodigoInstitucionApvi": CodigoInstitucionApvi.current.value,
"Celular": Celular.current.value,
"CargoSEP": CargoSEP.current.value,
"Cargo": Cargo.current.value,
"CantidadHorasPactadas": CantidadHorasPactadas.current.value,
"CantidadCargasFamiliares": CantidadCargasFamiliares.current.value,
"BonoTaller": BonoTaller.current.value,
"BonoMovilizacion": BonoMovilizacion.current.value,
"BonoDirectivo": BonoDirectivo.current.value,
"BonoColacion": BonoColacion.current.value,
"APV": APV.current.value,
"ApellidoPaterno": ApellidoPaterno.current.value,
"ApellidoMaterno": ApellidoMaterno.current.value,
"AhorroVoluntario": AhorroVoluntario.current.value,
"MonedaApvi": MonedaApvi.current.value,
"Mail": Mail.current.value,
"Isapre": Isapre.current.value,
"Integracion": Integracion.current.value,
"IdMedioPago": IdMedioPago.current.value,
"IdBanco": IdBanco.current.value,
"Habilitado": Habilitado.current.checked,
"FechaTerminoContrato": FechaTerminoContrato.current.value,
"FechaNacimiento": FechaNacimiento.current.value,
"FechaInicioContrato": FechaInicioContrato.current.value,
"EstadoContrato": EstadoContrato.current.value,
"EsProfesional": EsProfesional.current.checked,
"EsPensionado": EsPensionado.current.checked,
"AFP": AFP.current.value,
"PorcentajeActualAFP": PorcentajeActualAFP.current.value,
"NumeroFun": NumeroFun.current.value,
"NumeroCuentaBanco": NumeroCuentaBanco.current.value,
"Nombres": Nombres.current.value,
"Nacionalidad": Nacionalidad.current.value,
"ValorContrato": ValorContrato.current.value,
"UfPlanIsapre": UfPlanIsapre.current.value,
"TipoContrato": TipoContrato.current.value,
"SolicitudJovenTrabajador": SolicitudJovenTrabajador.current.checked,
"Sexo": Sexo.current.value,
"Rut": Rut.current.value,
"IdColegio": selectedListColegio
})
return json;
}
React.useEffect(() => {
if (EntidadEditarEmpleado !== '') {
if (listaAFP === '') { ListasEditarCrear() }
MapearEntidadToUseRef();
}
if (selectedAFP !== '') {
CambiarPorcentajeAFP()
}
if (Nuevo && EntidadEditarEmpleado === '') {
ClearUseRef()
setNuevo(false)
}
});
React.useEffect(() => {
PintarExito()
}, MensajeExito);
const [Nuevo, setNuevo] = React.useState(false);
function NuevoEmpleado() {
setEntidadEditarEmpleado('')
setNuevo(true)
setmensajeError('')
setmensajeExito('')
}
const ClearUseRef = () => {
AhorroVoluntario.current = ''
ApellidoMaterno.current = ''
ApellidoPaterno.current = ''
APV.current = ''
BonoColacion.current = ''
BonoDirectivo.current = ''
BonoMovilizacion.current = ''
BonoTaller.current = ''
CantidadCargasFamiliares.current = ''
CantidadHorasPactadas.current = ''
Cargo.current = ''
CargoSEP.current = ''
Celular.current = ''
setSelectedInstitucion( '' )
Comentarios.current = ''
DatosContactoEmergencia.current = ''
DepositosConvenidosApvi.current = ''
Direccion.current = 'false'
EsDocente.current = 'false'
//EsGes.current =EntidadEditarEmpleado.EsGes ?? 'false'
EsPensionado.current = 'false'
EsProfesional.current = 'false'
EstadoContrato.current = ''
FechaInicioContrato.current = ''
FechaNacimiento.current = ''
FechaTerminoContrato.current = ''
Habilitado.current = 'false'
setSelectedBanco( '' )
setSelectedModalidadPago( '' )
Integracion.current = ''
setSelectedIsapre( '' )
Mail.current = ''
setSelectedMoneda( '' )
setSelectedNacionalidad( '' )
Nombres.current = ''
NumeroCuentaBanco.current = ''
NumeroFun.current = ''
PorcentajeActualAFP.current = ''
setSelectedAFP( '' )
Rut.current = ''
setSelectedSexo( '' )
SolicitudJovenTrabajador.current = 'false'
setSelectedTipoContrato( '' )
UfPlanIsapre.current = ''
ValorContrato.current = ''
}
const CambiarPorcentajeAFP = () => {
fetch('./MantenedorEmpleadosReact/GetPorcentajeDescuentoAFP?afp=' + selectedAFP, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
PorcentajeActualAFP.current.value = data + ' %'
})
.catch((err) => {
console.log(err.message);
});
}
const ListasEditarCrear = () => {
fetch('./MantenedorEmpleadosReact/BuscarSelectLists', {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setListaAFP(data.ListaAFP)
setListaBanco(data.ListaBanco)
setListaInstitucionApv(data.ListainstitucionApvi)
setListaIsapre(data.ListaIsapre)
setListaModalidadPago(data.ListaMedioDePago)
setListaMonedaApv(data.ListaMonedasApvi)
setListaNacionalidad(data.ListaNacionalidad)
setListaSexo(data.ListaSexo)
setListaTipoContrato(data.ListaTipoContrato)
})
.catch((err) => {
console.log(err.message);
});
}
const PintarListaColegio = model.ListaColegios.map(colegio => {
return ()
});
const PintarlistaMoneda = () => listaMonedaApv.map(colegio => {
return ()
});
const handleChangeMoneda = (e) => {
setSelectedMoneda(e.target.value)
};
const PintarlistaSexo = () => listaSexo.map(colegio => {
return ()
});
const handleChangeSexo = (e) => {
setSelectedSexo(e.target.value)
};
const PintarlistaNacionalidad = () => listaNacionalidad.map(colegio => {
return ()
});
const handleChangeNacionalidad = (e) => {
setSelectedNacionalidad(e.target.value)
};
const PintarlistaTipoContrato = () => listaTipoContrato.map(colegio => {
return ()
});
const handleChangeTipoContrato = (e) => {
setSelectedTipoContrato(e.target.value)
};
const PintarlistaModalidadPago = () => listaModalidadPago.map(colegio => {
return ()
});
const handleChangeModalidadPago = (e) => {
setSelectedModalidadPago(e.target.value)
};
const PintarlistaBanco = () => listaBanco.map(colegio => {
return ()
})
const handleChangeBanco = (e) => {
setSelectedBanco(e.target.value)
};;
const PintarlistaInstitucionApv = () => listaInstitucionApv.map(colegio => {
return ()
});
const handleChangeInstitucion = (e) => {
setSelectedInstitucion(e.target.value)
};
const PintarlistaIsapre = () => listaIsapre.map(colegio => {
return ()
});
const handleChangeIsapre = (e) => {
setSelectedIsapre(e.target.value)
};
const PintarlistaAFP = () => listaAFP.map(colegio => {
return ()
});
const handleChangeAFP = (e) => {
setSelectedAFP(e.target.value)
};
const buscar = () => {
if (selectedListColegio === '') {
let error = '';
if (selectedListColegio === '') { error = error + ' Seleccione colegio' }
alert(error)
setLista(null);
} else {
fetch('./MantenedorEmpleadosReact/Index?idColegio=' + selectedListColegio, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setLista(data.Lista);
})
.catch((err) => {
console.log(err.message);
});
}
};
const [mensajeExito, setmensajeExito] = React.useState('');
const [mensajeError, setmensajeError] = React.useState('');
const AbrirModalEditar = () => {
const json = MapearUseRefToEntidad()
fetch('./MantenedorEmpleadosReact/GrabarEmpleadoColegio?json=' + json, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
if (data.MensajeExito !== '') {
setmensajeExito(data.MensajeExito)
// setPrimerEdit(true)
const myModalEl = document.getElementById('closeModal')
myModalEl.click();
//setEntidadEditarEmpleado('')
//ClearUseRef()
const buscarColegio = document.getElementById('buscarColegio')
buscarColegio.click();
} else {
setmensajeError(data.MensajeError)
}
})
.catch((err) => {
console.log(err.message);
});
}
const PintarFormularioCrearEditarEmpleado = () => {
return (EntidadEditarEmpleado !== '' || !Nuevo && EntidadEditarEmpleado === '' ?
{mensajeError !== '' ?
Error! {mensajeError}. intentelo denuevo.
: ''}
{editarEmpleado !== '' ?
: ''}
Banco
Modalidad de pago
Numero de cuenta
: '')
}
const PintarExito = () => {
return ( mensajeExito !== '' ?
Exito! {mensajeExito}.
: '')
}
return (<>
{PintarExito()}
{PintarFormularioCrearEditarEmpleado()}
{Lista !== null && Lista !== '' ? PintarLista(Lista) : <><>
>>}
>)
}
function ReseteoContrasenaReact() {
const RutRef = React.useRef('');
const [Mensaje, setMensaje] = React.useState('');
const [Exito, setExito] = React.useState('');
const Resetear = () => {
if (RutRef.current !== undefined && RutRef.current.value !== '') {
fetch('./ResetoContraseñaReact/ResetarContrasena?rut=' + RutRef.current.value, {
method: 'POST',
headers: {
'Content-type': 'application/xml; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setExito(data.Exito)
setMensaje(data.Mensaje + ' - ' + RutRef.current.value)
if (data.Mensaje === 'Error Sesion') {
window.location.href = "/LoginRemuneracionesReact";
}
})
.catch((err) => {
console.log(err.message);
});
} else {
setExito(false)
setMensaje('Debe Ingresar Rut Empleado')
}
};
return (<>
{Exito === true ?
Exito! {Mensaje}.
: Exito === false ?
Error! {Mensaje}. intentelo denuevo.
: ''}
>)
}
function LoginSeccionSostenedorReact(model) {
const [result, setResult] = React.useState('');
const contrasenaRef = React.useRef('');
const resultadoRef = React.useRef('');
const usuarioRef = React.useRef('');
const [selectedListPeriodo, setSelectedPeriodoValue] = React.useState('');
const handleChangePeriodo = (e) => {
setSelectedPeriodoValue(e.target.value);
};
function login(e) {
setResult('');
e.preventDefault();
try {
let faltaUsuario = usuarioRef.current.value === null || usuarioRef.current.value === "";
let faltaPass = contrasenaRef.current.value === null || contrasenaRef.current.value === "";
if (faltaUsuario) {
setResult((result) => result + " \n se debe ingresar usuario");
}
if (faltaPass) {
setResult((result) => result + " \n se debe ingresar contrasena");
}
// alert('user :' + usuarioRef.current.value + ' pass :' + contrasenaRef.current.value);
if (!faltaUsuario && !faltaPass) {
let json = JSON.stringify({
inputEmail: usuarioRef.current.value,
inputPassword: contrasenaRef.current.value, RecordarUsuario: 1
});
fetch('./SeccionSostenedorReact/index?json=' + json, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
if (data.Redirect === "ListarSeccionSostenedorReact") {
window.location.href = "/SeccionSostenedorReact/ListarSeccionSostenedorReact?RutSostenedor=" + data.RutSostenedor;
} else
{
setResult((result) => + " " + data.MensajeError);
}
})
.catch((err) => {
console.log(err.message);
});
spinnerBorderEl.style.display = 'none';
}
} catch (ex) {
}
};
function focus(e) {
//e.preventDefault();
try {
//alert('amska');
} catch (ex) {
}
};
return (
)
}
function ListarSeccionSostenedorReact(idSostenedor) {
const [informesGastosMensuales, setInformesGastosMensuales] = React.useState(undefined);
const [informesGastosMensualesMineduc, setInformesGastosMensualesMineduc] = React.useState(undefined);
let id = idSostenedor.IdSostenedor;
React.useEffect(() => {
Mineduc()
mensuales()
},[])
function Mineduc() {
fetch('/SeccionSostenedorReact/ListaInformeMineduc?idSostenedor=' + id, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((datanew) => {
console.log(datanew);
setInformesGastosMensualesMineduc(datanew)
})
.catch((err) => {
console.log(err.message);
});
console.log("informesGastosMensualesMineduc" + informesGastosMensualesMineduc)
}
const PDF = (url) => {
window.open(url);
}
const mensuales = () => {
fetch('/SeccionSostenedorReact/ListaInformeMensual?idSostenedor=' + id, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
setInformesGastosMensuales(data)
})
.catch((err) => {
console.log(err.message);
})
console.log("informesGastosMensuales " + informesGastosMensuales)
}
const PintarMineduc = () => {
Mineduc()
return (informesGastosMensualesMineduc === undefined ?
<>
Loading...
|
>
: informesGastosMensualesMineduc.map((i) => (
{i.Periodo} |
{i.NumeroEmpleados} |
{i.TotalImponible} |
|
)))
}
const PintarMesual = () => {
mensuales()
return (informesGastosMensuales === undefined ?
<>
Loading...
|
>
: informesGastosMensuales.map((i) => (
{i.NombreColegio} |
{i.NombreMesAño} |
{i.TotalHaberes} |
{i.TotalMesAnterior} |
|
)))
}
const pdfMensual = (periodo,idColegio) => {
fetch('/SeccionSostenedorReact/GetInformeGastosMensuales?idColegio=' + idColegio + "&periodo=" + periodo, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
window.open(data, '_blank');
})
.catch((err) => {
console.log(err.message);
})
console.log("GetInformeGastosMensual " + informesGastosMensuales)
}
const pdfMineduc = (periodo) => {
fetch('/SeccionSostenedorReact/GetInformeGastosMensualesMineduc?idSostenedor=' + id + "&perioro=" + periodo, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.text())
.then((data) => {
console.log(data);
window.open(data, '_blank');
})
.catch((err) => {
console.log(err.message);
})
console.log("GetInformeGastosMensualesMineduc " + informeGastosMensualesMineduc)
}
return (
Colegio |
Periodo |
Total Haberes |
Mes Anterior |
{PintarMesual()}
Periodo |
Cant. Empleados |
Total Imponible |
|
{PintarMineduc()}
)
}