registro evento y pdf
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
TYPEDB =
|
||||
|
||||
DB =
|
||||
|
||||
USERDB =
|
||||
|
||||
PASSDB =
|
||||
|
||||
HOSTDB =
|
||||
|
||||
PORT =
|
||||
@@ -6,6 +6,10 @@ app.get('/', function(req, res) {
|
||||
});
|
||||
require('dotenv').config()
|
||||
app.use(cors());
|
||||
// console.log( "host", process.env.HOSTDB,
|
||||
// "user", process.env.USERDB,
|
||||
// "password", process.env.PASSDB,
|
||||
// "database", process.env.DB)
|
||||
app.use(express.json()) // for parsing application/json
|
||||
app.use(express.urlencoded({ extended: true }))
|
||||
app.use(require('./routes/index.js'))
|
||||
|
||||
Binary file not shown.
Generated
+1647
-13
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,11 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"express-fileupload": "^1.1.6",
|
||||
"fs": "0.0.1-security",
|
||||
"mysql": "^2.18.1",
|
||||
"nodemon": "^2.0.2",
|
||||
"pdfkit": "^0.11.0",
|
||||
"qr-image": "^3.2.0",
|
||||
"randomstring": "^1.1.5",
|
||||
"sendmail": "^1.6.1"
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 466 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 278 KiB |
@@ -0,0 +1,21 @@
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express')
|
||||
var app = express();
|
||||
var qr = require('./qr.js');
|
||||
|
||||
|
||||
app.get('/crear_pdf', async(req, res) => {
|
||||
await qr(req.query.id_persona).then(async (p) => {
|
||||
// console.log(req.query);
|
||||
// console.log(p);
|
||||
//res.download(__dirname + `/../files/lista-${req.query.id_persona}.pdf`);
|
||||
res.status(200).json({ error: false, msj: "exito" });
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
res.status(400).json({ error: true, msj: "Error al crear el comprobante", type: err });
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
|
||||
module.exports = app;
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express')
|
||||
const sendmail = require('sendmail')();
|
||||
var app = express();
|
||||
|
||||
|
||||
function query(consulta) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
connection.query(`${consulta}`, (error, results, files) => {
|
||||
if (error) reject(error);
|
||||
resolve(results);
|
||||
});
|
||||
})
|
||||
}
|
||||
app.get('/descargar_pdf', async (req, res) => {
|
||||
|
||||
let cad=`select * from persona where id_persona=${req.query.id_persona};`;
|
||||
let ans=await query(cad);
|
||||
let correo=ans[0].correo_electronico;
|
||||
console.log(ans);
|
||||
sendmail({
|
||||
from: 'ciie2020@acatlan.unam.mx',
|
||||
to: `${correo}`,
|
||||
subject: 'Inscipción coloquio de Educacion FES-Acatlan',
|
||||
html: `Gracias por inscribirte al coloquio internacional de educacion`,
|
||||
// attachments: [
|
||||
// { // use URL as an attachment
|
||||
// filename: 'comprobante.txt',
|
||||
// path: __dirname + `/../files/lista-${req.query.id_persona}.pdf`
|
||||
// }
|
||||
// ]
|
||||
});
|
||||
//res.download(__dirname + `/../files/lista-${req.query.id_persona}.pdf`);
|
||||
return res.status(200).json({msj: "exito"});
|
||||
})
|
||||
|
||||
module.exports = app;
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express')
|
||||
var app = express();
|
||||
|
||||
@@ -65,9 +65,6 @@ app.get('/enviar_email', async(req, res) => {
|
||||
to: `${correo}`,
|
||||
subject: 'Recuperacion de contraseña coloquio de Educacion FES-Acatlan',
|
||||
html: `Estimado usuario su nueva contraseña es: ${nueva}`,
|
||||
}, function(err, reply) {
|
||||
console.log(err && err.stack);
|
||||
console.dir(reply);
|
||||
});
|
||||
|
||||
}).catch(() => {
|
||||
|
||||
@@ -12,4 +12,8 @@ app.use(require('./descargar_ponencia'));
|
||||
app.use(require('./descargar_cartel'));
|
||||
app.use(require('./enviar_email'));
|
||||
app.use(require('./traer_persona'));
|
||||
app.use(require('./traer_eventos'));
|
||||
app.use(require('./registro_evento'));
|
||||
app.use(require('./crear_pdf'));
|
||||
app.use(require('./descargar_pdf'));
|
||||
module.exports = app;
|
||||
@@ -0,0 +1,121 @@
|
||||
'use strict ';
|
||||
|
||||
const PDFDocument = require('pdfkit');
|
||||
|
||||
class PDFDocumentWithTables extends PDFDocument {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
table(table, arg0, arg1, arg2) {
|
||||
let startX = this.page.margins.left,
|
||||
startY = this.y;
|
||||
let options = {};
|
||||
|
||||
if ((typeof arg0 === 'number') && (typeof arg1 === 'number')) {
|
||||
startX = arg0;
|
||||
startY = arg1;
|
||||
|
||||
if (typeof arg2 === 'object')
|
||||
options = arg2;
|
||||
} else if (typeof arg0 === 'object') {
|
||||
options = arg0;
|
||||
}
|
||||
|
||||
const columnCount = table.headers.length;
|
||||
const columnSpacing = options.columnSpacing || 15;
|
||||
const rowSpacing = options.rowSpacing || 5;
|
||||
const usableWidth = options.width || (this.page.width - this.page.margins.left - this.page.margins.right);
|
||||
|
||||
const prepareHeader = options.prepareHeader || (() => {});
|
||||
const prepareRow = options.prepareRow || (() => {});
|
||||
const computeRowHeight = (row) => {
|
||||
let result = 0;
|
||||
|
||||
row.forEach((cell) => {
|
||||
const cellHeight = this.heightOfString(cell, {
|
||||
width: columnWidth,
|
||||
align: 'left'
|
||||
});
|
||||
result = Math.max(result, cellHeight);
|
||||
});
|
||||
|
||||
return result + rowSpacing;
|
||||
};
|
||||
|
||||
const columnContainerWidth = usableWidth / columnCount;
|
||||
const columnWidth = columnContainerWidth - columnSpacing;
|
||||
const maxY = this.page.height - this.page.margins.bottom;
|
||||
|
||||
let rowBottomY = 0;
|
||||
|
||||
this.on('pageAdded', () => {
|
||||
startY = this.page.margins.top;
|
||||
rowBottomY = 0;
|
||||
});
|
||||
|
||||
// Allow the user to override style for headers
|
||||
prepareHeader();
|
||||
|
||||
// Check to have enough room for header and first rows
|
||||
if (startY + 3 * computeRowHeight(table.headers) > maxY)
|
||||
this.addPage();
|
||||
|
||||
// Print all headers
|
||||
table.headers.forEach((header, i) => {
|
||||
this.text(header, startX + i * columnContainerWidth, startY, {
|
||||
width: columnWidth,
|
||||
align: 'left'
|
||||
});
|
||||
});
|
||||
|
||||
// Refresh the y coordinate of the bottom of the headers row
|
||||
rowBottomY = Math.max(startY + computeRowHeight(table.headers), rowBottomY);
|
||||
|
||||
// Separation line between headers and rows
|
||||
this.moveTo(startX, rowBottomY - rowSpacing * 0.5)
|
||||
.lineTo(startX + usableWidth, rowBottomY - rowSpacing * 0.5)
|
||||
.lineWidth(2)
|
||||
.stroke();
|
||||
|
||||
table.rows.forEach((row, i) => {
|
||||
const rowHeight = computeRowHeight(row);
|
||||
|
||||
// Switch to next page if we cannot go any further because the space is over.
|
||||
// For safety, consider 3 rows margin instead of just one
|
||||
if (startY + 3 * rowHeight < maxY)
|
||||
startY = rowBottomY + rowSpacing;
|
||||
else
|
||||
this.addPage();
|
||||
|
||||
// Allow the user to override style for rows
|
||||
prepareRow(row, i);
|
||||
|
||||
// Print all cells of the current row
|
||||
row.forEach((cell, i) => {
|
||||
this.text(cell, startX + i * columnContainerWidth, startY, {
|
||||
width: columnWidth,
|
||||
align: 'left'
|
||||
});
|
||||
});
|
||||
|
||||
// Refresh the y coordinate of the bottom of this row
|
||||
rowBottomY = Math.max(startY + rowHeight, rowBottomY);
|
||||
|
||||
// Separation line between rows
|
||||
this.moveTo(startX, rowBottomY - rowSpacing * 0.5)
|
||||
.lineTo(startX + usableWidth, rowBottomY - rowSpacing * 0.5)
|
||||
.lineWidth(1)
|
||||
.opacity(0.7)
|
||||
.stroke()
|
||||
.opacity(1); // Reset opacity after drawing the line
|
||||
});
|
||||
|
||||
this.x = startX;
|
||||
this.moveDown();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PDFDocumentWithTables;
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
'use strict';
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express');
|
||||
var qr = require('qr-image');
|
||||
const fs = require('fs');
|
||||
const PDFDocument = require('./pdfkit-tables');
|
||||
|
||||
function query(consulta) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
connection.query(`${consulta}`, (error, results, files) => {
|
||||
if (error) reject(error);
|
||||
resolve(results);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
let c_pdf = function(id_persona) {
|
||||
return new Promise(async function(resolve, reject) {
|
||||
|
||||
let doc = new PDFDocument();
|
||||
let inicio = 120;
|
||||
// let cad = `select * from persona where id_persona=${id_persona}`;
|
||||
// let resp = await query(cad);
|
||||
// let data = resp[var i_m = require('./g_img.js');0];
|
||||
|
||||
|
||||
doc.pipe(fs.createWriteStream(__dirname + `/../files/lista-${id_persona}.pdf`));
|
||||
|
||||
|
||||
doc.image(__dirname + '/Imagenes/logo_unam.png', inicio, 30, { scale: 0.04 });
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(10)
|
||||
.text('UNIVERSIDAD NACIONAL AUTONOMA DE MEXICO', inicio + 60, 40);
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(10)
|
||||
.text('FACULTAD DE ESTUDIOS SUPERIORES ACATLÁN', inicio + 66, 50);
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(10)
|
||||
.text('COLOQUIO INTERNACIONAL DE EDUCACION', inicio + 72, 60);
|
||||
|
||||
doc.image(__dirname + '/Imagenes/Fes-aniversario.png', inicio + 305, 28, { scale: 0.035 });
|
||||
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(8)
|
||||
.text('COMPROBANTE DE INSCRIPCIÓN', inicio + 120, 80);
|
||||
|
||||
doc.moveTo(70, 110)
|
||||
.lineTo(542, 110);
|
||||
|
||||
|
||||
var datetime = new Date();
|
||||
console.log(datetime);
|
||||
let d = datetime.getDate();
|
||||
let m = datetime.getMonth();
|
||||
m++;
|
||||
let a = datetime.getFullYear();
|
||||
if (d < 10) {
|
||||
let aux = `0${d}`;
|
||||
d = aux;
|
||||
|
||||
}
|
||||
if (m < 10) {
|
||||
let aux = `0${m}`;
|
||||
m = aux;
|
||||
|
||||
}
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(13)
|
||||
.text(`${d}/${m}/${a}`, inicio + 305, 120);
|
||||
let marg = 70;
|
||||
|
||||
doc.image(qr.imageSync(`${id_persona}`, { type: 'png' }), marg, 120, { scale: 0.85 });
|
||||
|
||||
|
||||
const table0 = {
|
||||
headers: ['Nombre', 'Correo'],
|
||||
rows: []
|
||||
};
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(13)
|
||||
.text('CONFERENCIAS', inicio + 142, 240);
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(12)
|
||||
.text('Nota:', marg, 270);
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(10)
|
||||
.text(` 1.- Presentarse 10 minutos antes de que inicie la actividad.`, marg, 285);
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(10)
|
||||
.text(' 2.-Si seleccionaste talleres y no los has pagado el sistema no permitira tu ingreso', marg, 295);
|
||||
|
||||
doc.font('Times-Roman')
|
||||
.fontSize(12)
|
||||
.text('', marg, 300);
|
||||
|
||||
|
||||
let n_cad=`select * from persona where id_persona=${id_persona}`;
|
||||
let resu=await query(n_cad);
|
||||
table0.rows.push([resu[0].nombre + " " + resu[0].apellido_p+ " " + resu[0].apellido_m, resu[0].correo_electronico]);
|
||||
doc.moveDown().table(table0, 200, 150, { width: 300 });
|
||||
|
||||
|
||||
|
||||
var table1 = {
|
||||
headers: ['Nombre', 'Lugar',' Fecha Hora '],
|
||||
rows: []
|
||||
};
|
||||
|
||||
let todos_los_eventos=`select distinct f.id_evento from fecha as f inner join asistencia as a where a.id_persona=${id_persona} and a.id_fecha=f.id_fecha `;
|
||||
let eventos= await query(todos_los_eventos);
|
||||
console.log(eventos);
|
||||
for(let j=0; j<eventos.length; j++)
|
||||
{
|
||||
let new_cad=`select * from evento where id_evento=${eventos[j].id_evento};`;
|
||||
let new_ans=await query(new_cad);
|
||||
//console.log(new_ans);
|
||||
new_cad=`select * from fecha where id_evento=${eventos[j].id_evento};`;
|
||||
let fechas=await query(new_cad);
|
||||
let aux=[];
|
||||
console.log(fechas);
|
||||
for(let h=0; h<fechas.length; h++)
|
||||
{
|
||||
let po = fechas[h].fecha_inicio;
|
||||
let dia = po.getDate();
|
||||
let mes = po.getMonth();
|
||||
mes++
|
||||
let anio = po.getFullYear();
|
||||
let hora = po.getHours();
|
||||
let min = po.getMinutes();
|
||||
if (hora < 10) {
|
||||
let aux = `0${hora}`;
|
||||
hora = aux;
|
||||
|
||||
}
|
||||
if (min < 10) {
|
||||
let aux = `0${min}`;
|
||||
min = aux;
|
||||
|
||||
}
|
||||
if (dia < 10) {
|
||||
let aux = `0${dia}`;
|
||||
dia = aux;
|
||||
|
||||
}
|
||||
if (mes < 10) {
|
||||
let aux = `0${mes}`;
|
||||
mes = aux;
|
||||
|
||||
}
|
||||
let uno = `${dia}/${mes}/${anio}`;
|
||||
let dos = "";
|
||||
dos = `${hora}:${min}`;
|
||||
if(aux.length==0)
|
||||
aux.push(`${uno} ${dos}`);
|
||||
else
|
||||
aux.push(`\n${uno} ${dos}`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
table1.rows.push([new_ans[0].nombre_evento, new_ans[0].lugar,aux]);
|
||||
}
|
||||
doc.moveDown().table(table1, 70, 340, { width: 470 });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// doc.image(qr.imageSync(`${id_persona}`, { type: 'png' }), {
|
||||
// fit: [250, 300],
|
||||
// align: 'center',
|
||||
// valign: 'center'
|
||||
// });
|
||||
doc.end();
|
||||
resolve({ "docx": `${id_persona}.pdf` })
|
||||
reject(err=>{
|
||||
console.log(err);
|
||||
return err;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
let g_pdf = async function(idPersona) {
|
||||
|
||||
|
||||
// console.log("datos: ", req.query);
|
||||
let inicio = 120;
|
||||
let id_persona = idPersona;
|
||||
|
||||
|
||||
c_pdf(id_persona)
|
||||
//await doc
|
||||
// .fontSize(25)
|
||||
// .text('Some text with an embedded font!', 100, 100);
|
||||
// await doc.font('Times-Roman')
|
||||
// .fontSize(10)
|
||||
// .text(`${data.nombre} ${ data.apellido_p} ${data.apellido_m}: ${data.id_persona}`, inicio + 60, 40);
|
||||
|
||||
|
||||
//return res.download(__dirname + `/../files/lista-${req.query.id_persona}.pdf`);
|
||||
//return
|
||||
.then(data => {
|
||||
|
||||
//res.download(__dirname + `/../files/comprobante_pago-${req.query.id_persona}.docx`);
|
||||
console.log(data)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
return;
|
||||
})
|
||||
// console.log(data);
|
||||
|
||||
};
|
||||
|
||||
module.exports = g_pdf;
|
||||
@@ -0,0 +1,83 @@
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express');
|
||||
|
||||
|
||||
var app = express()
|
||||
|
||||
function query(consulta) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
connection.query(`${consulta}`, (error, results, files) => {
|
||||
if (error) reject(error);
|
||||
resolve(results);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
app.post('/registro_evento', async(req, res) => {
|
||||
try {
|
||||
let datos=req.body.eventos;
|
||||
let id_persona= req.body.id_persona;
|
||||
let pag=true;
|
||||
let con=req.body.constacia;
|
||||
let total= req.body.total_pago;
|
||||
|
||||
let eliminar_eventos=`select distinct f.id_evento from fecha as f inner join asistencia as a where a.id_persona=${id_persona} and a.id_fecha=f.id_fecha `;
|
||||
let query_eliminar= await query(eliminar_eventos);
|
||||
//console.log(query_eliminar);
|
||||
for(let i=0; i<query_eliminar.length; i++)
|
||||
{
|
||||
let nueva_cad =`update evento set cupo=cupo+1 where id_evento=${query_eliminar[i].id_evento};`;
|
||||
let agregar=await query(nueva_cad);
|
||||
}
|
||||
eliminar_eventos=`delete from asistencia where id_persona=${id_persona};`;
|
||||
query_eliminar=await query(eliminar_eventos);
|
||||
eliminar_eventos = `delete from pago where id_persona=${id_persona};`;
|
||||
query_eliminar=await query(eliminar_eventos);
|
||||
|
||||
|
||||
|
||||
if(con==true)
|
||||
pag=false;
|
||||
for(let i=0;i<datos.length; i++)
|
||||
{
|
||||
//console.log(datos[i]);
|
||||
let nueva_cad =`update evento set cupo=cupo-1 where id_evento=${datos[i].id_evento};`;
|
||||
let nueva_query=await query(nueva_cad);
|
||||
let n_cad=`select * from fecha where id_evento=${datos[i].id_evento};`;
|
||||
|
||||
let n_ans=await query(n_cad);
|
||||
// console.log(n_ans);
|
||||
for(let j=0; j<n_ans.length; j++)
|
||||
{
|
||||
if(datos[i].tipo_evento=="Ponencia")
|
||||
{
|
||||
let ins_cad=`insert into asistencia values(null, ${id_persona}, ${n_ans[j].id_fecha}, false, true, false);`;
|
||||
let ins_query= await query(ins_cad);
|
||||
}
|
||||
if(datos[i].tipo_evento=="Taller")
|
||||
{
|
||||
let ins_cad=`insert into asistencia values(null, ${id_persona}, ${n_ans[j].id_fecha}, true, false, false);`;
|
||||
let ins_query= await query(ins_cad);
|
||||
}
|
||||
if(datos[i].tipo_evento=="Mesa tematica")
|
||||
{
|
||||
let ins_cad=`insert into asistencia values(null, ${id_persona}, ${n_ans[j].id_fecha}, ${con}, ${pag}, false);`;
|
||||
let ins_query= await query(ins_cad);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
let cad=`insert into pago values (null, ${id_persona}, ${total});`;
|
||||
let nueva_query= await query(cad);
|
||||
res.status(200).json({error: false, msj: "exito"});
|
||||
|
||||
} catch (err) {
|
||||
console.log("afuera ", err);
|
||||
res.status(400).json({ error: true, msj: err });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = app
|
||||
@@ -0,0 +1,53 @@
|
||||
const connection = require('../conf/connection.js');
|
||||
const express = require('express');
|
||||
|
||||
|
||||
var app = express()
|
||||
|
||||
function query(consulta) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
connection.query(`${consulta}`, (error, results, files) => {
|
||||
if (error) reject(error);
|
||||
resolve(results);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
app.get('/traer_eventos', async(req, res) => {
|
||||
try {
|
||||
let cad = `select * from evento;`;
|
||||
let respuesta = query(cad);
|
||||
//console.log(respuesta);
|
||||
respuesta.then(r => {
|
||||
let ans={};
|
||||
ans.mesa=[];
|
||||
ans.taller=[];
|
||||
ans.ponencia=[];
|
||||
for(let i=0; i<r.length; i++)
|
||||
{
|
||||
if(r[i].tipo_evento=="Ponencia")
|
||||
ans.ponencia.push(r[i]);
|
||||
if(r[i].tipo_evento=="Taller")
|
||||
ans.taller.push(r[i]);
|
||||
if(r[i].tipo_evento=="Mesa tematica")
|
||||
ans.mesa.push(r[i]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
res.status(200).json({ error: false, msj: "exito", data: ans });
|
||||
return;
|
||||
}).catch(err => {
|
||||
res.status(400).json({ error: false, msj: err });
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
console.log("afuera ", err);
|
||||
res.status(400).json({ error: true, msj: err });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = app
|
||||
@@ -24,6 +24,7 @@ app.get('/traer_pais', async(req, res) => {
|
||||
res.status(200).json({ error: false, msj: "exito", paises: r });
|
||||
return;
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
res.status(400).json({ error: false, msj: err });
|
||||
});
|
||||
|
||||
|
||||
+79
-56
@@ -1,64 +1,87 @@
|
||||
drop database coloquio_educacion;
|
||||
Create Database coloquio_educacion;
|
||||
use coloquio_educacion;
|
||||
CREATE TABLE persona (
|
||||
id_persona int PRIMARY KEY AUTO_INCREMENT,
|
||||
nombre varchar(60),
|
||||
apellido_p varchar(30),
|
||||
apellido_m varchar(30),
|
||||
ponente boolean,
|
||||
asistente boolean,
|
||||
institucion_procedencia varchar(60),
|
||||
comunidad varchar(255),
|
||||
situacion_academica varchar(70),
|
||||
pais_origen varchar(30),
|
||||
numero_cuenta varchar(20),
|
||||
correo_electronico varchar(40),
|
||||
password varchar(300),
|
||||
pagado boolean
|
||||
);
|
||||
drop database coloquio_educacion;
|
||||
Create Database coloquio_educacion;
|
||||
use coloquio_educacion;
|
||||
|
||||
CREATE TABLE conferecia (
|
||||
id_conferencia int PRIMARY KEY AUTO_INCREMENT,
|
||||
nombre_conferencia varchar(200),
|
||||
mesa_tematica varchar(200),
|
||||
nombre_ponente varchar(200)
|
||||
);
|
||||
|
||||
CREATE TABLE conferencia_persona (
|
||||
id_registro int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_persona int,
|
||||
id_conferencia int,
|
||||
asistencia boolean
|
||||
);
|
||||
|
||||
CREATE TABLE admin (
|
||||
id_admin int PRIMARY KEY AUTO_INCREMENT,
|
||||
usuario varchar(30),
|
||||
password varchar(300),
|
||||
nombre_mesa varchar(200)
|
||||
);
|
||||
CREATE TABLE persona (
|
||||
id_persona int PRIMARY KEY AUTO_INCREMENT,
|
||||
nombre varchar(60),
|
||||
apellido_p varchar(30),
|
||||
apellido_m varchar(30),
|
||||
ponente boolean,
|
||||
asistente boolean,
|
||||
institucion_procedencia varchar(60),
|
||||
comunidad varchar(255),
|
||||
situacion_academica varchar(70),
|
||||
pais_origen varchar(30),
|
||||
numero_cuenta varchar(20),
|
||||
correo_electronico varchar(40),
|
||||
password varchar(300),
|
||||
pagado boolean
|
||||
);
|
||||
|
||||
CREATE TABLE trabajo (
|
||||
id_trabajo int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_persona int,
|
||||
tipo_trabajo varchar(50),
|
||||
nombre_trabajo varchar(150),
|
||||
autor_principal varchar(100),
|
||||
segundo_autor varchar(100),
|
||||
mesa_tematica varchar(100),
|
||||
pagado boolean,
|
||||
publicado boolean,
|
||||
aceptado boolean
|
||||
);
|
||||
Create TABLE pais(
|
||||
id_pais int PRIMARY KEY AUTO_INCREMENT,
|
||||
nombre_pais varchar(100)
|
||||
);
|
||||
|
||||
ALTER TABLE conferencia_persona ADD FOREIGN KEY (id_conferencia) REFERENCES conferecia (id_conferencia);
|
||||
|
||||
ALTER TABLE conferencia_persona ADD FOREIGN KEY (id_persona) REFERENCES persona (id_persona);
|
||||
|
||||
ALTER TABLE trabajo ADD FOREIGN KEY (id_persona) REFERENCES persona (id_persona);
|
||||
|
||||
|
||||
CREATE TABLE conferecia (
|
||||
id_conferencia int PRIMARY KEY AUTO_INCREMENT,
|
||||
nombre_conferencia varchar(200),
|
||||
mesa_tematica varchar(200),
|
||||
nombre_ponente varchar(200)
|
||||
);
|
||||
|
||||
CREATE TABLE conferencia_persona (
|
||||
id_registro int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_persona int,
|
||||
id_conferencia int,
|
||||
asistencia boolean
|
||||
);
|
||||
|
||||
CREATE TABLE admin (
|
||||
id_admin int PRIMARY KEY AUTO_INCREMENT,
|
||||
usuario varchar(30),
|
||||
password varchar(300),
|
||||
nombre_mesa varchar(200)
|
||||
);
|
||||
|
||||
CREATE TABLE trabajo (
|
||||
id_trabajo int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_persona int,
|
||||
tipo_trabajo varchar(50),
|
||||
nombre_trabajo varchar(150),
|
||||
autor_principal varchar(100),
|
||||
segundo_autor varchar(100),
|
||||
mesa_tematica varchar(100),
|
||||
pagado boolean,
|
||||
publicado boolean,
|
||||
aceptado boolean
|
||||
);
|
||||
Create TABLE pais(
|
||||
id_pais int PRIMARY KEY AUTO_INCREMENT,
|
||||
nombre_pais varchar(100)
|
||||
);
|
||||
|
||||
Create Table evento (
|
||||
id_evento int PRIMARY KEY AUTO_INCREMENT,
|
||||
tipo_evento varchar (150),
|
||||
nombre_evento varchar (150),
|
||||
cupo int,
|
||||
lugar varchar(150)
|
||||
);
|
||||
|
||||
Create Table fecha(
|
||||
id_fecha int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_evento int,
|
||||
fecha_inicio datetime,
|
||||
fecha_fin datetime
|
||||
);
|
||||
|
||||
ALTER TABLE conferencia_persona ADD FOREIGN KEY (id_conferencia) REFERENCES conferecia (id_conferencia);
|
||||
|
||||
ALTER TABLE conferencia_persona ADD FOREIGN KEY (id_persona) REFERENCES persona (id_persona);
|
||||
|
||||
ALTER TABLE trabajo ADD FOREIGN KEY (id_persona) REFERENCES persona (id_persona);
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
drop table conferecia;
|
||||
drop table conferencia_persona;
|
||||
drop table asistencia;
|
||||
drop table fecha;
|
||||
drop table evento;
|
||||
|
||||
create table pago(
|
||||
id_pago int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_persona int,
|
||||
total_pago int
|
||||
);
|
||||
|
||||
Create Table evento (
|
||||
id_evento int PRIMARY KEY AUTO_INCREMENT,
|
||||
tipo_evento varchar (150),
|
||||
nombre_evento varchar (150),
|
||||
cupo int,
|
||||
lugar varchar(150)
|
||||
);
|
||||
|
||||
Create Table fecha(
|
||||
id_fecha int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_evento int,
|
||||
fecha_inicio datetime,
|
||||
fecha_fin datetime
|
||||
);
|
||||
|
||||
|
||||
Create Table asistencia(
|
||||
id_asistencia int PRIMARY KEY AUTO_INCREMENT,
|
||||
id_persona int,
|
||||
id_fecha int,
|
||||
constancia boolean,
|
||||
pagado boolean,
|
||||
asistencia boolean
|
||||
);
|
||||
|
||||
|
||||
|
||||
alter table pago add FOREIGN KEY (id_persona) REFERENCES persona (id_persona);
|
||||
ALTER TABLE fecha ADD FOREIGN KEY (id_evento) REFERENCES evento (id_evento);
|
||||
ALTER TABLE asistencia ADD FOREIGN KEY (id_fecha) REFERENCES fecha (id_fecha);
|
||||
ALTER TABLE asistencia ADD FOREIGN KEY (id_persona) REFERENCES persona (id_persona);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -221,3 +221,84 @@ insert into admin values(null, 'Mesa_9', '$2b$10$zULlGphKeqXkvqAifLX7r.XlZYDJ403
|
||||
--insert into admin values(null, 'Administrador', 'CMfcStNPjz', '' );
|
||||
insert into admin values(null, 'Administrador', '$2b$10$YqVknXcVK3g4H.b4X7ecVO9inEvBA0vBKrN1lZyRL1U9p0qwEQGJm', '' );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 9: Educación ambiental y bioética.", 60, "Sala 1");
|
||||
|
||||
insert into fecha values(null , 1, '2020-08-17 12:00:00', , '2020-08-17 15:00:00');
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 8: Políticas Públicas para la innovación y transoformación educativa.", 60, "Sala 2");
|
||||
|
||||
insert into fecha values(null , 2, '2020-08-17 12:00:00', '2020-08-17 15:00:00');
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 7: Propuestas de Tranformación Curricular.", 50, "Sala de videoconferencias");
|
||||
|
||||
insert into fecha values(null , 3, '2020-08-17 12:00:00', '2020-08-17 15:00:00');
|
||||
|
||||
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 4: Experiencias de innovación e intervención.", 60, "Sala 1");
|
||||
|
||||
insert into fecha values(null , 4, '2020-08-18 11:00:00', '2020-08-18 15:00:00');
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 1: Educación Inclusiva.", 60, "Sala 2");
|
||||
|
||||
insert into fecha values(null , 5, '2020-08-18 11:00:00', '2020-08-18 15:00:00');
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 6: Lectura y Escritura.", 50, "Sala de videoconferencias");
|
||||
|
||||
insert into fecha values (null , 6, '2020-08-18 11:00:00', '2020-08-18 15:00:00');
|
||||
|
||||
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 5: TIC y las TAC en la Educación.", 60, "Sala 1");
|
||||
|
||||
insert into fecha values (null , 7, '2020-08-19 12:00:00', '2020-08-19 15:00:00');
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 2: Educación y Género", 60, "Sala 2");
|
||||
|
||||
insert into fecha values (null , 8, '2020-08-19 12:00:00', '2020-08-19 15:00:00');
|
||||
|
||||
insert into evento values (null,"Mesa tematica", "Mesa 3: Ética, Valores y formación Socioemocial.", 50, "Sala de videoconferencias");
|
||||
|
||||
insert into fecha values (null , 9 , '2020-08-19 12:00:00', '2020-08-19 15:00:00');
|
||||
|
||||
|
||||
|
||||
insert into evento values (null, "Taller", "Taller 1: Lectura y Escritura.", 35, "Aula Magna UIM II" );
|
||||
|
||||
insert into fecha values (null , 10 , '2020-08-17 16:00:00', '2020-08-17 17:00:00');
|
||||
|
||||
insert into fecha values (null , 10 , '2020-08-18 16:00:00', '2020-08-18 18:00:00');
|
||||
|
||||
insert into fecha values (null , 10 , '2020-08-19 16:00:00', '2020-08-19 17:00:00');
|
||||
|
||||
|
||||
|
||||
insert into evento values (null, "Taller", "Taller 2: Educación Inclusiva.", 35, "Sala de Seminarios" );
|
||||
|
||||
insert into fecha values (null , 11 , '2020-08-17 17:00:00', '2020-08-17 18:00:00');
|
||||
|
||||
insert into fecha values (null , 11 , '2020-08-18 16:00:00', '2020-08-18 18:00:00');
|
||||
|
||||
insert into fecha values (null , 11 , '2020-08-19 16:00:00', '2020-08-19 17:00:00');
|
||||
|
||||
|
||||
|
||||
insert into evento values (null, "Ponencia", "Ponencia Magistral: Dra. Raquel Glazman.", 150, "Unidad de Congresos UIM II" );
|
||||
|
||||
insert into fecha values (null , 12 , '2020-08-17 10:00:00', '2020-08-17 12:00:00');
|
||||
|
||||
insert into evento values (null, "Ponencia", "Ponencia Magistral: Dra. Alma Rosa Sánchez.", 150, "Unidad de Congresos UIM II" );
|
||||
|
||||
insert into fecha values (null , 13 , '2020-08-18 10:00:00', '2020-08-18 11:00:00');
|
||||
|
||||
insert into evento values (null, "Ponencia", "Ponencia Magistral: J. César Arboleda.", 150, "Unidad de Congresos UIM II" );
|
||||
|
||||
insert into fecha values (null , 14 , '2020-08-19 10:00:00', '2020-08-18 11:00:00');
|
||||
|
||||
insert into evento values (null, "Ponencia", "Ponencia Magistral: Lucie Sauvé", 150, "Unidad de Congresos UIM II" );
|
||||
|
||||
insert into fecha values (null , 15 , '2020-08-19 10:45:00', '2020-08-18 12:00:00');
|
||||
|
||||
Reference in New Issue
Block a user