From 089d5055d8b58f91b5132ef37eed016cf6fdeb1e Mon Sep 17 00:00:00 2001 From: DanielRamirezGe Date: Tue, 15 Oct 2019 19:50:46 -0500 Subject: [PATCH] actualizacion de cupo --- routes/cupo.js | 2 +- routes/get_excel.js | 45 ++++++++++++++++++++++++++++++++++++--------- routes/index.js | 3 +-- routes/paseLista.js | 3 ++- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/routes/cupo.js b/routes/cupo.js index e299de4..2f5f2f9 100644 --- a/routes/cupo.js +++ b/routes/cupo.js @@ -28,7 +28,7 @@ app.get('/cupo', async(req, res) => { return; } arr.push([element.nombre, 150, 150 - element.capacidad, r[0].asis]); - if (element.idConferencia == 13) { + if (element.idConferencia == results.length) { res.status(200).json(arr); return; } diff --git a/routes/get_excel.js b/routes/get_excel.js index 014b069..3cdcc6b 100644 --- a/routes/get_excel.js +++ b/routes/get_excel.js @@ -1,11 +1,38 @@ -var wb = XLSX.utils.book_new(); -wb.Props = { - Title: "SheetJS Tutorial", - Subject: "Test", - Author: "Red Stapler", - CreatedDate: new Date(2017, 12, 19) -}; +// Require library +var excel = require('excel4node'); +// Create a new instance of a Workbook class +app.get('/get_excel', async(req, res) => { + var workbook = new excel.Workbook(); -/ * Agregar la hoja de trabajo al libro de trabajo * / -XLSX.utils.book_append_sheet(wb, ws, ws_name); \ No newline at end of file + // Add Worksheets to the workbook + var worksheet = workbook.addWorksheet('Sheet 1'); + var worksheet2 = workbook.addWorksheet('Sheet 2'); + + // Create a reusable style + var style = workbook.createStyle({ + font: { + color: '#FF0800', + size: 12 + }, + numberFormat: '$#,##0.00; ($#,##0.00); -' + }); + + // Set value of cell A1 to 100 as a number type styled with paramaters of style + worksheet.cell(1, 1).number(100).style(style); + + // Set value of cell B1 to 300 as a number type styled with paramaters of style + worksheet.cell(1, 2).number(200).style(style); + + // Set value of cell C1 to a formula styled with paramaters of style + worksheet.cell(1, 3).formula('A1 + B1').style(style); + + // Set value of cell A2 to 'string' styled with paramaters of style + worksheet.cell(2, 1).string('string').style(style); + + // Set value of cell A3 to true as a boolean type styled with paramaters of style but with an adjustment to the font size. + worksheet.cell(3, 1).bool(true).style(style).style({ font: { size: 14 } }); + + workbook.write('Excel.xlsx'); +}) +module.exports = app; \ No newline at end of file diff --git a/routes/index.js b/routes/index.js index 367fb42..5a16663 100644 --- a/routes/index.js +++ b/routes/index.js @@ -12,6 +12,5 @@ app.use(require('./verificarConferencia')); app.use(require('./cupo')); app.use(require('./loginAdmin')); app.use(require('./paseLista')); - - +//app.use(require('./get_excel')); module.exports = app; \ No newline at end of file diff --git a/routes/paseLista.js b/routes/paseLista.js index b1f7844..75f16bc 100644 --- a/routes/paseLista.js +++ b/routes/paseLista.js @@ -3,6 +3,7 @@ const express = require('express') var app = express(); app.get('/paseLista', async(req, res) => { var datetime = await new Date(); + var mayor = new Date(); var menor = new Date(); await mayor.setMinutes(datetime.getMinutes() + 30); @@ -51,7 +52,7 @@ app.get('/paseLista', async(req, res) => { return; }); } else { - res.status(400).json({ error: false, msj: 'No se encontro la persona' }); + res.status(400).json({ msj: 'No se encontro la persona' }); return; } })