Commit 2af7d98c by Luciano Barletta

user changes

- swapped pdfs
- removed dynamic weight
- fixed pdf buttons
- changed some names
- fixed bug where string default values could be NaN
1 parent d45feb5a
......@@ -41,7 +41,7 @@ Al fondo de la página habrá un campo "Por defecto" que contiene el texto que t
Al terminar de escribir los datos, se pueden convertir a PDF con los dos botones del final. La conversión a PDF se puede realizar tantas veces como se quiera, modificando datos cada vez si hubo un error. Tener en cuenta que realizar la recolección de datos de la misma patente cambiará algunos datos generados automáticamente.
El botón 1 genera el documento simplificado, el botón 2 genera el documento complejo. Cualquiera (o los dos) pueden ser generados. Luego de generados se pueden guardar o imprimir.
El botón 1 genera el documento de la linea 1, el botón 2 genera el documento de la linea 2. Cualquiera (o los dos) pueden ser generados. Luego de generados se pueden guardar o imprimir.
*Nota: El signo de pregunta significa que no se pudo recoletar el dato de la página.
......
......@@ -121,8 +121,7 @@ def readdata(s, r):
# suspension
for i in range(2):
sus = {}
sus[f'peso_dinamico_{i + 1}'] = empty_for_question(attempt_do(reach(f"pesoBascula-{i}"), default = "?")(s))
sus[f'peso_estatico_{i + 1}'] = empty_for_question(attempt_do(reach(f"pesoMaximo-{i}"), default = "?")(s))
sus[f'peso_estatico_{i + 1}'] = empty_for_question(attempt_do(reach(f"pesoBascula-{i}"), default = "?")(s))
r['suspension'].update(sus)
......@@ -130,8 +129,7 @@ def readdata(s, r):
frenos = s.find(SI.By.XPATH, "//table[@class='tabla_ensayo']/tbody//tr[@class='odd' or @class='even']","1-4")
for i in range(4):
fre = {}
fre[f'peso_dinamico_{i + 1}'] = empty_for_question(attempt_do(reach(f"pesoBascula-{i}"), default = "?")(s))
fre[f'peso_estatico_{i + 1}'] = empty_for_question(attempt_do(reach(f"pesoMaximo-{i}"), default = "?")(s))
fre[f'peso_estatico_{i + 1}'] = empty_for_question(attempt_do(reach(f"pesoBascula-{i}"), default = "?")(s))
fre[f'fuerza_izquierda_{i + 1}'] = empty_for_question(attempt_do(reach(f"fuerzaIzq-{i}"), default = "?")(s))
fre[f'fuerza_derecha_{i + 1}'] = empty_for_question(attempt_do(reach(f"fuerzaDer-{i}"), default = "?")(s))
......@@ -139,8 +137,7 @@ def readdata(s, r):
# freno trasero
r['trasero']['peso_dinamico'] = empty_for_question(attempt_do(reach(f"pesoBasculaEst-0"), default = "?")(s))
r['trasero']['peso_estatico'] = empty_for_question(attempt_do(reach(f"pesoMaximoEst-0"), default = "?")(s))
r['trasero']['peso_estatico'] = empty_for_question(attempt_do(reach(f"pesoBasculaEst-0"), default = "?")(s))
r['trasero']['fuerza_izquierda'] = empty_for_question(attempt_do(reach(f"fuerzaIzqEst-0"), default = "?")(s))
r['trasero']['fuerza_derecha'] = empty_for_question(attempt_do(reach(f"fuerzaDerEst-0"), default = "?")(s))
r['trasero']['eje'] = empty_for_question(attempt_do(reach(f"nroEjeEst-0"), default = "?")(s))
......
......@@ -85,9 +85,6 @@ class Text {
*/
draw(pdf) {
/** replace ? with 0s (temporary) **/
if (this.text == "?") this.text = "0.000";
if (this.font){
pdf.setFont(this.font.font);
pdf.setFontType(this.font.type);
......
......@@ -2,7 +2,6 @@ class PDF1 {
"use strict";
constructor() {
/** Coordinate container that occupies the whole page **/
this.A4 = new Div(
......@@ -11,13 +10,52 @@ class PDF1 {
);
this.containerSize = 86;
this.font = {
"font": "courier",
this.body = {
"font": "times",
"type": "normal",
"size": 10
};
this.title = {
"font": "times",
"type": "bold",
"size": 11
};
this.subtitle = {
"font": "times",
"type": "bold",
"size": 10
};
this.line = () => new Line(
new Vector(Pos.beg_margin, Pos.end),
new Vector(Pos.end_margin + 3, Pos.end)
);
}
_getdata(data, op, n) {
switch (op.toLowerCase()) {
case "fi":
op = "fuerza_izquierda";break;
case "fd":
op = "fuerza_derecha";break;
case "ri":
op = "resistencia_izquierda";break;
case "rd":
op = "resistencia_derecha";break;
case "oi":
op = "ovalidad_izquierda";break;
case "od":
op = "ovalidad_derecha";break;
case "pe":
op = "peso_estatico";break;
case "pd":
op = "peso_dinamico";break;
}
return data[op + "_" + n];
}
pdf(data) {
/**
......@@ -27,12 +65,13 @@ class PDF1 {
*/
const pdfthis = this;
const functionMapping = [
(pointer, data) => pdfthis.mahaToPDF(pointer, data['header']),
(pointer, data) => pdfthis.headerToPDF(pointer, data['header']),
(pointer, data) => pdfthis.alineadorToPDF(pointer, data['alineador']),
(pointer, data) => pdfthis.suspensionToPDF(pointer, data['suspension']),
(pointer, data) => pdfthis.frenosToPDF(pointer, data['frenos']),
(pointer, data) => pdfthis.traseroToPDF(pointer, data['trasero']),
(pointer, data) => pdfthis.gaseshumosToPDF(pointer, data['gaseshumos'])
(pointer, data) => pdfthis.frenosToPDF(pointer, data),
(pointer, data) => pdfthis.gaseshumosToPDF(pointer, data['gaseshumos']),
(pointer, data) => pdfthis.footerToPDF(pointer, data)
];
/**
......@@ -47,180 +86,405 @@ class PDF1 {
return this.A4;
}
headerToPDF(pointer, data) {
mahaToPDF(pointer, data) {
const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 3)));
const maha = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 6)));
header.addRelativeChildren([
new Text("Dominio: " + data['patente'], new Vector(Pos.beg_margin, Pos.two_thirds), this.font),
maha.addRelativeChildren([
this.line(),
new Text("Fecha: " + data['fecha'], new Vector(Pos.third, Pos.two_thirds), this.font)
new Text(
["MAHA","EUROSYSTEM","Bitte hier Ihre","Anschrift eintragen"],
new Vector(Pos.middle, Pos.quarter),
this.body,
"center"
),
new Text(
["EUROSYSTEM","V 3.18.009",data['fecha']],
new Vector(Pos.end_margin - 7, Pos.third + 5),
this.body,
"right"
),
new Image(
document.getElementById("maha"),
new Vector(Pos.end - 12, Pos.beg_margin),
new Vector(10, Pos.end_margin - 5)
)
]);
return pointer.addxy(0, 3);
return pointer.addxy(0,6);
}
alineadorToPDF(pointer, data) {
headerToPDF(pointer, data) {
const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5)));
const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 10)));
alineador.addRelativeChildren([
new Text("Resultado Pruebas en Banco de Alineador al Paso", new Vector(Pos.beg_margin + 2, Pos.third), this.font),
const body_black = {
"font" : "times",
"type" : "bold",
"size" : 9
};
new Text("Eje Delantero", new Vector(Pos.beg_margin + 2, Pos.two_thirds), this.font),
header.addRelativeChildren([
new Text(data['eje_delantero'], new Vector(Pos.quarter, Pos.two_thirds), this.font)
this.line(),
new Text(
[
"Nombre/Empresa:",
"Calle:",
"CP:Ciudad:",
"Teléfono:",
`Fecha de Prueba:\t${data['fecha']}`,
"Hora de Prueba:",
"Estado de Carga:\tVacio"
],
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 10),
body_black
),
new Text(
[
`Matrícula:\t${data['patente']}`,
"Kilometraje:",
"Matriculación:",
"Fabricante:",
"Tipo de Vehic.:",
"Nº motor:",
"Cantidad de Ejes:\t0"
],
new Vector(Pos.two_thirds, Pos.beg_margin + 10),
body_black
)
]);
return pointer.addxy(0, 5);
return pointer.addxy(0, 10);
}
suspensionToPDF(pointer, data) {
const suspension = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 15)));
alineadorToPDF(pointer, data) {
const divsize = new Vector(this.containerSize, Pos.middle);
const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 6)));
const ejes = suspension.addRelativeChildren([
new Div(new Vector(Pos.beg_margin + 2, Pos.beg), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.middle), divsize)
]);
alineador.addRelativeChildren([
const table = (container, eje, RI, peso, RD) => {
this.line(),
container.addRelativeChildren([
new Text(`Resultado Pruebas en Banco de Suspensión - Eje ${eje}`, new Vector(0, Pos.third, ), this.font),
new Text(
"Alineador al Paso",
new Vector(Pos.beg_margin + 5, Pos.third),
this.title
),
new Text("Rendimiento Izquierdo", new Vector(Pos.beg, Pos.two_thirds), this.font),
new Text(
`Eje delantero\t${data['eje_delantero']} m/km\t\tEje trasero\t--- m/km`,
new Vector(Pos.beg_margin + 5, Pos.two_thirds),
this.body
)
]);
new Text(RI, new Vector(Pos.beg + 10, Pos.end, ), this.font),
return pointer.addxy(0, 6);
}
new Text("Peso Total del Eje", new Vector(Pos.middle - 10, Pos.two_thirds), this.font),
suspensionToPDF(pointer, data) {
new Text(peso, new Vector(Pos.middle - 3, Pos.end), this.font),
const suspension = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 8)));
new Text("Rendimiento Derecho", new Vector(Pos.three_quarters - 5, Pos.two_thirds), this.font),
const tiny_body = {
"font" : "times",
"type" : "normal",
"size" : 9
}
new Text(RD, new Vector(Pos.three_quarters + 5, Pos.end), this.font)
suspension.addRelativeChildren([
this.line(),
new Text(
"Bco. de Suspensiones",
new Vector(Pos.beg_margin + 5, Pos.third),
this.title
),
new Text(
["Eje delantero", "Eje trasero"],
new Vector(Pos.beg_margin + 5, Pos.two_thirds),
this.subtitle
),
new Text(
["Izq.", "--- Mm", "--- Mm"],
new Vector(30, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Der.", "--- Mm", "--- Mm"],
new Vector(45, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Izq.", `${data['rendimiento_izquierdo_1']} %`, `${data['rendimiento_izquierdo_2']} %`],
new Vector(60, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Der.", `${data['rendimiento_derecho_1']} %`, `${data['rendimiento_derecho_2']} %`],
new Vector(75, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Peso", `${data['peso_estatico_1']} kg`],
new Vector(90, Pos.middle + 5),
tiny_body,
"center"
)
]);
};
for (let i = 0; i < 2; i++) {
table(
ejes[i],
i + 1,
data[`rendimiento_izquierdo_${i+1}`],
data[`peso_estatico_${i+1}`],
data[`rendimiento_derecho_${i+1}`]
);
}
return pointer.addxy(0, 15);
return pointer.addxy(0, 8);
}
frenosToPDF(pointer, data) {
const frenos = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 60)));
const frenos = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 30)));
frenos.addRelativeChild(this.line());
const divsize = new Vector(this.containerSize, Pos.quarter);
const pruebas = frenos.addRelativeChild(new Div(new Vector(Pos.beg, Pos.beg), new Vector(Pos.end, Pos.middle + 10)));
const evaluacion = frenos.addRelativeChild(new Div(new Vector(Pos.beg, Pos.middle + 10), new Vector(Pos.end, Pos.middle - 10)));
const ejes = frenos.addRelativeChildren([
new Div(new Vector(Pos.beg_margin + 2, Pos.beg), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.quarter), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.middle), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.three_quarters), divsize)
const tiny_body = {
"font": "times",
"type": "normal",
"size": 9
}
pruebas.addRelativeChildren([
new Text(
"Frenómetro",
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 5),
this.title
),
new Text(
"Prueba de Frenado",
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 15),
this.subtitle
),
new Line(
new Vector(Pos.beg_margin + 5, Pos.quarter + 18),
new Vector(Pos.end_margin - 5, Pos.quarter + 18)
),
new Text(
["","", "1.FS", "2.FS", "3.FS", "4.FS", `${data['trasero']['eje']}.FE`],
new Vector(Pos.beg_margin + 5, Pos.quarter + 12),
tiny_body
),
new Text(
"Resist.Rodadura [kN]",
new Vector(21, Pos.quarter + 5),
tiny_body
),
new Text(
"Fuerza de Frenado [kN]",
new Vector(40, Pos.quarter + 5),
tiny_body
),
new Text(
"Ovalidad [kN]",
new Vector(60.5, Pos.quarter + 5),
tiny_body
),
new Text(
"Peso [kg]",
new Vector(79, Pos.quarter + 5),
tiny_body
),
]);
const table = (container, eje, FI, RI, OI, peso, FD, RD, OD) => {
const freno = (title, data, access, position) => {
container.addRelativeChildren([
new Text(`Diagnóstico de Frenos - Eje ${eje}`, new Vector(Pos.beg, Pos.beg_margin + 10), this.font),
const f = data['frenos'];
const t = data['trasero'][access] === undefined ? "---" : data['trasero'][access];
new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.quarter), this.font),
return new Text(
[title, "", f[access + "_1"], f[access + "_2"], f[access + "_3"], f[access + "_4"], t],
position,
tiny_body,
"center"
)
}
new Text(`${FI}`, new Vector(Pos.beg_margin + 3, Pos.quarter + 10), this.font),
const eje = (data, position) => {
new Text("Res.Rodadura IZ", new Vector(Pos.beg_margin, Pos.middle), this.font),
const sum = (data, access1, access2) => {
const a = parseFloat(data[access1]);
const b = parseFloat(data[access2]);
new Text(`${RI}`, new Vector(Pos.beg_margin + 3, Pos.middle + 10), this.font),
if (isNaN(a)) return data[access1];
if (isNaN(b)) return data[access2];
new Text("Ovalidad IZ", new Vector(Pos.beg_margin, Pos.three_quarters), this.font),
return (a + b).toFixed(2);
}
const f = data['frenos'];
const t = data['trasero'];
return new Text(
[
"Eje", "",
`${sum(f,"fuerza_izquierda_1","fuerza_derecha_1")}`,
`${sum(f,"fuerza_izquierda_2","fuerza_derecha_2")}`,
`${sum(f,"fuerza_izquierda_3","fuerza_derecha_3")}`,
`${sum(f,"fuerza_izquierda_4","fuerza_derecha_4")}`,
`${sum(t,"fuerza_izquierda","fuerza_derecha")}`,
],
position,
tiny_body,
"center"
)
}
new Text(`${OI}`, new Vector(Pos.beg_margin + 3, Pos.three_quarters + 10), this.font),
const fuerzas = eje(data, new Vector(53, Pos.quarter + 12));
new Text("Peso del Eje", new Vector(Pos.middle - 10, Pos.quarter), this.font),
const peso = freno("Total", data, "peso_estatico", new Vector(82, Pos.quarter + 12));
new Text(`${peso}`, new Vector(Pos.middle - 5, Pos.quarter + 10), this.font),
pruebas.addRelativeChildren([
new Text("Fuerza DE", new Vector(Pos.three_quarters, Pos.quarter), this.font),
freno("Izq.", data, "resistencia_izquierda", new Vector(24, Pos.quarter + 12)),
new Text(`${FD}`, new Vector(Pos.three_quarters + 3, Pos.quarter + 10), this.font),
freno("Der.", data, "resistencia_derecha", new Vector(30, Pos.quarter + 12)),
new Text("Res.Rodadura DE", new Vector(Pos.three_quarters, Pos.middle), this.font),
freno("Izq.", data, "fuerza_izquierda", new Vector(42, Pos.quarter + 12)),
new Text(`${RD}`, new Vector(Pos.three_quarters + 3, Pos.middle + 10), this.font),
freno("Der.", data, "fuerza_derecha", new Vector(48, Pos.quarter + 12)),
new Text("Ovalidad DE", new Vector(Pos.three_quarters, Pos.three_quarters), this.font),
fuerzas,
new Text(`${OD}`, new Vector(Pos.three_quarters + 3, Pos.three_quarters + 10), this.font)
freno("Izq.", data, "ovalidad_izquierda", new Vector(62, Pos.quarter + 12)),
freno("Der.", data, "ovalidad_derecha", new Vector(68, Pos.quarter + 12)),
peso,
]);
};
for (let i = 0; i < ejes.length; i++) {
table(
ejes[i],
i + 1,
data[`fuerza_izquierda_${i + 1}`],
data[`resistencia_izquierda_${i + 1}`],
data[`ovalidad_izquierda_${i + 1}`],
data[`peso_estatico_${i + 1}`],
data[`fuerza_derecha_${i + 1}`],
data[`resistencia_derecha_${i + 1}`],
data[`ovalidad_derecha_${i + 1}`]
);
}
const sumtext = (text) => {
const a = parseFloat(text[2]);
const b = parseFloat(text[3]);
const c = parseFloat(text[4]);
const d = parseFloat(text[5]);
return pointer.addxy(0, 60);
if (isNaN(a)) return text[2];
if (isNaN(b)) return text[3];
if (isNaN(c)) return text[4];
if (isNaN(d)) return text[5];
return (a + b + c + d).toFixed(2);
}
traseroToPDF(pointer, data) {
evaluacion.addRelativeChildren([
new Text(
"Evaluación Final",
new Vector(Pos.beg_margin + 5, Pos.beg_margin),
this.subtitle
),
new Text(
["Freno de Servicio (FS)", "Freno de Estacionamiento (FE)"],
new Vector(Pos.beg_margin + 5, Pos.quarter + 10),
this.body
),
new Text(
[
"Fuerza de frenado máx. [kN]",
`${sumtext(fuerzas.text)}`,
fuerzas.text[6]
],
new Vector(Pos.middle, Pos.quarter),
this.body,
"center"
),
new Text(
`Peso total:\t${sumtext(peso.text)} kg`,
new Vector(Pos.beg_margin + 5, Pos.three_quarters),
this.body
)
]);
const trasero = this.A4.addRelativeChild(new Div(pointer.addxy(Pos.beg_margin + 2, 0), new Vector(this.containerSize, 9)));
return pointer.addxy(0, 30);
}
trasero.addRelativeChildren([
gaseshumosToPDF(pointer, data) {
new Text("Diagnóstico de Frenos - Eje Trasero - Frenos de Mano", new Vector(Pos.beg, Pos.third, ), this.font),
const gases = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 6)));
new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.two_thirds), this.font),
const tiny_body = {
"font": "times",
"type": "normal",
"size": 9
}
new Text(data['fuerza_izquierda'], new Vector(Pos.beg_margin, Pos.end), this.font),
gases.addRelativeChildren([
new Text("Fuerza DE", new Vector(Pos.three_quarters, Pos.two_thirds), this.font),
this.line(),
new Text(data['fuerza_derecha'], new Vector(Pos.three_quarters, Pos.end), this.font),
new Text(
"Gases",
new Vector(Pos.beg_margin + 5, Pos.third),
this.title
),
new Text(
`k medio\t${data['opacidad_logaritmica']} l/m\tOC:\t${data['oc']}\tHC:\t${data['hc']}`,
new Vector(Pos.beg_margin + 5, Pos.two_thirds),
tiny_body
),
]);
return pointer.addxy(0, 9);
return pointer.addxy(0,6);
}
gaseshumosToPDF(pointer, data) {
const gaseshumos = this.A4.addRelativeChild(new Div(pointer.addxy(Pos.beg_margin + 2, 0), new Vector(this.containerSize, 9)));
gaseshumos.addRelativeChildren([
footerToPDF(pointer, data) {
new Text("Resultado Analizador de Gases", new Vector(Pos.beg, Pos.third), this.font),
const footer = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 30)));
new Text("Resultado Analizador de Humos", new Vector(Pos.two_thirds, Pos.third), this.font),
footer.addRelativeChildren([
new Text(`CO ${data['co']} % HC ${data['hc']} ppm`, new Vector(Pos.beg, Pos.two_thirds), this.font),
this.line(),
new Text(`Medición ${data['opacidad_logaritmica']}`, new Vector(Pos.three_quarters, Pos.two_thirds), this.font)
new Text(
"Inspector:",
new Vector(Pos.quarter - 5, Pos.end_margin),
this.subtitle,
"center"
),
new Text(
"Firma:.........................",
new Vector(Pos.three_quarters, Pos.end_margin),
this.subtitle,
"center"
)
]);
return pointer.addxy(0, 9);
return pointer.addxy(0,30);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ class PDF2 {
"use strict";
constructor() {
/** Coordinate container that occupies the whole page **/
this.A4 = new Div(
......@@ -10,52 +11,13 @@ class PDF2 {
);
this.containerSize = 86;
this.body = {
"font": "times",
this.font = {
"font": "courier",
"type": "normal",
"size": 10
};
this.title = {
"font": "times",
"type": "bold",
"size": 11
};
this.subtitle = {
"font": "times",
"type": "bold",
"size": 10
};
this.line = () => new Line(
new Vector(Pos.beg_margin, Pos.end),
new Vector(Pos.end_margin + 3, Pos.end)
);
}
_getdata(data, op, n) {
switch (op.toLowerCase()) {
case "fi":
op = "fuerza_izquierda";break;
case "fd":
op = "fuerza_derecha";break;
case "ri":
op = "resistencia_izquierda";break;
case "rd":
op = "resistencia_derecha";break;
case "oi":
op = "ovalidad_izquierda";break;
case "od":
op = "ovalidad_derecha";break;
case "pe":
op = "peso_estatico";break;
case "pd":
op = "peso_dinamico";break;
}
return data[op + "_" + n];
}
pdf(data) {
/**
......@@ -65,13 +27,12 @@ class PDF2 {
*/
const pdfthis = this;
const functionMapping = [
(pointer, data) => pdfthis.mahaToPDF(pointer, data['header']),
(pointer, data) => pdfthis.headerToPDF(pointer, data['header']),
(pointer, data) => pdfthis.alineadorToPDF(pointer, data['alineador']),
(pointer, data) => pdfthis.suspensionToPDF(pointer, data['suspension']),
(pointer, data) => pdfthis.frenosToPDF(pointer, data),
(pointer, data) => pdfthis.gaseshumosToPDF(pointer, data['gaseshumos']),
(pointer, data) => pdfthis.footerToPDF(pointer, data)
(pointer, data) => pdfthis.frenosToPDF(pointer, data['frenos']),
(pointer, data) => pdfthis.traseroToPDF(pointer, data['trasero']),
(pointer, data) => pdfthis.gaseshumosToPDF(pointer, data['gaseshumos'])
];
/**
......@@ -86,417 +47,180 @@ class PDF2 {
return this.A4;
}
mahaToPDF(pointer, data) {
const maha = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 6)));
maha.addRelativeChildren([
this.line(),
headerToPDF(pointer, data) {
new Text(
["MAHA","EUROSYSTEM","Bitte hier Ihre","Anschrift eintragen"],
new Vector(Pos.middle, Pos.quarter),
this.body,
"center"
),
const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 3)));
new Text(
["EUROSYSTEM","V 3.18.009",data['fecha']],
new Vector(Pos.end_margin - 7, Pos.third + 5),
this.body,
"right"
),
header.addRelativeChildren([
new Text("Dominio: " + data['patente'], new Vector(Pos.beg_margin, Pos.two_thirds), this.font),
new Image(
document.getElementById("maha"),
new Vector(Pos.end - 12, Pos.beg_margin),
new Vector(10, Pos.end_margin - 5)
)
new Text("Fecha: " + data['fecha'], new Vector(Pos.third, Pos.two_thirds), this.font)
]);
return pointer.addxy(0,6);
return pointer.addxy(0, 3);
}
headerToPDF(pointer, data) {
alineadorToPDF(pointer, data) {
const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 10)));
const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5)));
const body_black = {
"font" : "times",
"type" : "bold",
"size" : 9
};
alineador.addRelativeChildren([
new Text("Resultado Pruebas en Banco de Alineador al Paso", new Vector(Pos.beg_margin + 2, Pos.third), this.font),
header.addRelativeChildren([
new Text("Eje Delantero", new Vector(Pos.beg_margin + 2, Pos.two_thirds), this.font),
this.line(),
new Text(
[
"Nombre/Empresa:",
"Calle:",
"CP:Ciudad:",
"Teléfono:",
`Fecha de Prueba:\t${data['fecha']}`,
"Hora de Prueba:",
"Estado de Carga:\tVacio"
],
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 10),
body_black
),
new Text(
[
`Matrícula:\t${data['patente']}`,
"Kilometraje:",
"Matriculación:",
"Fabricante:",
"Tipo de Vehic.:",
"Nº motor:",
"Cantidad de Ejes:\t0"
],
new Vector(Pos.two_thirds, Pos.beg_margin + 10),
body_black
)
new Text(data['eje_delantero'], new Vector(Pos.quarter, Pos.two_thirds), this.font)
]);
return pointer.addxy(0, 10);
return pointer.addxy(0, 5);
}
alineadorToPDF(pointer, data) {
suspensionToPDF(pointer, data) {
const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 6)));
const suspension = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 15)));
alineador.addRelativeChildren([
const divsize = new Vector(this.containerSize, Pos.middle);
this.line(),
const ejes = suspension.addRelativeChildren([
new Div(new Vector(Pos.beg_margin + 2, Pos.beg), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.middle), divsize)
]);
new Text(
"Alineador al Paso",
new Vector(Pos.beg_margin + 5, Pos.third),
this.title
),
const table = (container, eje, RI, peso, RD) => {
new Text(
`Eje delantero\t${data['eje_delantero']} m/km\t\tEje trasero\t--- m/km`,
new Vector(Pos.beg_margin + 5, Pos.two_thirds),
this.body
)
]);
container.addRelativeChildren([
new Text(`Resultado Pruebas en Banco de Suspensión - Eje ${eje}`, new Vector(0, Pos.third, ), this.font),
return pointer.addxy(0, 6);
}
new Text("Rendimiento Izquierdo", new Vector(Pos.beg, Pos.two_thirds), this.font),
suspensionToPDF(pointer, data) {
new Text(RI, new Vector(Pos.beg + 10, Pos.end, ), this.font),
const suspension = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 8)));
new Text("Peso Total del Eje", new Vector(Pos.middle - 10, Pos.two_thirds), this.font),
const tiny_body = {
"font" : "times",
"type" : "normal",
"size" : 9
}
new Text(peso, new Vector(Pos.middle - 3, Pos.end), this.font),
new Text("Rendimiento Derecho", new Vector(Pos.three_quarters - 5, Pos.two_thirds), this.font),
suspension.addRelativeChildren([
this.line(),
new Text(
"Bco. de Suspensiones",
new Vector(Pos.beg_margin + 5, Pos.third),
this.title
),
new Text(
["Eje delantero", "Eje trasero"],
new Vector(Pos.beg_margin + 5, Pos.two_thirds),
this.subtitle
),
new Text(
["Izq.", "0 Mm", "0 Mm"],
new Vector(25, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Der.", "0 Mm", "0 Mm"],
new Vector(35, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Dif.", "0 %", "0 %"],
new Vector(45, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Izq.", "0 %", "0 %"],
new Vector(55, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Der.", "0 %", "0 %"],
new Vector(65, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["Dif.", "0 %", "0 %"],
new Vector(75, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["estat.", `${data['peso_estatico_1']} kg`, `${data['peso_dinamico_1']} kg`],
new Vector(85, Pos.middle + 5),
tiny_body,
"center"
),
new Text(
["dinam.", `${data['peso_estatico_2']} kg`, `${data['peso_dinamico_2']} kg`],
new Vector(95, Pos.middle + 5),
tiny_body,
"center"
)
new Text(RD, new Vector(Pos.three_quarters + 5, Pos.end), this.font)
]);
};
return pointer.addxy(0, 8);
for (let i = 0; i < 2; i++) {
table(
ejes[i],
i + 1,
data[`rendimiento_izquierdo_${i+1}`],
data[`peso_estatico_${i+1}`],
data[`rendimiento_derecho_${i+1}`]
);
}
frenosToPDF(pointer, data) {
return pointer.addxy(0, 15);
}
const frenos = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 30)));
frenos.addRelativeChild(this.line());
frenosToPDF(pointer, data) {
const pruebas = frenos.addRelativeChild(new Div(new Vector(Pos.beg, Pos.beg), new Vector(Pos.end, Pos.middle + 10)));
const evaluacion = frenos.addRelativeChild(new Div(new Vector(Pos.beg, Pos.middle + 10), new Vector(Pos.end, Pos.middle - 10)));
const frenos = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 60)));
const tiny_body = {
"font": "times",
"type": "normal",
"size": 9
}
const divsize = new Vector(this.containerSize, Pos.quarter);
pruebas.addRelativeChildren([
new Text(
"Frenómetro",
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 5),
this.title
),
new Text(
"Prueba de Frenado",
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 15),
this.subtitle
),
new Line(
new Vector(Pos.beg_margin + 5, Pos.quarter + 18),
new Vector(Pos.end_margin - 5, Pos.quarter + 18)
),
new Text(
["","", "1.FS", "2.FS", "3.FS", "4.FS", `${data['trasero']['eje']}.FE`],
new Vector(Pos.beg_margin + 5, Pos.quarter + 12),
tiny_body
),
new Text(
"Resist.Rodadura [kN]",
new Vector(21, Pos.quarter + 5),
tiny_body
),
new Text(
"Fuerza de Frenado [kN]",
new Vector(40, Pos.quarter + 5),
tiny_body
),
new Text(
"Ovalidad [kN]",
new Vector(60.5, Pos.quarter + 5),
tiny_body
),
new Text(
"Peso [kg]",
new Vector(79, Pos.quarter + 5),
tiny_body
),
const ejes = frenos.addRelativeChildren([
new Div(new Vector(Pos.beg_margin + 2, Pos.beg), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.quarter), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.middle), divsize),
new Div(new Vector(Pos.beg_margin + 2, Pos.three_quarters), divsize)
]);
const freno = (title, data, access, position) => {
const f = data['frenos'];
const t = data['trasero'][access] === undefined ? "---" : data['trasero'][access];
const table = (container, eje, FI, RI, OI, peso, FD, RD, OD) => {
return new Text(
[title, "", f[access + "_1"], f[access + "_2"], f[access + "_3"], f[access + "_4"], t],
position,
tiny_body,
"center"
)
}
container.addRelativeChildren([
new Text(`Diagnóstico de Frenos - Eje ${eje}`, new Vector(Pos.beg, Pos.beg_margin + 10), this.font),
const eje = (data, position) => {
const sum = (data, access1, access2) => (parseFloat(data[access1]) + parseFloat(data[access2])).toFixed(2);
const f = data['frenos'];
const t = data['trasero'];
return new Text(
[
"Eje", "",
`${sum(f,"fuerza_izquierda_1","fuerza_derecha_1")}`,
`${sum(f,"fuerza_izquierda_2","fuerza_derecha_2")}`,
`${sum(f,"fuerza_izquierda_3","fuerza_derecha_3")}`,
`${sum(f,"fuerza_izquierda_4","fuerza_derecha_4")}`,
`${sum(t,"fuerza_izquierda","fuerza_derecha")}`,
],
position,
tiny_body,
"center"
)
}
new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.quarter), this.font),
const fuerzas = eje(data, new Vector(53, Pos.quarter + 12));
new Text(`${FI}`, new Vector(Pos.beg_margin + 3, Pos.quarter + 10), this.font),
const estat = freno("estat.", data, "peso_estatico", new Vector(78, Pos.quarter + 12));
new Text("Res.Rodadura IZ", new Vector(Pos.beg_margin, Pos.middle), this.font),
const dinam = freno("dinam.", data, "peso_dinamico", new Vector(86, Pos.quarter + 12));
new Text(`${RI}`, new Vector(Pos.beg_margin + 3, Pos.middle + 10), this.font),
pruebas.addRelativeChildren([
new Text("Ovalidad IZ", new Vector(Pos.beg_margin, Pos.three_quarters), this.font),
freno("Izq.", data, "resistencia_izquierda", new Vector(24, Pos.quarter + 12)),
new Text(`${OI}`, new Vector(Pos.beg_margin + 3, Pos.three_quarters + 10), this.font),
freno("Der.", data, "resistencia_derecha", new Vector(30, Pos.quarter + 12)),
new Text("Peso del Eje", new Vector(Pos.middle - 10, Pos.quarter), this.font),
freno("Izq.", data, "fuerza_izquierda", new Vector(42, Pos.quarter + 12)),
new Text(`${peso}`, new Vector(Pos.middle - 5, Pos.quarter + 10), this.font),
freno("Der.", data, "fuerza_derecha", new Vector(48, Pos.quarter + 12)),
new Text("Fuerza DE", new Vector(Pos.three_quarters, Pos.quarter), this.font),
fuerzas,
new Text(`${FD}`, new Vector(Pos.three_quarters + 3, Pos.quarter + 10), this.font),
freno("Izq.", data, "ovalidad_derecha", new Vector(62, Pos.quarter + 12)),
new Text("Res.Rodadura DE", new Vector(Pos.three_quarters, Pos.middle), this.font),
freno("Der.", data, "ovalidad_derecha", new Vector(68, Pos.quarter + 12)),
new Text(`${RD}`, new Vector(Pos.three_quarters + 3, Pos.middle + 10), this.font),
estat,
new Text("Ovalidad DE", new Vector(Pos.three_quarters, Pos.three_quarters), this.font),
dinam
new Text(`${OD}`, new Vector(Pos.three_quarters + 3, Pos.three_quarters + 10), this.font)
]);
};
const sumtext = (text) =>
`${
(parseFloat(text[2]) +
parseFloat(text[3]) +
parseFloat(text[4]) +
parseFloat(text[5])).toFixed(2)
}`
evaluacion.addRelativeChildren([
new Text(
"Evaluación Final",
new Vector(Pos.beg_margin + 5, Pos.beg_margin),
this.subtitle
),
new Text(
["Freno de Servicio (FS)", "Freno de Estacionamiento (FE)"],
new Vector(Pos.beg_margin + 5, Pos.quarter + 10),
this.body
),
new Text(
[
"Fuerza de frenado máx. [kN]",
sumtext(fuerzas.text),
fuerzas.text[6]
],
new Vector(Pos.middle, Pos.quarter),
this.body,
"center"
),
new Text(
`Peso estático:\t${sumtext(estat.text)} kg\tPeso dinámico:\t${sumtext(dinam.text)} kg`,
new Vector(Pos.beg_margin + 5, Pos.three_quarters),
this.body
)
]);
for (let i = 0; i < ejes.length; i++) {
table(
ejes[i],
i + 1,
data[`fuerza_izquierda_${i + 1}`],
data[`resistencia_izquierda_${i + 1}`],
data[`ovalidad_izquierda_${i + 1}`],
data[`peso_estatico_${i + 1}`],
data[`fuerza_derecha_${i + 1}`],
data[`resistencia_derecha_${i + 1}`],
data[`ovalidad_derecha_${i + 1}`]
);
}
return pointer.addxy(0, 30);
return pointer.addxy(0, 60);
}
gaseshumosToPDF(pointer, data) {
traseroToPDF(pointer, data) {
const gases = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 6)));
const trasero = this.A4.addRelativeChild(new Div(pointer.addxy(Pos.beg_margin + 2, 0), new Vector(this.containerSize, 9)));
const tiny_body = {
"font": "times",
"type": "normal",
"size": 9
}
trasero.addRelativeChildren([
new Text("Diagnóstico de Frenos - Eje Trasero - Frenos de Mano", new Vector(Pos.beg, Pos.third, ), this.font),
new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.two_thirds), this.font),
gases.addRelativeChildren([
new Text(data['fuerza_izquierda'], new Vector(Pos.beg_margin, Pos.end), this.font),
this.line(),
new Text("Fuerza DE", new Vector(Pos.three_quarters, Pos.two_thirds), this.font),
new Text(
"Opacímetro",
new Vector(Pos.beg_margin + 5, Pos.third),
this.title
),
new Text(data['fuerza_derecha'], new Vector(Pos.three_quarters, Pos.end), this.font),
new Text(
`k medio\t${data['opacidad_logaritmica']} l/m\tOC:\t${data['oc']}\tHC:\t${data['hc']}`,
new Vector(Pos.beg_margin + 5, Pos.two_thirds),
tiny_body
),
]);
return pointer.addxy(0,6);
return pointer.addxy(0, 9);
}
footerToPDF(pointer, data) {
gaseshumosToPDF(pointer, data) {
const gaseshumos = this.A4.addRelativeChild(new Div(pointer.addxy(Pos.beg_margin + 2, 0), new Vector(this.containerSize, 9)));
gaseshumos.addRelativeChildren([
const footer = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 30)));
new Text("Resultado Analizador de Gases", new Vector(Pos.beg, Pos.third), this.font),
footer.addRelativeChildren([
new Text("Resultado Analizador de Humos", new Vector(Pos.two_thirds, Pos.third), this.font),
this.line(),
new Text(`CO ${data['co']} % HC ${data['hc']} ppm`, new Vector(Pos.beg, Pos.two_thirds), this.font),
new Text(
"Inspector:",
new Vector(Pos.quarter - 5, Pos.end_margin),
this.subtitle,
"center"
),
new Text(`Medición ${data['opacidad_logaritmica']}`, new Vector(Pos.three_quarters, Pos.two_thirds), this.font)
new Text(
"Firma:.........................",
new Vector(Pos.three_quarters, Pos.end_margin),
this.subtitle,
"center"
)
]);
return pointer.addxy(0,30);
return pointer.addxy(0, 9);
}
}
\ No newline at end of file
......@@ -33,6 +33,12 @@ td{
bottom: 0px;
}
.PDFButtonContainerFixed {
position: fixed;
right: 50;
bottom: 33.33%;
}
.PDFButton {
background-color: #4CAF50;
border: none;
......@@ -80,7 +86,7 @@ input {
.Message {
min-width: 10%;
min-height: 10%;
min-height: 5%;
position: fixed;
top: 50%;
left: 50%;
......@@ -88,7 +94,7 @@ input {
}
.MessageFixed {
position: absolute;
position: fixed;
top: 50;
right: 50;
}
......
......@@ -6,7 +6,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script>
<script src="{{ url_for('static', filename = 'src/ajax.js') }}"></script>
<script src="{{ url_for('static', filename = 'src/div.js') }}"></script>
<script src="{{ url_for('static', filename = 'src/getters.js') }}"></script>
<script src="{{ url_for('static', filename = 'src/pdf1.js') }}"></script>
<script src="{{ url_for('static', filename = 'src/pdf2.js') }}"></script>
<script src="{{ url_for('static', filename = 'src/forms.js') }}"></script>
......@@ -22,17 +21,17 @@
Pueden ser completados a mano antes de convertir a PDF.<br>
De no ser completados, se completaran automáticamente con el valor del campo 'Por defecto' al final de la página.
</div>
<h1>Datos Generales:</h1>
<h1>Datos Generales</h1>
Patente <input sub="header" type="text" name="patente">
<br>
Fecha <input sub="header" type="text" name="fecha">
<br>
<h1>Alineador:</h1>
<h1>Alineador</h1>
Eje Delantero <input sub="alineador" type="text" name="eje_delantero">
<br>
<h1>Suspensión:</h1>
<h1>Suspensión</h1>
{% for eje in range(2) %}
<h3>Eje {{ eje + 1 }}</h3>
......@@ -40,15 +39,13 @@
<br>
Rendimiento Derecho <input sub="suspension" type="text" name="rendimiento_derecho_{{ eje + 1 }}">
<br>
Peso Estático (Total) <input sub="suspension" type="text" name="peso_estatico_{{ eje + 1 }}">
<br>
Peso Dinámico (Báscula) <input sub="suspension" type="text" name="peso_dinamico_{{ eje + 1 }}">
Peso Total <input sub="suspension" type="text" name="peso_estatico_{{ eje + 1 }}">
<br>
<br>
{% endfor %}
<h1>Frenos:</h1>
<h1>Frenos</h1>
{% for eje in range(4) %}
<h3>Eje {{ eje + 1 }}</h3>
......@@ -64,24 +61,24 @@
<br>
Ovalidad Derecha <input sub="frenos" type="text" name="ovalidad_derecha_{{ eje + 1 }}">
<br>
Peso Estático (Total) <input sub="frenos" type="text" name="peso_estatico_{{ eje + 1 }}">
<br>
Peso Dinámico (Báscula) <input sub="frenos" type="text" name="peso_dinamico_{{ eje + 1 }}">
Peso Total <input sub="frenos" type="text" name="peso_estatico_{{ eje + 1 }}">
<br>
<br>
{% endfor %}
<h1>Freno Trasero:</h1>
<h1>Freno Trasero</h1>
Fuerza Izquierda <input sub="trasero" type="text" name="fuerza_izquierda">
<br>
Fuerza Derecha <input sub="trasero" type="text" name="fuerza_derecha">
<br>
Eje Nº <input sub="trasero" type="text" name="eje">
<br>
<!--Peso Total--> <input hidden sub="trasero" type="text" name="peso_estatico">
<br>
<h1>Gases y Humos</h1>
Opacidad Logarítmica <input sub="gaseshumos" type="text" name="opacidad_logaritmica">
Gases <input sub="gaseshumos" type="text" name="opacidad_logaritmica">
<br>
CO <input sub="gaseshumos" type="text" name="co">
<br>
......@@ -89,10 +86,10 @@
<br>
<br>
<br>
Por defecto: <input type="text" name="defecto" value="0.00">
Por defecto: <input type="text" name="defecto" value="---">
<br>
<div class="PDFButtonContainer">
<div class="PDFButtonContainerFixed">
<button class="PDFButton" onclick=
"window.open(
compile(
......@@ -102,7 +99,7 @@
.output('bloburl')
)";
>
Convertir a PDF - 1
Linea 1
</button>
<button class="PDFButton" onclick=
......@@ -114,14 +111,14 @@
.output('bloburl')
)";
>
Convertir a PDF - 2
Linea 2
</button>
<img id="maha" src="{{ url_for('static', filename = 'assets/maha.png') }}" style="display: none;">
</div>
</div>
<div id="form" style="height: 100%; display: {% if bypass %} none {% else %} block {% endif %}">
<h1>Generación de PDF:</h1>
<h1>Generación de PDF</h1>
Usuario <input required type="text" sub="credenciales" name="usuario">
<br>
......@@ -130,7 +127,7 @@
Patente <input required type="text" sub="header" name="patente">
<br>
<h1>Datos Extra:</h1>
<h1>Datos de Suspensión</h1>
Rendimiento Izquierdo - Eje 1 <input required type="number" step="any" sub="suspension" name="rendimiento_izquierdo_1">
<br>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!