Commit c9901f4c by Tu Nombre

Corrijo detalles de reporte

1 parent c14a4c26
...@@ -273,7 +273,7 @@ def gotoadmin(s, r): ...@@ -273,7 +273,7 @@ def gotoadmin(s, r):
r['header']['cp'] = cp.get_attribute("innerText").split(":")[1].strip() r['header']['cp'] = cp.get_attribute("innerText").split(":")[1].strip()
return r return r
######################Cambio DBA ruido
def readdata(s, r): def readdata(s, r):
reach = lambda id: lambda s: s.readInput( s.find(s.By.ID, id) ) reach = lambda id: lambda s: s.readInput( s.find(s.By.ID, id) )
......
...@@ -7,7 +7,7 @@ class PDF2 { ...@@ -7,7 +7,7 @@ class PDF2 {
/** Coordinate container that occupies the whole page **/ /** Coordinate container that occupies the whole page **/
this.A4 = new Div( this.A4 = new Div(
new Vector(0, 0), new Vector(0, 0),
new Vector(595, 842) new Vector(842,595)
); );
this.containerSize = 86; this.containerSize = 86;
...@@ -16,6 +16,7 @@ class PDF2 { ...@@ -16,6 +16,7 @@ class PDF2 {
"type": "normal", "type": "normal",
"size": 10 "size": 10
}; };
this.Dominio = ""
} }
...@@ -26,13 +27,15 @@ class PDF2 { ...@@ -26,13 +27,15 @@ class PDF2 {
* They all return a coordinate "pointer" to draw. * They all return a coordinate "pointer" to draw.
*/ */
const pdfthis = this; const pdfthis = this;
console.log(data)
const functionMapping = [ const functionMapping = [
(pointer, data) => pdfthis.headerToPDF(pointer, data['header']), (pointer, data) => pdfthis.headerToPDF(pointer, data['header']),
(pointer, data) => pdfthis.alineadorToPDF(pointer, data['alineador']), (pointer, data) => pdfthis.alineadorToPDF(pointer, data['alineador']),
(pointer, data) => pdfthis.suspensionToPDF(pointer, data['suspension']), (pointer, data) => pdfthis.suspensionToPDF(pointer, data['suspension']),
(pointer, data) => pdfthis.frenosToPDF(pointer, data['frenos']), (pointer, data) => pdfthis.frenosToPDF(pointer, data['frenos']),
(pointer, data) => pdfthis.traseroToPDF(pointer, data['trasero']), (pointer, data) => pdfthis.traseroToPDF(pointer, data['trasero']),
(pointer, data) => pdfthis.gaseshumosToPDF(pointer, data['gaseshumos']) (pointer, data) => pdfthis.gaseshumosToPDF(pointer, data['gaseshumos']),
(pointer, data) => pdfthis.ruidoToPDF(pointer, data['gaseshumos'])
]; ];
/** /**
...@@ -46,33 +49,48 @@ class PDF2 { ...@@ -46,33 +49,48 @@ class PDF2 {
return this.A4; return this.A4;
} }
todosValoresIguales(obj) {
// Obtener todos los valores del objeto en un array
const valores = Object.values(obj);
// Verificar si todos los valores son iguales
for (let i = 1; i < valores.length; i++) {
if (valores[i] !== valores[0]) {
return true; // Al menos un valor es diferente
}
}
return false; // Todos los valores son iguales
}
headerToPDF(pointer, data) { headerToPDF(pointer, data) {
const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5))); //const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5)));
this.Dominio = data['patente'].toUpperCase()
header.addRelativeChildren([ //header.addRelativeChildren([
new Text("Dominio: " + data['patente'], new Vector(Pos.beg_margin , Pos.third), this.font), // new Text("Dominio: " + data['patente'], new Vector(Pos.beg_margin , Pos.third), this.font),
new Text("Ingeniero: " + data['ingeniero'], new Vector(Pos.quarter + 4, Pos.third), this.font), // new Text("Ingeniero: " + data['ingeniero'], new Vector(Pos.quarter + 4, Pos.third), this.font),
new Text("Fecha y hora " + data['fecha'] + " " + data['hora'], new Vector(Pos.third + 30, Pos.third), this.font) // new Text("Fecha y hora " + data['fecha'] + " " + data['hora'], new Vector(Pos.third + 30, Pos.third), this.font)
]); //]);
return pointer.addxy(0, 3); //return pointer.addxy(0, 3);
return pointer
} }
alineadorToPDF(pointer, data) { alineadorToPDF(pointer, data) {
const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5))); //const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5)));
alineador.addRelativeChildren([ //alineador.addRelativeChildren([
new Text("Resultado Pruebas en Banco de Alineador al Paso", new Vector(Pos.beg_margin + 2, Pos.third), this.font), //new Text("Resultado Pruebas en Banco de Alineador al Paso", new Vector(Pos.beg_margin + 2, Pos.third), this.font),
new Text("Eje Delantero", new Vector(Pos.beg_margin + 2, Pos.two_thirds), this.font), //new Text("Eje Delantero", new Vector(Pos.beg_margin + 2, Pos.two_thirds), this.font),
new Text(data['eje_delantero'], new Vector(Pos.quarter, Pos.two_thirds), this.font) //new Text(data['eje_delantero'], new Vector(Pos.quarter, Pos.two_thirds), this.font)
]); //]);
return pointer.addxy(0, 5); //return pointer.addxy(0, 5);
return pointer
} }
suspensionToPDF(pointer, data) { suspensionToPDF(pointer, data) {
...@@ -87,9 +105,9 @@ class PDF2 { ...@@ -87,9 +105,9 @@ class PDF2 {
]); ]);
const table = (container, eje, RI, peso, RD) => { const table = (container, eje, RI, peso, RD) => {
container.addRelativeChildren([ container.addRelativeChildren([
new Text(`Resultado Pruebas en Banco de Suspensión - Eje ${eje}`, new Vector(0, Pos.third, ), this.font), new Text(`${this.Dominio} - Resultado Pruebas en Banco de Suspensión - Eje ${eje}`, new Vector(0, Pos.third, ), this.font),
new Text("Rendimiento Izquierdo", new Vector(Pos.beg, Pos.two_thirds), this.font), new Text("Rendimiento Izquierdo", new Vector(Pos.beg, Pos.two_thirds), this.font),
...@@ -133,38 +151,30 @@ class PDF2 { ...@@ -133,38 +151,30 @@ class PDF2 {
const table = (container, eje, FI, RI, OI, peso, FD, RD, OD) => { const table = (container, eje, FI, RI, OI, peso, FD, RD, OD) => {
container.addRelativeChildren([ if (FI === RI === OI === peso === FD === RD === OD) {
new Text(`Diagnóstico de Frenos - Eje ${eje}`, new Vector(Pos.beg, Pos.beg_margin + 10), this.font), console.log(eje)
} else {
new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.quarter), this.font),
container.addRelativeChildren([
new Text(`${FI}`, new Vector(Pos.beg_margin + 3, Pos.quarter + 10), this.font), new Text(`${this.Dominio} - Diagnóstico de Frenos - Eje ${eje}`, new Vector(Pos.beg, Pos.beg_margin + 10), this.font),
new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.quarter), this.font),
new Text("Res.Rodadura IZ", new Vector(Pos.beg_margin, Pos.middle), this.font), new Text(`${FI} KN`, new Vector(Pos.beg_margin + 3, Pos.quarter + 10), this.font),
new Text("Res.Rodadura IZ", new Vector(Pos.beg_margin, Pos.middle), this.font),
new Text(`${RI}`, new Vector(Pos.beg_margin + 3, Pos.middle + 10), this.font), new Text(`${RI} Kg`, new Vector(Pos.beg_margin + 3, Pos.middle + 10), this.font),
new Text("Ovalidad IZ", new Vector(Pos.beg_margin, Pos.three_quarters), this.font),
new Text("Ovalidad IZ", new Vector(Pos.beg_margin, Pos.three_quarters), this.font), new Text(`${OI}`, new Vector(Pos.beg_margin + 3, Pos.three_quarters + 10), this.font),
new Text("Peso del Eje", new Vector(Pos.middle - 10, Pos.middle), this.font),
new Text(`${OI}`, new Vector(Pos.beg_margin + 3, Pos.three_quarters + 10), this.font), new Text(`${peso} Kg`, new Vector(Pos.middle - 5, Pos.middle + 10), this.font),
new Text("Diferencia ", new Vector(Pos.middle - 10, Pos.quarter), this.font),
new Text("Peso del Eje", new Vector(Pos.middle - 10, Pos.quarter), this.font), new Text(`${peso} %`, new Vector(Pos.middle - 5, Pos.quarter + 10), this.font),
new Text("Fuerza DE", new Vector(Pos.three_quarters, Pos.quarter), this.font),
new Text(`${peso}`, new Vector(Pos.middle - 5, Pos.quarter + 10), this.font), new Text(`${FD} KN`, new Vector(Pos.three_quarters + 3, Pos.quarter + 10), this.font),
new Text("Res.Rodadura DE", new Vector(Pos.three_quarters, Pos.middle), this.font),
new Text("Fuerza DE", new Vector(Pos.three_quarters, Pos.quarter), this.font), new Text(`${RD} Kg`, new Vector(Pos.three_quarters + 3, Pos.middle + 10), this.font),
new Text("Ovalidad DE", new Vector(Pos.three_quarters, Pos.three_quarters), this.font),
new Text(`${FD}`, new Vector(Pos.three_quarters + 3, Pos.quarter + 10), this.font), new Text(`${OD}`, new Vector(Pos.three_quarters + 3, Pos.three_quarters + 10), this.font)
]);
new Text("Res.Rodadura DE", new Vector(Pos.three_quarters, Pos.middle), this.font), }
new Text(`${RD}`, new Vector(Pos.three_quarters + 3, Pos.middle + 10), this.font),
new Text("Ovalidad DE", new Vector(Pos.three_quarters, Pos.three_quarters), this.font),
new Text(`${OD}`, new Vector(Pos.three_quarters + 3, Pos.three_quarters + 10), this.font)
]);
}; };
for (let i = 0; i < ejes.length; i++) { for (let i = 0; i < ejes.length; i++) {
...@@ -190,7 +200,7 @@ class PDF2 { ...@@ -190,7 +200,7 @@ class PDF2 {
trasero.addRelativeChildren([ trasero.addRelativeChildren([
new Text("Diagnóstico de Frenos - Eje Trasero - Frenos de Mano", new Vector(Pos.beg, Pos.third, ), this.font), new Text(`${this.Dominio} - 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), new Text("Fuerza IZ", new Vector(Pos.beg_margin, Pos.two_thirds), this.font),
...@@ -211,9 +221,9 @@ class PDF2 { ...@@ -211,9 +221,9 @@ class PDF2 {
gaseshumos.addRelativeChildren([ gaseshumos.addRelativeChildren([
new Text("Resultado Analizador de Gases", new Vector(Pos.beg, Pos.third), this.font), new Text(`${this.Dominio} - Resultado Analizador de Gases`, new Vector(Pos.beg, Pos.third), this.font),
new Text("Resultado Analizador de Humos", new Vector(Pos.two_thirds, Pos.third), this.font), new Text(`${this.Dominio} - Resultado Analizador de Humos`, new Vector(Pos.two_thirds, Pos.third), this.font),
new Text(`CO ${data['co']} % HC ${data['hc']} ppm`, new Vector(Pos.beg, Pos.two_thirds), this.font), new Text(`CO ${data['co']} % HC ${data['hc']} ppm`, new Vector(Pos.beg, Pos.two_thirds), this.font),
...@@ -223,4 +233,25 @@ class PDF2 { ...@@ -223,4 +233,25 @@ class PDF2 {
return pointer.addxy(0, 9); return pointer.addxy(0, 9);
} }
ruidoToPDF(pointer, data) {
const gaseshumos = this.A4.addRelativeChild(new Div(pointer.addxy(Pos.beg_margin + 2, 0), new Vector(this.containerSize, 9)));
gaseshumos.addRelativeChildren([
new Text(`${this.Dominio} - Resultado Analizador Ruido`, new Vector(Pos.beg, Pos.third), this.font),
new Text("", new Vector(Pos.two_thirds, Pos.third), this.font),
new Text(` ${data['co']} dba`, new Vector(Pos.beg, Pos.two_thirds), this.font),
new Text("", new Vector(Pos.three_quarters, Pos.two_thirds), this.font)
]);
return pointer.addxy(0, 9);
}
} }
\ No newline at end of file \ No newline at end of file
<html lang="en">
<html lang="es">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
...@@ -11,8 +12,9 @@ ...@@ -11,8 +12,9 @@
<script src="{{ url_for('static', filename = 'src/pdf3.js') }}"></script> <script src="{{ url_for('static', filename = 'src/pdf3.js') }}"></script>
<script src="{{ url_for('static', filename = 'src/forms.js') }}"></script> <script src="{{ url_for('static', filename = 'src/forms.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename = 'styles/general.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename = 'styles/general.css') }}">
<!--INCLUIMOS LA FUENTE--> <!--INCLUIMOS LA FUENTE
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" /> <link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" />
-->
<title>Pruebas de Alineamiento</title> <title>Pruebas de Alineamiento</title>
</head> </head>
<body> <body>
...@@ -98,9 +100,9 @@ ...@@ -98,9 +100,9 @@
Eficacia estic. <input sub="frenos" type="text" id="rf_servicio_eficacia_estatica" name="rf_servicio_eficacia_estatica" value="---"> Eficacia estic. <input sub="frenos" type="text" id="rf_servicio_eficacia_estatica" name="rf_servicio_eficacia_estatica" value="---">
<br> <br>
<h1>Freno Estacionamiento</h1> <h1>Freno Estacionamiento</h1>
Fuerza Izquierda <input sub="trasero" type="text" name="fuerza_izquierda" id="fuerza_izquierda_freno_mano"> Fuerza Izquierda <input sub="trasero" type="text" name="fuerza_izquierda" id="2fuerza_izquierda_freno_mano">
<br> <br>
Fuerza Derecha <input sub="trasero" type="text" name="fuerza_derecha" id="fuerza_derecha_freno_mano"> Fuerza Derecha <input sub="trasero" type="text" name="fuerza_derecha" id="2fuerza_derecha_freno_mano">
<br> <br>
Diferencia <input sub="frenos" type="text" id="diferencia_freno_mano" name="diferencia_freno_mano" value="---" readonly> Diferencia <input sub="frenos" type="text" id="diferencia_freno_mano" name="diferencia_freno_mano" value="---" readonly>
<br> <br>
...@@ -125,6 +127,9 @@ ...@@ -125,6 +127,9 @@
<br> <br>
HC <input sub="gaseshumos" type="text" name="hc"> HC <input sub="gaseshumos" type="text" name="hc">
<br> <br>
<h1>Ruido</h1>
dbA <input sub="ruido" type="text" name="ruido_dba" id="ruido_dba_id">
<br>
<br> <br>
<br> <br>
Por defecto: <input type="text" name="defecto" value="---"> Por defecto: <input type="text" name="defecto" value="---">
...@@ -136,7 +141,7 @@ ...@@ -136,7 +141,7 @@
"window.open( "window.open(
compile( compile(
(new PDF2()).pdf( collectToConvert() ), (new PDF2()).pdf( collectToConvert() ),
new jsPDF('portrait', 'pt', 'a4') new jsPDF('landscape', 'pt', 'a4')
) )
.output('bloburl') .output('bloburl')
)"; )";
...@@ -219,7 +224,7 @@ ...@@ -219,7 +224,7 @@
<span class = "X">x<span> <span class = "X">x<span>
</div> </div>
</div> </div>
<script src="{{ url_for('static', filename = 'src/report.js') }}"></script> <!--<script src="{{ url_for('static', filename = 'src/report.js') }}"></script>-->
</body> </body>
</html> </html>
\ No newline at end of file \ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!