updated model sample & clientSample

This commit is contained in:
Joan Sanchez 2018-07-27 11:18:27 +02:00
parent f87ccee0b2
commit 23993ce717
7 changed files with 126 additions and 78 deletions

View File

@ -1,9 +1,9 @@
{
"name": "ClientNotification",
"name": "ClientSample",
"base": "VnModel",
"options": {
"mysql": {
"table": "clientNotification"
"table": "clientSample"
}
},
"properties": {
@ -22,15 +22,25 @@
"model": "Client",
"foreignKey": "clientFk"
},
"clientNotificationType": {
"type": {
"type": "belongsTo",
"model": "ClientNotificationType",
"foreignKey": "clientNotificationTypeFk"
"model": "Sample",
"foreignKey": "typeFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"account": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyFk"
}
}
}

View File

@ -1,9 +1,9 @@
{
"name": "ClientNotificationType",
"name": "Sample",
"base": "VnModel",
"options": {
"mysql": {
"table": "clientNotificationType"
"table": "sample"
}
},
"properties": {

View File

@ -38,10 +38,10 @@
"CreditClassification": {
"dataSource": "vn"
},
"ClientNotificationType": {
"Sample": {
"dataSource": "vn"
},
"ClientNotification": {
"ClientSample": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,15 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `sample` AS
SELECT
`e`.`id` AS `id`,
`e`.`abrev` AS `code`,
`e`.`descripcion` AS `description`,
`e`.`visible` AS `isVisible`
FROM
`vn2008`.`escritos` `e`;
DROP VIEW `vn`.`clientNotificationType`;

View File

@ -0,0 +1,18 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `clientSample` AS
SELECT
`e`.`id` AS `id`,
`e`.`Id_Cliente` AS `clientFk`,
`e`.`escritos_id` AS `typeFk`,
`e`.`fecha` AS `created`,
`e`.`Id_Trabajador` AS `workerFk`,
`e`.`userFk` AS `userFk`,
`e`.`empresa_id` AS `companyFk`
FROM
`vn2008`.`escritos_det` `e`;
DROP VIEW `vn`.`clientNotification`;

View File

@ -22618,6 +22618,7 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `calling`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2;
@ -25034,7 +25035,8 @@ BEGIN
-- Insertamos los tickets que ya tienen expediciones, que fallaran si se repite la clave primaria.
INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) SELECT p.name, e.ticket_id, COUNT(e.ticket_id)
INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos)
SELECT p.name, e.ticket_id, COUNT(e.ticket_id)
FROM expeditions e
JOIN Tickets t ON ticket_id = Id_Ticket
JOIN Consignatarios c USING(Id_Consigna)
@ -25068,6 +25070,7 @@ BEGIN
GROUP BY p.name, Id_Ticket
) sub GROUP BY province
ON DUPLICATE KEY UPDATE Faltan = Faltan;
-- Mostramos el resultado
SELECT Provincia, COUNT(Id_Ticket) expediciones, SUM(Bultos) Bultos, SUM(Faltan) Prevision
@ -31606,6 +31609,7 @@ BEGIN
INSERT INTO Mensajes(Mensaje,Fecha,Remitente,Destinatario)
VALUES(memTXT, NOW(),idREM, idDES);
SELECT LAST_INSERT_ID() INTO last_ID;
@ -43227,31 +43231,32 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client;
--
-- Temporary table structure for view `clientNotification`
-- Temporary table structure for view `clientSample`
--
DROP TABLE IF EXISTS `clientNotification`;
/*!50001 DROP VIEW IF EXISTS `clientNotification`*/;
DROP TABLE IF EXISTS `clientSample`;
/*!50001 DROP VIEW IF EXISTS `clientSample`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `clientNotification` AS SELECT
/*!50001 CREATE VIEW `clientSample` AS SELECT
1 AS `id`,
1 AS `clientFk`,
1 AS `clientNotificationTypeFk`,
1 AS `typeFk`,
1 AS `created`,
1 AS `workerFk`,
1 AS `userFk`*/;
1 AS `userFk`,
1 AS `companyFk`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary table structure for view `clientNotificationType`
-- Temporary table structure for view `sample`
--
DROP TABLE IF EXISTS `clientNotificationType`;
/*!50001 DROP VIEW IF EXISTS `clientNotificationType`*/;
DROP TABLE IF EXISTS `sample`;
/*!50001 DROP VIEW IF EXISTS `sample`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `clientNotificationType` AS SELECT
/*!50001 CREATE VIEW `sample` AS SELECT
1 AS `id`,
1 AS `code`,
1 AS `description`,
@ -74253,10 +74258,10 @@ USE `vn`;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `clientNotification`
-- Final view structure for view `clientSample`
--
/*!50001 DROP VIEW IF EXISTS `clientNotification`*/;
/*!50001 DROP VIEW IF EXISTS `clientSample`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
@ -74265,16 +74270,16 @@ USE `vn`;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `clientNotification` AS select `e`.`id` AS `id`,`e`.`Id_Cliente` AS `clientFk`,`e`.`escritos_id` AS `clientNotificationTypeFk`,`e`.`fecha` AS `created`,`e`.`Id_Trabajador` AS `workerFk`,`e`.`userFk` AS `userFk` from `vn2008`.`escritos_det` `e` */;
/*!50001 VIEW `clientSample` AS select `e`.`id` AS `id`,`e`.`Id_Cliente` AS `clientFk`,`e`.`escritos_id` AS `typeFk`,`e`.`fecha` AS `created`,`e`.`Id_Trabajador` AS `workerFk`,`e`.`userFk` AS `userFk`,`e`.`empresa_id` AS `companyFk` from `vn2008`.`escritos_det` `e` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `clientNotificationType`
-- Final view structure for view `sample`
--
/*!50001 DROP VIEW IF EXISTS `clientNotificationType`*/;
/*!50001 DROP VIEW IF EXISTS `sample`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
@ -74283,7 +74288,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `clientNotificationType` AS select `e`.`id` AS `id`,`e`.`abrev` AS `code`,`e`.`descripcion` AS `description`,`e`.`visible` AS `isVisible` from `vn2008`.`escritos` `e` */;
/*!50001 VIEW `sample` AS select `e`.`id` AS `id`,`e`.`abrev` AS `code`,`e`.`descripcion` AS `description`,`e`.`visible` AS `isVisible` from `vn2008`.`escritos` `e` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;

View File

@ -729,10 +729,10 @@ call vn.manaSpellersRequery(19);
call vn.manaSpellersRequery(18);
INSERT INTO `vn`.`clientNotification`(`id`, `clientFk`, `clientNotificationTypeFk`, `created`, `workerFk`)
INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk`, `companyFk`)
VALUES
( 1, 101, 1, CURDATE(), 18),
( 2, 101, 1, CURDATE(), 18),
( 3, 101, 2, CURDATE(), 18),
( 4, 102, 2, CURDATE(), 18),
( 5, 102, 3, CURDATE(), 19);
( 1, 101, 1, CURDATE(), 18, 442),
( 2, 101, 1, CURDATE(), 18, 442),
( 3, 101, 2, CURDATE(), 18, 442),
( 4, 102, 2, CURDATE(), 18, 567),
( 5, 102, 3, CURDATE(), 19, 567);