Starting... Connect to Target Database... Connect to Target Database done Perform Checks in Target... - Validating for existing schemas on target MySQL Server... Perform Checks in Target done Create Schemas and Objects.... - Creating schema in target MySQL server at Mysql@euconsulting-group.it:3307... - Executing preamble script... Execute statement: SET FOREIGN_KEY_CHECKS = 0 - Creating schema tempus_innodb... Execute statement: CREATE SCHEMA IF NOT EXISTS `tempus_innodb` - Creating table tempus_innodb.internal_execptions Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`internal_execptions` ( `pk_progressivo` INT NOT NULL AUTO_INCREMENT, `except_name` VARCHAR(70) NOT NULL, `except_message` VARCHAR(100) NOT NULL, `except_flag` VARCHAR(1) NULL DEFAULT 'N', PRIMARY KEY (`pk_progressivo`)) ENGINE = InnoDB AUTO_INCREMENT = 18 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'tabella delle eccezioni importata da IB e utilizzata da trigger e procedure per sollevare eccezioni attraverso il codice SQLSTATE 45000 ' - Creating table tempus_innodb.menu_function_group Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`menu_function_group` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `GRUPPO_DESCRIZIONE` VARCHAR(100) NOT NULL, `GRUPPO_SORT` SMALLINT NOT NULL DEFAULT '0', `GRUPPO_FLAG_ABILITATA` CHAR(1) NOT NULL DEFAULT 'S', `GRUPPO_MODULO` SMALLINT NOT NULL DEFAULT '0', `GRUPPO_IMAGE` LONGBLOB NULL DEFAULT NULL, `GRUPPO_ADMIN` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1435` (`GRUPPO_DESCRIZIONE` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 5 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'definisce i gruppi delle voci di menu delle funzioni DashBoard' - Creating table tempus_innodb.menu_function_items Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`menu_function_items` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MENU_GROUP` INT NOT NULL DEFAULT '0', `ITEMS_DESCRIZIONE` VARCHAR(100) NOT NULL, `ITEM_SORT` SMALLINT NOT NULL DEFAULT '0', `ITEM_FLAG_ABILITATA` CHAR(1) NOT NULL DEFAULT 'S', `ITEM_IMAGE` LONGBLOB NULL DEFAULT NULL, `TAG_PANEL` SMALLINT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1442` (`ITEMS_DESCRIZIONE` ASC, `FK_MENU_GROUP` ASC) VISIBLE, UNIQUE INDEX `INTEG_1446` (`TAG_PANEL` ASC) VISIBLE, INDEX `INTEG_1443` (`FK_MENU_GROUP` ASC) VISIBLE, CONSTRAINT `INTEG_1443` FOREIGN KEY (`FK_MENU_GROUP`) REFERENCES `tempus_innodb`.`menu_function_group` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 16 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'definisce gli items delle voci di gruppo menu delle funzioni DashBoard' - Creating table tempus_innodb.nc_allegati_messaggi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`nc_allegati_messaggi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MESSAGGIO` INT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `DATA_IMPORTAZIONE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_91` (`FK_MESSAGGIO` ASC) VISIBLE, CONSTRAINT `INTEG_91` FOREIGN KEY (`FK_MESSAGGIO`) REFERENCES `tempus_innodb`.`nc_messaggi` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.nc_master Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`nc_master` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `K_TIPO_PRATICA` SMALLINT NULL DEFAULT NULL, `KEY_ANNO` SMALLINT NOT NULL, `KEY_PROGRESSIVO` INT NOT NULL, `DATA_OP` DATE NOT NULL, `UTENTE` VARCHAR(10) NULL DEFAULT NULL, `FIRMA_UTENTE` VARCHAR(1) NOT NULL DEFAULT 'N', `FIRMA_DIRIGENTE` VARCHAR(1) NOT NULL DEFAULT 'N', `FIRMA_SUPERVISORE` VARCHAR(1) NOT NULL DEFAULT 'N', `FK_UTENTE_RILEVATORE` INT NOT NULL DEFAULT '0', `DATA_FIRMA_UTENTE` DATETIME NULL DEFAULT NULL, `DATA_FIRMA_DIRIGENTE` DATETIME NULL DEFAULT NULL, `DATA_FIRMA_SUPERVISORE` DATETIME NULL DEFAULT NULL, `QUALIFICA_TABELLA_VIEW` VARCHAR(2) NOT NULL DEFAULT 'UT', `FK_MOTIVI_NC` INT NOT NULL DEFAULT '9999', `FK_SMASTER` INT NOT NULL DEFAULT '9999', `FK_UOC` INT NOT NULL DEFAULT '9999', `FK_UOS` INT NOT NULL DEFAULT '9999', `FK_STATO_NC` INT NOT NULL DEFAULT '1', `FK_DIRIGENTE_RESP` INT NOT NULL DEFAULT '9999', `FK_SUPERVISORE` INT NOT NULL DEFAULT '9999', `FK_REFQUAL` INT NOT NULL DEFAULT '9999', `FIRMA_REFQUAL` VARCHAR(1) NOT NULL DEFAULT 'N', `DATA_FIRMA_REFQUAL` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_27` (`KEY_ANNO` ASC, `KEY_PROGRESSIVO` ASC) VISIBLE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Necessaria per far funzionare le query dei messaggi' - Creating table tempus_innodb.nc_messaggi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`nc_messaggi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `K_DA_UTENTE` INT NOT NULL DEFAULT '0', `K_A_UTENTE` INT NOT NULL DEFAULT '0', `DATA_INVIO` DATETIME NULL DEFAULT NULL, `DATA_VISUALIZZAZIONE` DATETIME NULL DEFAULT NULL, `DATA_LETTURA` DATETIME NULL DEFAULT NULL, `K_NC` INT NOT NULL DEFAULT '0', `MESS_TEXT_OUT` LONGTEXT NULL DEFAULT NULL, `MESS_TEXT_IN` LONGTEXT NULL DEFAULT NULL, `FLAG_ARCHIVIATO` VARCHAR(1) NULL DEFAULT NULL, `NC_DA_FIRMARE` VARCHAR(1) NOT NULL DEFAULT 'N', `TAB_DI_GENERAZIONE` VARCHAR(2) NULL DEFAULT NULL, `FLAG_RISPOSTA` VARCHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 15 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.nc_messaggi_email Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`nc_messaggi_email` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MESSAGGIO` INT NOT NULL DEFAULT '0', `FLAG_INVIATA` CHAR(1) NOT NULL DEFAULT 'S', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.rdb$install Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`rdb$install` ( `PK_KEY` INT NOT NULL DEFAULT '0', `MODULE_NUMBER` SMALLINT NOT NULL DEFAULT '0') ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'INSTALL SYSTEM' - Creating table tempus_innodb.sys_config_utente Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_config_utente` ( `PK_PROGRESSIVO` INT NOT NULL, `FK_UTENTE` INT NOT NULL DEFAULT '9999', `FK_MASTER_STRUTTURA` INT NOT NULL DEFAULT '9999', `FK_UOC` INT NOT NULL DEFAULT '9999', `FK_UOS` INT NOT NULL DEFAULT '9999', `UTENTE` VARCHAR(10) NOT NULL, `FLAG_SUPERVISORE` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_RESPONSABILE` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_DIRIGENTE` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_REFQUAL` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_AUDITOR` VARCHAR(1) NOT NULL DEFAULT 'N', `RESP_FK_MASTER_STRUTTURA` INT NOT NULL DEFAULT '9999', `RESP_FK_UOC` INT NOT NULL DEFAULT '9999', `RESP_FK_UOS` INT NOT NULL DEFAULT '9999', `FK_CDC` INT NOT NULL DEFAULT '9999', `CDC` VARCHAR(10) NOT NULL DEFAULT '9999', `NOMINATIVO` VARCHAR(100) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_728` (`RESP_FK_UOC` ASC) VISIBLE, INDEX `INTEG_729` (`RESP_FK_UOS` ASC) VISIBLE, INDEX `INTEG_732` (`FK_MASTER_STRUTTURA` ASC) VISIBLE, INDEX `INTEG_733` (`FK_UOC` ASC) VISIBLE, INDEX `INTEG_734` (`FK_UOS` ASC) VISIBLE, INDEX `INTEG_735` (`RESP_FK_MASTER_STRUTTURA` ASC) VISIBLE, CONSTRAINT `INTEG_728` FOREIGN KEY (`RESP_FK_UOC`) REFERENCES `tempus_innodb`.`sys_uoc` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_729` FOREIGN KEY (`RESP_FK_UOS`) REFERENCES `tempus_innodb`.`sys_uos` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_732` FOREIGN KEY (`FK_MASTER_STRUTTURA`) REFERENCES `tempus_innodb`.`sys_master_struttura` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_733` FOREIGN KEY (`FK_UOC`) REFERENCES `tempus_innodb`.`sys_uoc` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_734` FOREIGN KEY (`FK_UOS`) REFERENCES `tempus_innodb`.`sys_uos` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_735` FOREIGN KEY (`RESP_FK_MASTER_STRUTTURA`) REFERENCES `tempus_innodb`.`sys_master_struttura` (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_decodifica_tag Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_decodifica_tag` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TAG` INT NOT NULL DEFAULT '0', `DESCRIZIONE` VARCHAR(1000) NOT NULL, `FLAG_MENU` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_TAG_CONFIGURAZIONE` VARCHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_186` (`PK_PROGRESSIVO` ASC, `TAG` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 32 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'elenca i tag usati per i menu e i pgm che poi vengono abilitati o disabilitati agli utenti' - Creating table tempus_innodb.sys_detail_vuoto Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_detail_vuoto` ( `CAMPO` SMALLINT NULL DEFAULT NULL) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'TABELLA VUOTA PER CONNESSIONE COMPONENTE DETAIL NEL CLIENT' - Creating table tempus_innodb.sys_ip_address_utente Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_ip_address_utente` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_UTENTE` INT NOT NULL DEFAULT '0', `UTENTE` CHAR(10) NOT NULL, `IP_ADDRESS` CHAR(50) NOT NULL, `HOST_NAME` CHAR(100) NULL DEFAULT NULL, `TIME_OUT` TIME NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 4040 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_log_operazioni Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_log_operazioni` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `DATA_OP` DATE NOT NULL, `TIPO_OPERAZIONE` CHAR(1) NOT NULL, `IP_ADDRESS` CHAR(20) NULL DEFAULT NULL, `COMPUTER_NAME` CHAR(30) NULL DEFAULT NULL, `TITLE_FORM_FMX` CHAR(30) NULL DEFAULT NULL, `UTENTE_OP` CHAR(20) NULL DEFAULT NULL, `INFO_SQL_RECORD` LONGBLOB NULL DEFAULT NULL, `FLAG_SYS` CHAR(1) NULL DEFAULT NULL, `UTENTE_IB` CHAR(20) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_mansioni Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_mansioni` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CODICE` VARCHAR(2) NOT NULL DEFAULT 'UT', `DESCRIZIONE` VARCHAR(100) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_201` (`CODICE` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_master_struttura Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_master_struttura` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `DESCRIZIONE` VARCHAR(250) NOT NULL, `DESCRIZIONE_GRAFICO` VARCHAR(250) NULL DEFAULT NULL, `COLORE_GRAFICO` INT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 10000 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_motivi_nc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_motivi_nc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `DESCRIZIONE_MOTIVO` VARCHAR(250) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Necessaria per far funzionare le query dei messaggi' - Creating table tempus_innodb.sys_params_plattaform Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_params_plattaform` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `PATH_PRINT_DEFAULT` CHAR(250) NOT NULL DEFAULT '', `KEY_SOFTWARE` SMALLINT NOT NULL DEFAULT '0', `DELAY_EMAIL_BATCH` INT NOT NULL DEFAULT '0', `DELAY_EMAIL_SINGLE` INT NOT NULL DEFAULT '54000', `PASSWORD_PROVISIONAL` VARCHAR(30) NOT NULL DEFAULT 'Xy0@99aAbBX2004', `BATCH_EMAIL_ON` TIME NULL DEFAULT NULL, `BATCH_EMAIL_OFF` TIME NULL DEFAULT NULL, `ABILITA_BATCH_EMAIL` CHAR(1) NOT NULL DEFAULT 'S', `ABILITA_BATCH_EMAIL_PSWD` CHAR(1) NOT NULL DEFAULT 'S', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_params_plattaform_user Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_params_plattaform_user` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `PATH_PRINT_DEFAULT` CHAR(250) NOT NULL DEFAULT '', `KEY_SOFTWARE` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 3 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_query_pgm Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_query_pgm` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TAG_PGM` INT NOT NULL DEFAULT '0', `SQL_COMMAND_BASE` VARCHAR(1000) NULL DEFAULT NULL, `SQL_COMMAND_DETAIL` VARCHAR(1000) NULL DEFAULT NULL, `NOME_PROGRAMMA` VARCHAR(250) NULL DEFAULT NULL, `TABLE_NAME` VARCHAR(50) NULL DEFAULT NULL, `TABLE_NAME_DETAIL` VARCHAR(50) NULL DEFAULT NULL, `NOME_GRAFICO` CHAR(50) NULL DEFAULT NULL, `TITOLO_TESTA` CHAR(100) NULL DEFAULT NULL, `SOTTOTITOLO_TESTA` CHAR(100) NULL DEFAULT NULL, `TITOLO_CODA` CHAR(100) NULL DEFAULT NULL, `SOTTOTITOLO_CODA` CHAR(100) NULL DEFAULT NULL, `ETICHETTA_X` CHAR(20) NULL DEFAULT NULL, `ETICHETTA_Y` CHAR(20) NULL DEFAULT NULL, `ETICHETTA_LEGENDA` CHAR(20) NULL DEFAULT NULL, `FLAG_GRAFICO` CHAR(1) NOT NULL DEFAULT 'N', `ETICHETTA_X1` VARCHAR(20) NULL DEFAULT NULL, `ETICHETTA_Y1` VARCHAR(20) NULL DEFAULT NULL, `ETICHETTA_X2` VARCHAR(20) NULL DEFAULT NULL, `ETICHETTA_Y2` VARCHAR(20) NULL DEFAULT NULL, `ETICHETTA_X3` VARCHAR(20) NULL DEFAULT NULL, `ETICHETTA_Y3` VARCHAR(20) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 101 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'contiene le query base per ogni programma, caricare il valore di TAG del componente action list che lancia il programma NON IL VALORE DI TAG DELLA VOCE MENU' - Creating table tempus_innodb.sys_uoc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_uoc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MSTRUTTURE` INT NOT NULL DEFAULT '9999', `DESCRIZIONE` VARCHAR(250) NOT NULL, `FLAG_CERCA_DIP` VARCHAR(1) NOT NULL DEFAULT 'S', `DESCRIZIONE_GRAFICO` VARCHAR(250) NULL DEFAULT NULL, `COLORE_GRAFICO` INT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_744` (`FK_MSTRUTTURE` ASC) VISIBLE, CONSTRAINT `INTEG_744` FOREIGN KEY (`FK_MSTRUTTURE`) REFERENCES `tempus_innodb`.`sys_master_struttura` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 10000 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'UNITA OPERATIVA COMPLESSA SECONDO LIVELLO ORGANIZZAZIONE' - Creating table tempus_innodb.sys_uos Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_uos` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_PK_PROGRESSIVO_MASTER` INT NOT NULL DEFAULT '9999', `FK_UOC` INT NOT NULL DEFAULT '9999', `DESCRIZIONE` VARCHAR(250) NOT NULL, `FLAG_CERCA_DIP` VARCHAR(1) NOT NULL DEFAULT 'S', `DESCRIZIONE_GRAFICO` VARCHAR(250) NULL DEFAULT NULL, `COLORE_GRAFICO` INT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_745` (`FK_UOC` ASC) VISIBLE, CONSTRAINT `INTEG_745` FOREIGN KEY (`FK_UOC`) REFERENCES `tempus_innodb`.`sys_uoc` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 10000 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'UNITA OPERATIVA SEMPLICE TERZO LIVELLO ORGANIZZAZIONE' - Creating table tempus_innodb.sys_user_online Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_user_online` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `K_UTENTE` INT NOT NULL, `NOME_UTENTE` CHAR(30) NULL DEFAULT NULL, `COGNOME_UTENTE` CHAR(30) NULL DEFAULT NULL, `DATA_LOGIN` DATETIME NOT NULL, `DATA_LOGOUT` DATETIME NULL DEFAULT NULL, `IP_ADDRESS` CHAR(50) NOT NULL, `HOST_NAME` CHAR(100) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_utenti Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_utenti` ( `PK_PROGRESSIVO` INT NOT NULL, `UTENTE` VARCHAR(10) NOT NULL, `NOME_UTENTE` VARCHAR(30) NOT NULL, `COGNOME_UTENTE` VARCHAR(30) NOT NULL, `USER_PASSWORD` VARCHAR(20) NOT NULL, `TELEFONO_INTERNO` VARCHAR(16) NULL DEFAULT NULL, `CELLULARE` VARCHAR(16) NULL DEFAULT NULL, `EMAIL_PEC` VARCHAR(40) NULL DEFAULT NULL, `EMAIL` VARCHAR(40) NULL DEFAULT NULL, `scadenza_psw` DATE NULL DEFAULT (curdate() + interval 90 day), `FLAG_STORICO` VARCHAR(1) NOT NULL DEFAULT 'N', `UTENTE_NUM` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `UTENTE` (`UTENTE` ASC) VISIBLE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_utenti_asinc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_utenti_asinc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `UTENTE` VARCHAR(10) NOT NULL, `NOME_UTENTE` VARCHAR(30) NOT NULL, `COGNOME_UTENTE` VARCHAR(30) NOT NULL, `USER_PASSWORD` VARCHAR(20) NOT NULL, `TELEFONO_INTERNO` VARCHAR(16) NULL DEFAULT NULL, `CELLULARE` VARCHAR(16) NULL DEFAULT NULL, `EMAIL_PEC` VARCHAR(40) NULL DEFAULT NULL, `EMAIL` VARCHAR(40) NULL DEFAULT NULL, `SCADENZA_PSW` DATE NOT NULL, `FLAG_STORICO` VARCHAR(1) NOT NULL DEFAULT 'N', `UTENTE_NUM` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 7 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.sys_utenti_mansione Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_utenti_mansione` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_UTENTE` INT NOT NULL DEFAULT '9999', `UTENTE` VARCHAR(10) NOT NULL DEFAULT '9999', `MANSIONE_TABELLA` VARCHAR(2) NOT NULL DEFAULT 'UT', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 1833 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Per ogni utente registra la mansione che ha all\'interno del programma UT=Utente AU=Auditor RQ=Referente Qualita' - Creating table tempus_innodb.sys_utenti_menu Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_utenti_menu` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_UTENTE` INT NOT NULL DEFAULT '9999', `UTENTE` VARCHAR(10) NOT NULL DEFAULT '9999', `FK_TAG` INT NOT NULL DEFAULT '0', `TAG_AUTORIZZATO` SMALLINT NOT NULL DEFAULT '999', `FLAG_PERMESSO` VARCHAR(1) NOT NULL DEFAULT 'S', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PER OGNI UTENTE CONFIGURA LE VOCI DI MENU CHE VEDRA' - Creating table tempus_innodb.sys_utenti_pgm Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_utenti_pgm` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_PROG_UTENTI` INT NOT NULL DEFAULT '0', `UTENTE` VARCHAR(10) NOT NULL, `FK_TAG` INT NOT NULL DEFAULT '0', `TAG_AUTORIZZATO` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PERMESSI PER UTILIZZARE I PROGRAMM\\\\\\\\n IL CAMPO TAG DA L\'AUTORIZZAZIONE AD APRIRE IL PROGRAMMA CON QUEL TAG ALTRIMENTI MESS DI AVVISO ALL\'UTENTE CHE NON PUO USARE IL PROGRAMMA' - Creating table tempus_innodb.sys_utenti_pgm_utente Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`sys_utenti_pgm_utente` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_PROG_UTENTI` INT NOT NULL DEFAULT '0', `UTENTE` VARCHAR(10) NOT NULL, `FK_TAG` INT NOT NULL DEFAULT '0', `TAG_AUTORIZZATO` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1279` (`FK_PROG_UTENTI` ASC, `UTENTE` ASC, `TAG_AUTORIZZATO` ASC) VISIBLE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'contiene la lista dei progressivi dei programmi abilitati per un utente semplice' - Creating table tempus_innodb.tr_azione Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tr_azione` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `TOT_ORE` DOUBLE NOT NULL DEFAULT '0', `TOT_COSTO` DOUBLE NOT NULL DEFAULT '0', `TOT_ORE_ISTITUZIONALI` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1341` (`FK_AZIONE` ASC) VISIBLE, CONSTRAINT `INTEG_1341` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 469 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tr_azione_sottolivelli Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tr_azione_sottolivelli` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_SOTTOLIV` INT NOT NULL DEFAULT '0', `TOT_ORE` DOUBLE NOT NULL DEFAULT '0', `TOT_COSTO` DOUBLE NOT NULL DEFAULT '0', `TOT_ORE_ISTITUZIONALI` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1343` (`FK_AZIONE_SOTTOLIV` ASC) VISIBLE, CONSTRAINT `INTEG_1343` FOREIGN KEY (`FK_AZIONE_SOTTOLIV`) REFERENCES `tempus_innodb`.`ts_azione_sottolivelli` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 677 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tr_mgruppo Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tr_mgruppo` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MG` INT NOT NULL DEFAULT '0', `TOT_ORE` DOUBLE NOT NULL DEFAULT '0', `TOT_COSTO` DOUBLE NOT NULL DEFAULT '0', `TOT_ORE_ISTITUZIONALI` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1345` (`FK_MG` ASC) VISIBLE, CONSTRAINT `INTEG_1345` FOREIGN KEY (`FK_MG`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 261 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts1_costi_key_import Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_costi_key_import` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_COSTO` INT NOT NULL DEFAULT '0', `KEY_IMPORT` CHAR(25) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `CHIAVE_GIA_IMPOSTATA_PER_QUESTO_COSTO` (`FK_COSTO` ASC, `KEY_IMPORT` ASC) VISIBLE, INDEX `KEY_IMPORT_idx` (`KEY_IMPORT` ASC) VISIBLE, CONSTRAINT `INTEG_1133` FOREIGN KEY (`FK_COSTO`) REFERENCES `tempus_innodb`.`ts1_tipo_costi` (`PK_PROGRESSIVO`) ON DELETE CASCADE, CONSTRAINT `INTEG_9901` FOREIGN KEY (`KEY_IMPORT`) REFERENCES `tempus_innodb`.`ts1_key_import` (`KEY_IMPORT`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 6 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE LE CHIAVI DI IMPORTAZIONE ALTERNATIVE ALLA PRIMA PER OGNI COSTO' - Creating table tempus_innodb.ts1_key_import Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_key_import` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `KEY_IMPORT` CHAR(25) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `KEY_IMPORT_UNIQUE` (`KEY_IMPORT` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 19 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE LE CHIAVI DI IMPORTAZIONE DATI COGE DEL CLIENTE' - Creating table tempus_innodb.ts1_partneriato_params Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_partneriato_params` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_PARTNER` INT NOT NULL DEFAULT '0', `FK_RICLASSIFICA` INT NOT NULL DEFAULT '0', `FK_RICLASSIFICA_COSTO` INT NOT NULL DEFAULT '0', `PERC_COMPETENZA` FLOAT NOT NULL DEFAULT '0', `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `CONFIGURAZIONE_PRESENTE` (`FK_PARTNER` ASC, `FK_RICLASSIFICA` ASC, `FK_RICLASSIFICA_COSTO` ASC) VISIBLE, INDEX `INTEG_1116` (`FK_RICLASSIFICA` ASC) VISIBLE, INDEX `INTEG_1117` (`FK_RICLASSIFICA_COSTO` ASC) VISIBLE, CONSTRAINT `INTEG_1115` FOREIGN KEY (`FK_PARTNER`) REFERENCES `tempus_innodb`.`tt1_partner_anagrafica` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_1116` FOREIGN KEY (`FK_RICLASSIFICA`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1117` FOREIGN KEY (`FK_RICLASSIFICA_COSTO`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto_detail` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MODULO 1\\\\\\\\r\\\\\\\\nCOLLEGA PARTER AL PROGETTO RICLASSIFICATO I TOTALI SONO TUTTI DI LOOKUP IN DELPHI QUI HO SOLO LA PERCENTUALE DI COMPETENZA' - Creating table tempus_innodb.ts1_riclassifica_progetto Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_riclassifica_progetto` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MACROGRUPPO` INT NOT NULL DEFAULT '0', `FLAG_ATTIVO` CHAR(1) NOT NULL DEFAULT 'S', `NOTE` VARCHAR(300) NULL DEFAULT NULL, `DEFINIZIONE_RICLASSIFICATO` VARCHAR(250) NOT NULL, `NSAL_UFFICIALI` SMALLINT NOT NULL DEFAULT '1', `NSAL_INTERNI` SMALLINT NOT NULL DEFAULT '1', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `RICLASSIFICAZIONE_PRESENTE` (`FK_MACROGRUPPO` ASC) VISIBLE, CONSTRAINT `INTEG_1095` FOREIGN KEY (`FK_MACROGRUPPO`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MODULO 1 Tabella Master di riclassificazione del progetto finanziato' - Creating table tempus_innodb.ts1_riclassifica_progetto_allegati Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_riclassifica_progetto_allegati` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_RICLASSIFICA` INT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `DATA_IMPORTAZIONE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `ts1_riclassifica_progetto_allegati_ibfk_1` (`FK_RICLASSIFICA` ASC) VISIBLE, CONSTRAINT `ts1_riclassifica_progetto_allegati_ibfk_1` FOREIGN KEY (`FK_RICLASSIFICA`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts1_riclassifica_progetto_detail Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_riclassifica_progetto_detail` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_PARAM_PROGETTO` INT NOT NULL DEFAULT '0', `FK_TIPO_COSTO` INT NOT NULL DEFAULT '0', `FLAG_ATTIVO` CHAR(1) NOT NULL DEFAULT 'N', `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, `BUDGET` DOUBLE NOT NULL DEFAULT '0', `BUDGET_UTILIZZATO` DOUBLE NOT NULL DEFAULT '0', `QUOTA_DETRAIBILE` FLOAT NOT NULL DEFAULT '100', `BUDGET_TMP_CALCOLI` DOUBLE NOT NULL DEFAULT '0', `GG_TMP` INT GENERATED ALWAYS AS ((to_days(`DATA_FI`) - to_days(`DATA_IN`))) VIRTUAL, `BUDGET_GG_TMP` DOUBLE GENERATED ALWAYS AS ((`BUDGET` / `GG_TMP`)) VIRTUAL, `DATA_IN_TMP` DATE NOT NULL, `FK_ANAG` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `COSTO_GIA_REGISTRATO` (`FK_PARAM_PROGETTO` ASC, `FK_TIPO_COSTO` ASC) VISIBLE, INDEX `INTEG_1106` (`FK_TIPO_COSTO` ASC) VISIBLE, CONSTRAINT `INTEG_1105` FOREIGN KEY (`FK_PARAM_PROGETTO`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1106` FOREIGN KEY (`FK_TIPO_COSTO`) REFERENCES `tempus_innodb`.`ts1_tipo_costi` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MODULO 1 DETTAGLIO DELLA TABELLA PARAMETRI PROGETTO OGNI REC UN TIPO DI COSTO E I SUOI TOTALIZZATORI' - Creating table tempus_innodb.ts1_riclassifica_progetto_dett_allert Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_riclassifica_progetto_dett_allert` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_PARAM_PROGETTO_DETAIL` INT NOT NULL DEFAULT '0', `FLAG_ATTIVO` CHAR(1) NOT NULL DEFAULT 'N', `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, `BUDGET` DOUBLE NOT NULL DEFAULT '0', `BUDGET_UTILIZZATO` DOUBLE NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `FLAG_EMAIL` CHAR(1) NOT NULL DEFAULT 'N', `GG_ALLERT` SMALLINT NOT NULL DEFAULT '15', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `ALLERT_GIA_ATTIVATO` (`FK_PARAM_PROGETTO_DETAIL` ASC, `DATA_IN` ASC, `DATA_FI` ASC) VISIBLE, CONSTRAINT `INTEG_1126` FOREIGN KEY (`FK_PARAM_PROGETTO_DETAIL`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto_detail` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MODULO 1 ALLERT DEI RECORD DI DETTAGLIO DELLA TABELLA PARAMETRI PROGETTO DA QUANDO E ENTRO QUANDO FARE UNA COSA' - Creating table tempus_innodb.ts1_tipo_costi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_tipo_costi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CODICE_COSTO` VARCHAR(4) NOT NULL, `DESCRIZIONE` VARCHAR(250) NOT NULL, `FLAG_ATTIVO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_PERSONALE` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_COSTO_IMPORTATO` CHAR(1) NOT NULL DEFAULT 'S', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1090` (`CODICE_COSTO` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 28 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MODULO 1 ANAGRAFICA COSTI' - Creating table tempus_innodb.ts1_tipo_doc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts1_tipo_doc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CODICE` CHAR(4) NOT NULL, `DESCRIZIONE` VARCHAR(50) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `CODICE_PRESENTE` (`CODICE` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 53 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'TIPI DI ALLEGATI' - Creating table tempus_innodb.ts_anno Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_anno` ( `ANNO` INT NOT NULL DEFAULT '0', `FLAG_BISESTILE` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`ANNO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PARAMETRI ANNO ESERCIZIO' - Creating table tempus_innodb.ts_azione Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MACROGRUPPO` INT NOT NULL DEFAULT '0', `AZIONE` VARCHAR(20) NOT NULL, `DATA_INIZIO` DATETIME NOT NULL, `DATA_FINE` DATETIME NOT NULL, `CUP` VARCHAR(100) NOT NULL, `DESCRIZIONE` VARCHAR(500) NOT NULL, `COSTO_STANDARD` CHAR(1) NOT NULL DEFAULT 'N', `COSTO_STANDARD_1_2_ZERO_PER_NO` SMALLINT NOT NULL DEFAULT '0', `MONTE_ORE` SMALLINT NOT NULL DEFAULT '0', `FLAG_AZIONE_SOSPESA` CHAR(1) NOT NULL DEFAULT 'N', `BUDGET_AZIONE` DOUBLE NOT NULL DEFAULT '0', `BUDGET_AZIONE_USATO` DOUBLE NOT NULL DEFAULT '0', `BUDGET_AZIONE_ASSEGNATO` DOUBLE NOT NULL DEFAULT '0', `FILENAME` VARCHAR(20) NOT NULL, `MONTE_ORE_ANNUO` SMALLINT NULL DEFAULT '0', `FLAG_COSTO_STD_FISSO` CHAR(1) NOT NULL DEFAULT 'N', `CSTD_ALTO1` DOUBLE NOT NULL DEFAULT '0', `CSTD_ALTO2` DOUBLE NOT NULL DEFAULT '0', `CSTD_MEDIO1` DOUBLE NOT NULL DEFAULT '0', `CSTD_MEDIO2` DOUBLE NOT NULL DEFAULT '0', `CSTD_BASSO1` DOUBLE NOT NULL DEFAULT '0', `CSTD_BASSO2` DOUBLE NOT NULL DEFAULT '0', `FLAG_CHIUSO` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_CALCOLO_MINUTO` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_PLAN` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_273` (`AZIONE` ASC) VISIBLE, INDEX `INTEG_754` (`FK_MACROGRUPPO` ASC) VISIBLE, CONSTRAINT `INTEG_754` FOREIGN KEY (`FK_MACROGRUPPO`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 33 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_azione_allegati Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_allegati` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `DATA_IMPORTAZIONE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1190` (`FK_AZIONE` ASC) VISIBLE, CONSTRAINT `INTEG_1190` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 6 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE ALLEGATI ALLA AZIONE RACCORDATO ALLA AZIONE' - Creating table tempus_innodb.ts_azione_parametri_calcolo Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_parametri_calcolo` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `NUMERO_SAL` SMALLINT NOT NULL DEFAULT '1', `SAL_ELABORATO` CHAR(1) NOT NULL DEFAULT 'N', `DATA_INIZIO` DATETIME NULL DEFAULT NULL, `DATA_FINE` DATETIME NULL DEFAULT NULL, `PERC_CTRL_ORE` SMALLINT NOT NULL DEFAULT '80', `MESI_UOMO_DIP` DOUBLE NOT NULL DEFAULT '0', `IMPORTO_DIP` DOUBLE NOT NULL DEFAULT '0', `ORE_PROGETTO_DIP` DOUBLE NOT NULL DEFAULT '0', `ORE_BASE_CALCOLO_DIP` SMALLINT NOT NULL DEFAULT '0', `DURATA_IN_MESI` SMALLINT NOT NULL DEFAULT '0', `DATA_IN_STP` DATETIME NULL DEFAULT NULL, `DATA_FI_STP` DATETIME NULL DEFAULT NULL, `COEFF_CORREZIONE_ORE` FLOAT NOT NULL DEFAULT '1', `PESO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_794` (`FK_AZIONE_STRUTTURA` ASC, `ANNO` ASC, `NUMERO_SAL` ASC) VISIBLE, INDEX `INTEG_52` (`FK_AZIONE_STRUTTURA` ASC, `NUMERO_SAL` ASC) VISIBLE, CONSTRAINT `INTEG_52` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NUMERO_SAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 2546 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'E\' LA VECCHIA BIO_PARAMETRI_AZIONI \\\\\\\\r\\\\\\\\nVIENE USATA COME PARAMETRI PER ELABORARE \\\\\\\\r\\\\\\\\nCREA IL SIMULATORE DELL\'AZIONE STRUTTURA A CUI SI LEGA' - Creating table tempus_innodb.ts_azione_parametri_stampe Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_parametri_stampe` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `TAG_REPORT` SMALLINT NOT NULL DEFAULT '0', `RIGA` SMALLINT NOT NULL DEFAULT '1', `COLONNA` SMALLINT NOT NULL DEFAULT '0', `FLAG_BLOB` CHAR(1) NOT NULL DEFAULT 'N', `ALLEGATO_BRL` LONGBLOB NULL DEFAULT NULL, `DESCRIZIONE` VARCHAR(250) NOT NULL, `DESCRIZIONE2` VARCHAR(250) NULL DEFAULT NULL, `FK_NOMI_REPORT` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `RIGA_COLONNA_GIA_PRESENTE_PER_IL_REPORT` (`FK_AZIONE` ASC, `TAG_REPORT` ASC, `RIGA` ASC, `COLONNA` ASC) VISIBLE, INDEX `INTEG_1180` (`FK_NOMI_REPORT` ASC) VISIBLE, CONSTRAINT `INTEG_1180` FOREIGN KEY (`FK_NOMI_REPORT`) REFERENCES `tempus_innodb`.`ts_nomi_report` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_34` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 50 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PARAMETRI STAMPA PER AZIONE E TIPO DI REPORT (TAG NUMERICO) DEFINISCE DOVE STAMPARE CON RIGA COLONNA' - Creating table tempus_innodb.ts_azione_plan Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_plan` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MACROGRUPPO` INT NOT NULL DEFAULT '0', `FK_AZIONE` INT NOT NULL DEFAULT '0', `FLAG_ESCLUDI_SABATO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_ESCLUDI_DOMENICA` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_OGNI_GIORNO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_GIORNI_ALTERNI` CHAR(1) NOT NULL DEFAULT 'N', `PERCENTUALE_MAX_GIORNO` FLOAT NOT NULL DEFAULT '80', `TOTALE_ORE` DOUBLE NOT NULL DEFAULT '0', `TOTALE_ORE_PLAN` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1308` (`FK_MACROGRUPPO` ASC) VISIBLE, INDEX `INTEG_1309` (`FK_AZIONE` ASC) VISIBLE, CONSTRAINT `INTEG_1308` FOREIGN KEY (`FK_MACROGRUPPO`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1309` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_azione_sal Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_sal` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_82` (`FK_AZIONE` ASC, `NSAL` ASC, `DATA_IN` ASC, `DATA_FI` ASC) VISIBLE, CONSTRAINT `INTEG_78` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 138 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PROGRESSIVI SAL PER AZIONE' - Creating table tempus_innodb.ts_azione_sottolivelli Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_sottolivelli` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `FK_SOTTOLIVELLI` INT NOT NULL DEFAULT '0', `DATA_INIZIO_AZLIV` DATETIME NOT NULL, `DATA_FINE_AZLIV` DATETIME NOT NULL, `BUDGET_AZLIV` DOUBLE NOT NULL DEFAULT '0', `BUDGET_AZLIV_USATO` DOUBLE NOT NULL DEFAULT '0', `PATH_REPORT` CHAR(120) NULL DEFAULT NULL, `FLAG_PLAN` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_307` (`FK_AZIONE` ASC, `FK_SOTTOLIVELLI` ASC) VISIBLE, INDEX `INTEG_759` (`FK_SOTTOLIVELLI` ASC) VISIBLE, CONSTRAINT `INTEG_758` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_759` FOREIGN KEY (`FK_SOTTOLIVELLI`) REFERENCES `tempus_innodb`.`ts_sottolivelli` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 59 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'RACCORDA L\'AZIONE AI SOTTOLIVELLI (MISURE)' - Creating table tempus_innodb.ts_azione_sottolivelli_plan Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_sottolivelli_plan` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MACROGRUPPO` INT NOT NULL DEFAULT '0', `FK_AZIONE` INT NOT NULL DEFAULT '0', `FK_AZIONE_SOTTOLIV` INT NOT NULL DEFAULT '0', `FLAG_ESCLUDI_SABATO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_ESCLUDI_DOMENICA` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_OGNI_GIORNO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_GIORNI_ALTERNI` CHAR(1) NOT NULL DEFAULT 'N', `PERCENTUALE_MAX_GIORNO` FLOAT NOT NULL DEFAULT '80', `TOTALE_ORE` DOUBLE NOT NULL DEFAULT '0', `TOTALE_ORE_PLAN` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1323` (`FK_MACROGRUPPO` ASC) VISIBLE, INDEX `INTEG_1324` (`FK_AZIONE` ASC) VISIBLE, INDEX `INTEG_1325` (`FK_AZIONE_SOTTOLIV` ASC) VISIBLE, CONSTRAINT `INTEG_1323` FOREIGN KEY (`FK_MACROGRUPPO`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1324` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1325` FOREIGN KEY (`FK_AZIONE_SOTTOLIV`) REFERENCES `tempus_innodb`.`ts_azione_sottolivelli` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PARAMS PER AZIONE-SOTTOLIV CHE USA LA PLAN ORE, RECORD PRESENTE SE MACROGRUPPO CON FLAG_PLAN=S' - Creating table tempus_innodb.ts_azione_struttura Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_struttura` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `FK_ANAG_PROGETTO` INT NOT NULL DEFAULT '0', `FK_AZIONE_SOTTOLIVELLI` INT NOT NULL DEFAULT '0', `FLAG_BLOCCATO` VARCHAR(1) NOT NULL DEFAULT 'N', `FK_MASTER_ODS` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `CHECK_LISTA_GIA_COLLEGATA` (`FK_AZIONE` ASC, `FK_ANAG_PROGETTO` ASC, `FK_AZIONE_SOTTOLIVELLI` ASC) VISIBLE, UNIQUE INDEX `ODS_GIA_COLLEGATO` (`PK_PROGRESSIVO` ASC, `FK_MASTER_ODS` ASC) VISIBLE, INDEX `INTEG_761` (`FK_ANAG_PROGETTO` ASC) VISIBLE, INDEX `INTEG_762` (`FK_AZIONE_SOTTOLIVELLI` ASC) VISIBLE, INDEX `INTEG_111` (`FK_MASTER_ODS` ASC) VISIBLE, CONSTRAINT `INTEG_111` FOREIGN KEY (`FK_MASTER_ODS`) REFERENCES `tempus_innodb`.`tt_lista_personale_master` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_760` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_761` FOREIGN KEY (`FK_ANAG_PROGETTO`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_762` FOREIGN KEY (`FK_AZIONE_SOTTOLIVELLI`) REFERENCES `tempus_innodb`.`ts_azione_sottolivelli` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 822 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE IL COLLEGAMENTO AZIONE DIPENDENTE VIENE ALIMENTATA DALLA LISTA_PERSONALE_DETAIL CON PROCEDURE SERVE COME SIMULATORE CANCELLANDO QUESTI DATI NON CANCELLO LA STRUTTURA ORIGINALE MA ANNULLO TUTTE LE OPERAZIONI SENZA CHE DEBBANO REINSERIRE I DATI DELLA STRUTTURA TUTTE LE TABELLE SONO COLLEGATE A QUESTA E NON A TS_AZIONE_STRUTTURA' - Creating table tempus_innodb.ts_azione_struttura_simula Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_azione_struttura_simula` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `PK_PROGRESSIVO_AZSTRUT` INT NOT NULL DEFAULT '0', `FK_AZIONE` INT NOT NULL DEFAULT '0', `FK_ANAG_PROGETTO` INT NOT NULL DEFAULT '0', `FK_AZIONE_SOTTOLIVELLI` INT NOT NULL DEFAULT '0', `FLAG_BLOCCATO` VARCHAR(1) NOT NULL DEFAULT 'N', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_MASTER_ODS` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_51` (`PK_PROGRESSIVO_AZSTRUT` ASC, `NSAL` ASC) VISIBLE, INDEX `INTEG_290` (`FK_ANAG_PROGETTO` ASC) VISIBLE, INDEX `INTEG_289` (`FK_AZIONE` ASC) VISIBLE, INDEX `INTEG_291` (`FK_AZIONE_SOTTOLIVELLI` ASC) VISIBLE, INDEX `ODS_COLLEGATO_AD_UN_SAL` (`PK_PROGRESSIVO_AZSTRUT` ASC, `FK_MASTER_ODS` ASC) VISIBLE, INDEX `ODS_UTILIZZATO_IN_UN_SAL` (`FK_MASTER_ODS` ASC) VISIBLE, CONSTRAINT `INTEG_289` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_290` FOREIGN KEY (`FK_ANAG_PROGETTO`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_291` FOREIGN KEY (`FK_AZIONE_SOTTOLIVELLI`) REFERENCES `tempus_innodb`.`ts_azione_sottolivelli` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ODS_COLLEGATO_AD_UN_SAL` FOREIGN KEY (`PK_PROGRESSIVO_AZSTRUT` , `FK_MASTER_ODS`) REFERENCES `tempus_innodb`.`ts_azione_struttura` (`PK_PROGRESSIVO` , `FK_MASTER_ODS`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ODS_UTILIZZATO_IN_UN_SAL` FOREIGN KEY (`FK_MASTER_ODS`) REFERENCES `tempus_innodb`.`tt_lista_personale_master` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 2557 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE IL COLLEGAMENTO AZIONE DIPENDENTE VIENE ALIMENTATA DALLA LISTA_PERSONALE_DETAIL CON PROCEDURE SERVE COME SIMULATORE CANCELLANDO QUESTI DATI NON CANCELLO LA STRUTTURA ORIGINALE MA ANNULLO TUTTE LE OPERAZIONI SENZA CHE DEBBANO REINSERIRE I DATI DELLA STRUTTURA TUTTE LE TABELLE SONO COLLEGATE A QUESTA E NON A TS_AZIONE_STRUTTURA' - Creating table tempus_innodb.ts_calendario Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_calendario` ( `ANNO` SMALLINT NOT NULL DEFAULT '0', `MM` SMALLINT NOT NULL DEFAULT '0', `GG_INIZIO` SMALLINT NOT NULL DEFAULT '0', `GG_FINE` SMALLINT NOT NULL DEFAULT '0', `DATA_INIZIO` DATE NOT NULL, `DATA_FINE` DATE NOT NULL, `NOME_MESE` CHAR(30) NOT NULL, `NOME_GIORNO_INIZIO_MESE` CHAR(30) NOT NULL, `NOME_GIORNO_1` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_2` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_3` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_4` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_5` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_6` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_7` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_8` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_9` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_10` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_11` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_12` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_13` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_14` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_15` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_16` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_17` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_18` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_19` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_20` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_21` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_22` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_23` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_24` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_25` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_26` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_27` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_28` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_29` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_30` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_31` CHAR(15) NULL DEFAULT NULL, PRIMARY KEY (`ANNO`, `MM`, `GG_INIZIO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_cdc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_cdc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CDC` CHAR(10) NOT NULL, `DESCRIZIONE` CHAR(250) NOT NULL, `FLAG_ATTIVO` CHAR(1) NULL DEFAULT 'S', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 10000 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_cfisc_nontrovati Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_cfisc_nontrovati` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CFISC` CHAR(16) NOT NULL, `DATA_ESECUZIONE_IMPORT` DATETIME NOT NULL, `ANNO_IMPORT` SMALLINT NOT NULL DEFAULT '0', `MESE_IMPORT` SMALLINT NOT NULL DEFAULT '0', `FLAG_ANAGRAFICA_CREATA` CHAR(1) NOT NULL DEFAULT 'N', `DATA_CREAZIONE_ANAGRAFICO` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 208 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'TABELLA CHE CONTIENE I CFISC NON TROVATI NELLE IMPORTAZIONI' - Creating table tempus_innodb.ts_emaildainviare Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_emaildainviare` ( `pk_progressivo` INT NOT NULL AUTO_INCREMENT, `fk_anag` INT NOT NULL DEFAULT '0', `oggetto` VARCHAR(100) NULL DEFAULT NULL, `testo` VARCHAR(250) NOT NULL, `flag_inviata` CHAR(1) NOT NULL DEFAULT 'N', `data_richiesta` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `data_invio` DATETIME NULL DEFAULT NULL, `email_utilizzata` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`pk_progressivo`)) ENGINE = InnoDB AUTO_INCREMENT = 10 DEFAULT CHARACTER SET = utf8mb3 COMMENT = 'contenitore email da inviare' - Creating table tempus_innodb.ts_giorni_del_mese Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_giorni_del_mese` ( `MM` SMALLINT NOT NULL DEFAULT '0', `GG_DAL` SMALLINT NULL DEFAULT NULL, `GG_AL` SMALLINT NULL DEFAULT NULL, `NOME_MESE` VARCHAR(20) NOT NULL, PRIMARY KEY (`MM`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_giorni_fissi_per_stampa Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_giorni_fissi_per_stampa` ( `GIORNO_1` SMALLINT NULL DEFAULT '1', `GIORNO_2` SMALLINT NULL DEFAULT '2', `GIORNO_3` SMALLINT NULL DEFAULT '3', `GIORNO_4` SMALLINT NULL DEFAULT '4', `GIORNO_5` SMALLINT NULL DEFAULT '5', `GIORNO_6` SMALLINT NULL DEFAULT '6', `GIORNO_7` SMALLINT NULL DEFAULT '7', `GIORNO_8` SMALLINT NULL DEFAULT '8', `GIORNO_9` SMALLINT NULL DEFAULT '9', `GIORNO_10` SMALLINT NULL DEFAULT '10', `GIORNO_11` SMALLINT NULL DEFAULT '11', `GIORNO_12` SMALLINT NULL DEFAULT '12', `GIORNO_13` SMALLINT NULL DEFAULT '13', `GIORNO_14` SMALLINT NULL DEFAULT '14', `GIORNO_15` SMALLINT NULL DEFAULT '15', `GIORNO_16` SMALLINT NULL DEFAULT '16', `GIORNO_17` SMALLINT NULL DEFAULT '17', `GIORNO_18` SMALLINT NULL DEFAULT '18', `GIORNO_19` SMALLINT NULL DEFAULT '19', `GIORNO_20` SMALLINT NULL DEFAULT '20', `GIORNO_21` SMALLINT NULL DEFAULT '21', `GIORNO_22` SMALLINT NULL DEFAULT '22', `GIORNO_23` SMALLINT NULL DEFAULT '23', `GIORNO_24` SMALLINT NULL DEFAULT '24', `GIORNO_25` SMALLINT NULL DEFAULT '25', `GIORNO_26` SMALLINT NULL DEFAULT '26', `GIORNO_27` SMALLINT NULL DEFAULT '27', `GIORNO_28` SMALLINT NULL DEFAULT '28', `GIORNO_29` SMALLINT NULL DEFAULT '29', `GIORNO_30` SMALLINT NULL DEFAULT '30', `GIORNO_31` SMALLINT NULL DEFAULT '31', `NOME_GIORNO_1` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_2` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_3` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_4` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_5` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_6` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_7` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_8` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_9` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_10` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_11` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_12` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_13` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_14` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_15` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_16` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_17` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_18` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_19` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_20` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_21` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_22` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_23` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_24` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_25` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_26` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_27` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_28` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_29` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_30` CHAR(15) NULL DEFAULT NULL, `NOME_GIORNO_31` CHAR(15) NULL DEFAULT NULL) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_ico Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_ico` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FLAG_SI_NO` CHAR(1) NOT NULL DEFAULT 'N', `IMAGE_ICO` LONGBLOB NULL DEFAULT NULL, `TIPO` SMALLINT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 3 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_macrogruppo Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_macrogruppo` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `MACROGRUPPO` VARCHAR(20) NOT NULL, `DESCRIZIONE` VARCHAR(500) NOT NULL, `FLAG_MG_SOSPESO` CHAR(1) NULL DEFAULT 'N', `LOGO_BLR` LONGBLOB NULL DEFAULT NULL, `BUDGET_MG` DOUBLE NOT NULL DEFAULT '0', `BUDGET_MG_USATO` DOUBLE NOT NULL DEFAULT '0', `BUDGET_MG_ASSEGNATO` DOUBLE NOT NULL DEFAULT '0', `DATA_INIZIO` DATETIME NOT NULL, `DATA_FINE` DATETIME NOT NULL, `TAG_REPORT` SMALLINT NOT NULL DEFAULT '0', `FLAG_CHIUSO` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_USO_INTERNO` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_PLAN` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_330` (`MACROGRUPPO` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 19 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_macrogruppo_allegati Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_macrogruppo_allegati` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MASTER_MG` INT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `DATA_IMPORTAZIONE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1195` (`FK_MASTER_MG` ASC) VISIBLE, CONSTRAINT `INTEG_1195` FOREIGN KEY (`FK_MASTER_MG`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 6 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'contiene gli allegati del macrogruppo' - Creating table tempus_innodb.ts_macrogruppo_plan Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_macrogruppo_plan` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MACROGRUPPO` INT NOT NULL DEFAULT '0', `FLAG_ESCLUDI_SABATO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_ESCLUDI_DOMENICA` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_OGNI_GIORNO` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_GIORNI_ALTERNI` CHAR(1) NOT NULL DEFAULT 'N', `PERCENTUALE_MAX_GIORNO` FLOAT NOT NULL DEFAULT '80', `TOTALE_ORE` DOUBLE NOT NULL DEFAULT '0', `TOTALE_ORE_PLAN` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1295` (`FK_MACROGRUPPO` ASC) VISIBLE, CONSTRAINT `INTEG_1295` FOREIGN KEY (`FK_MACROGRUPPO`) REFERENCES `tempus_innodb`.`ts_macrogruppo` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 5 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PARAMS PER AZIONE CHE USA LA PLAN ORE, RECORD PRESENTE SE MACROGRUPPO CON FLAG_PLAN=S' - Creating table tempus_innodb.ts_menu_icons Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_menu_icons` ( `ID` INT NOT NULL DEFAULT '0', `CATEGORY` VARCHAR(50) NULL DEFAULT NULL, `DESCRIPTION` VARCHAR(50) NULL DEFAULT NULL, `SEARCHTERMS` LONGTEXT NULL DEFAULT NULL, `ICON` LONGBLOB NULL DEFAULT NULL, `SOTTOMENU` INT NOT NULL DEFAULT '0', `FLAG_SOTTOMENU_SN` VARCHAR(1) NOT NULL DEFAULT 'N', `TAG_PGM` SMALLINT NOT NULL DEFAULT '0', `TAG_MENU` SMALLINT NOT NULL DEFAULT '0', `VOCE_ADMIN` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_NASCOSTO` CHAR(1) NOT NULL DEFAULT 'N', `MODULO` SMALLINT NOT NULL DEFAULT '0', `ID_MICROSERVICE` SMALLINT NULL DEFAULT '1', PRIMARY KEY (`ID`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_menu_icons_salva Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_menu_icons_salva` ( `ID` INT NOT NULL DEFAULT '0', `CATEGORY` VARCHAR(50) NULL DEFAULT NULL, `DESCRIPTION` VARCHAR(50) NULL DEFAULT NULL, `SEARCHTERMS` LONGTEXT NULL DEFAULT NULL, `ICON` LONGBLOB NULL DEFAULT NULL, `SOTTOMENU` INT NOT NULL DEFAULT '0', `FLAG_SOTTOMENU_SN` VARCHAR(1) NOT NULL DEFAULT 'N', `TAG_PGM` SMALLINT NOT NULL DEFAULT '0', `TAG_MENU` SMALLINT NOT NULL DEFAULT '0', `VOCE_ADMIN` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_NASCOSTO` CHAR(1) NOT NULL DEFAULT 'N', `MODULO` SMALLINT NOT NULL DEFAULT '0', PRIMARY KEY (`ID`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_mesi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_mesi` ( `MESE_NUM` SMALLINT NOT NULL DEFAULT '0', `MESE` CHAR(30) NULL DEFAULT NULL, `GG_FI` SMALLINT NOT NULL DEFAULT '30', PRIMARY KEY (`MESE_NUM`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_microservice Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_microservice` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `MICROSERVICE_TAG` SMALLINT NOT NULL DEFAULT '0', `MICROSERVICE_NAME` VARCHAR(20) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 9 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.ts_nomi_report Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_nomi_report` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TAG_REPORT` SMALLINT NOT NULL DEFAULT '0', `NOME_REPORT` CHAR(100) NOT NULL DEFAULT 'REPORT', `FLAG_EXCEL` CHAR(1) NOT NULL DEFAULT 'S', `FLAG_PDF` CHAR(1) NOT NULL DEFAULT 'S', `NOME_REPORT_ESTERNO` CHAR(100) NOT NULL DEFAULT 'TEMPUS_', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `FLAG_BLOCCATO` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `numero_report` (`TAG_REPORT` ASC) COMMENT '\'\'\'\'\'\'\'Numero Report duplicato\'\'\'\'\'\'\'' VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 9 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'DEFINISCE I PARAMETRI DI OGNI REPORT' - Creating table tempus_innodb.ts_parametri_elaborazione Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_parametri_elaborazione` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `ANNO` SMALLINT NOT NULL DEFAULT '0', `FK_AZIONE_SOTTOLIVELLI` INT NOT NULL DEFAULT '0', `SAL` SMALLINT NOT NULL DEFAULT '0', `FLAG_ELABORATO` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_ABORTITO` CHAR(1) NOT NULL DEFAULT 'N', `IMPORTO_ELABORATO` DOUBLE NOT NULL DEFAULT '0', `COEFFICIENTE` FLOAT NOT NULL DEFAULT '0', `DATA_ELABORAZIONE` DATETIME NOT NULL, `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, `PERC_CTRL_ORE` FLOAT NOT NULL DEFAULT '0', `IMPORTO_CALCOLATO` DOUBLE NOT NULL DEFAULT '0', `TOT_ORE_CALCOLATE` FLOAT NOT NULL DEFAULT '0', `SAL_STAMPA` SMALLINT NULL DEFAULT '1', `FLAG_STAMPATO` VARCHAR(1) NOT NULL DEFAULT 'N', `FLAG_INVIATO` VARCHAR(1) NOT NULL DEFAULT 'N', `campo1` DOUBLE NULL DEFAULT '0', `campo2` DOUBLE NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_780` (`FK_AZIONE_SOTTOLIVELLI` ASC) VISIBLE, CONSTRAINT `INTEG_780` FOREIGN KEY (`FK_AZIONE_SOTTOLIVELLI`) REFERENCES `tempus_innodb`.`ts_azione_sottolivelli` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 410 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'supporta minuti CONTIENE I DATI DI OGNI SINGOLO TENTATIVO DI ELABORAZIONE SERVE PER LANCIARE LA STORED PROC DI LANCIO ELABORAZIONE' - Creating table tempus_innodb.ts_path_stampe Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_path_stampe` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `PATH_STAMPA` VARCHAR(260) NOT NULL DEFAULT 'C:\\', `PATH_STAMPA_PDF` VARCHAR(260) NULL DEFAULT 'C:\\', `PATH_EXCEL` VARCHAR(260) NULL DEFAULT 'C:\\', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1203` (`FK_AZIONE` ASC) VISIBLE, CONSTRAINT `INTEG_1203` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 19 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE LE PATH DA PROPORRE PER LE STAMPE DELLE AZIONI' - Creating table tempus_innodb.ts_pswduser Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_pswduser` ( `pk_progressivo` INT NOT NULL AUTO_INCREMENT, `fk_anag` INT NOT NULL DEFAULT '0', `password_hash` VARCHAR(64) NOT NULL, `salt` VARCHAR(32) NOT NULL, `data_generazione` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `provvisoria` CHAR(1) NULL DEFAULT 'N', `data_scadenza` DATETIME NOT NULL, PRIMARY KEY (`pk_progressivo`), INDEX `anagrafico_idx` (`fk_anag` ASC) VISIBLE, CONSTRAINT `anagrafico` FOREIGN KEY (`fk_anag`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 1046 DEFAULT CHARACTER SET = utf8mb3 - Creating table tempus_innodb.ts_sottolivelli Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`ts_sottolivelli` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CODICE` VARCHAR(20) NOT NULL, `DESCRIZIONE` VARCHAR(100) NOT NULL, `ETICHETTA_MISURA_STAMPA` VARCHAR(30) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_341` (`CODICE` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 41 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'ANAGRAFICA GENERICA DELLE MISURE O SOTTOLIVELLI' - Creating table tempus_innodb.tt1_fatture_import Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_fatture_import` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `PIVA` VARCHAR(11) NOT NULL DEFAULT '0', `SIGLA_PIVA` VARCHAR(5) NOT NULL DEFAULT 'IT', `CFISC` VARCHAR(16) NOT NULL, `NUMERO` VARCHAR(20) NOT NULL DEFAULT '0', `DATA_DOCUMENTO` DATE NOT NULL, `DENOMINAZIONE` VARCHAR(80) NULL DEFAULT NULL, `COGNOME` VARCHAR(60) NULL DEFAULT NULL, `NOME` VARCHAR(60) NULL DEFAULT NULL, `TOTALE_DOCUMENTO` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO` DOUBLE NOT NULL DEFAULT '0', `KEY_IMPORTAZIONE` VARCHAR(25) NOT NULL, `FLAG_IMPORTATA` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_SCARTATA` CHAR(1) NOT NULL DEFAULT 'N', `DATA_IMPORTAZIONE` DATETIME NOT NULL, `FLAG_DOC_PRESENTE` CHAR(1) NOT NULL DEFAULT 'N', `FK_RICLASSIFICATO` INT NOT NULL DEFAULT '0', `FK_TIPO_COSTO` INT NOT NULL DEFAULT '0', `FLAG_PAGAMENTO_PRESENTE` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `DOCUMENTO_GIA_PRESENTE` (`PIVA` ASC, `CFISC` ASC, `NUMERO` ASC, `DATA_DOCUMENTO` ASC) VISIBLE, INDEX `INTEG_1355` (`FK_RICLASSIFICATO` ASC) VISIBLE, INDEX `INTEG_1356` (`FK_TIPO_COSTO` ASC) VISIBLE, CONSTRAINT `INTEG_1355` FOREIGN KEY (`FK_RICLASSIFICATO`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1356` FOREIGN KEY (`FK_TIPO_COSTO`) REFERENCES `tempus_innodb`.`ts1_tipo_costi` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'TESTATA FATTURA IMPORTATA' - Creating table tempus_innodb.tt1_fatture_import_allegati Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_fatture_import_allegati` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_FATTIMP` INT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `DATA_IMPORTAZIONE` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1155` (`FK_FATTIMP` ASC) VISIBLE, CONSTRAINT `INTEG_1155` FOREIGN KEY (`FK_FATTIMP`) REFERENCES `tempus_innodb`.`tt1_fatture_import` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'DOCUMENTO FATTURA IMPORTATA' - Creating table tempus_innodb.tt1_fatture_pagamenti_import Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_fatture_pagamenti_import` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_FATTURA` INT NOT NULL DEFAULT '0', `DATA_PAGAMENTO` DATE NOT NULL, `DATA_MANDATO` DATE NOT NULL, `N_MANDATO_NUMERICO` INT NULL DEFAULT '0', `N_MANDATO_TESTO` VARCHAR(20) NOT NULL, `IMPORTO_PAGATO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1454` (`FK_FATTURA` ASC) VISIBLE, CONSTRAINT `INTEG_1454` FOREIGN KEY (`FK_FATTURA`) REFERENCES `tempus_innodb`.`tt1_fatture_import` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'RIFERIMENTI AI PAGAMENTI DELLE FT IMPORTATE' - Creating table tempus_innodb.tt1_ods_plan Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_ods_plan` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MASTER` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1253` (`FK_MASTER` ASC, `FK_ANAG` ASC, `ANNO` ASC, `MESE` ASC) VISIBLE, INDEX `INTEG_1255` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1254` FOREIGN KEY (`FK_MASTER`) REFERENCES `tempus_innodb`.`tt_lista_personale_master` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1255` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PLAN DELLE ORE PER IL PERSONAL ODS (MODULO 1 OPTIONAL)' - Creating table tempus_innodb.tt1_partner_anagrafica Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_partner_anagrafica` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `NOMINATIVO` CHAR(100) NOT NULL, `CITTA` VARCHAR(100) NOT NULL, `INDIRIZZO` VARCHAR(100) NOT NULL, `RIFERIMENTI` VARCHAR(100) NULL DEFAULT NULL, `EMAIL` VARCHAR(50) NULL DEFAULT NULL, `NAZIONE_IVA` VARCHAR(5) NULL DEFAULT NULL, `PIVA` VARCHAR(11) NULL DEFAULT NULL, `CFISC` VARCHAR(16) NULL DEFAULT NULL, `TELEFONO` CHAR(15) NULL DEFAULT NULL, `CELLULARE` CHAR(15) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 5 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MODULO 1 ANAGRAFICA PARTNER' - Creating table tempus_innodb.tt1_project_plan Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_project_plan` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_RICLASSIFICA` INT NOT NULL DEFAULT '0', `IDX_MILESTONE` INT NOT NULL DEFAULT '0', `MILESTONE_DAL` DATE NOT NULL, `MILESTONE_AL` DATE NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1456` (`FK_RICLASSIFICA` ASC, `IDX_MILESTONE` ASC) VISIBLE, UNIQUE INDEX `INTEG_1457` (`PK_PROGRESSIVO` ASC, `IDX_MILESTONE` ASC) VISIBLE, CONSTRAINT `INTEG_1397` FOREIGN KEY (`FK_RICLASSIFICA`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MASTER DEL PROJECT PLAN' - Creating table tempus_innodb.tt1_project_plan_documenti Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_project_plan_documenti` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_TASK` INT NOT NULL DEFAULT '0', `FK_DOCU` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1425` (`FK_TASK` ASC) VISIBLE, INDEX `INTEG_1426` (`FK_DOCU` ASC) VISIBLE, CONSTRAINT `INTEG_1425` FOREIGN KEY (`FK_TASK`) REFERENCES `tempus_innodb`.`tt1_project_plan_task` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1426` FOREIGN KEY (`FK_DOCU`) REFERENCES `tempus_innodb`.`tt1_fatture_import` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'TABELLA CHE RACCORDA I TASK CON I DOCUMENTI CARICATI PER COMPETENZA DI COSTO E DATA' - Creating table tempus_innodb.tt1_project_plan_task Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt1_project_plan_task` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MASTER_PLAN` INT NOT NULL DEFAULT '0', `FK_RICLASS_DETT` INT NOT NULL DEFAULT '0', `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, `IMPORTO_RICALCOLATO` DOUBLE NOT NULL DEFAULT '0', `FK_COSTO` INT NOT NULL DEFAULT '0', `FK_IDX_MILESTONE` INT NOT NULL DEFAULT '0', `IMPORTO_DOCUMENTI` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1404` (`FK_RICLASS_DETT` ASC) VISIBLE, INDEX `INTEG_1413` (`FK_COSTO` ASC) VISIBLE, INDEX `INTEG_1458` (`FK_MASTER_PLAN` ASC, `FK_IDX_MILESTONE` ASC) VISIBLE, CONSTRAINT `INTEG_1402` FOREIGN KEY (`FK_MASTER_PLAN`) REFERENCES `tempus_innodb`.`tt1_project_plan` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `INTEG_1404` FOREIGN KEY (`FK_RICLASS_DETT`) REFERENCES `tempus_innodb`.`ts1_riclassifica_progetto_detail` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_1413` FOREIGN KEY (`FK_COSTO`) REFERENCES `tempus_innodb`.`ts1_tipo_costi` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_1458` FOREIGN KEY (`FK_MASTER_PLAN` , `FK_IDX_MILESTONE`) REFERENCES `tempus_innodb`.`tt1_project_plan` (`PK_PROGRESSIVO` , `IDX_MILESTONE`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'DETAIL DEL PROJECT PLAN CONTIENE I TASK GENERATI' - Creating table tempus_innodb.tt_allegati_hash Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_allegati_hash` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MASTER_INPUT` INT NOT NULL DEFAULT '0', `FK_TABLE_ALLEGATI` INT NOT NULL DEFAULT '0', `ALLEGATO_HASH` VARCHAR(256) NOT NULL, `SEZIONE` VARCHAR(2) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `FK_TABLE_ALLEGATO` (`FK_TABLE_ALLEGATI` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 22 DEFAULT CHARACTER SET = utf8mb3 COMMENT = 'Contiene l\'\'hash 256 per ogni doc salvato, legato alla tabella che contiene l\'allegato tramite SEZIONE e FK_TABLE_ALLEGATI\\\\\\\\n' - Creating table tempus_innodb.tt_allegati_master Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_allegati_master` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TIPO_ALLEGATO` CHAR(2) NOT NULL DEFAULT 'XX', `FK_ALLEGATO` INT NOT NULL DEFAULT '0', `DATA_IMPORTAZIONE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_350` (`TIPO_ALLEGATO` ASC, `FK_ALLEGATO` ASC) VISIBLE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'RACCORDA TUTTI I TIPI DI ALLEGATI (ZUCCHETTI, AZIONI ETC)' - Creating table tempus_innodb.tt_allegati_path Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_allegati_path` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ALLEGATI_MASTER` INT NOT NULL DEFAULT '0', `SEZIONE_ALLEGATO` VARCHAR(2) NOT NULL, `LOCAL_PATH_FILE` VARCHAR(250) NULL DEFAULT NULL, `SERVER_PATH_FILE` VARCHAR(250) NULL DEFAULT NULL, `NOME_ALLEGATO` VARCHAR(100) NULL DEFAULT NULL, `TIPO_FILE` VARCHAR(10) NULL DEFAULT NULL, `FK_ALL_SEZIONI` INT NOT NULL DEFAULT '0', `IP_CARICAMENTO` VARCHAR(20) NULL DEFAULT NULL, `NOME_PC_CARICAMENTO` VARCHAR(100) NULL DEFAULT NULL, `WINDOWS_USER_CARICAMENTO` VARCHAR(100) NULL DEFAULT NULL, `FK_UTENTE_CARICAMENTO` INT NOT NULL DEFAULT '9999', `DIMENSIONE_ALLEGATO` DOUBLE NULL DEFAULT '0', `DATA_CARICAMENTO` DATETIME NOT NULL, `NOTA` VARCHAR(250) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), CONSTRAINT `FK_ANAG` FOREIGN KEY (`PK_PROGRESSIVO`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 22 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'COLLEGATO ALLA MASTER ALLEGATI \\\\\\\\r\\\\\\\\nCONTIENE PERCORSO DI TUTTI GLI ALLEGATI\\\\\\\\r\\\\\\\\nLA MASTER ALLEGATI MI DICE SE E\' ALLEGATO AZIONE O ALLEGATO ZUCCHETTI O ALLEGATO AD ALTRO' - Creating table tempus_innodb.tt_anag_personale Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_anag_personale` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CODICE_FISCALE` CHAR(16) NOT NULL, `MATRICOLA` CHAR(10) NOT NULL, `NOMINATIVO` CHAR(100) NOT NULL, `SESSO` CHAR(1) NULL DEFAULT NULL, `FLAG_TEMPO_DETERMINATO` CHAR(1) NULL DEFAULT NULL, `DATA_ASS` DATETIME NULL DEFAULT NULL, `FLAG_AMMINISTRATIVO_SN` CHAR(1) NULL DEFAULT NULL, `LIVELLO_COSTO_STANDARD_ALTO` CHAR(1) NULL DEFAULT NULL, `LIVELLO_COSTO_STANDARD_MEDIO` CHAR(1) NULL DEFAULT NULL, `LIVELLO_COSTO_STANDARD_BASSO` CHAR(1) NULL DEFAULT NULL, `CAMBIO_MATR` VARCHAR(1) NOT NULL DEFAULT 'N', `FK_CDC` INT NOT NULL DEFAULT '9999', `UTENTE_NUM` INT NOT NULL DEFAULT '0', `FK_UTENTI` INT NOT NULL DEFAULT '0', `COGNOME_UTENTE` CHAR(30) NULL DEFAULT NULL, `NOME_UTENTE` CHAR(30) NULL DEFAULT NULL, `FOTO_UTENTE` LONGBLOB NULL DEFAULT NULL, `FLAG_ODS` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1181` (`UTENTE_NUM` ASC) VISIBLE, UNIQUE INDEX `INTEG_367` (`CODICE_FISCALE` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 640 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_anag_personale_costi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_anag_personale_costi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `ANNO` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', `COSTO_ORARIO_ARROTONDATO` DOUBLE NOT NULL DEFAULT '0', `COSTO_ORARIO_STANDARD` DOUBLE NOT NULL DEFAULT '0', `PESO_STANDARD` DOUBLE NOT NULL DEFAULT '0', `COSTO_ORARIO_STANDARD_ARROTONDATO` DOUBLE NOT NULL DEFAULT '0', `COSTO_ORARIO_STANDARD2` DOUBLE NOT NULL DEFAULT '0', `COSTO_ORARIO_STANDARD_ARROTONDATO2` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_380` (`ANNO` ASC, `FK_ANAG` ASC) VISIBLE, INDEX `INTEG_767` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_767` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 1538 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_anag_personale_dettagli Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_anag_personale_dettagli` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_TT_ANAG_PERSONALE` INT NOT NULL DEFAULT '0', `TIPO_RAPP` CHAR(50) NULL DEFAULT NULL, `CAT_ECO` CHAR(30) NULL DEFAULT NULL, `CAT_ECO2` CHAR(50) NULL DEFAULT NULL, `CODICE_QUALIFICA` CHAR(10) NULL DEFAULT NULL, `QUALIFICA` CHAR(100) NULL DEFAULT NULL, `MATRICOLA` CHAR(10) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_768` (`FK_TT_ANAG_PERSONALE` ASC) VISIBLE, CONSTRAINT `INTEG_768` FOREIGN KEY (`FK_TT_ANAG_PERSONALE`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 437 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_anag_personale_qualifiche Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_anag_personale_qualifiche` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_TT_ANAG_PERSONALE` INT NOT NULL DEFAULT '0', `QUALIFICA` CHAR(100) NOT NULL, `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_769` (`FK_TT_ANAG_PERSONALE` ASC) VISIBLE, CONSTRAINT `INTEG_769` FOREIGN KEY (`FK_TT_ANAG_PERSONALE`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 24823 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_ctrl_random Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_ctrl_random` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `NUMERO` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_62` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC) VISIBLE, CONSTRAINT `INTEG_62` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_ferie Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_ferie` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL, `MESE` SMALLINT NOT NULL, `ORE_GIORNO_1` DOUBLE NOT NULL, `ORE_GIORNO_2` DOUBLE NOT NULL, `ORE_GIORNO_3` DOUBLE NOT NULL, `ORE_GIORNO_4` DOUBLE NOT NULL, `ORE_GIORNO_5` DOUBLE NOT NULL, `ORE_GIORNO_6` DOUBLE NOT NULL, `ORE_GIORNO_7` DOUBLE NOT NULL, `ORE_GIORNO_8` DOUBLE NOT NULL, `ORE_GIORNO_9` DOUBLE NOT NULL, `ORE_GIORNO_10` DOUBLE NOT NULL, `ORE_GIORNO_11` DOUBLE NOT NULL, `ORE_GIORNO_12` DOUBLE NOT NULL, `ORE_GIORNO_13` DOUBLE NOT NULL, `ORE_GIORNO_14` DOUBLE NOT NULL, `ORE_GIORNO_15` DOUBLE NOT NULL, `ORE_GIORNO_16` DOUBLE NOT NULL, `ORE_GIORNO_17` DOUBLE NOT NULL, `ORE_GIORNO_18` DOUBLE NOT NULL, `ORE_GIORNO_19` DOUBLE NOT NULL, `ORE_GIORNO_20` DOUBLE NOT NULL, `ORE_GIORNO_21` DOUBLE NOT NULL, `ORE_GIORNO_22` DOUBLE NOT NULL, `ORE_GIORNO_23` DOUBLE NOT NULL, `ORE_GIORNO_24` DOUBLE NOT NULL, `ORE_GIORNO_25` DOUBLE NOT NULL, `ORE_GIORNO_26` DOUBLE NOT NULL, `ORE_GIORNO_27` DOUBLE NOT NULL, `ORE_GIORNO_28` DOUBLE NOT NULL, `ORE_GIORNO_29` DOUBLE NOT NULL, `ORE_GIORNO_30` DOUBLE NOT NULL, `ORE_GIORNO_31` DOUBLE NOT NULL, `TOTALE_MESE` DOUBLE NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_772` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_772` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 12170 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_lista_personale_detail Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_lista_personale_detail` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MASTER` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `FLAG_SOSPESO` VARCHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `UTENTE_GIA_REGISTRATO_IN_QUESTO_ODS` (`FK_MASTER` ASC, `FK_ANAG` ASC) VISIBLE, INDEX `INTEG_774` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_773` FOREIGN KEY (`FK_MASTER`) REFERENCES `tempus_innodb`.`tt_lista_personale_master` (`PK_PROGRESSIVO`) ON DELETE CASCADE, CONSTRAINT `INTEG_774` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 693 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'DETAIL ODS' - Creating table tempus_innodb.tt_lista_personale_master Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_lista_personale_master` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `DATA_INPUT` DATETIME NOT NULL, `NOTE` VARCHAR(250) NULL DEFAULT NULL, `FLAG_AMMINISTRATIVI` CHAR(1) NOT NULL DEFAULT 'N', `FLAG_SOSPESO` VARCHAR(1) NOT NULL DEFAULT 'N', `DATA_IN` DATE NOT NULL, `DATA_FI` DATE NOT NULL, `PROTOCOLLO` CHAR(30) NULL DEFAULT NULL, `DATA_PROTOCOLLO` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_775` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_775` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 73 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MASTER ODS' - Creating table tempus_innodb.tt_malattia Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_malattia` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL, `ORE_GIORNO_2` DOUBLE NOT NULL, `ORE_GIORNO_3` DOUBLE NOT NULL, `ORE_GIORNO_4` DOUBLE NOT NULL, `ORE_GIORNO_5` DOUBLE NOT NULL, `ORE_GIORNO_6` DOUBLE NOT NULL, `ORE_GIORNO_7` DOUBLE NOT NULL, `ORE_GIORNO_8` DOUBLE NOT NULL, `ORE_GIORNO_9` DOUBLE NOT NULL, `ORE_GIORNO_10` DOUBLE NOT NULL, `ORE_GIORNO_11` DOUBLE NOT NULL, `ORE_GIORNO_12` DOUBLE NOT NULL, `ORE_GIORNO_13` DOUBLE NOT NULL, `ORE_GIORNO_14` DOUBLE NOT NULL, `ORE_GIORNO_15` DOUBLE NOT NULL, `ORE_GIORNO_16` DOUBLE NOT NULL, `ORE_GIORNO_17` DOUBLE NOT NULL, `ORE_GIORNO_18` DOUBLE NOT NULL, `ORE_GIORNO_19` DOUBLE NOT NULL, `ORE_GIORNO_20` DOUBLE NOT NULL, `ORE_GIORNO_21` DOUBLE NOT NULL, `ORE_GIORNO_22` DOUBLE NOT NULL, `ORE_GIORNO_23` DOUBLE NOT NULL, `ORE_GIORNO_24` DOUBLE NOT NULL, `ORE_GIORNO_25` DOUBLE NOT NULL, `ORE_GIORNO_26` DOUBLE NOT NULL, `ORE_GIORNO_27` DOUBLE NOT NULL, `ORE_GIORNO_28` DOUBLE NOT NULL, `ORE_GIORNO_29` DOUBLE NOT NULL, `ORE_GIORNO_30` DOUBLE NOT NULL, `ORE_GIORNO_31` DOUBLE NOT NULL, `TOTALE_MESE` DOUBLE NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_776` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_776` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 1095 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_ods_doc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_ods_doc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_MASTER_ODS` INT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `DATA_IMPORTAZIONE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_119` (`FK_MASTER_ODS` ASC) VISIBLE, CONSTRAINT `INTEG_119` FOREIGN KEY (`FK_MASTER_ODS`) REFERENCES `tempus_innodb`.`tt_lista_personale_master` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 12 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_permessi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_permessi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL, `ORE_GIORNO_2` DOUBLE NOT NULL, `ORE_GIORNO_3` DOUBLE NOT NULL, `ORE_GIORNO_4` DOUBLE NOT NULL, `ORE_GIORNO_5` DOUBLE NOT NULL, `ORE_GIORNO_6` DOUBLE NOT NULL, `ORE_GIORNO_7` DOUBLE NOT NULL, `ORE_GIORNO_8` DOUBLE NOT NULL, `ORE_GIORNO_9` DOUBLE NOT NULL, `ORE_GIORNO_10` DOUBLE NOT NULL, `ORE_GIORNO_11` DOUBLE NOT NULL, `ORE_GIORNO_12` DOUBLE NOT NULL, `ORE_GIORNO_13` DOUBLE NOT NULL, `ORE_GIORNO_14` DOUBLE NOT NULL, `ORE_GIORNO_15` DOUBLE NOT NULL, `ORE_GIORNO_16` DOUBLE NOT NULL, `ORE_GIORNO_17` DOUBLE NOT NULL, `ORE_GIORNO_18` DOUBLE NOT NULL, `ORE_GIORNO_19` DOUBLE NOT NULL, `ORE_GIORNO_20` DOUBLE NOT NULL, `ORE_GIORNO_21` DOUBLE NOT NULL, `ORE_GIORNO_22` DOUBLE NOT NULL, `ORE_GIORNO_23` DOUBLE NOT NULL, `ORE_GIORNO_24` DOUBLE NOT NULL, `ORE_GIORNO_25` DOUBLE NOT NULL, `ORE_GIORNO_26` DOUBLE NOT NULL, `ORE_GIORNO_27` DOUBLE NOT NULL, `ORE_GIORNO_28` DOUBLE NOT NULL, `ORE_GIORNO_29` DOUBLE NOT NULL, `ORE_GIORNO_30` DOUBLE NOT NULL, `ORE_GIORNO_31` DOUBLE NOT NULL, `TOTALE_MESE` DOUBLE NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_777` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_777` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 13416 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_riepilogo_assegnazioni Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_riepilogo_assegnazioni` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `COSTO_ASSEGNATO` DOUBLE NOT NULL DEFAULT '0', `ORE_ASSEGNATE` DOUBLE NOT NULL DEFAULT '0', `ORE_CARICATE` DOUBLE NOT NULL DEFAULT '0', `ORE_DA_CARICARE` DOUBLE NOT NULL DEFAULT '0', `TOTALE_GG_POSSIBILI` INT NOT NULL DEFAULT '0', `ORE_FATTIBILI` DOUBLE NOT NULL DEFAULT '0', `PESO_ORE` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_DA_FARE` DOUBLE NOT NULL DEFAULT '0', `ORE_DA_FARE_TRONCATO` DOUBLE NOT NULL DEFAULT '0', `MINUTI_DA_FARE_TRONCATO` DOUBLE NOT NULL DEFAULT '0', `SETTIMANE_POSSIBILI` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_57` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC) VISIBLE, INDEX `INTEG_779` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_57` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE, CONSTRAINT `INTEG_779` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 10005 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'ex bio_rendicontazione_famega contiene le ore e i soldi assegnati ad ogni soggetto per il progetto elaborato\\\\\\\\r\\\\\\\\nviene usato anche al posto di bio_calcolo_ore_giornaliere_da_spalmare\\\\\\\\r\\\\\\\\nperchè riporta tutti i valori necessari\\\\\\\\r\\\\\\\\neliminati diversi campi doppi' - Creating table tempus_innodb.tt_riepilogo_feamp Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_riepilogo_feamp` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `FK_AZIONE_STRUTTURA1` INT NOT NULL DEFAULT '0', `TOTALE_ORE1` INT NOT NULL DEFAULT '0', `COSTO_ORARIO1` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO1` DOUBLE NOT NULL DEFAULT '0', `FK_AZIONE_STRUTTURA2` INT NOT NULL DEFAULT '0', `TOTALE_ORE2` INT NOT NULL DEFAULT '0', `COSTO_ORARIO2` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO2` DOUBLE NOT NULL DEFAULT '0', `FK_AZIONE_STRUTTURA3` INT NOT NULL DEFAULT '0', `TOTALE_ORE3` INT NOT NULL DEFAULT '0', `COSTO_ORARIO3` DOUBLE NOT NULL DEFAULT '0', `TOTALE_COSTO3` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_956` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_956` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_riepilogo_pesi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_riepilogo_pesi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `PESO` DOUBLE NOT NULL DEFAULT '0', `QUANTI` SMALLINT NOT NULL DEFAULT '0', `IMPORTO_ASSEGNATO_TOT` DOUBLE NOT NULL DEFAULT '0', `IMPORTO_ASSEGNATO_SINGOLO` DOUBLE NOT NULL DEFAULT '0', `ORE_ASSEGNATE_TOT` DOUBLE NOT NULL DEFAULT '0', `ORE_ASSEGNATE_SINGOLO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_58` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC) VISIBLE, CONSTRAINT `INTEG_58` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 11097 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'EX BIO_GRUPPO_PESO\\\\\\\\r\\\\\\\\n contiene quanti soggetti per ogni peso assegnato' - Creating table tempus_innodb.tt_scadenze_user Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_scadenze_user` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `DATA_CREAZIONE` DATETIME NOT NULL, `DATA_REMEMBER` DATE NOT NULL, `MEMO_FIELD` LONGBLOB NULL DEFAULT NULL, `FLAG_EMAIL` CHAR(1) NOT NULL DEFAULT 'N', `FK_TIMESHEET` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1003` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1003` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 5 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_timbrature Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timbrature` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_344` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_344` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 16122 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE LE TIMBRATURE RETTIFICATE DALLE VARIE AZIONI A CUI A PARTECIPATO IL DIPENDENTE' - Creating table tempus_innodb.tt_timbrature_giorno Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timbrature_giorno` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `DATA_TIMBRATURA` DATETIME NOT NULL, `GG` SMALLINT NOT NULL DEFAULT '0', `MM` SMALLINT NOT NULL DEFAULT '0', `AA` SMALLINT NOT NULL DEFAULT '0', `ORE_LAVORATE` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `CTRL_TIMBRATURA_DUPLICATA` (`FK_ANAG` ASC, `DATA_TIMBRATURA` ASC) VISIBLE, CONSTRAINT `INTEG_781` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 251296 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'contiene ore lavoro per data ore non convertite in 60esimi utilizzare _calcola60esimi serve per controllare se ha timbrato in una certa data' - Creating table tempus_innodb.tt_timbrature_interni Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timbrature_interni` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1244` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1244` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 6542 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE LE TIMBRATURE RETTIFICATE DALLE VARIE AZIONI A CUI A PARTECIPATO IL DIPENDENTE E CON I VALORI DEI PROGETTI INTERNI' - Creating table tempus_innodb.tt_timbrature_storico Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timbrature_storico` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_782` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_782` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 14571 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'CONTIENE LE ORIGINALI TIMBRATURE' - Creating table tempus_innodb.tt_timesheet Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `GIORNO_1` SMALLINT NULL DEFAULT '1', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `GIORNO_2` SMALLINT NULL DEFAULT '2', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `GIORNO_3` SMALLINT NULL DEFAULT '3', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `GIORNO_4` SMALLINT NULL DEFAULT '4', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `GIORNO_5` SMALLINT NULL DEFAULT '5', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `GIORNO_6` SMALLINT NULL DEFAULT '6', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `GIORNO_7` SMALLINT NULL DEFAULT '7', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `GIORNO_8` SMALLINT NULL DEFAULT '8', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `GIORNO_9` SMALLINT NULL DEFAULT '9', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `GIORNO_10` SMALLINT NULL DEFAULT '10', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `GIORNO_11` SMALLINT NULL DEFAULT '11', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `GIORNO_12` SMALLINT NULL DEFAULT '12', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `GIORNO_13` SMALLINT NULL DEFAULT '13', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `GIORNO_14` SMALLINT NULL DEFAULT '14', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `GIORNO_15` SMALLINT NULL DEFAULT '15', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `GIORNO_16` SMALLINT NULL DEFAULT '16', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `GIORNO_17` SMALLINT NULL DEFAULT '17', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `GIORNO_18` SMALLINT NULL DEFAULT '18', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `GIORNO_19` SMALLINT NULL DEFAULT '19', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `GIORNO_20` SMALLINT NULL DEFAULT '20', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `GIORNO_21` SMALLINT NULL DEFAULT '21', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `GIORNO_22` SMALLINT NULL DEFAULT '22', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `GIORNO_23` SMALLINT NULL DEFAULT '23', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `GIORNO_24` SMALLINT NULL DEFAULT '24', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `GIORNO_25` SMALLINT NULL DEFAULT '25', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `GIORNO_26` SMALLINT NULL DEFAULT '26', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `GIORNO_27` SMALLINT NULL DEFAULT '27', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `GIORNO_28` SMALLINT NULL DEFAULT '28', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `GIORNO_29` SMALLINT NULL DEFAULT '29', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `GIORNO_30` SMALLINT NULL DEFAULT '30', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `GIORNO_31` SMALLINT NULL DEFAULT '31', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `TOTALE_GIORNATE_POSSIBILI` SMALLINT NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1246` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC, `FK_ANAG` ASC, `ANNO` ASC, `MESE` ASC) VISIBLE, INDEX `INTEG_783` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_59` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE, CONSTRAINT `INTEG_783` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 9750 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'ex BIO_TIMESHEET_ESTESO TIMESHEET PROGETTO ANNO, MESE' - Creating table tempus_innodb.tt_timesheet_cross_table Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_cross_table` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_968` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC) VISIBLE, INDEX `INTEG_969` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_968` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE, CONSTRAINT `INTEG_969` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 33647 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Raggruppa le ore lavorate sul progetto per anno/mese\\\\\\\\r\\\\\\\\nusata nelle stampe tramite storproc' - Creating table tempus_innodb.tt_timesheet_cross_table_altri_progetti Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_cross_table_altri_progetti` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', `ATTIVITA_STP` CHAR(50) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1007` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1007` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 9686 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Raggruppa le ore lavorate sui progetti diversi da quelli in stampa per anno/mese usata nelle stampe tramite storproc' - Creating table tempus_innodb.tt_timesheet_cross_table_attivita_ordinaria Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_cross_table_attivita_ordinaria` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', `ATTIVITA_STP` CHAR(50) NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1019` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1019` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 19481 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Raggruppa le ore ordinarie lavorate per anno/mese usata nelle stampe tramite storproc' - Creating table tempus_innodb.tt_timesheet_cross_table_summary_all Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_cross_table_summary_all` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', `ATTIVITA_STP` CHAR(50) NULL DEFAULT NULL, `RIGA_STAMPA` SMALLINT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1033` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1033` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 58340 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Raggruppa le 3 cross di stampa per anno/mese\\\\\\\\r\\\\\\\\nusata nelle stampe tramite storproc' - Creating table tempus_innodb.tt_timesheet_doc Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_doc` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TIPO_DOCUMENTO` VARCHAR(2) NOT NULL, `FK_TIMESHEET` INT NOT NULL DEFAULT '0', `FLAG_FIRMATO` CHAR(1) NOT NULL DEFAULT 'N', `DATA_FIRMA` DATETIME NULL DEFAULT NULL, `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `ALLEGATO_BLR_FIRMATO` LONGBLOB NULL DEFAULT NULL, `NOME_FILE` VARCHAR(250) NOT NULL, `FLAG_BLOCCATO` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_42` (`FK_TIMESHEET` ASC) VISIBLE, CONSTRAINT `INTEG_42` FOREIGN KEY (`FK_TIMESHEET`) REFERENCES `tempus_innodb`.`tt_timesheet` (`PK_PROGRESSIVO`) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_timesheet_doc_altri Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_doc_altri` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_TIPO_DOCUMENTO` INT NOT NULL DEFAULT '0', `FK_TIMESHEET` INT NOT NULL DEFAULT '0', `FLAG_FIRMATO` CHAR(1) NOT NULL DEFAULT 'N', `DATA_FIRMA` DATETIME NULL DEFAULT NULL, `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `NOME_FILE` VARCHAR(250) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1163` (`FK_TIMESHEET` ASC) VISIBLE, INDEX `INTEG_1169` (`FK_TIPO_DOCUMENTO` ASC) VISIBLE, CONSTRAINT `INTEG_1163` FOREIGN KEY (`FK_TIMESHEET`) REFERENCES `tempus_innodb`.`tt_timesheet` (`PK_PROGRESSIVO`) ON DELETE CASCADE, CONSTRAINT `INTEG_1169` FOREIGN KEY (`FK_TIPO_DOCUMENTO`) REFERENCES `tempus_innodb`.`ts1_tipo_doc` (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_timesheet_download Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_download` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TIPO_DOCUMENTO` VARCHAR(2) NOT NULL, `DATA_STAMPA` DATETIME NULL DEFAULT NULL, `ALLEGATO_BLR` LONGBLOB NULL DEFAULT NULL, `NOME_FILE` VARCHAR(250) NOT NULL, `KEY_INUTILE_PER_ROUTINE` INT NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'LA KEY_INUTILE VIENE USATA SOLO PER FAR GIRARE IL METODO CHE CERCA UN CAMPO IN CUI METTERE UN VALORE DI RIFERIMENTO' - Creating table tempus_innodb.tt_timesheet_giorno Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_giorno` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `GIORNO` SMALLINT NULL DEFAULT '1', `ORE_GIORNO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_60` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC) VISIBLE, INDEX `INTEG_785` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_60` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE, CONSTRAINT `INTEG_785` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'ex BIO_TIMESHEET_ESTESO_GIORNALIERO TIMESHEET PROGETTO PER GIORNO' - Creating table tempus_innodb.tt_timesheet_manuale Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_manuale` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TIPO_DATO` CHAR(25) NOT NULL, `SORT_DATO` SMALLINT NOT NULL DEFAULT '0', `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL, `ORE_GIORNO_2` DOUBLE NOT NULL, `ORE_GIORNO_3` DOUBLE NOT NULL, `ORE_GIORNO_4` DOUBLE NOT NULL, `ORE_GIORNO_5` DOUBLE NOT NULL, `ORE_GIORNO_6` DOUBLE NOT NULL, `ORE_GIORNO_7` DOUBLE NOT NULL, `ORE_GIORNO_8` DOUBLE NOT NULL, `ORE_GIORNO_9` DOUBLE NOT NULL, `ORE_GIORNO_10` DOUBLE NOT NULL, `ORE_GIORNO_11` DOUBLE NOT NULL, `ORE_GIORNO_12` DOUBLE NOT NULL, `ORE_GIORNO_13` DOUBLE NOT NULL, `ORE_GIORNO_14` DOUBLE NOT NULL, `ORE_GIORNO_15` DOUBLE NOT NULL, `ORE_GIORNO_16` DOUBLE NOT NULL, `ORE_GIORNO_17` DOUBLE NOT NULL, `ORE_GIORNO_18` DOUBLE NOT NULL, `ORE_GIORNO_19` DOUBLE NOT NULL, `ORE_GIORNO_20` DOUBLE NOT NULL, `ORE_GIORNO_21` DOUBLE NOT NULL, `ORE_GIORNO_22` DOUBLE NOT NULL, `ORE_GIORNO_23` DOUBLE NOT NULL, `ORE_GIORNO_24` DOUBLE NOT NULL, `ORE_GIORNO_25` DOUBLE NOT NULL, `ORE_GIORNO_26` DOUBLE NOT NULL, `ORE_GIORNO_27` DOUBLE NOT NULL, `ORE_GIORNO_28` DOUBLE NOT NULL, `ORE_GIORNO_29` DOUBLE NOT NULL, `ORE_GIORNO_30` DOUBLE NOT NULL, `ORE_GIORNO_31` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NULL DEFAULT NULL, `FLAG_VALIDATO` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 3257 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_timesheet_manuale_validato Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_manuale_validato` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `PK_PROGRESSIVO_ORIGINALE` INT NOT NULL DEFAULT '0', `TIPO_DATO` CHAR(25) NOT NULL, `SORT_DATO` SMALLINT NOT NULL DEFAULT '0', `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL, `ORE_GIORNO_2` DOUBLE NOT NULL, `ORE_GIORNO_3` DOUBLE NOT NULL, `ORE_GIORNO_4` DOUBLE NOT NULL, `ORE_GIORNO_5` DOUBLE NOT NULL, `ORE_GIORNO_6` DOUBLE NOT NULL, `ORE_GIORNO_7` DOUBLE NOT NULL, `ORE_GIORNO_8` DOUBLE NOT NULL, `ORE_GIORNO_9` DOUBLE NOT NULL, `ORE_GIORNO_10` DOUBLE NOT NULL, `ORE_GIORNO_11` DOUBLE NOT NULL, `ORE_GIORNO_12` DOUBLE NOT NULL, `ORE_GIORNO_13` DOUBLE NOT NULL, `ORE_GIORNO_14` DOUBLE NOT NULL, `ORE_GIORNO_15` DOUBLE NOT NULL, `ORE_GIORNO_16` DOUBLE NOT NULL, `ORE_GIORNO_17` DOUBLE NOT NULL, `ORE_GIORNO_18` DOUBLE NOT NULL, `ORE_GIORNO_19` DOUBLE NOT NULL, `ORE_GIORNO_20` DOUBLE NOT NULL, `ORE_GIORNO_21` DOUBLE NOT NULL, `ORE_GIORNO_22` DOUBLE NOT NULL, `ORE_GIORNO_23` DOUBLE NOT NULL, `ORE_GIORNO_24` DOUBLE NOT NULL, `ORE_GIORNO_25` DOUBLE NOT NULL, `ORE_GIORNO_26` DOUBLE NOT NULL, `ORE_GIORNO_27` DOUBLE NOT NULL, `ORE_GIORNO_28` DOUBLE NOT NULL, `ORE_GIORNO_29` DOUBLE NOT NULL, `ORE_GIORNO_30` DOUBLE NOT NULL, `ORE_GIORNO_31` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NULL DEFAULT NULL, `FLAG_VALIDATO` CHAR(1) NOT NULL DEFAULT 'N', `DATA_VALIDAZIONE` DATETIME NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 304 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.tt_timesheet_riepilogo Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_riepilogo` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NULL DEFAULT '0', `MESE` SMALLINT NULL DEFAULT '0', `GIORNO_1` SMALLINT NULL DEFAULT '1', `ORE_GIORNO_1` DOUBLE NULL DEFAULT '0', `GIORNO_2` SMALLINT NULL DEFAULT '2', `ORE_GIORNO_2` DOUBLE NULL DEFAULT '0', `GIORNO_3` SMALLINT NULL DEFAULT '3', `ORE_GIORNO_3` DOUBLE NULL DEFAULT '0', `GIORNO_4` SMALLINT NULL DEFAULT '4', `ORE_GIORNO_4` DOUBLE NULL DEFAULT '0', `GIORNO_5` SMALLINT NULL DEFAULT '5', `ORE_GIORNO_5` DOUBLE NULL DEFAULT '0', `GIORNO_6` SMALLINT NULL DEFAULT '6', `ORE_GIORNO_6` DOUBLE NULL DEFAULT '0', `GIORNO_7` SMALLINT NULL DEFAULT '7', `ORE_GIORNO_7` DOUBLE NULL DEFAULT '0', `GIORNO_8` SMALLINT NULL DEFAULT '8', `ORE_GIORNO_8` DOUBLE NULL DEFAULT '0', `GIORNO_9` SMALLINT NULL DEFAULT '9', `ORE_GIORNO_9` DOUBLE NULL DEFAULT '0', `GIORNO_10` SMALLINT NULL DEFAULT '10', `ORE_GIORNO_10` DOUBLE NULL DEFAULT '0', `GIORNO_11` SMALLINT NULL DEFAULT '11', `ORE_GIORNO_11` DOUBLE NULL DEFAULT '0', `GIORNO_12` SMALLINT NULL DEFAULT '12', `ORE_GIORNO_12` DOUBLE NULL DEFAULT '0', `GIORNO_13` SMALLINT NULL DEFAULT '13', `ORE_GIORNO_13` DOUBLE NULL DEFAULT '0', `GIORNO_14` SMALLINT NULL DEFAULT '14', `ORE_GIORNO_14` DOUBLE NULL DEFAULT '0', `GIORNO_15` SMALLINT NULL DEFAULT '15', `ORE_GIORNO_15` DOUBLE NULL DEFAULT '0', `GIORNO_16` SMALLINT NULL DEFAULT '16', `ORE_GIORNO_16` DOUBLE NULL DEFAULT '0', `GIORNO_17` SMALLINT NULL DEFAULT '17', `ORE_GIORNO_17` DOUBLE NULL DEFAULT '0', `GIORNO_18` SMALLINT NULL DEFAULT '18', `ORE_GIORNO_18` DOUBLE NULL DEFAULT '0', `GIORNO_19` SMALLINT NULL DEFAULT '19', `ORE_GIORNO_19` DOUBLE NULL DEFAULT '0', `GIORNO_20` SMALLINT NULL DEFAULT '20', `ORE_GIORNO_20` DOUBLE NULL DEFAULT '0', `GIORNO_21` SMALLINT NULL DEFAULT '21', `ORE_GIORNO_21` DOUBLE NULL DEFAULT '0', `GIORNO_22` SMALLINT NULL DEFAULT '22', `ORE_GIORNO_22` DOUBLE NULL DEFAULT '0', `GIORNO_23` SMALLINT NULL DEFAULT '23', `ORE_GIORNO_23` DOUBLE NULL DEFAULT '0', `GIORNO_24` SMALLINT NULL DEFAULT '24', `ORE_GIORNO_24` DOUBLE NULL DEFAULT '0', `GIORNO_25` SMALLINT NULL DEFAULT '25', `ORE_GIORNO_25` DOUBLE NULL DEFAULT '0', `GIORNO_26` SMALLINT NULL DEFAULT '26', `ORE_GIORNO_26` DOUBLE NULL DEFAULT '0', `GIORNO_27` SMALLINT NULL DEFAULT '27', `ORE_GIORNO_27` DOUBLE NULL DEFAULT '0', `GIORNO_28` SMALLINT NULL DEFAULT '28', `ORE_GIORNO_28` DOUBLE NULL DEFAULT '0', `GIORNO_29` SMALLINT NULL DEFAULT '29', `ORE_GIORNO_29` DOUBLE NULL DEFAULT '0', `GIORNO_30` SMALLINT NULL DEFAULT '30', `ORE_GIORNO_30` DOUBLE NULL DEFAULT '0', `GIORNO_31` SMALLINT NULL DEFAULT '31', `ORE_GIORNO_31` DOUBLE NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NULL DEFAULT NULL, `TOTALE_ORE` DOUBLE NULL DEFAULT NULL, `TOTALE_GIORNATE_POSSIBILI` INT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_787` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_787` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 1365 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'supporta minuti e somma tutti i progetti con la struttura uguale ai timesheet leggendo questo ho il quadro generale' - Creating table tempus_innodb.tt_timesheet_somma_azione Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_somma_azione` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `TOTALE_GIORNATE_POSSIBILI` SMALLINT NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_TMP_PER_SOMMA` DOUBLE NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1272` (`ANNO` ASC, `MESE` ASC, `FK_ANAG` ASC, `FK_AZIONE` ASC, `NSAL` ASC) VISIBLE, INDEX `INTEG_1131` (`FK_ANAG` ASC) VISIBLE, INDEX `INTEG_921` (`FK_AZIONE` ASC) VISIBLE, CONSTRAINT `INTEG_1131` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_921` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 67749 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Supporta MINUTI totali AZIONE-SAL dipendente \\\\\\\\r\\\\\\\\nalimentato dalla generazione dei timesheet e ricostruito da AGGIORNA_TOTALIZZATORI' - Creating table tempus_innodb.tt_timesheet_somma_sottliv_anno_mese Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_somma_sottliv_anno_mese` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE` INT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `TOTALE_GIORNATE_POSSIBILI` SMALLINT NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_TMP_PER_SOMMA` DOUBLE NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), UNIQUE INDEX `INTEG_1264` (`ANNO` ASC, `MESE` ASC, `FK_ANAG` ASC, `FK_AZIONE` ASC) VISIBLE, INDEX `INTEG_835` (`FK_ANAG` ASC) VISIBLE, INDEX `INTEG_922` (`FK_AZIONE` ASC) VISIBLE, CONSTRAINT `INTEG_835` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_922` FOREIGN KEY (`FK_AZIONE`) REFERENCES `tempus_innodb`.`ts_azione` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 52211 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Supporta MINUTI totali AZIONE dipendente \\\\\\\\r\\\\\\\\nalimentato dalla generazione dei timesheet e ricostruito da AGGIORNA_TOTALIZZATORI' - Creating table tempus_innodb.tt_timesheet_tmp_per_somme_azione Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_tmp_per_somme_azione` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_AZIONE_STRUTTURA` INT NOT NULL DEFAULT '0', `NSAL` SMALLINT NOT NULL DEFAULT '0', `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `GIORNO_1` SMALLINT NULL DEFAULT '1', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `GIORNO_2` SMALLINT NULL DEFAULT '2', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `GIORNO_3` SMALLINT NULL DEFAULT '3', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `GIORNO_4` SMALLINT NULL DEFAULT '4', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `GIORNO_5` SMALLINT NULL DEFAULT '5', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `GIORNO_6` SMALLINT NULL DEFAULT '6', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `GIORNO_7` SMALLINT NULL DEFAULT '7', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `GIORNO_8` SMALLINT NULL DEFAULT '8', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `GIORNO_9` SMALLINT NULL DEFAULT '9', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `GIORNO_10` SMALLINT NULL DEFAULT '10', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `GIORNO_11` SMALLINT NULL DEFAULT '11', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `GIORNO_12` SMALLINT NULL DEFAULT '12', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `GIORNO_13` SMALLINT NULL DEFAULT '13', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `GIORNO_14` SMALLINT NULL DEFAULT '14', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `GIORNO_15` SMALLINT NULL DEFAULT '15', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `GIORNO_16` SMALLINT NULL DEFAULT '16', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `GIORNO_17` SMALLINT NULL DEFAULT '17', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `GIORNO_18` SMALLINT NULL DEFAULT '18', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `GIORNO_19` SMALLINT NULL DEFAULT '19', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `GIORNO_20` SMALLINT NULL DEFAULT '20', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `GIORNO_21` SMALLINT NULL DEFAULT '21', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `GIORNO_22` SMALLINT NULL DEFAULT '22', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `GIORNO_23` SMALLINT NULL DEFAULT '23', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `GIORNO_24` SMALLINT NULL DEFAULT '24', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `GIORNO_25` SMALLINT NULL DEFAULT '25', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `GIORNO_26` SMALLINT NULL DEFAULT '26', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `GIORNO_27` SMALLINT NULL DEFAULT '27', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `GIORNO_28` SMALLINT NULL DEFAULT '28', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `GIORNO_29` SMALLINT NULL DEFAULT '29', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `GIORNO_30` SMALLINT NULL DEFAULT '30', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `GIORNO_31` SMALLINT NULL DEFAULT '31', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `TOTALE_GIORNATE_POSSIBILI` SMALLINT NOT NULL, `COSTO_ORARIO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1262` (`FK_ANAG` ASC) VISIBLE, INDEX `INTEG_98` (`FK_AZIONE_STRUTTURA` ASC, `NSAL` ASC) VISIBLE, CONSTRAINT `INTEG_1262` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`), CONSTRAINT `INTEG_98` FOREIGN KEY (`FK_AZIONE_STRUTTURA` , `NSAL`) REFERENCES `tempus_innodb`.`ts_azione_struttura_simula` (`PK_PROGRESSIVO_AZSTRUT` , `NSAL`) ON DELETE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 9750 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'tabella intermedia che viene alimentata per calcolare attraverso trigger la tabella di somma tt_timesheet_somma_azione e la tabella di somma TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE' - Creating table tempus_innodb.tt_timesheet_tmp_somma Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_tmp_somma` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL DEFAULT '0', `TOT_COSTO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1268` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1268` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'solo stampe SOMMA LE ORE DI TUTTI I PROGETTI PER PERSONA' - Creating table tempus_innodb.tt_timesheet_tmp_somma_anno Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_tmp_somma_anno` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL, `ANNO` SMALLINT NOT NULL DEFAULT '0', `TOTALE_ORE` DOUBLE NOT NULL DEFAULT '0', `TOT_COSTO` DOUBLE NOT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1283` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1283` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'solo stampe SOMMA LE ORE DI TUTTI I PROGETTI PER PERSONA ANNO' - Creating table tempus_innodb.tt_timesheet_tmp_somma_azioni_per_stp Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`tt_timesheet_tmp_somma_azioni_per_stp` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_ANAG` INT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ORE_GIORNO_1` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_2` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_3` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_4` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_5` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_6` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_7` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_8` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_9` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_10` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_11` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_12` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_13` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_14` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_15` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_16` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_17` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_18` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_19` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_20` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_21` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_22` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_23` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_24` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_25` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_26` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_27` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_28` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_29` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_30` DOUBLE NOT NULL DEFAULT '0', `ORE_GIORNO_31` DOUBLE NOT NULL DEFAULT '0', `TOTALE_MESE` DOUBLE NOT NULL, `TOTALE_ORE` DOUBLE NOT NULL, `TOTALE_GIORNATE_POSSIBILI` SMALLINT NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_1263` (`FK_ANAG` ASC) VISIBLE, CONSTRAINT `INTEG_1263` FOREIGN KEY (`FK_ANAG`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 38612 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'SOMMA TUTTE LE AZIONI MENO QUELLA IN STAMPA PER POTER STAMPARE LA RIGA TOTALI ALTRE AZIONI non usa il SAL ma li somma tutti' - Creating table tempus_innodb.zucchetti_fase_01_cmo Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_fase_01_cmo` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `MATRICOLA` CHAR(10) NOT NULL, `CFISC` CHAR(16) NOT NULL, `ANNO` SMALLINT NULL DEFAULT NULL, `CMO` FLOAT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_788` (`CFISC` ASC) VISIBLE, CONSTRAINT `INTEG_788` FOREIGN KEY (`CFISC`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`CODICE_FISCALE`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_fase_01_ferie Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_fase_01_ferie` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `MATRICOLA` CHAR(10) NOT NULL, `CFISC` CHAR(16) NOT NULL, `DATA_FERIE` DATETIME NOT NULL, `ORE_FERIE` FLOAT NULL DEFAULT NULL, `GIORNO` SMALLINT NULL DEFAULT NULL, `MESE` SMALLINT NULL DEFAULT NULL, `ANNO` SMALLINT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_789` (`CFISC` ASC) VISIBLE, CONSTRAINT `INTEG_789` FOREIGN KEY (`CFISC`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`CODICE_FISCALE`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_fase_01_malattie Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_fase_01_malattie` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `MATRICOLA` CHAR(10) NOT NULL, `CFISC` CHAR(16) NOT NULL, `DATA_MALATTIA` DATETIME NOT NULL, `ORE_MALATTIA` FLOAT NULL DEFAULT NULL, `GIORNO` SMALLINT NULL DEFAULT NULL, `MESE` SMALLINT NULL DEFAULT NULL, `ANNO` SMALLINT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_790` (`CFISC` ASC) VISIBLE, CONSTRAINT `INTEG_790` FOREIGN KEY (`CFISC`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`CODICE_FISCALE`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_fase_01_permessi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_fase_01_permessi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `MATRICOLA` CHAR(10) NOT NULL, `CFISC` CHAR(16) NOT NULL, `DATA_PERMESSO` DATETIME NOT NULL, `ORE1` FLOAT NULL DEFAULT '0', `ORE2` FLOAT NULL DEFAULT '0', `ORE3` FLOAT NULL DEFAULT '0', `ORE4` FLOAT NULL DEFAULT '0', `ORE5` FLOAT NULL DEFAULT '0', `ORE6` FLOAT NULL DEFAULT '0', `ORE7` FLOAT NULL DEFAULT '0', `ORE8` FLOAT NULL DEFAULT '0', `ORE9` FLOAT NULL DEFAULT '0', `ORE10` FLOAT NULL DEFAULT '0', `ORE11` FLOAT NULL DEFAULT '0', `GIORNO` SMALLINT NULL DEFAULT NULL, `MESE` SMALLINT NULL DEFAULT NULL, `ANNO` SMALLINT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_791` (`CFISC` ASC) VISIBLE, CONSTRAINT `INTEG_791` FOREIGN KEY (`CFISC`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`CODICE_FISCALE`)) ENGINE = InnoDB AUTO_INCREMENT = 6017 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_fase_01_presenze Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_fase_01_presenze` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `CFISC` CHAR(16) NOT NULL, `MATRICOLA` CHAR(10) NOT NULL, `QUALIFICA` CHAR(100) NULL DEFAULT NULL, `DATA_TIMBRATURA` DATETIME NOT NULL, `ORE_LAVORATE` FLOAT NULL DEFAULT NULL, `ANNO` SMALLINT NULL DEFAULT NULL, `MESE` SMALLINT NULL DEFAULT NULL, `GIORNO` SMALLINT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `ZUCCHETTI_PRESENZE_ANNO_IDX` (`ANNO` ASC) VISIBLE, INDEX `ZUCCHETTI_PRESENZE_MESE_IDX` (`MESE` ASC) VISIBLE) ENGINE = InnoDB AUTO_INCREMENT = 6651 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_file_importati Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_file_importati` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `TIPO_FILE` CHAR(2) NOT NULL DEFAULT 'ZU', `ANNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ALLEGATO_BLR` LONGTEXT NULL DEFAULT NULL, PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Contiene tutti i file importati di ferie malattie permessi timbrature COLLEGATO ALLA GESTIONE PATH ATTRAVERSO LA MASTER ALLEGATI' - Creating table tempus_innodb.zucchetti_import_anag Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_import_anag` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `COGNOME` VARCHAR(50) NOT NULL, `NOME` VARCHAR(50) NOT NULL, `CFISC` CHAR(16) NOT NULL, `MATRICOLA` VARCHAR(10) NULL DEFAULT NULL, `DATA_ASS` DATE NULL DEFAULT NULL, `SESSO` CHAR(1) NOT NULL, `TEMPO_DETERMINATO_SN` CHAR(1) NULL DEFAULT NULL, `FLAG_ANAG_PRESENTE` CHAR(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'IMPORTAZIONE ANAGRAFICHE' - Creating table tempus_innodb.zucchetti_intermedio Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_intermedio` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_TT_ANAG_PERSONALE` INT NOT NULL DEFAULT '0', `DATA_TIMBRATURA` DATETIME NULL DEFAULT NULL, `GG` SMALLINT NOT NULL DEFAULT '0', `MM` SMALLINT NOT NULL DEFAULT '0', `AA` SMALLINT NOT NULL DEFAULT '0', `ORE` FLOAT NOT NULL DEFAULT '0', `TIPO_ORE` CHAR(1) NOT NULL, PRIMARY KEY (`PK_PROGRESSIVO`), INDEX `INTEG_792` (`FK_TT_ANAG_PERSONALE` ASC) VISIBLE, CONSTRAINT `INTEG_792` FOREIGN KEY (`FK_TT_ANAG_PERSONALE`) REFERENCES `tempus_innodb`.`tt_anag_personale` (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 13689 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_intermedio_livello Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_intermedio_livello` ( `CFISC` VARCHAR(16) NOT NULL, `LIVELLO` VARCHAR(10) NOT NULL, `FLAG_LIVELLO` CHAR(1) NULL DEFAULT NULL) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating table tempus_innodb.zucchetti_intermedio_permessi Execute statement: CREATE TABLE IF NOT EXISTS `tempus_innodb`.`zucchetti_intermedio_permessi` ( `PK_PROGRESSIVO` INT NOT NULL AUTO_INCREMENT, `FK_TT_ANAG_PERSONALE` INT NOT NULL DEFAULT '0', `DATA_PERMESSO` DATETIME NULL DEFAULT NULL, `ORE1` FLOAT NULL DEFAULT '0', `ORE2` FLOAT NULL DEFAULT '0', `ORE3` FLOAT NULL DEFAULT '0', `ORE4` FLOAT NULL DEFAULT '0', `ORE5` FLOAT NULL DEFAULT '0', `ORE6` FLOAT NULL DEFAULT '0', `ORE7` FLOAT NULL DEFAULT '0', `ORE8` FLOAT NULL DEFAULT '0', `ORE9` FLOAT NULL DEFAULT '0', `ORE10` FLOAT NULL DEFAULT '0', `ORE11` FLOAT NULL DEFAULT '0', `GIORNO` SMALLINT NOT NULL DEFAULT '0', `MESE` SMALLINT NOT NULL DEFAULT '0', `ANNO` SMALLINT NOT NULL DEFAULT '0', `TOTALE_PERMESSI` FLOAT NULL DEFAULT '0', PRIMARY KEY (`PK_PROGRESSIVO`)) ENGINE = InnoDB AUTO_INCREMENT = 73551 DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci - Creating view tempus_innodb.view_anag_qualifiche Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_anag_qualifiche` (`PK_PROGRESSIVO`,`CODICE_FISCALE`,`MATRICOLA`,`NOMINATIVO`,`SESSO`,`FLAG_TEMPO_DETERMINATO`,`DATA_ASS`,`FLAG_AMMINISTRATIVO_SN`,`LIVELLO_COSTO_STANDARD_ALTO`,`LIVELLO_COSTO_STANDARD_MEDIO`,`LIVELLO_COSTO_STANDARD_BASSO`,`CAMBIO_MATR`,`FK_CDC`,`UTENTE_NUM`,`FK_UTENTI`,`COGNOME_UTENTE`,`NOME_UTENTE`,`FOTO_UTENTE`,`FLAG_ODS`,`QUALIFICA`,`ANNO`,`MESE`) AS select distinct `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`CODICE_FISCALE` AS `codice_fiscale`,`a`.`MATRICOLA` AS `matricola`,`a`.`NOMINATIVO` AS `nominativo`,`a`.`SESSO` AS `sesso`,`a`.`FLAG_TEMPO_DETERMINATO` AS `flag_tempo_determinato`,`a`.`DATA_ASS` AS `data_ass`,`a`.`FLAG_AMMINISTRATIVO_SN` AS `flag_amministrativo_sn`,`a`.`LIVELLO_COSTO_STANDARD_ALTO` AS `livello_costo_standard_alto`,`a`.`LIVELLO_COSTO_STANDARD_MEDIO` AS `livello_costo_standard_medio`,`a`.`LIVELLO_COSTO_STANDARD_BASSO` AS `livello_costo_standard_basso`,`a`.`CAMBIO_MATR` AS `cambio_matr`,`a`.`FK_CDC` AS `fk_cdc`,`a`.`UTENTE_NUM` AS `utente_num`,`a`.`FK_UTENTI` AS `fk_utenti`,`a`.`COGNOME_UTENTE` AS `cognome_utente`,`a`.`NOME_UTENTE` AS `nome_utente`,`a`.`FOTO_UTENTE` AS `foto_utente`,`a`.`FLAG_ODS` AS `flag_ods`,`b`.`QUALIFICA` AS `qualifica`,`b`.`ANNO` AS `anno`,`b`.`MESE` AS `mese` from (`tempus_innodb`.`tt_anag_personale` `a` left join `tempus_innodb`.`tt_anag_personale_qualifiche` `b` on((`a`.`PK_PROGRESSIVO` = `b`.`FK_TT_ANAG_PERSONALE`))) - Creating view tempus_innodb.view_analisi_pesi Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_analisi_pesi` (`ANNO`,`FK_AZIONE`,`FK_AZIONE_STRUTTURA`,`FK_AZIONE_SOTTOLIVELLI`,`NUMERO_SAL`,`FK_ANAG`,`MESI_UOMO_DIP`,`IMPORTO_DIP`,`ORE_PROGETTO_DIP`,`COSTO_ORARIO`,`COSTO_ORARIO_STANDARD`,`COSTO_ORARIO_STANDARD2`,`SAL_MESI`,`SAL_GIORNI`,`SAL_FRAZIONE_MESI`,`COEFF_CORREZIONE_ORE`,`MONTE_ORE`) AS select `a`.`ANNO` AS `anno`,`d`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`b`.`FK_AZIONE_SOTTOLIVELLI` AS `fk_azione_sottolivelli`,`a`.`NUMERO_SAL` AS `numero_sal`,`b`.`FK_ANAG_PROGETTO` AS `fk_anag_progetto`,`a`.`MESI_UOMO_DIP` AS `mesi_uomo_dip`,`a`.`IMPORTO_DIP` AS `importo_dip`,`a`.`ORE_PROGETTO_DIP` AS `ore_progetto_dip`,`c`.`COSTO_ORARIO` AS `costo_orario`,`c`.`COSTO_ORARIO_STANDARD` AS `costo_orario_standard`,`c`.`COSTO_ORARIO_STANDARD2` AS `costo_orario_standard2`,((extract(month from `a`.`DATA_FINE`) - extract(month from `a`.`DATA_INIZIO`)) + 1) AS `SAL_MESI`,(`a`.`DATA_FINE` - `a`.`DATA_INIZIO`) AS `SAL_GIORNI`,((`a`.`DATA_FINE` - `a`.`DATA_INIZIO`) / 30) AS `SAL_FRAZIONE_MESI`,`a`.`COEFF_CORREZIONE_ORE` AS `coeff_correzione_ore`,`d`.`MONTE_ORE` AS `monte_ore` from (((`tempus_innodb`.`ts_azione_parametri_calcolo` `a` join `tempus_innodb`.`ts_azione_struttura` `b`) join `tempus_innodb`.`tt_anag_personale_costi` `c`) join `tempus_innodb`.`ts_azione` `d`) where ((`a`.`ANNO` = `c`.`ANNO`) and (`a`.`FK_AZIONE_STRUTTURA` = `b`.`PK_PROGRESSIVO`) and (`b`.`FK_ANAG_PROGETTO` = `c`.`FK_ANAG`) and (`b`.`FK_AZIONE` = `d`.`PK_PROGRESSIVO`)) - Creating view tempus_innodb.view_configurazione_azione Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_configurazione_azione` (`PK_MACROGRUPPO`,`MACROGRUPPO`,`DESC_MACROGRUPPO`,`MACROGRUPPO_SOSPESO`,`DATA_INIZIO_MG`,`DATA_FINE_MG`,`TAG_REPORT`,`PK_AZIONE`,`AZIONE`,`CUP`,`DESC_AZIONE`,`AZIONE_SOSPESA`,`DATA_INIZIO_AZ`,`DATA_FINE_AZ`,`FILENAME`,`PK_AZSOTLIV`,`PK_SOTTOLIVELLO`,`COD_SOTTLIV`,`DESC_SOTTOLIVELLO`,`DATA_INIZIO_AZLIV`,`DATA_FINE_AZLIV`,`FLAG_AZIONE_CHIUSO`,`FLAG_MG_CHIUSO`) AS select `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`MACROGRUPPO` AS `macrogruppo`,`a`.`DESCRIZIONE` AS `descrizione`,`a`.`FLAG_MG_SOSPESO` AS `flag_mg_sospeso`,`a`.`DATA_INIZIO` AS `data_inizio`,`a`.`DATA_FINE` AS `data_fine`,`a`.`TAG_REPORT` AS `tag_report`,`b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`AZIONE` AS `azione`,`b`.`CUP` AS `cup`,`b`.`DESCRIZIONE` AS `descrizione`,`b`.`FLAG_AZIONE_SOSPESA` AS `flag_azione_sospesa`,`b`.`DATA_INIZIO` AS `data_inizio`,`b`.`DATA_FINE` AS `data_fine`,`b`.`FILENAME` AS `filename`,`c`.`PK_PROGRESSIVO` AS `pk_progressivo`,`c`.`FK_SOTTOLIVELLI` AS `fk_sottolivelli`,`d`.`CODICE` AS `codice`,`d`.`DESCRIZIONE` AS `descrizione`,`c`.`DATA_INIZIO_AZLIV` AS `data_inizio_azliv`,`c`.`DATA_FINE_AZLIV` AS `data_fine_azliv`,`b`.`FLAG_CHIUSO` AS `flag_chiuso`,`a`.`FLAG_CHIUSO` AS `flag_chiuso` from (((`tempus_innodb`.`ts_macrogruppo` `a` join `tempus_innodb`.`ts_azione` `b`) join `tempus_innodb`.`ts_azione_sottolivelli` `c`) join `tempus_innodb`.`ts_sottolivelli` `d`) where ((`b`.`FK_MACROGRUPPO` = `a`.`PK_PROGRESSIVO`) and (`c`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`d`.`PK_PROGRESSIVO` = `c`.`FK_SOTTOLIVELLI`)) - Creating view tempus_innodb.view_configurazione_azione_personale Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_configurazione_azione_personale` (`PK_MACROGRUPPO`,`MACROGRUPPO`,`DESC_MACROGRUPPO`,`MACROGRUPPO_SOSPESO`,`DATA_INIZIO_MG`,`DATA_FINE_MG`,`TAG_REPORT`,`PK_AZIONE`,`AZIONE`,`CUP`,`DESC_AZIONE`,`AZIONE_SOSPESA`,`DATA_INIZIO_AZ`,`DATA_FINE_AZ`,`FILENAME`,`PK_ANAG`,`MATRICOLA`,`CODICE_FISCALE`,`NOMINATIVO`,`SOSPESO`,`IMAGE_ICO`,`FLAG_AZIONE_CHIUSO`,`FLAG_MG_CHIUSO`) AS select distinct `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`MACROGRUPPO` AS `macrogruppo`,`a`.`DESCRIZIONE` AS `descrizione`,`a`.`FLAG_MG_SOSPESO` AS `flag_mg_sospeso`,`a`.`DATA_INIZIO` AS `data_inizio`,`a`.`DATA_FINE` AS `data_fine`,`a`.`TAG_REPORT` AS `tag_report`,`b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`AZIONE` AS `azione`,`b`.`CUP` AS `cup`,`b`.`DESCRIZIONE` AS `descrizione`,`b`.`FLAG_AZIONE_SOSPESA` AS `flag_azione_sospesa`,`b`.`DATA_INIZIO` AS `data_inizio`,`b`.`DATA_FINE` AS `data_fine`,`b`.`FILENAME` AS `filename`,`f`.`PK_PROGRESSIVO` AS `pk_progressivo`,`f`.`MATRICOLA` AS `matricola`,`f`.`CODICE_FISCALE` AS `codice_fiscale`,`f`.`NOMINATIVO` AS `nominativo`,`g`.`FLAG_SOSPESO` AS `flag_sospeso`,`h`.`IMAGE_ICO` AS `image_ico`,`b`.`FLAG_CHIUSO` AS `flag_chiuso`,`a`.`FLAG_CHIUSO` AS `flag_chiuso` from (((((`tempus_innodb`.`ts_macrogruppo` `a` join `tempus_innodb`.`ts_azione` `b`) join `tempus_innodb`.`ts_azione_struttura` `e`) join `tempus_innodb`.`tt_anag_personale` `f`) join `tempus_innodb`.`tt_lista_personale_detail` `g`) join `tempus_innodb`.`ts_ico` `h`) where ((`b`.`FK_MACROGRUPPO` = `a`.`PK_PROGRESSIVO`) and (`e`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`e`.`FK_ANAG_PROGETTO` = `f`.`PK_PROGRESSIVO`) and (`e`.`FK_ANAG_PROGETTO` = `g`.`FK_ANAG`) and (`g`.`FLAG_SOSPESO` = `h`.`FLAG_SI_NO`) and (`e`.`FK_MASTER_ODS` = `g`.`FK_MASTER`) and (`h`.`TIPO` = 1)) - Creating view tempus_innodb.view_configurazione_azione_sottolivello_personale Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_configurazione_azione_sottolivello_personale` (`PK_MACROGRUPPO`,`MACROGRUPPO`,`DESC_MACROGRUPPO`,`MACROGRUPPO_SOSPESO`,`DATA_INIZIO_MG`,`DATA_FINE_MG`,`TAG_REPORT`,`PK_AZIONE`,`AZIONE`,`CUP`,`DESC_AZIONE`,`AZIONE_SOSPESA`,`DATA_INIZIO_AZ`,`DATA_FINE_AZ`,`FILENAME`,`PK_AZSOTLIV`,`DATA_INIZIO_AZLIV`,`DATA_FINE_AZLIV`,`PK_SOTTOLIVELLO`,`COD_SOTTLIV`,`DESC_SOTTOLIVELLO`,`PK_AZIONE_STRUTTURA`,`FK_MASTER_ODS`,`FLAG_SOSPESO_ODS`,`PK_ANAG`,`MATRICOLA`,`CODICE_FISCALE`,`NOMINATIVO`,`FLAG_AZIONE_CHIUSO`,`FLAG_MG_CHIUSO`) AS select `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`MACROGRUPPO` AS `macrogruppo`,`a`.`DESCRIZIONE` AS `descrizione`,`a`.`FLAG_MG_SOSPESO` AS `flag_mg_sospeso`,`a`.`DATA_INIZIO` AS `data_inizio`,`a`.`DATA_FINE` AS `data_fine`,`a`.`TAG_REPORT` AS `tag_report`,`b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`AZIONE` AS `azione`,`b`.`CUP` AS `cup`,`b`.`DESCRIZIONE` AS `descrizione`,`b`.`FLAG_AZIONE_SOSPESA` AS `flag_azione_sospesa`,`b`.`DATA_INIZIO` AS `data_inizio`,`b`.`DATA_FINE` AS `data_fine`,`b`.`FILENAME` AS `filename`,`c`.`PK_PROGRESSIVO` AS `pk_progressivo`,`c`.`DATA_INIZIO_AZLIV` AS `data_inizio_azliv`,`c`.`DATA_FINE_AZLIV` AS `data_fine_azliv`,`c`.`FK_SOTTOLIVELLI` AS `fk_sottolivelli`,`d`.`CODICE` AS `codice`,`d`.`DESCRIZIONE` AS `descrizione`,`e`.`PK_PROGRESSIVO` AS `pk_progressivo`,`e`.`FK_MASTER_ODS` AS `fk_master_ods`,`g`.`FLAG_SOSPESO` AS `flag_sospeso`,`f`.`PK_PROGRESSIVO` AS `pk_progressivo`,`f`.`MATRICOLA` AS `matricola`,`f`.`CODICE_FISCALE` AS `codice_fiscale`,`f`.`NOMINATIVO` AS `nominativo`,`b`.`FLAG_CHIUSO` AS `flag_chiuso`,`a`.`FLAG_CHIUSO` AS `flag_chiuso` from ((((((`tempus_innodb`.`ts_macrogruppo` `a` join `tempus_innodb`.`ts_azione` `b`) join `tempus_innodb`.`ts_azione_sottolivelli` `c`) join `tempus_innodb`.`ts_sottolivelli` `d`) join `tempus_innodb`.`ts_azione_struttura` `e`) join `tempus_innodb`.`tt_anag_personale` `f`) join `tempus_innodb`.`tt_lista_personale_detail` `g`) where ((`b`.`FK_MACROGRUPPO` = `a`.`PK_PROGRESSIVO`) and (`c`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`d`.`PK_PROGRESSIVO` = `c`.`FK_SOTTOLIVELLI`) and (`e`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`e`.`FK_AZIONE_SOTTOLIVELLI` = `c`.`PK_PROGRESSIVO`) and (`e`.`FK_ANAG_PROGETTO` = `f`.`PK_PROGRESSIVO`) and (`e`.`FK_MASTER_ODS` = `g`.`FK_MASTER`) and (`e`.`FK_MASTER_ODS` = `g`.`FK_MASTER`) and (`e`.`FK_ANAG_PROGETTO` = `g`.`FK_ANAG`)) - Creating view tempus_innodb.view_configurazione_mg_azione Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_configurazione_mg_azione` (`PK_MACROGRUPPO`,`MACROGRUPPO`,`DESC_MACROGRUPPO`,`MACROGRUPPO_SOSPESO`,`DATA_INIZIO_MG`,`DATA_FINE_MG`,`PK_AZIONE`,`AZIONE`,`CUP`,`DESC_AZIONE`,`AZIONE_SOSPESA`,`DATA_INIZIO_AZ`,`DATA_FINE_AZ`,`TAG_REPORT`,`FILENAME`,`FLAG_AZIONE_CHIUSO`,`FLAG_MG_CHIUSO`) AS select `a`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`a`.`MACROGRUPPO` AS `MACROGRUPPO`,`a`.`DESCRIZIONE` AS `DESCRIZIONE`,`a`.`FLAG_MG_SOSPESO` AS `FLAG_MG_SOSPESO`,`a`.`DATA_INIZIO` AS `DATA_INIZIO`,`a`.`DATA_FINE` AS `DATA_FINE`,`b`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`b`.`AZIONE` AS `AZIONE`,`b`.`CUP` AS `CUP`,`b`.`DESCRIZIONE` AS `DESCRIZIONE`,`b`.`FLAG_AZIONE_SOSPESA` AS `FLAG_AZIONE_SOSPESA`,`b`.`DATA_INIZIO` AS `DATA_INIZIO`,`b`.`DATA_FINE` AS `DATA_FINE`,`a`.`TAG_REPORT` AS `TAG_REPORT`,`b`.`FILENAME` AS `FILENAME`,`b`.`FLAG_CHIUSO` AS `flag_chiuso`,`a`.`FLAG_CHIUSO` AS `flag_chiuso` from (`tempus_innodb`.`ts_macrogruppo` `a` join `tempus_innodb`.`ts_azione` `b`) where (`b`.`FK_MACROGRUPPO` = `a`.`PK_PROGRESSIVO`) - Creating view tempus_innodb.view_configurazione_parametri_calcolo Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_configurazione_parametri_calcolo` (`PK_MACROGRUPPO`,`MACROGRUPPO`,`DESC_MACROGRUPPO`,`MACROGRUPPO_SOSPESO`,`TAG_REPORT`,`PK_AZIONE`,`AZIONE`,`CUP`,`DESC_AZIONE`,`AZIONE_SOSPESA`,`FILENAME`,`PK_AZSOTLIV`,`PK_SOTTOLIVELLO`,`COD_SOTTLIV`,`DESC_SOTTOLIVELLO`,`PK_AZIONE_STRUTTURA`,`PK_ANAG`,`MATRICOLA`,`CODICE_FISCALE`,`NOMINATIVO`,`ANNO`,`MESI_UOMO_DIP`,`IMPORTO_DIP`,`ORE_PROGETTO_DIP`,`ORE_BASE_CALCOLO_DIP`,`DATA_INIZIO`,`DATA_FINE`,`DURATA_IN_MESI`,`DATA_IN_STP`,`DATA_FI_STP`,`SAL`,`SAL_ELABORATO`,`COEFF_CORREZIONE_ORE`) AS select `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`MACROGRUPPO` AS `macrogruppo`,`a`.`DESCRIZIONE` AS `descrizione`,`a`.`FLAG_MG_SOSPESO` AS `flag_mg_sospeso`,`a`.`TAG_REPORT` AS `tag_report`,`b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`AZIONE` AS `azione`,`b`.`CUP` AS `cup`,`b`.`DESCRIZIONE` AS `descrizione`,`b`.`FLAG_AZIONE_SOSPESA` AS `flag_azione_sospesa`,`b`.`FILENAME` AS `filename`,`c`.`PK_PROGRESSIVO` AS `pk_progressivo`,`c`.`FK_SOTTOLIVELLI` AS `fk_sottolivelli`,`d`.`CODICE` AS `codice`,`d`.`DESCRIZIONE` AS `descrizione`,`e`.`PK_PROGRESSIVO` AS `pk_progressivo`,`f`.`PK_PROGRESSIVO` AS `pk_progressivo`,`f`.`MATRICOLA` AS `matricola`,`f`.`CODICE_FISCALE` AS `codice_fiscale`,`f`.`NOMINATIVO` AS `nominativo`,`g`.`ANNO` AS `anno`,`g`.`MESI_UOMO_DIP` AS `mesi_uomo_dip`,`g`.`IMPORTO_DIP` AS `importo_dip`,`g`.`ORE_PROGETTO_DIP` AS `ore_progetto_dip`,`g`.`ORE_BASE_CALCOLO_DIP` AS `ore_base_calcolo_dip`,`g`.`DATA_INIZIO` AS `data_inizio`,`g`.`DATA_FINE` AS `data_fine`,`g`.`DURATA_IN_MESI` AS `durata_in_mesi`,`g`.`DATA_IN_STP` AS `data_in_stp`,`g`.`DATA_FI_STP` AS `data_fi_stp`,`g`.`NUMERO_SAL` AS `numero_sal`,`g`.`SAL_ELABORATO` AS `sal_elaborato`,`g`.`COEFF_CORREZIONE_ORE` AS `coeff_correzione_ore` from ((((((`tempus_innodb`.`ts_macrogruppo` `a` join `tempus_innodb`.`ts_azione` `b`) join `tempus_innodb`.`ts_azione_sottolivelli` `c`) join `tempus_innodb`.`ts_sottolivelli` `d`) join `tempus_innodb`.`ts_azione_struttura` `e`) join `tempus_innodb`.`tt_anag_personale` `f`) join `tempus_innodb`.`ts_azione_parametri_calcolo` `g`) where ((`b`.`FK_MACROGRUPPO` = `a`.`PK_PROGRESSIVO`) and (`c`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`d`.`PK_PROGRESSIVO` = `c`.`FK_SOTTOLIVELLI`) and (`e`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`e`.`FK_AZIONE_SOTTOLIVELLI` = `c`.`PK_PROGRESSIVO`) and (`e`.`FK_ANAG_PROGETTO` = `f`.`PK_PROGRESSIVO`) and (`g`.`FK_AZIONE_STRUTTURA` = `e`.`PK_PROGRESSIVO`)) - Creating view tempus_innodb.view_configurazione_utente Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_configurazione_utente` (`FK_MSTRUTTURA`,`FK_UOC`,`FK_UOS`,`FK_UTENTE`,`RESP_FK_MSTRUTTURA`,`RESP_FK_UOC`,`RESP_FK_UOS`,`UTENTE`,`NOME_UTENTE`,`COGNOME_UTENTE`,`NOMINATIVO`,`NOMINATIVO_E_CODICE`,`FLAG_SUPERVISORE`,`FLAG_DIRIGENTE`,`FLAG_REFERENTE_QUALITA`,`FLAG_RESPONSABILE`,`FLAG_AUDITOR`,`MANSIONE_TABELLA`,`DESC_MANSIONE`,`USER_PASSWORD`,`SCADENZA_PSW`,`FK_ANAG`) AS select distinct `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`c`.`PK_PROGRESSIVO` AS `pk_progressivo`,`f`.`PK_PROGRESSIVO` AS `pk_progressivo`,`d`.`RESP_FK_MASTER_STRUTTURA` AS `RESP_FK_MASTER_STRUTTURA`,`d`.`RESP_FK_UOC` AS `RESP_FK_UOC`,`d`.`RESP_FK_UOS` AS `RESP_FK_UOS`,`f`.`UTENTE` AS `utente`,`f`.`NOME_UTENTE` AS `nome_utente`,`f`.`COGNOME_UTENTE` AS `cognome_utente`,concat(concat(rtrim(`f`.`COGNOME_UTENTE`),' '),rtrim(`f`.`NOME_UTENTE`)) AS `rtrim(f.cognome_utente)||' '||rtrim(f.nome_utente)`,concat(concat(concat(concat(concat(rtrim(`f`.`COGNOME_UTENTE`),' '),rtrim(`f`.`NOME_UTENTE`)),' ('),rtrim(`f`.`UTENTE`)),')') AS `NOMINATIVO`,`d`.`FLAG_SUPERVISORE` AS `flag_supervisore`,`d`.`FLAG_DIRIGENTE` AS `flag_dirigente`,`d`.`FLAG_REFQUAL` AS `FLAG_REFQUAL`,`d`.`FLAG_RESPONSABILE` AS `FLAG_RESPONSABILE`,`d`.`FLAG_AUDITOR` AS `FLAG_AUDITOR`,`e`.`MANSIONE_TABELLA` AS `mansione_tabella`,`g`.`DESCRIZIONE` AS `descrizione`,`f`.`USER_PASSWORD` AS `user_password`,`f`.`scadenza_psw` AS `scadenza_psw`,`f`.`FK_ANAG` AS `fk_anag` from ((((((`tempus_innodb`.`sys_master_struttura` `a` join `tempus_innodb`.`sys_uoc` `b`) join `tempus_innodb`.`sys_uos` `c`) join `tempus_innodb`.`sys_config_utente` `d`) join `tempus_innodb`.`sys_utenti_mansione` `e`) join `tempus_innodb`.`sys_utenti` `f`) join `tempus_innodb`.`sys_mansioni` `g`) where ((`a`.`PK_PROGRESSIVO` = `b`.`FK_MSTRUTTURE`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_UOC`) and (`c`.`PK_PROGRESSIVO` = `d`.`FK_UOS`) and (`d`.`FK_UTENTE` = `e`.`FK_UTENTE`) and (`d`.`FK_UTENTE` = `f`.`PK_PROGRESSIVO`) and (`e`.`MANSIONE_TABELLA` = `g`.`CODICE`)) - Creating view tempus_innodb.view_costo_pers_ods Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_costo_pers_ods` (`PK_PROGRESSIVO`,`FK_ODS`,`FK_ANAG`,`FLAG_SOSPESO`,`ANNO_IN`,`ANNO_FI`,`ANNO_COSTO`,`COSTO_ORARIO`,`COSTO_STD1`,`COSTO_STD2`) AS select `b`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`b`.`FK_MASTER` AS `FK_MASTER`,`b`.`FK_ANAG` AS `FK_ANAG`,`b`.`FLAG_SOSPESO` AS `FLAG_SOSPESO`,extract(year from `a`.`DATA_IN`) AS `anno_in`,extract(year from `a`.`DATA_FI`) AS `anno_fi`,`c`.`ANNO` AS `anno`,`f_arrotonda`(`c`.`COSTO_ORARIO`,2) AS `f_arrotonda(c.costo_orario, 2)`,`f_arrotonda`(`c`.`COSTO_ORARIO_STANDARD`,2) AS `f_arrotonda(c.costo_orario_standard, 2)`,`f_arrotonda`(`c`.`COSTO_ORARIO_STANDARD2`,2) AS `f_arrotonda(c.costo_orario_standard2, 2)` from ((`tempus_innodb`.`tt_lista_personale_master` `a` join `tempus_innodb`.`tt_lista_personale_detail` `b` on((`a`.`PK_PROGRESSIVO` = `b`.`FK_MASTER`))) left join `tempus_innodb`.`tt_anag_personale_costi` `c` on(((`c`.`FK_ANAG` = `b`.`FK_ANAG`) and (`c`.`ANNO` between extract(year from `a`.`DATA_IN`) and extract(year from `a`.`DATA_FI`))))) WARNING: Error executing ' CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_costo_pers_ods` (`PK_PROGRESSIVO`,`FK_ODS`,`FK_ANAG`,`FLAG_SOSPESO`,`ANNO_IN`,`ANNO_FI`,`ANNO_COSTO`,`COSTO_ORARIO`,`COSTO_STD1`,`COSTO_STD2`) AS select `b`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`b`.`FK_MASTER` AS `FK_MASTER`,`b`.`FK_ANAG` AS `FK_ANAG`,`b`.`FLAG_SOSPESO` AS `FLAG_SOSPESO`,extract(year from `a`.`DATA_IN`) AS `anno_in`,extract(year from `a`.`DATA_FI`) AS `anno_fi`,`c`.`ANNO` AS `anno`,`f_arrotonda`(`c`.`COSTO_ORARIO`,2) AS `f_arrotonda(c.costo_orario, 2)`,`f_arrotonda`(`c`.`COSTO_ORARIO_STANDARD`,2) AS `f_arrotonda(c.costo_orario_standard, 2)`,`f_arrotonda`(`c`.`COSTO_ORARIO_STANDARD2`,2) AS `f_arrotonda(c.costo_orario_standard2, 2)` from ((`tempus_innodb`.`tt_lista_personale_master` `a` join `tempus_innodb`.`tt_lista_personale_detail` `b` on((`a`.`PK_PROGRESSIVO` = `b`.`FK_MASTER`))) left join `tempus_innodb`.`tt_anag_personale_costi` `c` on(((`c`.`FK_ANAG` = `b`.`FK_ANAG`) and (`c`.`ANNO` between extract(year from `a`.`DATA_IN`) and extract(year from `a`.`DATA_FI`)))))' FUNCTION tempus_innodb.f_arrotonda does not exist. SQL Error: 1305 - Creating view tempus_innodb.view_importazioni_ferie Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_ferie` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_ferie`.`ANNO` AS `anno`,`tempus_innodb`.`tt_ferie`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_ferie`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_ferie`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_ferie`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_ferie` group by `tempus_innodb`.`tt_ferie`.`ANNO`,`tempus_innodb`.`tt_ferie`.`MESE` WARNING: Error executing ' CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_ferie` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_ferie`.`ANNO` AS `anno`,`tempus_innodb`.`tt_ferie`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_ferie`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_ferie`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_ferie`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_ferie` group by `tempus_innodb`.`tt_ferie`.`ANNO`,`tempus_innodb`.`tt_ferie`.`MESE`' FUNCTION tempus_innodb.F_CALCOLA100ESIMI does not exist. SQL Error: 1305 - Creating view tempus_innodb.view_importazioni_malattie Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_malattie` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_malattia`.`ANNO` AS `anno`,`tempus_innodb`.`tt_malattia`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_malattia`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_malattia`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_malattia`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_malattia` group by `tempus_innodb`.`tt_malattia`.`ANNO`,`tempus_innodb`.`tt_malattia`.`MESE` WARNING: Error executing ' CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_malattie` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_malattia`.`ANNO` AS `anno`,`tempus_innodb`.`tt_malattia`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_malattia`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_malattia`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_malattia`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_malattia` group by `tempus_innodb`.`tt_malattia`.`ANNO`,`tempus_innodb`.`tt_malattia`.`MESE`' FUNCTION tempus_innodb.F_CALCOLA100ESIMI does not exist. SQL Error: 1305 - Creating view tempus_innodb.view_importazioni_permessi Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_permessi` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_permessi`.`ANNO` AS `anno`,`tempus_innodb`.`tt_permessi`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_permessi`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_permessi`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_permessi`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_permessi` group by `tempus_innodb`.`tt_permessi`.`ANNO`,`tempus_innodb`.`tt_permessi`.`MESE` WARNING: Error executing ' CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_permessi` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_permessi`.`ANNO` AS `anno`,`tempus_innodb`.`tt_permessi`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_permessi`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_permessi`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_permessi`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_permessi` group by `tempus_innodb`.`tt_permessi`.`ANNO`,`tempus_innodb`.`tt_permessi`.`MESE`' FUNCTION tempus_innodb.F_CALCOLA100ESIMI does not exist. SQL Error: 1305 - Creating view tempus_innodb.view_importazioni_timbrature Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_timbrature` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_timbrature_storico`.`ANNO` AS `anno`,`tempus_innodb`.`tt_timbrature_storico`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_timbrature_storico`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_timbrature_storico`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_timbrature_storico`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_timbrature_storico` group by `tempus_innodb`.`tt_timbrature_storico`.`ANNO`,`tempus_innodb`.`tt_timbrature_storico`.`MESE` WARNING: Error executing ' CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_importazioni_timbrature` (`ANNO`,`MESE`,`TOTALE_100`,`TOTALE_60`,`TOTALE_GG`) AS select `tempus_innodb`.`tt_timbrature_storico`.`ANNO` AS `anno`,`tempus_innodb`.`tt_timbrature_storico`.`MESE` AS `mese`,round(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_timbrature_storico`.`TOTALE_MESE`)),2) AS `TOTALE_100`,round(`F_CALCOLA60ESIMI`(`F_CALCOLA100ESIMI`(sum(`tempus_innodb`.`tt_timbrature_storico`.`TOTALE_MESE`))),2) AS `TOTALE_60`,round((sum(`tempus_innodb`.`tt_timbrature_storico`.`TOTALE_MESE`) / 24),1) AS `TOTALE_GG` from `tempus_innodb`.`tt_timbrature_storico` group by `tempus_innodb`.`tt_timbrature_storico`.`ANNO`,`tempus_innodb`.`tt_timbrature_storico`.`MESE`' FUNCTION tempus_innodb.F_CALCOLA100ESIMI does not exist. SQL Error: 1305 - Creating view tempus_innodb.view_messaggi Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_messaggi` (`NOMINATIVO_DA`,`NOMINATIVO_A`,`DATA_INVIO`,`DATA_VISUALIZZAZIONE`,`DATA_LETTURA`,`MESSAGGIO_RICEVUTO`,`RISPOSTA`,`PK_UTENTE`,`K_DA_UTENTE`,`K_A_UTENTE`,`PK_NC`,`K_TIPO_PRATICA`,`ANNO`,`PROGRESSIVO`,`DATA_OP`,`DESCRIZIONE_ATTIVITA`,`PK_MESSAGGIO`,`ARCHIVIATO`,`NC_DA_FIRMARE`,`RISPOSTA_SI_NO`,`TAB_DI_GENERAZIONE`) AS select concat(concat(`b`.`COGNOME_UTENTE`,' '),`b`.`NOME_UTENTE`) AS `NOMINATIVO_DA`,concat(concat(`c`.`COGNOME_UTENTE`,' '),`c`.`NOME_UTENTE`) AS `NOMINATIVO_A`,`a`.`DATA_INVIO` AS `data_invio`,`a`.`DATA_VISUALIZZAZIONE` AS `data_visualizzazione`,`a`.`DATA_LETTURA` AS `data_lettura`,`a`.`MESS_TEXT_IN` AS `mess_text_in`,`a`.`MESS_TEXT_OUT` AS `mess_text_out`,`a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`K_DA_UTENTE` AS `k_da_utente`,`a`.`K_A_UTENTE` AS `k_a_utente`,0 AS `PK_NC`,0 AS `K_TIPO_PRATICA`,0 AS `ANNO`,0 AS `PROGRESSIVO`,curdate() AS `DATA_OP`,'' AS `DESCRIZIONE_ATTIVITA`,`a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`FLAG_ARCHIVIATO` AS `flag_archiviato`,`a`.`NC_DA_FIRMARE` AS `nc_da_firmare`,`a`.`FLAG_RISPOSTA` AS `flag_risposta`,`a`.`TAB_DI_GENERAZIONE` AS `TAB_DI_GENERAZIONE` from ((`tempus_innodb`.`sys_utenti` `b` join `tempus_innodb`.`sys_utenti` `c`) join `tempus_innodb`.`nc_messaggi` `a`) where ((`a`.`K_DA_UTENTE` = `b`.`PK_PROGRESSIVO`) and (`a`.`K_A_UTENTE` = `c`.`PK_PROGRESSIVO`)) - Creating view tempus_innodb.view_params_elab_detail Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_params_elab_detail` (`DATO_MASTER`,`PK_PROGRESSIVO`,`ANNO`,`FK_AZIONE_SOTTOLIVELLI`,`SAL`,`FLAG_ELABORATO`,`FLAG_ABORTITO`,`IMPORTO_ELABORATO`,`COEFFICIENTE`,`DATA_ELABORAZIONE`,`DATA_IN`,`DATA_FI`,`PERC_CTRL_ORE`,`IMPORTO_CALCOLATO`,`TOT_ORE_CALCOLATE`,`SAL_STAMPA`,`FLAG_STAMPATO`,`FLAG_INVIATO`) AS select concat(concat(concat(concat(concat(concat(concat(concat(concat('Elaborazione N.: ',`a`.`PK_PROGRESSIVO`),' Del S.A.L. : '),`a`.`SAL`),' Del :'),extract(day from `a`.`DATA_ELABORAZIONE`)),'/'),extract(month from `a`.`DATA_ELABORAZIONE`)),'/'),extract(year from `a`.`DATA_ELABORAZIONE`)) AS `DATO_MASTER`,`a`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`a`.`ANNO` AS `ANNO`,`a`.`FK_AZIONE_SOTTOLIVELLI` AS `FK_AZIONE_SOTTOLIVELLI`,`a`.`SAL` AS `SAL`,`a`.`FLAG_ELABORATO` AS `FLAG_ELABORATO`,`a`.`FLAG_ABORTITO` AS `FLAG_ABORTITO`,`a`.`IMPORTO_ELABORATO` AS `IMPORTO_ELABORATO`,`a`.`COEFFICIENTE` AS `COEFFICIENTE`,`a`.`DATA_ELABORAZIONE` AS `DATA_ELABORAZIONE`,`a`.`DATA_IN` AS `DATA_IN`,`a`.`DATA_FI` AS `DATA_FI`,`a`.`PERC_CTRL_ORE` AS `PERC_CTRL_ORE`,`a`.`IMPORTO_CALCOLATO` AS `IMPORTO_CALCOLATO`,`a`.`TOT_ORE_CALCOLATE` AS `TOT_ORE_CALCOLATE`,`a`.`SAL_STAMPA` AS `SAL_STAMPA`,`a`.`FLAG_STAMPATO` AS `FLAG_STAMPATO`,`a`.`FLAG_INVIATO` AS `FLAG_INVIATO` from `tempus_innodb`.`ts_parametri_elaborazione` `a` - Creating view tempus_innodb.view_presenze_pers_ods Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_presenze_pers_ods` (`FK_ODS`,`FK_ANAG`,`FLAG_SOSPESO`,`ANNO_PRESENZA`,`ANNO_IN`,`ANNO_FI`,`TOT_MESI`,`MESE_MIN`,`MESE_MAX`) AS select `b`.`FK_MASTER` AS `FK_MASTER`,`b`.`FK_ANAG` AS `FK_ANAG`,`b`.`FLAG_SOSPESO` AS `FLAG_SOSPESO`,`c`.`ANNO` AS `anno`,extract(year from `a`.`DATA_IN`) AS `anno_in`,extract(year from `a`.`DATA_FI`) AS `anno_fi`,count(`c`.`MESE`) AS `COUNT(C.MESE)`,min(`c`.`MESE`) AS `MIN(C.MESE)`,max(`c`.`MESE`) AS `MAX(C.MESE)` from ((`tempus_innodb`.`tt_lista_personale_master` `a` join `tempus_innodb`.`tt_lista_personale_detail` `b` on((`a`.`PK_PROGRESSIVO` = `b`.`FK_MASTER`))) left join `tempus_innodb`.`tt_timbrature` `c` on(((`c`.`FK_ANAG` = `b`.`FK_ANAG`) and (`c`.`ANNO` between extract(year from `a`.`DATA_IN`) and extract(year from `a`.`DATA_FI`))))) group by `b`.`FK_MASTER`,`b`.`FK_ANAG`,`b`.`FLAG_SOSPESO`,`c`.`ANNO`,extract(year from `a`.`DATA_IN`),extract(year from `a`.`DATA_FI`) - Creating view tempus_innodb.view_struttura_organico Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_struttura_organico` (`MS_PK_PROGRESSIVO`,`MS_DESCRIZIONE`,`UOC_PK_PROGRESSIVO`,`UOC_FK_MSTRUTTURE`,`UOC_DESCRIZIONE`,`UOC_CERCA_DIP`,`UOS_PK_PROGRESSIVO`,`UOS_FK_UOC`,`UOS_DESCRIZIONE`,`UOS_CERCA_DIP`) AS select `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`DESCRIZIONE` AS `DESCRIZIONE`,`b`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`b`.`FK_MSTRUTTURE` AS `fk_mstrutture`,`b`.`DESCRIZIONE` AS `DESCRIZIONE`,`b`.`FLAG_CERCA_DIP` AS `flag_cerca_dip`,`c`.`PK_PROGRESSIVO` AS `PK_PROGRESSIVO`,`c`.`FK_UOC` AS `fk_uoc`,`c`.`DESCRIZIONE` AS `DESCRIZIONE`,`c`.`FLAG_CERCA_DIP` AS `flag_cerca_dip` from ((`tempus_innodb`.`sys_master_struttura` `a` join `tempus_innodb`.`sys_uoc` `b`) join `tempus_innodb`.`sys_uos` `c`) where ((`a`.`PK_PROGRESSIVO` = `b`.`FK_MSTRUTTURE`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_UOC`)) order by `a`.`PK_PROGRESSIVO`,`b`.`FK_MSTRUTTURE`,`c`.`FK_UOC`,`c`.`PK_PROGRESSIVO` - Creating view tempus_innodb.view_struttura_per_cross_table_summary_all Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_struttura_per_cross_table_summary_all` (`FK_AZIONE`,`DESCRIZIONE_AZIONE`,`DESCRIZIONE_SOTTOLIVELLO`,`ETICHETTA_MISURA_STAMPA`,`FK_AZIONE_STRUTTURA`) AS select distinct `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`DESCRIZIONE` AS `descrizione`,`c`.`DESCRIZIONE` AS `descrizione`,`c`.`ETICHETTA_MISURA_STAMPA` AS `ETICHETTA_MISURA_STAMPA`,`d`.`PK_PROGRESSIVO` AS `pk_progressivo` from (((`tempus_innodb`.`ts_azione` `a` join `tempus_innodb`.`ts_azione_sottolivelli` `b`) join `tempus_innodb`.`ts_sottolivelli` `c`) join `tempus_innodb`.`ts_azione_struttura` `d`) where ((`a`.`PK_PROGRESSIVO` = `b`.`FK_AZIONE`) and (`b`.`FK_SOTTOLIVELLI` = `c`.`PK_PROGRESSIVO`) and (`d`.`FK_AZIONE_SOTTOLIVELLI` = `b`.`PK_PROGRESSIVO`)) - Creating view tempus_innodb.view_struttura_progetto_ods Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_struttura_progetto_ods` (`PK_MG`,`MACROGRUPPO`,`DESC_MG`,`PK_AZIONE`,`AZIONE`,`DESC_AZIONE`,`PK_AZSOT`,`PK_SOTTOLIV`,`COD_SOTTLIV`,`DESC_SOTTOLIV`,`FK_MASTER_ODS`) AS select distinct `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`MACROGRUPPO` AS `macrogruppo`,`a`.`DESCRIZIONE` AS `descrizione`,`b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`AZIONE` AS `azione`,`b`.`DESCRIZIONE` AS `descrizione`,`c`.`PK_PROGRESSIVO` AS `pk_progressivo`,`c`.`FK_SOTTOLIVELLI` AS `fk_sottolivelli`,`d`.`CODICE` AS `codice`,`d`.`DESCRIZIONE` AS `descrizione`,`e`.`FK_MASTER_ODS` AS `fk_master_ods` from ((((`tempus_innodb`.`ts_macrogruppo` `a` join `tempus_innodb`.`ts_azione` `b`) join `tempus_innodb`.`ts_azione_sottolivelli` `c`) join `tempus_innodb`.`ts_sottolivelli` `d`) join `tempus_innodb`.`ts_azione_struttura` `e`) where ((`b`.`FK_MACROGRUPPO` = `a`.`PK_PROGRESSIVO`) and (`c`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`d`.`PK_PROGRESSIVO` = `c`.`FK_SOTTOLIVELLI`) and (`e`.`FK_AZIONE` = `b`.`PK_PROGRESSIVO`) and (`e`.`FK_AZIONE_SOTTOLIVELLI` = `c`.`PK_PROGRESSIVO`)) order by `e`.`FK_MASTER_ODS` - Creating view tempus_innodb.view_timesheet_cross_table Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_timesheet_cross_table` (`PK_PROGRESSIVO`,`FK_AZIONE`,`FK_AZIONE_STRUTTURA`,`NSAL`,`FK_ANAG`,`NOMINATIVO`,`ANNO`,`MESE`,`TOTALE_MESE`,`TOTALE_ORE`,`COSTO_ORARIO`,`DESCRIZIONE_AZIONE`,`DESCRIZIONE_SOTTOLIVELLO`,`ETICHETTA_MISURA_STAMPA`,`DESCRIZIONE_MESE`) AS select `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`e`.`PK_PROGRESSIVO` AS `FK_AZIONE`,`a`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`a`.`NSAL` AS `nsal`,`a`.`FK_ANAG` AS `fk_anag`,`f`.`NOMINATIVO` AS `nominativo`,`a`.`ANNO` AS `anno`,`a`.`MESE` AS `mese`,`a`.`TOTALE_MESE` AS `totale_mese`,`a`.`TOTALE_ORE` AS `totale_ore`,`a`.`COSTO_ORARIO` AS `costo_orario`,`e`.`DESCRIZIONE` AS `DESCRIZIONE_AZIONE`,`d`.`DESCRIZIONE` AS `DESCRIZIONE_SOTTOLIVELLO`,`d`.`ETICHETTA_MISURA_STAMPA` AS `ETICHETTA_MISURA_STAMPA`,`g`.`NOME_MESE` AS `DESCRIZIONE_MESE` from ((((((`tempus_innodb`.`tt_timesheet_cross_table` `a` join `tempus_innodb`.`ts_azione_struttura` `b`) join `tempus_innodb`.`ts_azione_sottolivelli` `c`) join `tempus_innodb`.`ts_sottolivelli` `d`) join `tempus_innodb`.`ts_azione` `e`) join `tempus_innodb`.`tt_anag_personale` `f`) join `tempus_innodb`.`ts_calendario` `g`) where ((`a`.`FK_AZIONE_STRUTTURA` = `b`.`PK_PROGRESSIVO`) and (`b`.`FK_AZIONE_SOTTOLIVELLI` = `c`.`PK_PROGRESSIVO`) and (`c`.`FK_SOTTOLIVELLI` = `d`.`PK_PROGRESSIVO`) and (`c`.`FK_AZIONE` = `e`.`PK_PROGRESSIVO`) and (`a`.`FK_ANAG` = `f`.`PK_PROGRESSIVO`) and (`a`.`ANNO` = `g`.`ANNO`) and (`a`.`MESE` = `g`.`MM`)) - Creating view tempus_innodb.view_timesheet_cross_table_summary_all Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_timesheet_cross_table_summary_all` (`PK_PROGRESSIVO`,`FK_AZIONE`,`FK_AZIONE_STRUTTURA`,`NSAL`,`FK_ANAG`,`NOMINATIVO`,`ANNO`,`MESE`,`TOTALE_MESE`,`TOTALE_ORE`,`COSTO_ORARIO`,`DESCRIZIONE_AZIONE`,`DESCRIZIONE_SOTTOLIVELLO`,`ETICHETTA_MISURA_STAMPA`,`DESCRIZIONE_MESE`,`RIGA_STAMPA`,`ATTIVITA_STP`) AS select distinct `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`tempus_innodb`.`d`.`FK_AZIONE` AS `fk_azione`,`a`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`a`.`NSAL` AS `nsal`,`a`.`FK_ANAG` AS `fk_anag`,`b`.`NOMINATIVO` AS `nominativo`,`a`.`ANNO` AS `anno`,`a`.`MESE` AS `mese`,`a`.`TOTALE_MESE` AS `totale_mese`,`a`.`TOTALE_ORE` AS `totale_ore`,`a`.`COSTO_ORARIO` AS `costo_orario`,`tempus_innodb`.`d`.`DESCRIZIONE_AZIONE` AS `descrizione_azione`,`tempus_innodb`.`d`.`DESCRIZIONE_SOTTOLIVELLO` AS `descrizione_sottolivello`,`tempus_innodb`.`d`.`ETICHETTA_MISURA_STAMPA` AS `ETICHETTA_MISURA_STAMPA`,`c`.`NOME_MESE` AS `DESCRIZIONE_MESE`,`a`.`RIGA_STAMPA` AS `riga_stampa`,`a`.`ATTIVITA_STP` AS `attivita_stp` from (((`tempus_innodb`.`tt_timesheet_cross_table_summary_all` `a` left join `tempus_innodb`.`view_struttura_per_cross_table_summary_all` `d` on((`a`.`FK_AZIONE_STRUTTURA` = `tempus_innodb`.`d`.`FK_AZIONE_STRUTTURA`))) left join `tempus_innodb`.`tt_anag_personale` `b` on((`a`.`FK_ANAG` = `b`.`PK_PROGRESSIVO`))) left join `tempus_innodb`.`ts_calendario` `c` on(((`a`.`ANNO` = `c`.`ANNO`) and (`a`.`MESE` = `c`.`MM`)))) - Creating view tempus_innodb.view_timesheet_cross_table_totali Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_timesheet_cross_table_totali` (`FK_AZIONE_STRUTTURA`,`ETICHETTA_MISURA_STAMPA`,`FK_ANAG`,`ANNO`,`MESE`,`TOTALE_MESE`,`TOTALE_ORE`,`COSTO_ORARIO`) AS select `a`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`d`.`ETICHETTA_MISURA_STAMPA` AS `etichetta_misura_stampa`,`a`.`FK_ANAG` AS `fk_anag`,`a`.`ANNO` AS `anno`,`a`.`MESE` AS `mese`,sum(`a`.`TOTALE_MESE`) AS `totale_mese`,sum(`a`.`TOTALE_ORE`) AS `totale_ore`,avg(`a`.`COSTO_ORARIO`) AS `costo_orario` from (((`tempus_innodb`.`tt_timesheet` `a` join `tempus_innodb`.`ts_azione_struttura` `b`) join `tempus_innodb`.`ts_azione_sottolivelli` `c`) join `tempus_innodb`.`ts_sottolivelli` `d`) where ((`a`.`FK_AZIONE_STRUTTURA` = `b`.`PK_PROGRESSIVO`) and (`b`.`FK_AZIONE_SOTTOLIVELLI` = `c`.`PK_PROGRESSIVO`) and (`c`.`FK_SOTTOLIVELLI` = `d`.`PK_PROGRESSIVO`)) group by `a`.`FK_AZIONE_STRUTTURA`,`d`.`ETICHETTA_MISURA_STAMPA`,`a`.`FK_ANAG`,`a`.`ANNO`,`a`.`MESE` - Creating view tempus_innodb.view_timesheet_doc Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_timesheet_doc` (`PK_PROGRESSIVO`,`TIPO_DOCUMENTO`,`FK_TIMESHEET`,`FLAG_FIRMATO`,`DATA_FIRMA`,`ALLEGATO_ORIGINALE`,`ALLEGATO_FIRMATO`,`NOME_FILE`,`FK_AZIONE_STRUTTURA`,`ANNO`,`MESE`,`FK_ANAG`,`MATRICOLA`,`CODICE_FISCALE`,`NOMINATIVO`) AS select `a`.`PK_PROGRESSIVO` AS `pk_progressivo`,`a`.`TIPO_DOCUMENTO` AS `tipo_documento`,`a`.`FK_TIMESHEET` AS `fk_timesheet`,`a`.`FLAG_FIRMATO` AS `flag_firmato`,`a`.`DATA_FIRMA` AS `data_firma`,`a`.`ALLEGATO_BLR` AS `allegato_blr`,`a`.`ALLEGATO_BLR_FIRMATO` AS `allegato_blr_firmato`,`a`.`NOME_FILE` AS `nome_file`,`b`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`b`.`ANNO` AS `anno`,`b`.`MESE` AS `mese`,`c`.`PK_PROGRESSIVO` AS `FK_ANAG`,`c`.`MATRICOLA` AS `matricola`,`c`.`CODICE_FISCALE` AS `codice_fiscale`,`c`.`NOMINATIVO` AS `nominativo` from ((`tempus_innodb`.`tt_timesheet_doc` `a` join `tempus_innodb`.`tt_timesheet` `b`) join `tempus_innodb`.`tt_anag_personale` `c`) where ((`a`.`FK_TIMESHEET` = `b`.`PK_PROGRESSIVO`) and (`b`.`FK_ANAG` = `c`.`PK_PROGRESSIVO`)) - Creating view tempus_innodb.view_totale_allegati_ods Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totale_allegati_ods` (`FK_MASTER_ODS`,`TOTALE`) AS select `tempus_innodb`.`tt_ods_doc`.`FK_MASTER_ODS` AS `fk_master_ods`,(count(0) * 1) AS `count(*)` from `tempus_innodb`.`tt_ods_doc` group by `tempus_innodb`.`tt_ods_doc`.`FK_MASTER_ODS` - Creating view tempus_innodb.view_totali_azione Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totali_azione` (`FK_AZIONE`,`FK_ANAG`,`TOTALE_ORE`,`COSTO_ORARIO`,`TOTALE_COSTO`) AS select `a`.`FK_AZIONE` AS `fk_azione`,`a`.`FK_ANAG` AS `fk_anag`,sum(`a`.`TOTALE_ORE`) AS `totale_ore`,avg(`a`.`COSTO_ORARIO`) AS `costo_orario`,sum((`a`.`TOTALE_ORE` * `a`.`COSTO_ORARIO`)) AS `TOTALE_COSTO` from ((`tempus_innodb`.`tt_timesheet_somma_azione` `a` join `tempus_innodb`.`ts_azione_sottolivelli` `b`) join `tempus_innodb`.`ts_parametri_elaborazione` `c`) where ((`a`.`FK_AZIONE` = `b`.`FK_AZIONE`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_AZIONE_SOTTOLIVELLI`) and (`c`.`FLAG_ABORTITO` = 'N') and (`c`.`FLAG_ELABORATO` = 'S') and (`a`.`NSAL` = `c`.`SAL`)) group by `a`.`FK_AZIONE`,`a`.`FK_ANAG` - Creating view tempus_innodb.view_totali_azione_anno Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totali_azione_anno` (`FK_AZIONE`,`FK_ANAG`,`ANNO`,`TOTALE_ORE`,`COSTO_ORARIO`,`TOTALE_COSTO`) AS select `a`.`FK_AZIONE` AS `fk_azione`,`a`.`FK_ANAG` AS `fk_anag`,`a`.`ANNO` AS `anno`,sum(`a`.`TOTALE_ORE`) AS `TOTALE_ORE`,avg(`a`.`COSTO_ORARIO`) AS `COSTO_ORARIO`,sum((`a`.`TOTALE_ORE` * `a`.`COSTO_ORARIO`)) AS `TOTALE_COSTO` from ((`tempus_innodb`.`tt_timesheet_somma_azione` `a` join `tempus_innodb`.`ts_azione_sottolivelli` `b`) join `tempus_innodb`.`ts_parametri_elaborazione` `c`) where ((`a`.`FK_AZIONE` = `b`.`FK_AZIONE`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_AZIONE_SOTTOLIVELLI`) and (`c`.`FLAG_ABORTITO` = 'N') and (`c`.`FLAG_ELABORATO` = 'S') and (`a`.`NSAL` = `c`.`SAL`)) group by `a`.`FK_AZIONE`,`a`.`FK_ANAG`,`a`.`ANNO` - Creating view tempus_innodb.view_totali_generali Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totali_generali` (`FK_ANAG`,`TOTALE_ORE`,`COSTO_ORARIO`,`TOTALE_COSTO`) AS select `a`.`FK_ANAG` AS `fk_anag`,sum(`a`.`TOTALE_ORE`) AS `TOTALE_ORE`,avg(`a`.`COSTO_ORARIO`) AS `COSTO_ORARIO`,sum((`a`.`TOTALE_ORE` * `a`.`COSTO_ORARIO`)) AS `TOTALE_COSTO` from ((`tempus_innodb`.`tt_timesheet_somma_azione` `a` join `tempus_innodb`.`ts_azione_sottolivelli` `b`) join `tempus_innodb`.`ts_parametri_elaborazione` `c`) where ((`a`.`FK_AZIONE` = `b`.`FK_AZIONE`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_AZIONE_SOTTOLIVELLI`) and (`c`.`FLAG_ABORTITO` = 'N') and (`c`.`FLAG_ELABORATO` = 'S') and (`a`.`NSAL` = `c`.`SAL`)) group by `a`.`FK_ANAG` - Creating view tempus_innodb.view_totali_generali_anno Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totali_generali_anno` (`FK_ANAG`,`ANNO`,`TOTALE_ORE`,`COSTO_ORARIO`,`TOTALE_COSTO`) AS select `a`.`FK_ANAG` AS `fk_anag`,`a`.`ANNO` AS `anno`,sum(`a`.`TOTALE_ORE`) AS `TOTALE_ORE`,avg(`a`.`COSTO_ORARIO`) AS `COSTO_ORARIO`,sum((`a`.`TOTALE_ORE` * `a`.`COSTO_ORARIO`)) AS `TOTALE_COSTO` from ((`tempus_innodb`.`tt_timesheet_somma_azione` `a` join `tempus_innodb`.`ts_azione_sottolivelli` `b`) join `tempus_innodb`.`ts_parametri_elaborazione` `c`) where ((`a`.`FK_AZIONE` = `b`.`FK_AZIONE`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_AZIONE_SOTTOLIVELLI`) and (`c`.`FLAG_ABORTITO` = 'N') and (`c`.`FLAG_ELABORATO` = 'S') and (`a`.`NSAL` = `c`.`SAL`)) group by `a`.`FK_ANAG`,`a`.`ANNO` - Creating view tempus_innodb.view_totali_struttura Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totali_struttura` (`FK_AZIONE_STRUTTURA`,`FK_ANAG`,`TOTALE_MESE`,`TOTALE_ORE`,`COSTO_MEDIO`) AS select `tempus_innodb`.`tt_timesheet`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`tempus_innodb`.`tt_timesheet`.`FK_ANAG` AS `fk_anag`,sum(`tempus_innodb`.`tt_timesheet`.`TOTALE_MESE`) AS `TOTALE_MESE`,sum(`tempus_innodb`.`tt_timesheet`.`TOTALE_ORE`) AS `TOTALE_ORE`,avg(`tempus_innodb`.`tt_timesheet`.`COSTO_ORARIO`) AS `COSTO_MEDIO` from `tempus_innodb`.`tt_timesheet` group by `tempus_innodb`.`tt_timesheet`.`FK_AZIONE_STRUTTURA`,`tempus_innodb`.`tt_timesheet`.`FK_ANAG` - Creating view tempus_innodb.view_totali_struttura_anno Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_totali_struttura_anno` (`FK_AZIONE_STRUTTURA`,`FK_ANAG`,`ANNO`,`TOTALE_MESE`,`TOTALE_ORE`,`COSTO_MEDIO`) AS select `tempus_innodb`.`tt_timesheet`.`FK_AZIONE_STRUTTURA` AS `fk_azione_struttura`,`tempus_innodb`.`tt_timesheet`.`FK_ANAG` AS `fk_anag`,`tempus_innodb`.`tt_timesheet`.`ANNO` AS `anno`,sum(`tempus_innodb`.`tt_timesheet`.`TOTALE_MESE`) AS `TOTALE_MESE`,sum(`tempus_innodb`.`tt_timesheet`.`TOTALE_ORE`) AS `TOTALE_ORE`,avg(`tempus_innodb`.`tt_timesheet`.`COSTO_ORARIO`) AS `COSTO_MEDIO` from `tempus_innodb`.`tt_timesheet` group by `tempus_innodb`.`tt_timesheet`.`FK_AZIONE_STRUTTURA`,`tempus_innodb`.`tt_timesheet`.`FK_ANAG`,`tempus_innodb`.`tt_timesheet`.`ANNO` - Creating view tempus_innodb.view_user_online Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_user_online` (`PK_PROGRESSIVO`,`UTENTE`,`COGNOME_UTENTE`,`NOME_UTENTE`,`FLAG_REFERENTE_QUALITA`,`FLAG_DIRIGENTE`,`FLAG_RESPONSABILE`,`FLAG_AUDITOR`,`EMAIL`,`EMAIL_PEC`,`CELLULARE`,`TELEFONO_INTERNO`,`DATA_LOGIN`) AS select `b`.`PK_PROGRESSIVO` AS `pk_progressivo`,`b`.`UTENTE` AS `utente`,`b`.`COGNOME_UTENTE` AS `cognome_utente`,`b`.`NOME_UTENTE` AS `nome_utente`,`c`.`FLAG_REFQUAL` AS `FLAG_REFQUAL`,`c`.`FLAG_DIRIGENTE` AS `flag_dirigente`,`c`.`FLAG_RESPONSABILE` AS `flag_responsabile`,`c`.`FLAG_AUDITOR` AS `flag_auditor`,`b`.`EMAIL` AS `email`,`b`.`EMAIL_PEC` AS `email_pec`,`b`.`CELLULARE` AS `cellulare`,`b`.`TELEFONO_INTERNO` AS `telefono_interno`,`a`.`DATA_LOGIN` AS `data_login` from ((`tempus_innodb`.`sys_user_online` `a` join `tempus_innodb`.`sys_utenti` `b`) join `tempus_innodb`.`sys_config_utente` `c`) where ((`a`.`K_UTENTE` = `b`.`PK_PROGRESSIVO`) and (`b`.`PK_PROGRESSIVO` = `c`.`FK_UTENTE`) and (`a`.`DATA_LOGOUT` is null)) - Creating view tempus_innodb.view_zucchetti_fase_01_presenze Execute statement: USE `tempus_innodb` Execute statement: CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `tempus_innodb`.`view_zucchetti_fase_01_presenze` (`ANNO`,`MESE`,`CFISC`) AS select distinct `tempus_innodb`.`zucchetti_fase_01_presenze`.`ANNO` AS `anno`,`tempus_innodb`.`zucchetti_fase_01_presenze`.`MESE` AS `mese`,`tempus_innodb`.`zucchetti_fase_01_presenze`.`CFISC` AS `cfisc` from `tempus_innodb`.`zucchetti_fase_01_presenze` where `tempus_innodb`.`zucchetti_fase_01_presenze`.`CFISC` in (select `tempus_innodb`.`tt_anag_personale`.`CODICE_FISCALE` from `tempus_innodb`.`tt_anag_personale`) is false - Creating routine tempus_innodb.AGGIORNA_TOTALIZZATORI Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `AGGIORNA_TOTALIZZATORI`() BEGIN -- Pulizia delle tabelle: utilizzo di TRUNCATE per prestazioni migliori TRUNCATE TABLE TT_TIMESHEET_SOMMA_AZIONE; TRUNCATE TABLE TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE; TRUNCATE TABLE tt_timesheet_tmp_per_somme_azione; -- Inserimento nella tabella TT_TIMESHEET_SOMMA_AZIONE INSERT INTO TT_TIMESHEET_SOMMA_AZIONE SELECT DISTINCT 0 AS id, s.fk_azione, a.nsal, a.fk_anag, a.anno, a.mese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a.costo_orario, 0 AS valore_iniziale FROM tt_timesheet a JOIN ts_azione_struttura s ON s.pk_progressivo = a.fk_azione_struttura; -- Inserimento nella tabella TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE INSERT INTO TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE SELECT DISTINCT 0 AS id, s.fk_azione, a.fk_anag, a.anno, a.mese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a.costo_orario, 0 AS valore_iniziale FROM tt_timesheet a JOIN ts_azione_struttura s ON s.pk_progressivo = a.fk_azione_struttura; -- Inserimento nella tabella tt_timesheet_tmp_per_somme_azione INSERT INTO tt_timesheet_tmp_per_somme_azione SELECT * FROM tt_timesheet; END - Creating routine tempus_innodb.ALIMENTA_TIMESHEET_MANUALE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ALIMENTA_TIMESHEET_MANUALE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN XFK_AZIONE_STRUTTURA INTEGER, OUT ESEGUITO SMALLINT ) BEGIN declare conta_record smallint; set eseguito = 0; /* TODO controllare se giusto cancellare tutto */ delete from tt_timesheet_manuale where fk_anag = fk_anag; /* cancello tutto perchè in linea solo un mese alla volta altrimenti il pgm fa casino sulle etichette dei giorni mese where fk_anag = :fk_anag and anno = :anno and mese = :mese and fk_azione_struttura = :fk_azione_struttura; */ select count(*) into conta_record from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura; if (conta_record is null) then set conta_record = 0; end IF; if conta_record > 0 then select count(*) into conta_record from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura; if (conta_record is null) then set conta_record = 0; end IF; /* TODO le exception non arrivano sul client studiare se c'è la possibilita if (conta_record = 0) then exception no_dati_timesheet_manuali; */ /* controlla che TS non sia già stato firmato se firmato trova il rec in tt_timesheet_doc e quindi non puo modificare */ select count(*) into conta_record from tt_timesheet_doc where fk_timesheet = (select pk_progressivo from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura) and flag_firmato = 'S'; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then set eseguito = 1; end IF; if (conta_record = 0) then begin insert into tt_timesheet_manuale select 0, 'ore lavorate sul progetto', 1, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_ore, 'N' from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura; /* controlla sempre se i dettali ci sono altrimenti crea un rec a zero */ /* ferie */ select count(*) into conta_record from tt_ferie where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'ferie', 2, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from tt_ferie where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'ferie', 2, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; /* malattie */ select count(*) into conta_record from tt_malattia where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'malattie', 3, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from tt_malattia where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'malattie', 3, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; /* permessi */ select count(*) into conta_record from tt_permessi where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'permessi', 4, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from tt_permessi where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'permessi', 4, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; /* questa è una copia rivisitata di quella che viene usata in stampa */ call calcola_somma_altri_progetti_timesheet_manuale(fk_azione_struttura, fk_anag, anno, mese); /* permessi */ select count(*) into conta_record from tt_timesheet_tmp_somma_azioni_per_stp where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'altri progetti', 5, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_ore, 'N' from tt_timesheet_tmp_somma_azioni_per_stp where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'altri progetti', 5, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; insert into tt_timesheet_manuale select 0, 'totale progetti', 6, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_ore, 'N' from tt_timesheet_riepilogo where fk_anag = xfk_anag and anno = xanno and mese = xmese; insert into tt_timesheet_manuale select 0, 'attivita istituzionali', 7, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from TT_TIMBRATURE where fk_anag = xfk_anag and anno = xanno and mese = xmese; insert into tt_timesheet_manuale select 0, 'timbrature', 8, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from TT_TIMBRATURE_STORICO where fk_anag = xfk_anag and anno = xanno and mese = xmese; end; end IF; end if; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ALIMENTA_TIMESHEET_MANUALE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN XFK_AZIONE_STRUTTURA INTEGER, OUT ESEGUITO SMALLINT ) BEGIN declare conta_record smallint; set eseguito = 0; /* TODO controllare se giusto cancellare tutto */ delete from tt_timesheet_manuale where fk_anag = fk_anag; /* cancello tutto perchè in linea solo un mese alla volta altrimenti il pgm fa casino sulle etichette dei giorni mese where fk_anag = :fk_anag and anno = :anno and mese = :mese and fk_azione_struttura = :fk_azione_struttura; */ select count(*) into conta_record from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura; if (conta_record is null) then set conta_record = 0; end IF; if conta_record > 0 then select count(*) into conta_record from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura; if (conta_record is null) then set conta_record = 0; end IF; /* TODO le exception non arrivano sul client studiare se c'è la possibilita if (conta_record = 0) then exception no_dati_timesheet_manuali; */ /* controlla che TS non sia già stato firmato se firmato trova il rec in tt_timesheet_doc e quindi non puo modificare */ select count(*) into conta_record from tt_timesheet_doc where fk_timesheet = (select pk_progressivo from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura) and flag_firmato = 'S'; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then set eseguito = 1; end IF; if (conta_record = 0) then begin insert into tt_timesheet_manuale select 0, 'ore lavorate sul progetto', 1, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_ore, 'N' from tt_timesheet where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura; /* controlla sempre se i dettali ci sono altrimenti crea un rec a zero */ /* ferie */ select count(*) into conta_record from tt_ferie where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'ferie', 2, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from tt_ferie where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'ferie', 2, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; /* malattie */ select count(*) into conta_record from tt_malattia where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'malattie', 3, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from tt_malattia where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'malattie', 3, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; /* permessi */ select count(*) into conta_record from tt_permessi where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'permessi', 4, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from tt_permessi where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'permessi', 4, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; /* questa è una copia rivisitata di quella che viene usata in stampa */ call calcola_somma_altri_progetti_timesheet_manuale(fk_azione_struttura, fk_anag, anno, mese); /* permessi */ select count(*) into conta_record from tt_timesheet_tmp_somma_azioni_per_stp where fk_anag = xfk_anag and anno = xanno and mese = xmese; if (conta_record is null) then set conta_record = 0; end IF; if (conta_record > 0) then insert into tt_timesheet_manuale select 0, 'altri progetti', 5, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_ore, 'N' from tt_timesheet_tmp_somma_azioni_per_stp where fk_anag = xfk_anag and anno = xanno and mese = xmese; else insert into tt_timesheet_manuale values (0, 'altri progetti', 5, xfk_azione_struttura, xfk_anag, xanno, xmese, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N'); end IF; insert into tt_timesheet_manuale select 0, 'totale progetti', 6, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_ore, 'N' from tt_timesheet_riepilogo where fk_anag = xfk_anag and anno = xanno and mese = xmese; insert into tt_timesheet_manuale select 0, 'attivita istituzionali', 7, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from TT_TIMBRATURE where fk_anag = xfk_anag and anno = xanno and mese = xmese; insert into tt_timesheet_manuale select 0, 'timbrature', 8, xfk_azione_struttura, xfk_anag, xanno, xmese, ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31, totale_mese, 'N' from TT_TIMBRATURE_STORICO where fk_anag = xfk_anag and anno = xanno and mese = xmese; end; end IF; end if; END$$ ' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 241. SQL Error: 1064 - Creating routine tempus_innodb.ASSESTA_TOTALI_PARAM_ELAB Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ASSESTA_TOTALI_PARAM_ELAB`() BEGIN declare xanno SMALLINT; declare xsal SMALLINT; declare xfk_azione_sottolivelli INTEGER; declare xfk_azione INTEGER; declare xfk_sottolivelli INTEGER; declare tot_ore double precision; declare tot_costo DOUBLE PRECISION; declare xpk_progressivo integer; declare intermedio_ore double precision; declare intermedio_costo double precision; declare done bool default false; /* legge i params come puntatore */ declare cursor_params cursor for select pk_progressivo, fk_azione_sottolivelli, sal from TS_PARAMETRI_ELABORAZIONE where flag_elaborato = 'S' and flag_abortito = 'N'; /* legge tutti i tm interessati dal rec params */ /* totale_ore di tm è gia calcolato con la function per sommare i minuti */ declare cursor_timesheet cursor for select totale_ore, costo_orario from tt_timesheet where fk_azione_struttura in (select c.pk_progressivo from ts_azione_struttura c where c.fk_azione_sottolivelli = xfk_azione_sottolivelli) and nsal = xsal; declare continue handler for not found set done = true; /* azzera i totalizzatori delle ore e del costo dai params di elaborazione */ update ts_parametri_elaborazione set importo_calcolato = 0, tot_ore_calcolate = 0; open cursor_params; read_loop1 : loop fetch cursor_params into xpk_progressivo, xfk_azione_sottolivelli, xsal; if done then leave read_loop1; end if; open cursor_timesheet; read_loop2 : loop fetch cursor_timesheet into intermedio_ore, intermedio_costo; if done then leave read_loop2; end if; if (intermedio_ore is null) then set intermedio_ore = 0; end IF; if (intermedio_costo is null) then set intermedio_costo = 0; end IF; update ts_parametri_elaborazione set tot_ore_calcolate = f_corregge_60min(f_somma60esimi(tot_ore_calcolate, intermedio_ore)), importo_calcolato = importo_calcolato + (intermedio_costo * intermedio_ore) where pk_progressivo = xpk_progressivo; end loop; close cursor_timesheet; set done = false; end loop; close cursor_params; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ASSESTA_TOTALI_PARAM_ELAB`() BEGIN declare xanno SMALLINT; declare xsal SMALLINT; declare xfk_azione_sottolivelli INTEGER; declare xfk_azione INTEGER; declare xfk_sottolivelli INTEGER; declare tot_ore double precision; declare tot_costo DOUBLE PRECISION; declare xpk_progressivo integer; declare intermedio_ore double precision; declare intermedio_costo double precision; declare done bool default false; /* legge i params come puntatore */ declare cursor_params cursor for select pk_progressivo, fk_azione_sottolivelli, sal from TS_PARAMETRI_ELABORAZIONE where flag_elaborato = 'S' and flag_abortito = 'N'; /* legge tutti i tm interessati dal rec params */ /* totale_ore di tm è gia calcolato con la function per sommare i minuti */ declare cursor_timesheet cursor for select totale_ore, costo_orario from tt_timesheet where fk_azione_struttura in (select c.pk_progressivo from ts_azione_struttura c where c.fk_azione_sottolivelli = xfk_azione_sottolivelli) and nsal = xsal; declare continue handler for not found set done = true; /* azzera i totalizzatori delle ore e del costo dai params di elaborazione */ update ts_parametri_elaborazione set importo_calcolato = 0, tot_ore_calcolate = 0; open cursor_params; read_loop1 : loop fetch cursor_params into xpk_progressivo, xfk_azione_sottolivelli, xsal; if done then leave read_loop1; end if; open cursor_timesheet; read_loop2 : loop fetch cursor_timesheet into intermedio_ore, intermedio_costo; if done then leave read_loop2; end if; if (intermedio_ore is null) then set intermedio_ore = 0; end IF; if (intermedio_costo is null) then set intermedio_costo = 0; end IF; update ts_parametri_elaborazione set tot_ore_calcolate = f_corregge_60min(f_somma60esimi(tot_ore_calcolate, intermedio_ore)), importo_calcolato = importo_calcolato + (intermedio_costo * intermedio_ore) where pk_progressivo = xpk_progressivo; end loop; close cursor_timesheet; set done = false; end loop; close cursor_params; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 71. SQL Error: 1064 - Creating routine tempus_innodb.CALCOLA_SOMMA_ALTRI_PROGETTI_TIMESHEET_MANUALE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `CALCOLA_SOMMA_ALTRI_PROGETTI_TIMESHEET_MANUALE`( IN XFK_AZSTR INTEGER, IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT ) BEGIN declare xintermedio_ore double precision; declare xore_giorno_1 double precision; declare xore_giorno_2 double precision; declare xore_giorno_3 double precision; declare xore_giorno_4 double precision; declare xore_giorno_5 double precision; declare xore_giorno_6 double precision; declare xore_giorno_7 double precision; declare xore_giorno_8 double precision; declare xore_giorno_9 double precision; declare xore_giorno_10 double precision; declare xore_giorno_11 double precision; declare xore_giorno_12 double precision; declare xore_giorno_13 double precision; declare xore_giorno_14 double precision; declare xore_giorno_15 double precision; declare xore_giorno_16 double precision; declare xore_giorno_17 double precision; declare xore_giorno_18 double precision; declare xore_giorno_19 double precision; declare xore_giorno_20 double precision; declare xore_giorno_21 double precision; declare xore_giorno_22 double precision; declare xore_giorno_23 double precision; declare xore_giorno_24 double precision; declare xore_giorno_25 double precision; declare xore_giorno_26 double precision; declare xore_giorno_27 double precision; declare xore_giorno_28 double precision; declare xore_giorno_29 double precision; declare xore_giorno_30 double precision; declare xore_giorno_31 double precision; declare xore_float float; declare done bool default false; declare cursor_timesheet cursor for select ore_giorno_1,ore_giorno_2,ore_giorno_3,ore_giorno_4,ore_giorno_5,ore_giorno_6,ore_giorno_7,ore_giorno_8,ore_giorno_9,ore_giorno_10, ore_giorno_11,ore_giorno_12,ore_giorno_13,ore_giorno_14,ore_giorno_15,ore_giorno_16,ore_giorno_17,ore_giorno_18,ore_giorno_19,ore_giorno_20,ore_giorno_21,ore_giorno_22,ore_giorno_23, ore_giorno_24,ore_giorno_25,ore_giorno_26,ore_giorno_27,ore_giorno_28,ore_giorno_29,ore_giorno_30,ore_giorno_31 from tt_timesheet a where anno = xanno and mese = xmese and fk_anag = xfk_anag /* somma tutti i progetti diversi da quello in elaborazione */ /* fondamentale */ and fk_azione_struttura <> xfk_azstr; declare continue handler for not found set done = true; open cursor_timesheet; read_loop : loop fetch cursor_timesheet into xore_giorno_1, xore_giorno_2, xore_giorno_3, xore_giorno_4, xore_giorno_5, xore_giorno_6, xore_giorno_7, xore_giorno_8, xore_giorno_9, xore_giorno_10, xore_giorno_11, xore_giorno_12, xore_giorno_13, xore_giorno_14, xore_giorno_15, xore_giorno_16, xore_giorno_17, xore_giorno_18, xore_giorno_19, xore_giorno_20, xore_giorno_21, xore_giorno_22, xore_giorno_23, xore_giorno_24, xore_giorno_25, xore_giorno_26, xore_giorno_27, xore_giorno_28, xore_giorno_29, xore_giorno_30, xore_giorno_31; if done then leave read_loop; end if; update tt_timesheet_tmp_somma_azioni_per_stp set ore_giorno_1 = f_somma60esimi(xore_giorno_1, ore_giorno_1), ore_giorno_2 = f_somma60esimi(xore_giorno_2, ore_giorno_2), ore_giorno_3 = f_somma60esimi(xore_giorno_3, ore_giorno_3), ore_giorno_4 = f_somma60esimi(xore_giorno_4, ore_giorno_4), ore_giorno_5 = f_somma60esimi(xore_giorno_5, ore_giorno_5), ore_giorno_6 = f_somma60esimi(xore_giorno_6, ore_giorno_6), ore_giorno_7 = f_somma60esimi(xore_giorno_7, ore_giorno_7), ore_giorno_8 = f_somma60esimi(xore_giorno_8, ore_giorno_8), ore_giorno_9 = f_somma60esimi(xore_giorno_9, ore_giorno_9), ore_giorno_10 = f_somma60esimi(xore_giorno_10, ore_giorno_10), ore_giorno_11 = f_somma60esimi(xore_giorno_11, ore_giorno_11), ore_giorno_12 = f_somma60esimi(xore_giorno_12, ore_giorno_12), ore_giorno_13 = f_somma60esimi(xore_giorno_13, ore_giorno_13), ore_giorno_14 = f_somma60esimi(xore_giorno_14, ore_giorno_14), ore_giorno_15 = f_somma60esimi(xore_giorno_15, ore_giorno_15), ore_giorno_16 = f_somma60esimi(xore_giorno_16, ore_giorno_16), ore_giorno_17 = f_somma60esimi(xore_giorno_17, ore_giorno_17), ore_giorno_18 = f_somma60esimi(xore_giorno_18, ore_giorno_18), ore_giorno_19 = f_somma60esimi(xore_giorno_19, ore_giorno_19), ore_giorno_20 = f_somma60esimi(xore_giorno_20, ore_giorno_20), ore_giorno_21 = f_somma60esimi(xore_giorno_21, ore_giorno_21), ore_giorno_22 = f_somma60esimi(xore_giorno_22, ore_giorno_22), ore_giorno_23 = f_somma60esimi(xore_giorno_23, ore_giorno_23), ore_giorno_24 = f_somma60esimi(xore_giorno_24, ore_giorno_24), ore_giorno_25 = f_somma60esimi(xore_giorno_25, ore_giorno_25), ore_giorno_26 = f_somma60esimi(xore_giorno_26, ore_giorno_26), ore_giorno_27 = f_somma60esimi(xore_giorno_27, ore_giorno_27), ore_giorno_28 = f_somma60esimi(xore_giorno_28, ore_giorno_28), ore_giorno_29 = f_somma60esimi(xore_giorno_29, ore_giorno_29), ore_giorno_30 = f_somma60esimi(xore_giorno_30, ore_giorno_30), ore_giorno_31 = f_somma60esimi(xore_giorno_31, ore_giorno_31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end loop; close cursor_timesheet; END - Creating routine tempus_innodb.CREA_CALENDARIO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `CREA_CALENDARIO`(aa SMALLINT) BEGIN DECLARE mm SMALLINT; DECLARE gg SMALLINT; DECLARE gg_fine SMALLINT; DECLARE data_in DATE; DECLARE data_fi DATE; DECLARE nome_mese CHAR(30); DECLARE numero_giorno SMALLINT; DECLARE nome_giorno VARCHAR(10); SET mm = 0; WHILE (mm < 12) DO SET mm = mm + 1; SET gg = 1; -- Primo del mese attuale usando STR_TO_DATE SET data_in = STR_TO_DATE(CONCAT(mm, '/', gg, '/', aa), '%m/%d/%Y'); -- Primo del mese successivo IF (mm < 12) THEN SET data_fi = STR_TO_DATE(CONCAT(mm + 1, '/', gg, '/', aa), '%m/%d/%Y'); -- Ultimo giorno del mese attuale SET gg_fine = EXTRACT(DAY FROM data_fi - 1); ELSE SET gg_fine = 31; END IF; -- Data fine mese attuale usando STR_TO_DATE SET data_fi = STR_TO_DATE(CONCAT(mm, '/', gg_fine, '/', aa), '%m/%d/%Y'); -- Nome mese usando CASE SET nome_mese = CASE mm WHEN 1 THEN 'Gennaio' WHEN 2 THEN 'Febbraio' WHEN 3 THEN 'Marzo' WHEN 4 THEN 'Aprile' WHEN 5 THEN 'Maggio' WHEN 6 THEN 'Giugno' WHEN 7 THEN 'Luglio' WHEN 8 THEN 'Agosto' WHEN 9 THEN 'Settembre' WHEN 10 THEN 'Ottobre' WHEN 11 THEN 'Novembre' WHEN 12 THEN 'Dicembre' ELSE 'Unknown' END; -- Giorno della settimana usando CASE SET numero_giorno = WEEKDAY(data_in); SET nome_giorno = CASE numero_giorno WHEN 0 THEN 'Lun' WHEN 1 THEN 'Mar' WHEN 2 THEN 'Mer' WHEN 3 THEN 'Gio' WHEN 4 THEN 'Ven' WHEN 5 THEN 'Sab' WHEN 6 THEN 'Dom' ELSE 'Unknown' END; -- Inserimento nel calendario INSERT INTO ts_calendario VALUES (aa, mm, 1, gg_fine, data_in, data_fi, UPPER(nome_mese), nome_giorno, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); END WHILE; END - Creating routine tempus_innodb.DUPLICA_ODS Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `DUPLICA_ODS`(IN XPK_PROGRESSIVO INTEGER) BEGIN declare pk_progressivo_new integer; insert into TT_LISTA_PERSONALE_MASTER select 0, fk_anag, now(), concat('Duplicato ODS N. ', pk_progressivo), flag_amministrativi, flag_sospeso, data_in, data_fi, 0, now() from TT_LISTA_PERSONALE_MASTER where pk_progressivo = xpk_progressivo; set pk_progressivo_new = last_insert_id(); insert into TT_LISTA_PERSONALE_DETAIL select 0, pk_progressivo_new, fk_anag, flag_sospeso from TT_LISTA_PERSONALE_DETAIL where fk_master = xpk_progressivo; END - Creating routine tempus_innodb.ELABORAZIONE_00_PARAMS_CALCOLO_AZIONE_SAL Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_00_PARAMS_CALCOLO_AZIONE_SAL`( IN XANNO SMALLINT, IN XAZIONE INTEGER, IN XSOTTOLIVELLI INTEGER, IN XSAL SMALLINT ) BEGIN /* utilizza sal_frazione_mesi in questo modo è più preciso nei conti se le date non sono inizio fine mese */ DECLARE ximporto_calc DOUBLE PRECISION; DECLARE xtempo_calc DOUBLE PRECISION; DECLARE xcoefficiente DOUBLE PRECISION; DECLARE xfk_azione_struttura INTEGER; DECLARE xfk_anag INTEGER; DECLARE xdurata_sal FLOAT; DECLARE xmonte_ore SMALLINT; DECLARE xpeso DOUBLE PRECISION; DECLARE xpeso_standard1 DOUBLE PRECISION; DECLARE xpeso_standard2 DOUBLE PRECISION; DECLARE xtipo_costo_standard SMALLINT; DECLARE xfk_azione_sottolivelli INTEGER; DECLARE xanno2 SMALLINT; DECLARE xazione2 SMALLINT; DECLARE xanno3 SMALLINT; DECLARE xazione3 SMALLINT; DECLARE total_cost_arrotondato DOUBLE PRECISION; DECLARE total_cost_standard_arrotondato DOUBLE PRECISION; DECLARE total_cost_standard_arrotondato2 DOUBLE PRECISION; DECLARE done BOOL DEFAULT FALSE; DECLARE cursor_pesi CURSOR FOR SELECT ROUND(ROUND(((100 - a.costo_orario) * 100 / (SELECT ROUND(SUM(100 - c.costo_orario), 2) FROM view_analisi_pesi c WHERE anno = xanno2 AND fk_azione = xazione2)), 6) * a.importo_dip / 100, 0) AS importo, ROUND(ROUND(((100 - a.costo_orario) * 100 / (SELECT ROUND(SUM(100 - d.costo_orario), 2) FROM view_analisi_pesi d WHERE anno = xanno3 AND fk_azione = xazione3)), 6) * a.sal_mesi / 100, 2) AS tempo, fk_azione_struttura, coeff_correzione_ore, sal_frazione_mesi, monte_ore, fk_anag FROM view_analisi_pesi a WHERE anno = xanno AND fk_azione = xazione AND fk_azione_sottolivelli = xfk_azione_sottolivelli AND numero_sal = XSAL; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; SET xazione2 = xazione; SET xanno2 = xanno; SET xazione3 = xazione; SET xanno3 = xanno; -- Ottimizzazione: calcolo dei totali una sola volta SELECT ROUND(SUM(100 - b.costo_orario_arrotondato), 2), ROUND(SUM(100 - b.costo_orario_standard_arrotondato), 2), ROUND(SUM(100 - b.costo_orario_standard_arrotondato2), 2) INTO total_cost_arrotondato, total_cost_standard_arrotondato, total_cost_standard_arrotondato2 FROM tt_anag_personale_costi b WHERE anno = xanno AND fk_anag IN ( SELECT DISTINCT fk_anag_progetto FROM ts_azione_struttura WHERE fk_azione = xazione ); SELECT DISTINCT costo_standard_1_2_zero_per_no INTO xtipo_costo_standard FROM ts_azione WHERE pk_progressivo = xazione; SELECT pk_progressivo INTO xfk_azione_sottolivelli FROM ts_azione_sottolivelli WHERE fk_azione = xazione AND fk_sottolivelli = xsottolivelli; OPEN cursor_pesi; read_loop: LOOP FETCH cursor_pesi INTO ximporto_calc, xtempo_calc, xfk_azione_struttura, xcoefficiente, xdurata_sal, xmonte_ore, xfk_anag; IF done THEN LEAVE read_loop; END IF; -- Calcolo dei pesi SELECT ROUND((100 - a.costo_orario_arrotondato) * 100 / total_cost_arrotondato, 6), ROUND((100 - a.costo_orario_standard_arrotondato) * 100 / total_cost_standard_arrotondato, 6), ROUND((100 - a.costo_orario_standard_arrotondato2) * 100 / total_cost_standard_arrotondato2, 6) INTO xpeso, xpeso_standard1, xpeso_standard2 FROM tt_anag_personale_costi a WHERE fk_anag = xfk_anag AND anno = xanno; -- Gestione dei NULL SET xpeso = COALESCE(xpeso, 0); SET xpeso_standard1 = COALESCE(xpeso_standard1, 0); SET xpeso_standard2 = COALESCE(xpeso_standard2, 0); -- Configurazione del costo standard IF xtipo_costo_standard = 1 THEN SET xpeso = xpeso_standard1; ELSEIF xtipo_costo_standard = 2 THEN SET xpeso = xpeso_standard2; END IF; -- Aggiornamento dei parametri di calcolo UPDATE ts_azione_parametri_calcolo SET mesi_uomo_dip = xtempo_calc * xcoefficiente, importo_dip = ROUND(ximporto_calc, 2), durata_in_mesi = xdurata_sal, ore_progetto_dip = (xtempo_calc * xcoefficiente) * xmonte_ore, ore_base_calcolo_dip = xmonte_ore, peso = xpeso WHERE anno = xanno AND fk_azione_struttura = xfk_azione_struttura AND numero_sal = xsal; END LOOP; CLOSE cursor_pesi; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_00_PARAMS_CALCOLO_AZIONE_SAL`( IN XANNO SMALLINT, IN XAZIONE INTEGER, IN XSOTTOLIVELLI INTEGER, IN XSAL SMALLINT ) BEGIN /* utilizza sal_frazione_mesi in questo modo è più preciso nei conti se le date non sono inizio fine mese */ DECLARE ximporto_calc DOUBLE PRECISION; DECLARE xtempo_calc DOUBLE PRECISION; DECLARE xcoefficiente DOUBLE PRECISION; DECLARE xfk_azione_struttura INTEGER; DECLARE xfk_anag INTEGER; DECLARE xdurata_sal FLOAT; DECLARE xmonte_ore SMALLINT; DECLARE xpeso DOUBLE PRECISION; DECLARE xpeso_standard1 DOUBLE PRECISION; DECLARE xpeso_standard2 DOUBLE PRECISION; DECLARE xtipo_costo_standard SMALLINT; DECLARE xfk_azione_sottolivelli INTEGER; DECLARE xanno2 SMALLINT; DECLARE xazione2 SMALLINT; DECLARE xanno3 SMALLINT; DECLARE xazione3 SMALLINT; DECLARE total_cost_arrotondato DOUBLE PRECISION; DECLARE total_cost_standard_arrotondato DOUBLE PRECISION; DECLARE total_cost_standard_arrotondato2 DOUBLE PRECISION; DECLARE done BOOL DEFAULT FALSE; DECLARE cursor_pesi CURSOR FOR SELECT ROUND(ROUND(((100 - a.costo_orario) * 100 / (SELECT ROUND(SUM(100 - c.costo_orario), 2) FROM view_analisi_pesi c WHERE anno = xanno2 AND fk_azione = xazione2)), 6) * a.importo_dip / 100, 0) AS importo, ROUND(ROUND(((100 - a.costo_orario) * 100 / (SELECT ROUND(SUM(100 - d.costo_orario), 2) FROM view_analisi_pesi d WHERE anno = xanno3 AND fk_azione = xazione3)), 6) * a.sal_mesi / 100, 2) AS tempo, fk_azione_struttura, coeff_correzione_ore, sal_frazione_mesi, monte_ore, fk_anag FROM view_analisi_pesi a WHERE anno = xanno AND fk_azione = xazione AND fk_azione_sottolivelli = xfk_azione_sottolivelli AND numero_sal = XSAL; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; SET xazione2 = xazione; SET xanno2 = xanno; SET xazione3 = xazione; SET xanno3 = xanno; -- Ottimizzazione: calcolo dei totali una sola volta SELECT ROUND(SUM(100 - b.costo_orario_arrotondato), 2), ROUND(SUM(100 - b.costo_orario_standard_arrotondato), 2), ROUND(SUM(100 - b.costo_orario_standard_arrotondato2), 2) INTO total_cost_arrotondato, total_cost_standard_arrotondato, total_cost_standard_arrotondato2 FROM tt_anag_personale_costi b WHERE anno = xanno AND fk_anag IN ( SELECT DISTINCT fk_anag_progetto FROM ts_azione_struttura WHERE fk_azione = xazione ); SELECT DISTINCT costo_standard_1_2_zero_per_no INTO xtipo_costo_standard FROM ts_azione WHERE pk_progressivo = xazione; SELECT pk_progressivo INTO xfk_azione_sottolivelli FROM ts_azione_sottolivelli WHERE fk_azione = xazione AND fk_sottolivelli = xsottolivelli; OPEN cursor_pesi; read_loop: LOOP FETCH cursor_pesi INTO ximporto_calc, xtempo_calc, xfk_azione_struttura, xcoefficiente, xdurata_sal, xmonte_ore, xfk_anag; IF done THEN LEAVE read_loop; END IF; -- Calcolo dei pesi SELECT ROUND((100 - a.costo_orario_arrotondato) * 100 / total_cost_arrotondato, 6), ROUND((100 - a.costo_orario_standard_arrotondato) * 100 / total_cost_standard_arrotondato, 6), ROUND((100 - a.costo_orario_standard_arrotondato2) * 100 / total_cost_standard_arrotondato2, 6) INTO xpeso, xpeso_standard1, xpeso_standard2 FROM tt_anag_personale_costi a WHERE fk_anag = xfk_anag AND anno = xanno; -- Gestione dei NULL SET xpeso = COALESCE(xpeso, 0); SET xpeso_standard1 = COALESCE(xpeso_standard1, 0); SET xpeso_standard2 = COALESCE(xpeso_standard2, 0); -- Configurazione del costo standard IF xtipo_costo_standard = 1 THEN SET xpeso = xpeso_standard1; ELSEIF xtipo_costo_standard = 2 THEN SET xpeso = xpeso_standard2; END IF; -- Aggiornamento dei parametri di calcolo UPDATE ts_azione_parametri_calcolo SET mesi_uomo_dip = xtempo_calc * xcoefficiente, importo_dip = ROUND(ximporto_calc, 2), durata_in_mesi = xdurata_sal, ore_progetto_dip = (xtempo_calc * xcoefficiente) * xmonte_ore, ore_base_calcolo_dip = xmonte_ore, peso = xpeso WHERE anno = xanno AND fk_azione_struttura = xfk_azione_struttura AND numero_sal = xsal; END LOOP; CLOSE cursor_pesi; END$$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 137. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_01_CALCOLA_ORE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_01_CALCOLA_ORE`( IN XANNO SMALLINT, IN XAZIONE INTEGER, IN XSOTTOLIVELLI INTEGER, IN XSAL SMALLINT ) BEGIN declare xtipo_costo_standard SMALLINT; declare xFK_AZIONE_struttura INTEGER; declare xfk_anag INTEGER; declare ximporto_assegnato DOUBLE PRECISION; declare xcosto_orario DOUBLE PRECISION; declare xdurata_in_mesi SMALLINT; declare xore_assegnate_singolo DOUBLE PRECISION; declare xore_uomo_dip DOUBLE PRECISION; declare ximporto_dip DOUBLE PRECISION; declare xmesi_uomo_dip SMALLINT; declare xconta_presenza SMALLINT; declare xpeso DOUBLE PRECISION; declare xdata_inizio DATE; declare xmese_inizio SMALLINT; declare xdata_fine DATE; declare xmese_fine SMALLINT; declare xi SMALLINT; declare xmese SMALLINT; declare xfk_azione_sottolivelli INTEGER; declare done bool default false; declare cursor_params cursor for select fk_azione_struttura, data_inizio, data_fine, extract(month from data_inizio), extract(month from data_fine) from ts_azione_parametri_calcolo where anno = xANNO and importo_dip > 0 and numero_sal = xSAL and sal_elaborato = 'N' and peso > 0 /* controllo peso introdotto per evitare divisioni per zero dipendenti senza costo anno perche andati via */ and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli and flag_bloccato = 'N') order by fk_azione_struttura; declare cursor_params2 cursor for select fk_azione_struttura, importo_dip, mesi_uomo_dip, ore_progetto_dip, durata_in_mesi from ts_azione_parametri_calcolo where anno = xANNO and importo_dip > 0 and numero_sal = xSAL and sal_elaborato = 'N' and peso >0 and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli and flag_bloccato = 'N') order by fk_azione_struttura; declare cursor_riepilogo cursor for select b.fk_anag, b.fk_azione_struttura, c.peso, a.costo_orario, mese from tt_riepilogo_assegnazioni b, tt_anag_personale_costi a, ts_azione_parametri_calcolo c where c.peso > 0 and a.anno = b.anno and a.fk_anag = b.fk_anag and b.anno = xANNO /* non serve questo filtro perchè in tt_riepilogo_assegnazioni ha creato tutti i mesi del SAL */ /* and b.mese = xmese */ and b.fk_azione_struttura = c.fk_azione_struttura and b.nsal = xSAL and b.fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli and flag_bloccato = 'N') order by b.fk_anag, b.fk_azione_struttura; declare continue handler for not found set done = true; select distinct costo_standard_1_2_zero_per_no into xtipo_costo_standard from ts_azione where pk_progressivo = xAZIONE; select pk_progressivo into xfk_azione_sottolivelli from ts_azione_sottolivelli where fk_azione = xAZIONE and fk_sottolivelli = xSOTTOLIVELLI; open cursor_params; read_loop : loop fetch cursor_params into xFK_AZIONE_struttura, xdata_inizio, xdata_fine, xmese_inizio, xmese_fine; if done then leave read_loop; end if; set xi = xmese_inizio; while (xi <= xmese_fine) do begin insert into tt_riepilogo_assegnazioni select 0, xFK_AZIONE_struttura, xSAL, a.fk_anag_progetto, xANNO, xi, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 from ts_azione_struttura a where a.pk_progressivo = xFK_AZIONE_struttura and flag_bloccato = 'N'; set xi = xi + 1; end; end while; end loop; close cursor_params; set done = false; open cursor_params2; read_loop : loop fetch cursor_params2 into xFK_AZIONE_struttura, ximporto_dip, xmesi_uomo_dip, xore_uomo_dip, xdurata_in_mesi; if done then leave read_loop; end if; set xore_uomo_dip = xore_uomo_dip / xdurata_in_mesi; set xmesi_uomo_dip = xmesi_uomo_dip / xdurata_in_mesi; set ximporto_dip = ximporto_dip / xdurata_in_mesi; set xmesi_uomo_dip = f_arrotonda(xmesi_uomo_dip,2); set ximporto_dip = f_arrotonda(ximporto_dip,2); /* NUOVA VERSIONE DOPO DI AGOSTO 2021 SU VECCHIO DB */ insert into tt_riepilogo_pesi select 0, xFK_AZIONE_struttura, xSAL, b.anno, b.mese, c.peso, count(*), f_arrotonda((ximporto_dip * count(*)),2), f_arrotonda(ximporto_dip,2), f_corregge_60min(xore_uomo_dip * count(*)), f_corregge_60min(xore_uomo_dip) /* VERSIONE PRIMA DI AGOSTO 2021 SU VECCHIO DB f_arrotonda( ((ximporto_dip * c.peso / 100) * count(*)),2), f_arrotonda( (ximporto_dip * c.peso / 100),2), f_corregge_60min( (xore_uomo_dip * c.peso / 100) * count(*) ), f_corregge_60min( xore_uomo_dip * c.peso / 100 ) */ from tt_riepilogo_assegnazioni b, tt_anag_personale_costi a, ts_azione_parametri_calcolo c where c.peso > 0 and a.anno = b.anno and a.fk_anag = b.fk_anag and b.anno = xANNO /* non serve questo filtro perchè in tt_riepilogo_assegnazioni ha creato tutti i mesi del SAL */ /* and b.mese = xmese */ and b.fk_azione_struttura = xFK_AZIONE_struttura and b.nsal = xSAL and b.fk_azione_struttura = c.fk_azione_struttura group by b.fk_azione_struttura, b.anno, b.mese, c.peso; end loop; close cursor_params2; set done = false; open cursor_riepilogo; read_loop : loop fetch cursor_riepilogo into xfk_anag, xFK_AZIONE_struttura, xpeso, xcosto_orario, xmese; if done then leave read_loop; end if; /* controlla se il dipendente è presente */ select count(*) from tt_timbrature where fk_anag = xfk_anag and anno = xANNO and mese = xmese into xconta_presenza; if (xconta_presenza > 0) then begin select distinct importo_assegnato_singolo, ore_assegnate_singolo into ximporto_assegnato, xore_assegnate_singolo from tt_riepilogo_pesi where fk_azione_struttura= xFK_AZIONE_struttura and anno = xANNO and mese = xmese and peso = xpeso and nsal = xSAL; if (ximporto_assegnato is null) then set ximporto_assegnato = 0; end IF; set xore_assegnate_singolo = f_corregge_60min(xore_assegnate_singolo); set xore_assegnate_singolo = f_arrotonda(xore_assegnate_singolo, 2); set ximporto_assegnato = f_arrotonda(ximporto_assegnato,2); update tt_riepilogo_assegnazioni set costo_assegnato = ximporto_assegnato, ore_assegnate = xore_assegnate_singolo, ore_da_caricare = xore_assegnate_singolo where anno = xANNO and mese = xmese and fk_anag = xfk_anag and fk_azione_struttura = xFK_AZIONE_struttura and nsal = xSAL; end; end IF; end loop; close cursor_riepilogo; set done = false; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_01_CALCOLA_ORE`( IN XANNO SMALLINT, IN XAZIONE INTEGER, IN XSOTTOLIVELLI INTEGER, IN XSAL SMALLINT ) BEGIN declare xtipo_costo_standard SMALLINT; declare xFK_AZIONE_struttura INTEGER; declare xfk_anag INTEGER; declare ximporto_assegnato DOUBLE PRECISION; declare xcosto_orario DOUBLE PRECISION; declare xdurata_in_mesi SMALLINT; declare xore_assegnate_singolo DOUBLE PRECISION; declare xore_uomo_dip DOUBLE PRECISION; declare ximporto_dip DOUBLE PRECISION; declare xmesi_uomo_dip SMALLINT; declare xconta_presenza SMALLINT; declare xpeso DOUBLE PRECISION; declare xdata_inizio DATE; declare xmese_inizio SMALLINT; declare xdata_fine DATE; declare xmese_fine SMALLINT; declare xi SMALLINT; declare xmese SMALLINT; declare xfk_azione_sottolivelli INTEGER; declare done bool default false; declare cursor_params cursor for select fk_azione_struttura, data_inizio, data_fine, extract(month from data_inizio), extract(month from data_fine) from ts_azione_parametri_calcolo where anno = xANNO and importo_dip > 0 and numero_sal = xSAL and sal_elaborato = 'N' and peso > 0 /* controllo peso introdotto per evitare divisioni per zero dipendenti senza costo anno perche andati via */ and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli and flag_bloccato = 'N') order by fk_azione_struttura; declare cursor_params2 cursor for select fk_azione_struttura, importo_dip, mesi_uomo_dip, ore_progetto_dip, durata_in_mesi from ts_azione_parametri_calcolo where anno = xANNO and importo_dip > 0 and numero_sal = xSAL and sal_elaborato = 'N' and peso >0 and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli and flag_bloccato = 'N') order by fk_azione_struttura; declare cursor_riepilogo cursor for select b.fk_anag, b.fk_azione_struttura, c.peso, a.costo_orario, mese from tt_riepilogo_assegnazioni b, tt_anag_personale_costi a, ts_azione_parametri_calcolo c where c.peso > 0 and a.anno = b.anno and a.fk_anag = b.fk_anag and b.anno = xANNO /* non serve questo filtro perchè in tt_riepilogo_assegnazioni ha creato tutti i mesi del SAL */ /* and b.mese = xmese */ and b.fk_azione_struttura = c.fk_azione_struttura and b.nsal = xSAL and b.fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli and flag_bloccato = 'N') order by b.fk_anag, b.fk_azione_struttura; declare continue handler for not found set done = true; select distinct costo_standard_1_2_zero_per_no into xtipo_costo_standard from ts_azione where pk_progressivo = xAZIONE; select pk_progressivo into xfk_azione_sottolivelli from ts_azione_sottolivelli where fk_azione = xAZIONE and fk_sottolivelli = xSOTTOLIVELLI; open cursor_params; read_loop : loop fetch cursor_params into xFK_AZIONE_struttura, xdata_inizio, xdata_fine, xmese_inizio, xmese_fine; if done then leave read_loop; end if; set xi = xmese_inizio; while (xi <= xmese_fine) do begin insert into tt_riepilogo_assegnazioni select 0, xFK_AZIONE_struttura, xSAL, a.fk_anag_progetto, xANNO, xi, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 from ts_azione_struttura a where a.pk_progressivo = xFK_AZIONE_struttura and flag_bloccato = 'N'; set xi = xi + 1; end; end while; end loop; close cursor_params; set done = false; open cursor_params2; read_loop : loop fetch cursor_params2 into xFK_AZIONE_struttura, ximporto_dip, xmesi_uomo_dip, xore_uomo_dip, xdurata_in_mesi; if done then leave read_loop; end if; set xore_uomo_dip = xore_uomo_dip / xdurata_in_mesi; set xmesi_uomo_dip = xmesi_uomo_dip / xdurata_in_mesi; set ximporto_dip = ximporto_dip / xdurata_in_mesi; set xmesi_uomo_dip = f_arrotonda(xmesi_uomo_dip,2); set ximporto_dip = f_arrotonda(ximporto_dip,2); /* NUOVA VERSIONE DOPO DI AGOSTO 2021 SU VECCHIO DB */ insert into tt_riepilogo_pesi select 0, xFK_AZIONE_struttura, xSAL, b.anno, b.mese, c.peso, count(*), f_arrotonda((ximporto_dip * count(*)),2), f_arrotonda(ximporto_dip,2), f_corregge_60min(xore_uomo_dip * count(*)), f_corregge_60min(xore_uomo_dip) /* VERSIONE PRIMA DI AGOSTO 2021 SU VECCHIO DB f_arrotonda( ((ximporto_dip * c.peso / 100) * count(*)),2), f_arrotonda( (ximporto_dip * c.peso / 100),2), f_corregge_60min( (xore_uomo_dip * c.peso / 100) * count(*) ), f_corregge_60min( xore_uomo_dip * c.peso / 100 ) */ from tt_riepilogo_assegnazioni b, tt_anag_personale_costi a, ts_azione_parametri_calcolo c where c.peso > 0 and a.anno = b.anno and a.fk_anag = b.fk_anag and b.anno = xANNO /* non serve questo filtro perchè in tt_riepilogo_assegnazioni ha creato tutti i mesi del SAL */ /* and b.mese = xmese */ and b.fk_azione_struttura = xFK_AZIONE_struttura and b.nsal = xSAL and b.fk_azione_struttura = c.fk_azione_struttura group by b.fk_azione_struttura, b.anno, b.mese, c.peso; end loop; close cursor_params2; set done = false; open cursor_riepilogo; read_loop : loop fetch cursor_riepilogo into xfk_anag, xFK_AZIONE_struttura, xpeso, xcosto_orario, xmese; if done then leave read_loop; end if; /* controlla se il dipendente è presente */ select count(*) from tt_timbrature where fk_anag = xfk_anag and anno = xANNO and mese = xmese into xconta_presenza; if (xconta_presenza > 0) then begin select distinct importo_assegnato_singolo, ore_assegnate_singolo into ximporto_assegnato, xore_assegnate_singolo from tt_riepilogo_pesi where fk_azione_struttura= xFK_AZIONE_struttura and anno = xANNO and mese = xmese and peso = xpeso and nsal = xSAL; if (ximporto_assegnato is null) then set ximporto_assegnato = 0; end IF; set xore_assegnate_singolo = f_corregge_60min(xore_assegnate_singolo); set xore_assegnate_singolo = f_arrotonda(xore_assegnate_singolo, 2); set ximporto_assegnato = f_arrotonda(ximporto_assegnato,2); update tt_riepilogo_assegnazioni set costo_assegnato = ximporto_assegnato, ore_assegnate = xore_assegnate_singolo, ore_da_caricare = xore_assegnate_singolo where anno = xANNO and mese = xmese and fk_anag = xfk_anag and fk_azione_struttura = xFK_AZIONE_struttura and nsal = xSAL; end; end IF; end loop; close cursor_riepilogo; set done = false; END$$ ' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 198. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_02_CREA_TIMESHEET Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_02_CREA_TIMESHEET`( IN XANNO SMALLINT, IN AZIONE INTEGER, IN SOTTOLIVELLI INTEGER, IN SAL SMALLINT ) BEGIN /* Dichiarazione variabili */ DECLARE tipo_costo_standard SMALLINT; DECLARE xfk_azione_struttura INTEGER; DECLARE wfk_anag INTEGER; DECLARE wcont SMALLINT; DECLARE gg SMALLINT; DECLARE mm SMALLINT; DECLARE aa SMALLINT; DECLARE execstat CHAR(200); DECLARE mese_in SMALLINT; DECLARE mese_fi SMALLINT; DECLARE wmese SMALLINT; DECLARE xfk_azione_sottolivelli INTEGER; DECLARE done BOOL DEFAULT FALSE; /* Cursore per recuperare le azioni da elaborare */ DECLARE cursor_param CURSOR FOR SELECT apc.fk_azione_struttura, MONTH(apc.data_inizio), MONTH(apc.data_fine) FROM ts_azione_parametri_calcolo apc JOIN ts_azione_struttura asx ON apc.fk_azione_struttura = asx.pk_progressivo WHERE apc.anno = XANNO AND apc.importo_dip > 0 AND apc.numero_sal = SAL AND apc.sal_elaborato = 'N' AND asx.FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli AND asx.flag_bloccato = 'N' ORDER BY apc.fk_azione_struttura; /* Cursore per riepilogo assegnazioni */ DECLARE cursor_riepilogo CURSOR FOR SELECT a.fk_anag FROM tt_riepilogo_assegnazioni a WHERE a.fk_azione_struttura = xfk_azione_struttura AND anno = XANNO AND mese = wmese AND nsal = SAL; /* Cursore per recuperare timbrature giornaliere */ DECLARE cursor_timbrature CURSOR FOR SELECT gg, mm, aa FROM tt_timbrature_giorno WHERE fk_anag = wfk_anag AND aa = XANNO AND mm = wmese; /* Gestore per quando non ci sono più dati */ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; /* Recupera il costo standard per l'azione */ SELECT DISTINCT costo_standard_1_2_zero_per_no INTO tipo_costo_standard FROM ts_azione WHERE pk_progressivo = AZIONE; /* Recupera il codice per i sottolivelli */ SELECT pk_progressivo INTO xfk_azione_sottolivelli FROM ts_azione_sottolivelli WHERE fk_azione = AZIONE AND fk_sottolivelli = SOTTOLIVELLI; -- Inizio dell'elaborazione OPEN cursor_param; read_loop1: LOOP FETCH cursor_param INTO xfk_azione_struttura, mese_in, mese_fi; IF done THEN LEAVE read_loop1; END IF; SET wmese = mese_in; -- Ciclo sui mesi WHILE wmese <= mese_fi DO OPEN cursor_riepilogo; read_loop2: LOOP FETCH cursor_riepilogo INTO wfk_anag; IF done THEN LEAVE read_loop2; END IF; -- Verifica se esiste già una riga per il timesheet SELECT COUNT(*) INTO wcont FROM tt_timesheet WHERE fk_azione_struttura = xfk_azione_struttura AND anno = XANNO AND mese = wmese AND fk_anag = wfk_anag AND nsal = SAL; SET wcont = IFNULL(wcont, 0); IF wcont = 0 THEN INSERT INTO tt_timesheet (pk_progressivo, fk_azione_struttura, nsal, fk_anag, anno, mese, giorno_1, giorno_2, giorno_3, giorno_4, giorno_5, giorno_6, giorno_7, giorno_8, giorno_9, giorno_10, giorno_11, giorno_12, giorno_13, giorno_14, giorno_15, giorno_16, giorno_17, giorno_18, giorno_19, giorno_20, giorno_21, giorno_22, giorno_23, giorno_24, giorno_25, giorno_26, giorno_27, giorno_28, giorno_29, giorno_30, giorno_31, totale_mese, totale_ore, totale_giornate_possibili) VALUES (0, xfk_azione_struttura, SAL, wfk_anag, XANNO, wmese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); END IF; -- Verifica se esiste già una riga nel riepilogo timesheet SELECT COUNT(*) INTO wcont FROM tt_timesheet_riepilogo WHERE fk_anag = wfk_anag AND anno = XANNO AND mese = wmese; SET wcont = IFNULL(wcont, 0); IF wcont = 0 THEN INSERT INTO tt_timesheet_riepilogo (pk_progressivo, fk_anag, anno, mese, giorno_1, giorno_2, giorno_3, giorno_4, giorno_5, giorno_6, giorno_7, giorno_8, giorno_9, giorno_10, giorno_11, giorno_12, giorno_13, giorno_14, giorno_15, giorno_16, giorno_17, giorno_18, giorno_19, giorno_20, giorno_21, giorno_22, giorno_23, giorno_24, giorno_25, giorno_26, giorno_27, giorno_28, giorno_29, giorno_30, giorno_31, totale_mese, totale_ore, totale_giornate_possibili) VALUES (0, wfk_anag, XANNO, wmese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); END IF; OPEN cursor_timbrature; read_loop3: LOOP FETCH cursor_timbrature INTO gg, mm, aa; IF done THEN LEAVE read_loop3; END IF; -- Aggiorna il timesheet con le timbrature SET @sql_string = CONCAT('UPDATE tt_timesheet SET giorno_', gg, ' = 1 WHERE fk_anag =', wfk_anag, ' AND anno =', aa, ' AND mese =', mm); PREPARE stmt FROM @sql_string; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @sql_string = CONCAT('UPDATE tt_timesheet_riepilogo SET giorno_', gg, ' = 1 WHERE fk_anag =', wfk_anag, ' AND anno =', aa, ' AND mese =', mm); PREPARE stmt FROM @sql_string; EXECUTE stmt; DEALLOCATE PREPARE stmt; END LOOP; CLOSE cursor_timbrature; SET done = FALSE; END LOOP; CLOSE cursor_riepilogo; SET done = FALSE; SET wmese = wmese + 1; END WHILE; END LOOP; CLOSE cursor_param; SET done = FALSE; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_02_CREA_TIMESHEET`( IN XANNO SMALLINT, IN AZIONE INTEGER, IN SOTTOLIVELLI INTEGER, IN SAL SMALLINT ) BEGIN /* Dichiarazione variabili */ DECLARE tipo_costo_standard SMALLINT; DECLARE xfk_azione_struttura INTEGER; DECLARE wfk_anag INTEGER; DECLARE wcont SMALLINT; DECLARE gg SMALLINT; DECLARE mm SMALLINT; DECLARE aa SMALLINT; DECLARE execstat CHAR(200); DECLARE mese_in SMALLINT; DECLARE mese_fi SMALLINT; DECLARE wmese SMALLINT; DECLARE xfk_azione_sottolivelli INTEGER; DECLARE done BOOL DEFAULT FALSE; /* Cursore per recuperare le azioni da elaborare */ DECLARE cursor_param CURSOR FOR SELECT apc.fk_azione_struttura, MONTH(apc.data_inizio), MONTH(apc.data_fine) FROM ts_azione_parametri_calcolo apc JOIN ts_azione_struttura asx ON apc.fk_azione_struttura = asx.pk_progressivo WHERE apc.anno = XANNO AND apc.importo_dip > 0 AND apc.numero_sal = SAL AND apc.sal_elaborato = 'N' AND asx.FK_AZIONE_SOTTOLIVELLI = xfk_azione_sottolivelli AND asx.flag_bloccato = 'N' ORDER BY apc.fk_azione_struttura; /* Cursore per riepilogo assegnazioni */ DECLARE cursor_riepilogo CURSOR FOR SELECT a.fk_anag FROM tt_riepilogo_assegnazioni a WHERE a.fk_azione_struttura = xfk_azione_struttura AND anno = XANNO AND mese = wmese AND nsal = SAL; /* Cursore per recuperare timbrature giornaliere */ DECLARE cursor_timbrature CURSOR FOR SELECT gg, mm, aa FROM tt_timbrature_giorno WHERE fk_anag = wfk_anag AND aa = XANNO AND mm = wmese; /* Gestore per quando non ci sono più dati */ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; /* Recupera il costo standard per l'azione */ SELECT DISTINCT costo_standard_1_2_zero_per_no INTO tipo_costo_standard FROM ts_azione WHERE pk_progressivo = AZIONE; /* Recupera il codice per i sottolivelli */ SELECT pk_progressivo INTO xfk_azione_sottolivelli FROM ts_azione_sottolivelli WHERE fk_azione = AZIONE AND fk_sottolivelli = SOTTOLIVELLI; -- Inizio dell'elaborazione OPEN cursor_param; read_loop1: LOOP FETCH cursor_param INTO xfk_azione_struttura, mese_in, mese_fi; IF done THEN LEAVE read_loop1; END IF; SET wmese = mese_in; -- Ciclo sui mesi WHILE wmese <= mese_fi DO OPEN cursor_riepilogo; read_loop2: LOOP FETCH cursor_riepilogo INTO wfk_anag; IF done THEN LEAVE read_loop2; END IF; -- Verifica se esiste già una riga per il timesheet SELECT COUNT(*) INTO wcont FROM tt_timesheet WHERE fk_azione_struttura = xfk_azione_struttura AND anno = XANNO AND mese = wmese AND fk_anag = wfk_anag AND nsal = SAL; SET wcont = IFNULL(wcont, 0); IF wcont = 0 THEN INSERT INTO tt_timesheet (pk_progressivo, fk_azione_struttura, nsal, fk_anag, anno, mese, giorno_1, giorno_2, giorno_3, giorno_4, giorno_5, giorno_6, giorno_7, giorno_8, giorno_9, giorno_10, giorno_11, giorno_12, giorno_13, giorno_14, giorno_15, giorno_16, giorno_17, giorno_18, giorno_19, giorno_20, giorno_21, giorno_22, giorno_23, giorno_24, giorno_25, giorno_26, giorno_27, giorno_28, giorno_29, giorno_30, giorno_31, totale_mese, totale_ore, totale_giornate_possibili) VALUES (0, xfk_azione_struttura, SAL, wfk_anag, XANNO, wmese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); END IF; -- Verifica se esiste già una riga nel riepilogo timesheet SELECT COUNT(*) INTO wcont FROM tt_timesheet_riepilogo WHERE fk_anag = wfk_anag AND anno = XANNO AND mese = wmese; SET wcont = IFNULL(wcont, 0); IF wcont = 0 THEN INSERT INTO tt_timesheet_riepilogo (pk_progressivo, fk_anag, anno, mese, giorno_1, giorno_2, giorno_3, giorno_4, giorno_5, giorno_6, giorno_7, giorno_8, giorno_9, giorno_10, giorno_11, giorno_12, giorno_13, giorno_14, giorno_15, giorno_16, giorno_17, giorno_18, giorno_19, giorno_20, giorno_21, giorno_22, giorno_23, giorno_24, giorno_25, giorno_26, giorno_27, giorno_28, giorno_29, giorno_30, giorno_31, totale_mese, totale_ore, totale_giornate_possibili) VALUES (0, wfk_anag, XANNO, wmese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); END IF; OPEN cursor_timbrature; read_loop3: LOOP FETCH cursor_timbrature INTO gg, mm, aa; IF done THEN LEAVE read_loop3; END IF; -- Aggiorna il timesheet con le timbrature SET @sql_string = CONCAT('UPDATE tt_timesheet SET giorno_', gg, ' = 1 WHERE fk_anag =', wfk_anag, ' AND anno =', aa, ' AND mese =', mm); PREPARE stmt FROM @sql_string; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @sql_string = CONCAT('UPDATE tt_timesheet_riepilogo SET giorno_', gg, ' = 1 WHERE fk_anag =', wfk_anag, ' AND anno =', aa, ' AND mese =', mm); PREPARE stmt FROM @sql_string; EXECUTE stmt; DEALLOCATE PREPARE stmt; END LOOP; CLOSE cursor_timbrature; SET done = FALSE; END LOOP; CLOSE cursor_riepilogo; SET done = FALSE; SET wmese = wmese + 1; END WHILE; END LOOP; CLOSE cursor_param; SET done = FALSE; END$$ ' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 174. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_03_ASSEGNA_ORE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_03_ASSEGNA_ORE`( IN XANNO SMALLINT, IN XAZIONE INTEGER, IN XSOTTOLIVELLI INTEGER, IN XSAL SMALLINT ) BEGIN declare wtipo_costo_standard SMALLINT; declare wFK_AZIONE_struttura INTEGER; declare wfk_anag INTEGER; declare wcont SMALLINT; declare gg SMALLINT; declare mm SMALLINT; declare aa SMALLINT; declare wore_assegnate DOUBLE PRECISION; declare wmonte_ore SMALLINT; declare wgg_possibili SMALLINT; declare wore_possibili DOUBLE PRECISION; declare wore_fattibili DOUBLE PRECISION; declare wpk_progressivo INTEGER; declare wsettimane_possibili SMALLINT; declare wore_da_fare_troncato INTEGER; declare wminuti_da_fare DOUBLE PRECISION; declare wpercentuale DOUBLE PRECISION; declare wore_giorno_da_fare INTEGER; declare wmese SMALLINT; declare wfk_azione_sottolivelli INTEGER; declare done bool default false; declare cursor_param cursor for select fk_azione_struttura from ts_azione_parametri_calcolo where anno = ANNO and importo_dip > 0 and numero_sal = SAL and sal_elaborato = 'N' and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = wfk_azione_sottolivelli and flag_bloccato = 'N') order by fk_azione_struttura; declare cursor_riepilogo cursor for select pk_progressivo, fk_anag, ore_assegnate, totale_gg_possibili, mese from tt_riepilogo_assegnazioni where fk_azione_struttura = wFK_AZIONE_struttura and nsal = XSAL and anno = XANNO order by fk_anag, mese; declare continue handler for not found set done = true; select distinct costo_standard_1_2_zero_per_no, monte_ore into wtipo_costo_standard, wore_possibili from ts_azione where pk_progressivo = XAZIONE; select pk_progressivo into wfk_azione_sottolivelli from ts_azione_sottolivelli where fk_azione = XAZIONE and fk_sottolivelli = XSOTTOLIVELLI; open cursor_param; read_loop1 : loop fetch cursor_param into wFK_AZIONE_struttura; if done then leave read_loop1; end if; open cursor_riepilogo; read_loop2 : loop fetch cursor_riepilogo into wpk_progressivo, wfk_anag, wore_assegnate, wgg_possibili, wmese; if done then leave read_loop2; end if; set wore_assegnate = f_corregge_60min(wore_assegnate); if (wgg_possibili is null) then set wgg_possibili = 0; end IF; if (wgg_possibili is null) then set wgg_possibili = 0; end IF; if (wgg_possibili > 0) then begin set wsettimane_possibili = f_tronca((wgg_possibili / 5),0); set wore_giorno_da_fare = f_arrotonda((wore_assegnate / wgg_possibili), 2); set wore_giorno_da_fare = f_corregge_60min(wore_giorno_da_fare); set wminuti_da_fare = wore_giorno_da_fare - f_tronca(wore_giorno_da_fare, 0); set wminuti_da_fare = f_arrotonda(wminuti_da_fare, 2); set wore_da_fare_troncato = f_tronca(wore_giorno_da_fare, 0); /* non gestite da studiare se servono wore_fattibili = f_corregge_60min(wore_fattibili); wpercentuale = f_arrotonda((wore_assegnate * 100 / wore_fattibili),2); */ update tt_riepilogo_assegnazioni set ore_giorno_da_fare= wore_giorno_da_fare, ore_da_fare_troncato= wore_da_fare_troncato, minuti_da_fare_troncato= wminuti_da_fare, settimane_possibili= wsettimane_possibili /* non gestite da studiare se servono ore_fattibili= wore_fattibili, peso_ore= wpercentuale, */ where pk_progressivo = wpk_progressivo; end; end IF; end loop; close cursor_riepilogo; set done = false; end loop; close cursor_param; END - Creating routine tempus_innodb.ELABORAZIONE_040_COMPILA_TIMESHEET Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_040_COMPILA_TIMESHEET`( IN XANNO SMALLINT, IN AZIONE INTEGER, IN SOTTOLIVELLI INTEGER, IN SAL SMALLINT ) BEGIN declare s_n CHAR(1); declare numero_random SMALLINT; declare conta_loop SMALLINT; declare ore_assegnate_da_scalare DOUBLE PRECISION; declare ore_assegnate DOUBLE PRECISION; declare ndivisioni SMALLINT; declare xgiorno_1 SMALLINT; declare xgiorno_2 SMALLINT; declare xgiorno_3 SMALLINT; declare xgiorno_4 SMALLINT; declare xgiorno_5 SMALLINT; declare xgiorno_6 SMALLINT; declare xgiorno_7 SMALLINT; declare xgiorno_8 SMALLINT; declare xgiorno_9 SMALLINT; declare xgiorno_10 SMALLINT; declare xgiorno_11 SMALLINT; declare xgiorno_12 SMALLINT; declare xgiorno_13 SMALLINT; declare xgiorno_14 SMALLINT; declare xgiorno_15 SMALLINT; declare xgiorno_16 SMALLINT; declare xgiorno_17 SMALLINT; declare xgiorno_18 SMALLINT; declare xgiorno_19 SMALLINT; declare xgiorno_20 SMALLINT; declare xgiorno_21 SMALLINT; declare xgiorno_22 SMALLINT; declare xgiorno_23 SMALLINT; declare xgiorno_24 SMALLINT; declare xgiorno_25 SMALLINT; declare xgiorno_26 SMALLINT; declare xgiorno_27 SMALLINT; declare xgiorno_28 SMALLINT; declare xgiorno_29 SMALLINT; declare xgiorno_30 SMALLINT; declare xgiorno_31 SMALLINT; declare tot_ore_assegnate_da_registrare DOUBLE PRECISION; declare tot_ore_assegnate_da_registrare_salva DOUBLE PRECISION; declare wperc_ctrl_ore SMALLINT; declare wtipo_costo_standard SMALLINT; declare wfk_azione_struttura INTEGER; declare wfk_anag INTEGER; declare wcont SMALLINT; declare gg SMALLINT; declare mm SMALLINT; declare aa SMALLINT; declare wmonte_ore SMALLINT; declare wgg_possibili SMALLINT; declare wore_possibili DOUBLE PRECISION; declare wore_fattibili DOUBLE PRECISION; declare wpk_progressivo INTEGER; declare wsettimane_possibili SMALLINT; declare wore_da_fare_troncato INTEGER; declare wminuti_da_fare DOUBLE PRECISION; declare wpercentuale DOUBLE PRECISION; declare wore_giorno_da_fare INTEGER; declare gg_inizio_progetto SMALLINT; declare mm_inizio_progetto SMALLINT; declare aa_inizio_progetto SMALLINT; declare gg_fine_progetto SMALLINT; declare mm_fine_progetto SMALLINT; declare aa_fine_progetto SMALLINT; declare ore_int SMALLINT; declare min_dec FLOAT; declare min_int SMALLINT; declare i SMALLINT; declare ore_assegnate_int INTEGER; declare ore_assegnate_min DOUBLE PRECISION; declare somma_in_minuti DOUBLE PRECISION; declare wmese SMALLINT; declare fk_azione_sottolivelli INTEGER; declare done bool default false; declare cursor_param cursor for select fk_azione_struttura, extract(year from data_inizio), extract(month from data_inizio), extract(day from data_inizio), extract(year from data_fine), extract(month from data_fine), extract(day from data_fine), perc_ctrl_ore from ts_azione_parametri_calcolo where anno = XANNO and importo_dip > 0 and numero_sal = SAL and sal_elaborato = 'N' and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = fk_azione_sottolivelli and flag_bloccato = 'N') and importo_dip > 0 order by fk_azione_struttura; declare cursor_riepilogo cursor for select mese, fk_anag, f_arrotonda(ore_assegnate, 0) from tt_riepilogo_assegnazioni where fk_azione_struttura = wfk_azione_struttura and nsal = SAL and anno = XANNO order by fk_anag, mese; declare continue handler for not found set done = true; select distinct costo_standard_1_2_zero_per_no, monte_ore into wtipo_costo_standard, wore_possibili from ts_azione where pk_progressivo = AZIONE; select pk_progressivo into fk_azione_sottolivelli from ts_azione_sottolivelli where fk_azione = AZIONE and fk_sottolivelli = SOTTOLIVELLI; open cursor_param; read_loop1 : loop fetch cursor_param into wfk_azione_struttura, aa_inizio_progetto, mm_inizio_progetto, gg_inizio_progetto, aa_fine_progetto, mm_fine_progetto, gg_fine_progetto, wperc_ctrl_ore; if done then leave read_loop1; end if; open cursor_riepilogo; read_loop2 : loop fetch cursor_riepilogo into wmese, wfk_anag, tot_ore_assegnate_da_registrare; if done then leave read_loop2; end if; /* memorizza il time sheet */ select mese, giorno_1,giorno_2,giorno_3,giorno_4,giorno_5,giorno_6,giorno_7,giorno_8,giorno_9,giorno_10, giorno_11,giorno_12,giorno_13,giorno_14,giorno_15,giorno_16,giorno_17,giorno_18,giorno_19,giorno_20,giorno_21,giorno_22,giorno_23, giorno_24,giorno_25,giorno_26,giorno_27,giorno_28,giorno_29,giorno_30,giorno_31 into wmese, xgiorno_1, xgiorno_2, xgiorno_3, xgiorno_4, xgiorno_5, xgiorno_6, xgiorno_7, xgiorno_8, xgiorno_9, xgiorno_10, xgiorno_11, xgiorno_12, xgiorno_13, xgiorno_14, xgiorno_15, xgiorno_16, xgiorno_17, xgiorno_18, xgiorno_19, xgiorno_20, xgiorno_21, xgiorno_22, xgiorno_23, xgiorno_24, xgiorno_25, xgiorno_26, xgiorno_27, xgiorno_28, xgiorno_29, xgiorno_30, xgiorno_31 from tt_timesheet where fk_azione_struttura = wfk_azione_struttura and nsal = SAL and anno = XANNO and mese = wmese and fk_anag = wfk_anag; set ore_assegnate_da_scalare = 0; set ndivisioni = 0; /* 24-9-2020 istruzioni inutili perche arriva sempre con valore intero */ /* tot_ore_assegnate_da_registrare = f_corregge_60min(tot_ore_assegnate_da_registrare); */ /* tot_ore_assegnate_da_registrare = f_arrotonda(tot_ore_assegnate_da_registrare, 2); */ set ore_assegnate = tot_ore_assegnate_da_registrare; call elaborazione_041_compila_timesheet_ricalcola_ore_giorno (tot_ore_assegnate_da_registrare, @ndivisioni); select @ndivisioni into ndivisioni; set ore_assegnate_int = f_tronca(ore_assegnate, 0); /* 1.02 diventa 1.00 */ set ore_assegnate_min = (ore_assegnate - ore_assegnate_int) * 100; /* minuti 0.02 diventa 2 minuti*/ set ore_assegnate_int = ore_assegnate_int * 60; /* in minuti 1.00 diventa 60 */ set somma_in_minuti = ore_assegnate_int + ore_assegnate_min; /* ore in 60esimi + minuti diventa 62 minuti*/ /* qui divido i 62 minuti per ndivisioni */ set somma_in_minuti = somma_in_minuti / ndivisioni; /* trasforma il tutto in ore e minuti */ set somma_in_minuti = somma_in_minuti / 100; set ore_assegnate = somma_in_minuti; set conta_loop = 0; while (f_arrotonda(tot_ore_assegnate_da_registrare,2) > 0.0001) do begin set conta_loop = conta_loop + 1; /* questo controllo del loop a 150 viene fatto perche la funzione che rilascia il random potrebbe non estrarre un giorno fra 1 e 31 libero per evitare loop infiniti o lunghissimi dopo 150 tentativi simula che il giorno nel mese non sia disponibile */ if (conta_loop > 150) then /* poiche ha fatto 150 tentativi superiori al numero divisioni previste massime, azzero il totalizzatore delle ore da assegnare così esce dal loop */ set tot_ore_assegnate_da_registrare = 0; end IF; /* passo anche le ore che ancora sono da assegnare in maniera da capire in caso di non assegnazione quanto non riesce a dare trovero' errore nella tabella bio_random_falliti */ call elaborazione_042_compila_timesheet_calcola_random(wfk_azione_struttura, XANNO, wmese, wfk_anag, tot_ore_assegnate_da_registrare, gg_inizio_progetto, mm_inizio_progetto, aa_inizio_progetto, gg_fine_progetto, mm_fine_progetto, aa_fine_progetto, SAL, @numero_random); select @numero_random into numero_random; /* se esce con numero_random = 0 vuol dire che non ci sono numeri da assegnare pertanto deve uscire dal loop */ if (numero_random is null) then set numero_random = 0; end IF; /* impossibile ma non si sa mai meglio che non assegna niente */ if (numero_random > 31) then set numero_random = 0; end IF; /* il numero è buono vede se riesce ad assegnare il numero al calendario del mese se però quel giorno non è buono perche festa o non ha lavorato ore_assegnate_da_scalare = 0 */ if (numero_random > 0) then begin /* vede se c'è un giorno libero a cui assegnare altrimenti torna zero */ call elaborazione_043_compila_timesheet_assegna_ore_al_giorno (numero_random, ore_assegnate, xgiorno_1, xgiorno_2, xgiorno_3, xgiorno_4, xgiorno_5, xgiorno_6, xgiorno_7, xgiorno_8, xgiorno_9, xgiorno_10, xgiorno_11, xgiorno_12, xgiorno_13, xgiorno_14, xgiorno_15, xgiorno_16, xgiorno_17, xgiorno_18, xgiorno_19, xgiorno_20, xgiorno_21, xgiorno_22, xgiorno_23, xgiorno_24, xgiorno_25, xgiorno_26, xgiorno_27, xgiorno_28, xgiorno_29, xgiorno_30, xgiorno_31, @ore_assegnate_da_scalare); select @ore_assegnate_da_scalare into ore_assegnate_da_scalare; if (ore_assegnate_da_scalare is null) then set ore_assegnate_da_scalare = 0; end IF; /* riesce ad assegnare e allora decrementa il loop */ if (ore_assegnate_da_scalare > 0) then begin /* 25-03-2018 per evitare minuti spicci arrotondo ad un ora quelli < 1 */ if (ore_assegnate_da_scalare < 1) then set ore_assegnate_da_scalare = 1; end IF; set ore_int = f_tronca(ore_assegnate_da_scalare, 0); if (ore_int is null) then set ore_int = 0; end IF; set min_dec = ore_assegnate_da_scalare - ore_int; set min_dec = f_arrotonda(min_dec, 2); /* nella nuova versione lascia inalterata ore_int per i minuti fino a 30 e aumenta di 1 ora per i minuti superiori a 31 tutta la gestione in modalità testo l'ho eliminata 25-09-2020 */ if (min_dec >= 0.30 and min_dec < 0.99) then set ore_int = ore_int + 1; end IF; /* ore_assegnate_da_scalare contiene le ore e min arrotondati da registrare in tm */ set ore_assegnate_da_scalare = ore_int; if (ore_assegnate_da_scalare is null) then set ore_assegnate_da_scalare = 0; end IF; set s_n = 'N'; call elaborazione_044_compila_timesheet_assegna_giorno (wfk_anag, wfk_azione_struttura, XANNO, wmese, numero_random, ore_assegnate_da_scalare , wperc_ctrl_ore, @s_n); select @s_n into s_n; /* per risolvere alcuni casi riprova togliendo un'ora */ if (s_n = 'N') then begin if (ore_assegnate_da_scalare > 1) then begin set ore_assegnate_da_scalare = ore_assegnate_da_scalare - 1; if (ore_assegnate_da_scalare > 0) then begin call elaborazione_044_compila_timesheet_assegna_giorno (wfk_anag, wfk_azione_struttura, XANNO, wmese, numero_random, ore_assegnate_da_scalare , wperc_ctrl_ore, @s_n); select @s_n into s_n; end; end IF; if (s_n = 'N') then set ore_assegnate_da_scalare = 0; end IF; end; end IF; end; end IF; /* scala le ore, se nn ha assegnato scala zero */ set tot_ore_assegnate_da_registrare_salva = tot_ore_assegnate_da_registrare; set tot_ore_assegnate_da_registrare = f_calcola_differenza_orep(tot_ore_assegnate_da_registrare, ore_assegnate_da_scalare); /* controllo che non vada in negativo a causa della forzatura di 1 ora per minuti superiori a 30 */ if (tot_ore_assegnate_da_registrare < 0) then set tot_ore_assegnate_da_registrare = 0; end IF; set ore_assegnate_da_scalare = 0; end; end IF; end; end IF; end; end while; end loop; close cursor_riepilogo; set done = false; end loop; close cursor_param; END$$ DE WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_040_COMPILA_TIMESHEET`( IN XANNO SMALLINT, IN AZIONE INTEGER, IN SOTTOLIVELLI INTEGER, IN SAL SMALLINT ) BEGIN declare s_n CHAR(1); declare numero_random SMALLINT; declare conta_loop SMALLINT; declare ore_assegnate_da_scalare DOUBLE PRECISION; declare ore_assegnate DOUBLE PRECISION; declare ndivisioni SMALLINT; declare xgiorno_1 SMALLINT; declare xgiorno_2 SMALLINT; declare xgiorno_3 SMALLINT; declare xgiorno_4 SMALLINT; declare xgiorno_5 SMALLINT; declare xgiorno_6 SMALLINT; declare xgiorno_7 SMALLINT; declare xgiorno_8 SMALLINT; declare xgiorno_9 SMALLINT; declare xgiorno_10 SMALLINT; declare xgiorno_11 SMALLINT; declare xgiorno_12 SMALLINT; declare xgiorno_13 SMALLINT; declare xgiorno_14 SMALLINT; declare xgiorno_15 SMALLINT; declare xgiorno_16 SMALLINT; declare xgiorno_17 SMALLINT; declare xgiorno_18 SMALLINT; declare xgiorno_19 SMALLINT; declare xgiorno_20 SMALLINT; declare xgiorno_21 SMALLINT; declare xgiorno_22 SMALLINT; declare xgiorno_23 SMALLINT; declare xgiorno_24 SMALLINT; declare xgiorno_25 SMALLINT; declare xgiorno_26 SMALLINT; declare xgiorno_27 SMALLINT; declare xgiorno_28 SMALLINT; declare xgiorno_29 SMALLINT; declare xgiorno_30 SMALLINT; declare xgiorno_31 SMALLINT; declare tot_ore_assegnate_da_registrare DOUBLE PRECISION; declare tot_ore_assegnate_da_registrare_salva DOUBLE PRECISION; declare wperc_ctrl_ore SMALLINT; declare wtipo_costo_standard SMALLINT; declare wfk_azione_struttura INTEGER; declare wfk_anag INTEGER; declare wcont SMALLINT; declare gg SMALLINT; declare mm SMALLINT; declare aa SMALLINT; declare wmonte_ore SMALLINT; declare wgg_possibili SMALLINT; declare wore_possibili DOUBLE PRECISION; declare wore_fattibili DOUBLE PRECISION; declare wpk_progressivo INTEGER; declare wsettimane_possibili SMALLINT; declare wore_da_fare_troncato INTEGER; declare wminuti_da_fare DOUBLE PRECISION; declare wpercentuale DOUBLE PRECISION; declare wore_giorno_da_fare INTEGER; declare gg_inizio_progetto SMALLINT; declare mm_inizio_progetto SMALLINT; declare aa_inizio_progetto SMALLINT; declare gg_fine_progetto SMALLINT; declare mm_fine_progetto SMALLINT; declare aa_fine_progetto SMALLINT; declare ore_int SMALLINT; declare min_dec FLOAT; declare min_int SMALLINT; declare i SMALLINT; declare ore_assegnate_int INTEGER; declare ore_assegnate_min DOUBLE PRECISION; declare somma_in_minuti DOUBLE PRECISION; declare wmese SMALLINT; declare fk_azione_sottolivelli INTEGER; declare done bool default false; declare cursor_param cursor for select fk_azione_struttura, extract(year from data_inizio), extract(month from data_inizio), extract(day from data_inizio), extract(year from data_fine), extract(month from data_fine), extract(day from data_fine), perc_ctrl_ore from ts_azione_parametri_calcolo where anno = XANNO and importo_dip > 0 and numero_sal = SAL and sal_elaborato = 'N' and fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where FK_AZIONE_SOTTOLIVELLI = fk_azione_sottolivelli and flag_bloccato = 'N') and importo_dip > 0 order by fk_azione_struttura; declare cursor_riepilogo cursor for select mese, fk_anag, f_arrotonda(ore_assegnate, 0) from tt_riepilogo_assegnazioni where fk_azione_struttura = wfk_azione_struttura and nsal = SAL and anno = XANNO order by fk_anag, mese; declare continue handler for not found set done = true; select distinct costo_standard_1_2_zero_per_no, monte_ore into wtipo_costo_standard, wore_possibili from ts_azione where pk_progressivo = AZIONE; select pk_progressivo into fk_azione_sottolivelli from ts_azione_sottolivelli where fk_azione = AZIONE and fk_sottolivelli = SOTTOLIVELLI; open cursor_param; read_loop1 : loop fetch cursor_param into wfk_azione_struttura, aa_inizio_progetto, mm_inizio_progetto, gg_inizio_progetto, aa_fine_progetto, mm_fine_progetto, gg_fine_progetto, wperc_ctrl_ore; if done then leave read_loop1; end if; open cursor_riepilogo; read_loop2 : loop fetch cursor_riepilogo into wmese, wfk_anag, tot_ore_assegnate_da_registrare; if done then leave read_loop2; end if; /* memorizza il time sheet */ select mese, giorno_1,giorno_2,giorno_3,giorno_4,giorno_5,giorno_6,giorno_7,giorno_8,giorno_9,giorno_10, giorno_11,giorno_12,giorno_13,giorno_14,giorno_15,giorno_16,giorno_17,giorno_18,giorno_19,giorno_20,giorno_21,giorno_22,giorno_23, giorno_24,giorno_25,giorno_26,giorno_27,giorno_28,giorno_29,giorno_30,giorno_31 into wmese, xgiorno_1, xgiorno_2, xgiorno_3, xgiorno_4, xgiorno_5, xgiorno_6, xgiorno_7, xgiorno_8, xgiorno_9, xgiorno_10, xgiorno_11, xgiorno_12, xgiorno_13, xgiorno_14, xgiorno_15, xgiorno_16, xgiorno_17, xgiorno_18, xgiorno_19, xgiorno_20, xgiorno_21, xgiorno_22, xgiorno_23, xgiorno_24, xgiorno_25, xgiorno_26, xgiorno_27, xgiorno_28, xgiorno_29, xgiorno_30, xgiorno_31 from tt_timesheet where fk_azione_struttura = wfk_azione_struttura and nsal = SAL and anno = XANNO and mese = wmese and fk_anag = wfk_anag; set ore_assegnate_da_scalare = 0; set ndivisioni = 0; /* 24-9-2020 istruzioni inutili perche arriva sempre con valore intero */ /* tot_ore_assegnate_da_registrare = f_corregge_60min(tot_ore_assegnate_da_registrare); */ /* tot_ore_assegnate_da_registrare = f_arrotonda(tot_ore_assegnate_da_registrare, 2); */ set ore_assegnate = tot_ore_assegnate_da_registrare; call elaborazione_041_compila_timesheet_ricalcola_ore_giorno (tot_ore_assegnate_da_registrare, @ndivisioni); select @ndivisioni into ndivisioni; set ore_assegnate_int = f_tronca(ore_assegnate, 0); /* 1.02 diventa 1.00 */ set ore_assegnate_min = (ore_assegnate - ore_assegnate_int) * 100; /* minuti 0.02 diventa 2 minuti*/ set ore_assegnate_int = ore_assegnate_int * 60; /* in minuti 1.00 diventa 60 */ set somma_in_minuti = ore_assegnate_int + ore_assegnate_min; /* ore in 60esimi + minuti diventa 62 minuti*/ /* qui divido i 62 minuti per ndivisioni */ set somma_in_minuti = somma_in_minuti / ndivisioni; /* trasforma il tutto in ore e minuti */ set somma_in_minuti = somma_in_minuti / 100; set ore_assegnate = somma_in_minuti; set conta_loop = 0; while (f_arrotonda(tot_ore_assegnate_da_registrare,2) > 0.0001) do begin set conta_loop = conta_loop + 1; /* questo controllo del loop a 150 viene fatto perche la funzione che rilascia il random potrebbe non estrarre un giorno fra 1 e 31 libero per evitare loop infiniti o lunghissimi dopo 150 tentativi simula che il giorno nel mese non sia disponibile */ if (conta_loop > 150) then /* poiche ha fatto 150 tentativi superiori al numero divisioni previste massime, azzero il totalizzatore delle ore da assegnare così esce dal loop */ set tot_ore_assegnate_da_registrare = 0; end IF; /* passo anche le ore che ancora sono da assegnare in maniera da capire in caso di non assegnazione quanto non riesce a dare trovero' errore nella tabella bio_random_falliti */ call elaborazione_042_compila_timesheet_calcola_random(wfk_azione_struttura, XANNO, wmese, wfk_anag, tot_ore_assegnate_da_registrare, gg_inizio_progetto, mm_inizio_progetto, aa_inizio_progetto, gg_fine_progetto, mm_fine_progetto, aa_fine_progetto, SAL, @numero_random); select @numero_random into numero_random; /* se esce con numero_random = 0 vuol dire che non ci sono numeri da assegnare pertanto deve uscire dal loop */ if (numero_random is null) then set numero_random = 0; end IF; /* impossibile ma non si sa mai meglio che non assegna niente */ if (numero_random > 31) then set numero_random = 0; end IF; /* il numero è buono vede se riesce ad assegnare il numero al calendario del mese se però quel giorno non è buono perche festa o non ha lavorato ore_assegnate_da_scalare = 0 */ if (numero_random > 0) then begin /* vede se c'è un giorno libero a cui assegnare altrimenti torna zero */ call elaborazione_043_compila_timesheet_assegna_ore_al_giorno (numero_random, ore_assegnate, xgiorno_1, xgiorno_2, xgiorno_3, xgiorno_4, xgiorno_5, xgiorno_6, xgiorno_7, xgiorno_8, xgiorno_9, xgiorno_10, xgiorno_11, xgiorno_12, xgiorno_13, xgiorno_14, xgiorno_15, xgiorno_16, xgiorno_17, xgiorno_18, xgiorno_19, xgiorno_20, xgiorno_21, xgiorno_22, xgiorno_23, xgiorno_24, xgiorno_25, xgiorno_26, xgiorno_27, xgiorno_28, xgiorno_29, xgiorno_30, xgiorno_31, @ore_assegnate_da_scalare); select @ore_assegnate_da_scalare into ore_assegnate_da_scalare; if (ore_assegnate_da_scalare is null) then set ore_assegnate_da_scalare = 0; end IF; /* riesce ad assegnare e allora decrementa il loop */ if (ore_assegnate_da_scalare > 0) then begin /* 25-03-2018 per evitare minuti spicci arrotondo ad un ora quelli < 1 */ if (ore_assegnate_da_scalare < 1) then set ore_assegnate_da_scalare = 1; end IF; set ore_int = f_tronca(ore_assegnate_da_scalare, 0); if (ore_int is null) then set ore_int = 0; end IF; set min_dec = ore_assegnate_da_scalare - ore_int; set min_dec = f_arrotonda(min_dec, 2); /* nella nuova versione lascia inalterata ore_int per i minuti fino a 30 e aumenta di 1 ora per i minuti superiori a 31 tutta la gestione in modalità testo l'ho eliminata 25-09-2020 */ if (min_dec >= 0.30 and min_dec < 0.99) then set ore_int = ore_int + 1; end IF; /* ore_assegnate_da_scalare contiene le ore e min arrotondati da registrare in tm */ set ore_assegnate_da_scalare = ore_int; if (ore_assegnate_da_scalare is null) then set ore_assegnate_da_scalare = 0; end IF; set s_n = 'N'; call elaborazione_044_compila_timesheet_assegna_giorno (wfk_anag, wfk_azione_struttura, XANNO, wmese, numero_random, ore_assegnate_da_scalare , wperc_ctrl_ore, @s_n); select @s_n into s_n; /* per risolvere alcuni casi riprova togliendo un'ora */ if (s_n = 'N') then begin if (ore_assegnate_da_scalare > 1) then begin set ore_assegnate_da_scalare = ore_assegnate_da_scalare - 1; if (ore_assegnate_da_scalare > 0) then begin call elaborazione_044_compila_timesheet_assegna_giorno (wfk_anag, wfk_azione_struttura, XANNO, wmese, numero_random, ore_assegnate_da_scalare , wperc_ctrl_ore, @s_n); select @s_n into s_n; end; end IF; if (s_n = 'N') then set ore_assegnate_da_scalare = 0; end IF; end; end IF; end; end IF; /* scala le ore, se nn ha assegnato scala zero */ set tot_ore_assegnate_da_registrare_salva = tot_ore_assegnate_da_registrare; set tot_ore_assegnate_da_registrare = f_calcola_differenza_orep(tot_ore_assegnate_da_registrare, ore_assegnate_da_scalare); /* controllo che non vada in negativo a causa della forzatura di 1 ora per minuti superiori a 30 */ if (tot_ore_assegnate_da_registrare < 0) then set tot_ore_assegnate_da_registrare = 0; end IF; set ore_assegnate_da_scalare = 0; end; end IF; end; end IF; end; end while; end loop; close cursor_riepilogo; set done = false; end loop; close cursor_param; END$$ DE' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DE' at line 301. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_041_COMPILA_TIMESHEET_RICALCOLA_ORE_GIORNO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_041_COMPILA_TIMESHEET_RICALCOLA_ORE_GIORNO`( IN ORE_ASSEGNATE DOUBLE PRECISION, OUT N_DIVISIONI SMALLINT ) BEGIN declare ore_assegnate_da_scalare DOUBLE PRECISION; set ore_assegnate_da_scalare = 0; set n_divisioni = 0; /* 24-9-2020 ISTRUZIONI INUTILI PERCHE ARRIVA SEMPRE CON VALORE INTERO */ /* tot_ore_assegnate_da_registrare = F_CORREGGE_60MIN(:tot_ore_assegnate_da_registrare); */ /* tot_ore_assegnate_da_registrare = F_ARROTONDA(:tot_ore_assegnate_da_registrare, 2); */ /* queste divisioni servono per ripartire il totale ore che viene assegnato se le tolgo non assegna nulla esempio : calcola 200 ore non darebbe nulla senza le divisioni perche in un giorno 200 non c'entra con le divisioni calcolerebbe circa 2 ore e mezzo che è probabile vengano assegnate poi con il loop assegna il resto delle ore */ SET N_DIVISIONI = CASE WHEN ORE_ASSEGNATE > 0 AND ORE_ASSEGNATE < 5 THEN 1 WHEN ORE_ASSEGNATE > 5 AND ORE_ASSEGNATE < 10 THEN 2 WHEN ORE_ASSEGNATE >= 10 AND ORE_ASSEGNATE < 25 THEN 5 WHEN ORE_ASSEGNATE >= 25 AND ORE_ASSEGNATE < 50 THEN 12 WHEN ORE_ASSEGNATE >= 50 AND ORE_ASSEGNATE < 100 THEN 25 WHEN ORE_ASSEGNATE >= 100 AND ORE_ASSEGNATE < 150 THEN 30 WHEN ORE_ASSEGNATE >= 150 AND ORE_ASSEGNATE < 200 THEN 40 WHEN ORE_ASSEGNATE >= 200 AND ORE_ASSEGNATE < 250 THEN 50 WHEN ORE_ASSEGNATE >= 250 AND ORE_ASSEGNATE < 300 THEN 55 WHEN ORE_ASSEGNATE >= 300 AND ORE_ASSEGNATE < 350 THEN 65 WHEN ORE_ASSEGNATE >= 350 AND ORE_ASSEGNATE < 400 THEN 75 WHEN ORE_ASSEGNATE >= 400 AND ORE_ASSEGNATE < 450 THEN 80 WHEN ORE_ASSEGNATE >= 450 AND ORE_ASSEGNATE < 500 THEN 85 WHEN ORE_ASSEGNATE >= 500 AND ORE_ASSEGNATE < 600 THEN 90 WHEN ORE_ASSEGNATE >= 600 AND ORE_ASSEGNATE < 650 THEN 100 WHEN ORE_ASSEGNATE >= 650 AND ORE_ASSEGNATE < 800 THEN 120 WHEN ORE_ASSEGNATE >= 800 THEN 130 ELSE 1 END; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_041_COMPILA_TIMESHEET_RICALCOLA_ORE_GIORNO`( IN ORE_ASSEGNATE DOUBLE PRECISION, OUT N_DIVISIONI SMALLINT ) BEGIN declare ore_assegnate_da_scalare DOUBLE PRECISION; set ore_assegnate_da_scalare = 0; set n_divisioni = 0; /* 24-9-2020 ISTRUZIONI INUTILI PERCHE ARRIVA SEMPRE CON VALORE INTERO */ /* tot_ore_assegnate_da_registrare = F_CORREGGE_60MIN(:tot_ore_assegnate_da_registrare); */ /* tot_ore_assegnate_da_registrare = F_ARROTONDA(:tot_ore_assegnate_da_registrare, 2); */ /* queste divisioni servono per ripartire il totale ore che viene assegnato se le tolgo non assegna nulla esempio : calcola 200 ore non darebbe nulla senza le divisioni perche in un giorno 200 non c'entra con le divisioni calcolerebbe circa 2 ore e mezzo che è probabile vengano assegnate poi con il loop assegna il resto delle ore */ SET N_DIVISIONI = CASE WHEN ORE_ASSEGNATE > 0 AND ORE_ASSEGNATE < 5 THEN 1 WHEN ORE_ASSEGNATE > 5 AND ORE_ASSEGNATE < 10 THEN 2 WHEN ORE_ASSEGNATE >= 10 AND ORE_ASSEGNATE < 25 THEN 5 WHEN ORE_ASSEGNATE >= 25 AND ORE_ASSEGNATE < 50 THEN 12 WHEN ORE_ASSEGNATE >= 50 AND ORE_ASSEGNATE < 100 THEN 25 WHEN ORE_ASSEGNATE >= 100 AND ORE_ASSEGNATE < 150 THEN 30 WHEN ORE_ASSEGNATE >= 150 AND ORE_ASSEGNATE < 200 THEN 40 WHEN ORE_ASSEGNATE >= 200 AND ORE_ASSEGNATE < 250 THEN 50 WHEN ORE_ASSEGNATE >= 250 AND ORE_ASSEGNATE < 300 THEN 55 WHEN ORE_ASSEGNATE >= 300 AND ORE_ASSEGNATE < 350 THEN 65 WHEN ORE_ASSEGNATE >= 350 AND ORE_ASSEGNATE < 400 THEN 75 WHEN ORE_ASSEGNATE >= 400 AND ORE_ASSEGNATE < 450 THEN 80 WHEN ORE_ASSEGNATE >= 450 AND ORE_ASSEGNATE < 500 THEN 85 WHEN ORE_ASSEGNATE >= 500 AND ORE_ASSEGNATE < 600 THEN 90 WHEN ORE_ASSEGNATE >= 600 AND ORE_ASSEGNATE < 650 THEN 100 WHEN ORE_ASSEGNATE >= 650 AND ORE_ASSEGNATE < 800 THEN 120 WHEN ORE_ASSEGNATE >= 800 THEN 130 ELSE 1 END; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 43. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_042_COMPILA_TIMESHEET_CALCOLA_RANDOM Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_042_COMPILA_TIMESHEET_CALCOLA_RANDOM`( IN WFK_AZIONE_STRUTTURA INTEGER, IN WANNO SMALLINT, IN WMESE SMALLINT, IN WFK_ANAG INTEGER, IN ORE_DA_ASSEGNARE_PER_QUESTO_LOOP DOUBLE PRECISION, IN GG_INIZIO_PROGETTO SMALLINT, IN MM_INIZIO_PROGETTO SMALLINT, IN AA_INIZIO_PROGETTO SMALLINT, IN GG_FINE_PROGETTO SMALLINT, IN MM_FINE_PROGETTO SMALLINT, IN AA_FINE_PROGETTO SMALLINT, IN SAL SMALLINT, OUT NUMERO_RANDOM SMALLINT ) sp: BEGIN declare conta_loop SMALLINT; declare numero_registrato SMALLINT; set numero_random = 9999; set conta_loop = 0; while (NUMERO_RANDOM = 9999) do begin set conta_loop = conta_loop +1; /* se supera i 100 loop esce per non bloccare l'operazione */ if (conta_loop>100) then begin /* Non registro piu i falliti, lascio l'idea in caso di debug insert into bio_random_falliti values (:azione, :matricola, :ORE_DA_ASSEGNARE_PER_QUESTO_LOOP, :anno, :mese, :progetto, :sottoprog); */ set numero_random = 0; leave sp; end; end IF; /* select f_tronca((abs(f_roundsmallint_min_max(1,31))/1000),0)*/ /* select f_tronca(((f_roundsmallint_min_max(1,31))/1000),0) from rdb$database */ /* vecchia versione basata su select select distinct f_tronca(((rand() * 100) /3), 0) into numero_random from rdb$install; */ SET numero_random = FLOOR(RAND() * 31) + 1; if (NUMERO_RANDOM is null) then set numero_random = 1; end IF; if (NUMERO_RANDOM < 0) then set numero_random = numero_random * -1; end IF; if (NUMERO_RANDOM = 0) then set numero_random = 1; end IF; if (NUMERO_RANDOM > 31) then set numero_random = 9999; end IF; if (NUMERO_RANDOM <> 9999) then begin /* controlla data inizio progetto, se 20/mm/aa non assegna giorni < 20 */ if (WANNO = AA_INIZIO_PROGETTO) then if (WMESE = MM_INIZIO_PROGETTO) then if (NUMERO_RANDOM < gg_inizio_progetto) then /* il numero preso è buono ma inferiore alla data inizio progetto pertanto non buono */ set numero_random = 9999; end IF; end IF; end IF; /* controlla data fine progetto, se 20/mm/aa non assegna giorni > 20 */ if (WANNO = AA_FINE_PROGETTO) then if (WMESE = MM_FINE_PROGETTO) then if (NUMERO_RANDOM > gg_fine_progetto) then /* il numero preso è buono ma superiore alla data fine progetto pertanto non buono */ set numero_random = 9999; end IF; end IF; end IF; if (NUMERO_RANDOM <> 9999) then begin /* controlla se ha già registrato il numero random elaborato */ INSERT INTO tt_ctrl_random (fk_azione_struttura, nsal, anno, mese, fk_anag, numero) SELECT WFK_AZIONE_STRUTTURA, SAL, WANNO, WMESE, WFK_ANAG, NUMERO_RANDOM FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM tt_ctrl_random WHERE fk_azione_struttura = WFK_AZIONE_STRUTTURA AND nsal = SAL AND anno = WANNO AND mese = WMESE AND fk_anag = WFK_ANAG AND numero = NUMERO_RANDOM ); end; end IF; end; end IF; end; end while; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_042_COMPILA_TIMESHEET_CALCOLA_RANDOM`( IN WFK_AZIONE_STRUTTURA INTEGER, IN WANNO SMALLINT, IN WMESE SMALLINT, IN WFK_ANAG INTEGER, IN ORE_DA_ASSEGNARE_PER_QUESTO_LOOP DOUBLE PRECISION, IN GG_INIZIO_PROGETTO SMALLINT, IN MM_INIZIO_PROGETTO SMALLINT, IN AA_INIZIO_PROGETTO SMALLINT, IN GG_FINE_PROGETTO SMALLINT, IN MM_FINE_PROGETTO SMALLINT, IN AA_FINE_PROGETTO SMALLINT, IN SAL SMALLINT, OUT NUMERO_RANDOM SMALLINT ) sp: BEGIN declare conta_loop SMALLINT; declare numero_registrato SMALLINT; set numero_random = 9999; set conta_loop = 0; while (NUMERO_RANDOM = 9999) do begin set conta_loop = conta_loop +1; /* se supera i 100 loop esce per non bloccare l'operazione */ if (conta_loop>100) then begin /* Non registro piu i falliti, lascio l'idea in caso di debug insert into bio_random_falliti values (:azione, :matricola, :ORE_DA_ASSEGNARE_PER_QUESTO_LOOP, :anno, :mese, :progetto, :sottoprog); */ set numero_random = 0; leave sp; end; end IF; /* select f_tronca((abs(f_roundsmallint_min_max(1,31))/1000),0)*/ /* select f_tronca(((f_roundsmallint_min_max(1,31))/1000),0) from rdb$database */ /* vecchia versione basata su select select distinct f_tronca(((rand() * 100) /3), 0) into numero_random from rdb$install; */ SET numero_random = FLOOR(RAND() * 31) + 1; if (NUMERO_RANDOM is null) then set numero_random = 1; end IF; if (NUMERO_RANDOM < 0) then set numero_random = numero_random * -1; end IF; if (NUMERO_RANDOM = 0) then set numero_random = 1; end IF; if (NUMERO_RANDOM > 31) then set numero_random = 9999; end IF; if (NUMERO_RANDOM <> 9999) then begin /* controlla data inizio progetto, se 20/mm/aa non assegna giorni < 20 */ if (WANNO = AA_INIZIO_PROGETTO) then if (WMESE = MM_INIZIO_PROGETTO) then if (NUMERO_RANDOM < gg_inizio_progetto) then /* il numero preso è buono ma inferiore alla data inizio progetto pertanto non buono */ set numero_random = 9999; end IF; end IF; end IF; /* controlla data fine progetto, se 20/mm/aa non assegna giorni > 20 */ if (WANNO = AA_FINE_PROGETTO) then if (WMESE = MM_FINE_PROGETTO) then if (NUMERO_RANDOM > gg_fine_progetto) then /* il numero preso è buono ma superiore alla data fine progetto pertanto non buono */ set numero_random = 9999; end IF; end IF; end IF; if (NUMERO_RANDOM <> 9999) then begin /* controlla se ha già registrato il numero random elaborato */ INSERT INTO tt_ctrl_random (fk_azione_struttura, nsal, anno, mese, fk_anag, numero) SELECT WFK_AZIONE_STRUTTURA, SAL, WANNO, WMESE, WFK_ANAG, NUMERO_RANDOM FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM tt_ctrl_random WHERE fk_azione_struttura = WFK_AZIONE_STRUTTURA AND nsal = SAL AND anno = WANNO AND mese = WMESE AND fk_anag = WFK_ANAG AND numero = NUMERO_RANDOM ); end; end IF; end; end IF; end; end while; END$$ ' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 108. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_043_COMPILA_TIMESHEET_ASSEGNA_ORE_AL_GIORNO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_043_COMPILA_TIMESHEET_ASSEGNA_ORE_AL_GIORNO`( IN NUMERO_RANDOM SMALLINT, IN ORE_ASSEGNATE DOUBLE PRECISION, IN GIORNO_1 SMALLINT, IN GIORNO_2 SMALLINT, IN GIORNO_3 SMALLINT, IN GIORNO_4 SMALLINT, IN GIORNO_5 SMALLINT, IN GIORNO_6 SMALLINT, IN GIORNO_7 SMALLINT, IN GIORNO_8 SMALLINT, IN GIORNO_9 SMALLINT, IN GIORNO_10 SMALLINT, IN GIORNO_11 SMALLINT, IN GIORNO_12 SMALLINT, IN GIORNO_13 SMALLINT, IN GIORNO_14 SMALLINT, IN GIORNO_15 SMALLINT, IN GIORNO_16 SMALLINT, IN GIORNO_17 SMALLINT, IN GIORNO_18 SMALLINT, IN GIORNO_19 SMALLINT, IN GIORNO_20 SMALLINT, IN GIORNO_21 SMALLINT, IN GIORNO_22 SMALLINT, IN GIORNO_23 SMALLINT, IN GIORNO_24 SMALLINT, IN GIORNO_25 SMALLINT, IN GIORNO_26 SMALLINT, IN GIORNO_27 SMALLINT, IN GIORNO_28 SMALLINT, IN GIORNO_29 SMALLINT, IN GIORNO_30 SMALLINT, IN GIORNO_31 SMALLINT, OUT ORE_ASSEGNATE_DA_REGISTRARE DOUBLE PRECISION ) sp: BEGIN /* con questa procedura controlla se le ore calcolate possono essere inserite nel giorno scelto dal random in caso negativo esce per 0 cioè ore non assegnabili su quel giorno */ set ore_assegnate_da_registrare = 0; if (NUMERO_RANDOM = 0) then set numero_random = 1; end IF; if (NUMERO_RANDOM = 1) then begin if (GIORNO_1 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 2) then begin if (GIORNO_2 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 3) then begin if (GIORNO_3 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 4) then begin if (GIORNO_4 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 5) then begin if (GIORNO_5 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 6) then begin if (GIORNO_6 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 7) then begin if (GIORNO_7 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 8) then begin if (GIORNO_8 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 9) then begin if (GIORNO_9 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 10) then begin if (GIORNO_10 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 11) then begin if (GIORNO_11 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 12) then begin if (GIORNO_12 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 13) then begin if (GIORNO_13 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 14) then begin if (GIORNO_14 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 15) then begin if (GIORNO_15 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 16) then begin if (GIORNO_16 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 17) then begin if (GIORNO_17 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 18) then begin if (GIORNO_18 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 19) then begin if (GIORNO_19 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 20) then begin if (GIORNO_20 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 21) then begin if (GIORNO_21 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 22) then begin if (GIORNO_22 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 23) then begin if (GIORNO_23 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 24) then begin if (GIORNO_24 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 25) then begin if (GIORNO_25 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 26) then begin if (GIORNO_26 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 27) then begin if (GIORNO_27 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 28) then begin if (GIORNO_28 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 29) then begin if (GIORNO_29 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 30) then begin if (GIORNO_30 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 31) then begin if (GIORNO_31 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_043_COMPILA_TIMESHEET_ASSEGNA_ORE_AL_GIORNO`( IN NUMERO_RANDOM SMALLINT, IN ORE_ASSEGNATE DOUBLE PRECISION, IN GIORNO_1 SMALLINT, IN GIORNO_2 SMALLINT, IN GIORNO_3 SMALLINT, IN GIORNO_4 SMALLINT, IN GIORNO_5 SMALLINT, IN GIORNO_6 SMALLINT, IN GIORNO_7 SMALLINT, IN GIORNO_8 SMALLINT, IN GIORNO_9 SMALLINT, IN GIORNO_10 SMALLINT, IN GIORNO_11 SMALLINT, IN GIORNO_12 SMALLINT, IN GIORNO_13 SMALLINT, IN GIORNO_14 SMALLINT, IN GIORNO_15 SMALLINT, IN GIORNO_16 SMALLINT, IN GIORNO_17 SMALLINT, IN GIORNO_18 SMALLINT, IN GIORNO_19 SMALLINT, IN GIORNO_20 SMALLINT, IN GIORNO_21 SMALLINT, IN GIORNO_22 SMALLINT, IN GIORNO_23 SMALLINT, IN GIORNO_24 SMALLINT, IN GIORNO_25 SMALLINT, IN GIORNO_26 SMALLINT, IN GIORNO_27 SMALLINT, IN GIORNO_28 SMALLINT, IN GIORNO_29 SMALLINT, IN GIORNO_30 SMALLINT, IN GIORNO_31 SMALLINT, OUT ORE_ASSEGNATE_DA_REGISTRARE DOUBLE PRECISION ) sp: BEGIN /* con questa procedura controlla se le ore calcolate possono essere inserite nel giorno scelto dal random in caso negativo esce per 0 cioè ore non assegnabili su quel giorno */ set ore_assegnate_da_registrare = 0; if (NUMERO_RANDOM = 0) then set numero_random = 1; end IF; if (NUMERO_RANDOM = 1) then begin if (GIORNO_1 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 2) then begin if (GIORNO_2 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 3) then begin if (GIORNO_3 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 4) then begin if (GIORNO_4 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 5) then begin if (GIORNO_5 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 6) then begin if (GIORNO_6 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 7) then begin if (GIORNO_7 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 8) then begin if (GIORNO_8 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 9) then begin if (GIORNO_9 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 10) then begin if (GIORNO_10 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 11) then begin if (GIORNO_11 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 12) then begin if (GIORNO_12 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 13) then begin if (GIORNO_13 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 14) then begin if (GIORNO_14 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 15) then begin if (GIORNO_15 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 16) then begin if (GIORNO_16 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 17) then begin if (GIORNO_17 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 18) then begin if (GIORNO_18 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 19) then begin if (GIORNO_19 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 20) then begin if (GIORNO_20 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 21) then begin if (GIORNO_21 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 22) then begin if (GIORNO_22 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 23) then begin if (GIORNO_23 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 24) then begin if (GIORNO_24 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 25) then begin if (GIORNO_25 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 26) then begin if (GIORNO_26 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 27) then begin if (GIORNO_27 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 28) then begin if (GIORNO_28 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 29) then begin if (GIORNO_29 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 30) then begin if (GIORNO_30 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; if (NUMERO_RANDOM = 31) then begin if (GIORNO_31 > 0) then begin set ore_assegnate_da_registrare = ore_assegnate; leave sp; end; end IF; end; end IF; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 419. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_044_COMPILA_TIMESHEET_ASSEGNA_GIORNO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_044_COMPILA_TIMESHEET_ASSEGNA_GIORNO`( IN WFK_ANAG INTEGER, IN WFK_AZIONE_STRUTTURA INTEGER, IN WANNO SMALLINT, IN WMESE SMALLINT, IN GG SMALLINT, IN ORE SMALLINT, IN PERC_CTRL SMALLINT, OUT SOMMATO_SI_NO CHAR(1) ) BEGIN declare ore_effettive DOUBLE PRECISION; declare wore_ctrl DOUBLE PRECISION; declare superato_massimo CHAR(1); declare ore_del_giorno DOUBLE PRECISION; declare progetti DOUBLE PRECISION; declare timbrature DOUBLE PRECISION; declare percentuale DOUBLE PRECISION; /* per sicurezza metto 80 altrimenti potrebbe andare in errore per divisione per 0 */ if (PERC_CTRL = 0) then set perc_ctrl = 80; end IF; set ore = f_arrotonda(ore, 2); set superato_massimo = 'N'; set sommato_si_no = 'N'; set wore_ctrl = 0; set percentuale = 0; /* somma quante ore ha fatto in quel giorno x tutti i progetti */ /* set @sql_string = 'select ore_giorno_'||gg||',totale_ore into @xore_ctrl, @xprogetti from TT_TIMESHEET_RIEPILOGO where fk_anag='||wfk_anag||' and anno='||wanno||' and mese='||WMESE; */ -- Somma delle ore di quel giorno su tutti i progetti SET @sql_string = CONCAT( 'SELECT ore_giorno_', GG, ', totale_ore INTO @xore_ctrl, @xprogetti ', 'FROM TT_TIMESHEET_RIEPILOGO WHERE fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; select @xore_ctrl, @xprogetti into wore_ctrl, progetti; if (wore_ctrl is null) then set wore_ctrl = 0; end IF; /* controlla se la somma delle ore di quel giorno non supera il massimale di quanto ha lavorato */ /* set @sql_string = 'select ore_giorno_'||gg||',totale_mese into @wore_effettive, @wtimbrature from TT_TIMBRATURE_STORICO where anno='||wanno||' and mese='||wmese||' and fk_anag='||WFK_ANAG; */ SET @sql_string = CONCAT( 'SELECT ore_giorno_', GG, ', totale_mese INTO @wore_effettive, @wtimbrature ', 'FROM TT_TIMBRATURE_STORICO WHERE anno = ', WANNO, ' AND mese = ', WMESE, ' AND fk_anag = ', WFK_ANAG ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; select @wore_effettive, @wtimbrature into ore_effettive, timbrature; if (ore_effettive is null) then set ore_effettive = 0; end IF; /* se la somma di quanto ha gia fatto + quelle che deve caricare supera le ore lavorate effettive non assegna le ore su quel giorno */ set wore_ctrl = f_somma60esimi(wore_ctrl, ORE); if (wore_ctrl > ore_effettive) then set superato_massimo = 'S'; end IF; /* controlla che non ha superato l'80% */ if (superato_massimo = 'N') then begin /* calcola la percentuale impostata nei paramentri (generalmente 80%) delle timbrature che non deve essere superato */ set timbrature = timbrature * PERC_CTRL /100; /* calcola quante ore progetti ha fatto finora più quella assegnata */ set progetti = f_somma60esimi(progetti, ORE); if (progetti > timbrature) then set superato_massimo = 'S'; end IF; end; end IF; if (superato_massimo = 'N') then begin /*set @sql_string = 'update TT_TIMESHEET set ore_giorno_'||gg||'=f_somma60esimi('||ore||',ORE_giorno_'||gg||') where FK_AZIONE_STRUTTURA='||wfk_azione_struttura||' and fk_anag ='||wfk_anag||'and anno='||wanno||'and mese ='||wmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMESHEET SET ore_giorno_', GG, ' = f_somma60esimi(', ORE, ', ORE_giorno_', GG, ') ', 'WHERE FK_AZIONE_STRUTTURA = ', WFK_AZIONE_STRUTTURA, ' AND fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; /* set @sql_string = 'update TT_TIMESHEET_RIEPILOGO set ore_giorno_'||gg||'=f_somma60esimi('||ore||',ORE_giorno_'||gg||') where fk_anag ='||wfk_anag||'and anno='||wanno||'and mese ='||wmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMESHEET_RIEPILOGO SET ore_giorno_', GG, ' = f_somma60esimi(', ORE, ', ORE_giorno_', GG, ') ', 'WHERE fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; /* set @sql_string = 'update TT_TIMBRATURE set ore_giorno_'||gg||'=f_calcola_differenza_ore(ORE_giorno_'||gg||','||ore||') where fk_anag ='||wfk_anag||'and anno='||wanno||'and mese ='||wmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMBRATURE SET ore_giorno_', GG, ' = f_calcola_differenza_ore(ORE_giorno_', GG, ', ', ORE, ') ', 'WHERE fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; set sommato_si_no = 'S'; end; end IF; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_044_COMPILA_TIMESHEET_ASSEGNA_GIORNO`( IN WFK_ANAG INTEGER, IN WFK_AZIONE_STRUTTURA INTEGER, IN WANNO SMALLINT, IN WMESE SMALLINT, IN GG SMALLINT, IN ORE SMALLINT, IN PERC_CTRL SMALLINT, OUT SOMMATO_SI_NO CHAR(1) ) BEGIN declare ore_effettive DOUBLE PRECISION; declare wore_ctrl DOUBLE PRECISION; declare superato_massimo CHAR(1); declare ore_del_giorno DOUBLE PRECISION; declare progetti DOUBLE PRECISION; declare timbrature DOUBLE PRECISION; declare percentuale DOUBLE PRECISION; /* per sicurezza metto 80 altrimenti potrebbe andare in errore per divisione per 0 */ if (PERC_CTRL = 0) then set perc_ctrl = 80; end IF; set ore = f_arrotonda(ore, 2); set superato_massimo = 'N'; set sommato_si_no = 'N'; set wore_ctrl = 0; set percentuale = 0; /* somma quante ore ha fatto in quel giorno x tutti i progetti */ /* set @sql_string = 'select ore_giorno_'||gg||',totale_ore into @xore_ctrl, @xprogetti from TT_TIMESHEET_RIEPILOGO where fk_anag='||wfk_anag||' and anno='||wanno||' and mese='||WMESE; */ -- Somma delle ore di quel giorno su tutti i progetti SET @sql_string = CONCAT( 'SELECT ore_giorno_', GG, ', totale_ore INTO @xore_ctrl, @xprogetti ', 'FROM TT_TIMESHEET_RIEPILOGO WHERE fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; select @xore_ctrl, @xprogetti into wore_ctrl, progetti; if (wore_ctrl is null) then set wore_ctrl = 0; end IF; /* controlla se la somma delle ore di quel giorno non supera il massimale di quanto ha lavorato */ /* set @sql_string = 'select ore_giorno_'||gg||',totale_mese into @wore_effettive, @wtimbrature from TT_TIMBRATURE_STORICO where anno='||wanno||' and mese='||wmese||' and fk_anag='||WFK_ANAG; */ SET @sql_string = CONCAT( 'SELECT ore_giorno_', GG, ', totale_mese INTO @wore_effettive, @wtimbrature ', 'FROM TT_TIMBRATURE_STORICO WHERE anno = ', WANNO, ' AND mese = ', WMESE, ' AND fk_anag = ', WFK_ANAG ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; select @wore_effettive, @wtimbrature into ore_effettive, timbrature; if (ore_effettive is null) then set ore_effettive = 0; end IF; /* se la somma di quanto ha gia fatto + quelle che deve caricare supera le ore lavorate effettive non assegna le ore su quel giorno */ set wore_ctrl = f_somma60esimi(wore_ctrl, ORE); if (wore_ctrl > ore_effettive) then set superato_massimo = 'S'; end IF; /* controlla che non ha superato l'80% */ if (superato_massimo = 'N') then begin /* calcola la percentuale impostata nei paramentri (generalmente 80%) delle timbrature che non deve essere superato */ set timbrature = timbrature * PERC_CTRL /100; /* calcola quante ore progetti ha fatto finora più quella assegnata */ set progetti = f_somma60esimi(progetti, ORE); if (progetti > timbrature) then set superato_massimo = 'S'; end IF; end; end IF; if (superato_massimo = 'N') then begin /*set @sql_string = 'update TT_TIMESHEET set ore_giorno_'||gg||'=f_somma60esimi('||ore||',ORE_giorno_'||gg||') where FK_AZIONE_STRUTTURA='||wfk_azione_struttura||' and fk_anag ='||wfk_anag||'and anno='||wanno||'and mese ='||wmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMESHEET SET ore_giorno_', GG, ' = f_somma60esimi(', ORE, ', ORE_giorno_', GG, ') ', 'WHERE FK_AZIONE_STRUTTURA = ', WFK_AZIONE_STRUTTURA, ' AND fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; /* set @sql_string = 'update TT_TIMESHEET_RIEPILOGO set ore_giorno_'||gg||'=f_somma60esimi('||ore||',ORE_giorno_'||gg||') where fk_anag ='||wfk_anag||'and anno='||wanno||'and mese ='||wmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMESHEET_RIEPILOGO SET ore_giorno_', GG, ' = f_somma60esimi(', ORE, ', ORE_giorno_', GG, ') ', 'WHERE fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; /* set @sql_string = 'update TT_TIMBRATURE set ore_giorno_'||gg||'=f_calcola_differenza_ore(ORE_giorno_'||gg||','||ore||') where fk_anag ='||wfk_anag||'and anno='||wanno||'and mese ='||wmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMBRATURE SET ore_giorno_', GG, ' = f_calcola_differenza_ore(ORE_giorno_', GG, ', ', ORE, ') ', 'WHERE fk_anag = ', WFK_ANAG, ' AND anno = ', WANNO, ' AND mese = ', WMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; set sommato_si_no = 'S'; end; end IF; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 140. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_AGGIORNA_TIMESHEET_SOMMA_AZIONE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_AGGIORNA_TIMESHEET_SOMMA_AZIONE`( IN xFK_ANAG INTEGER, IN xFK_AZIONE INTEGER, IN xANNO SMALLINT, IN xMESE SMALLINT, IN xNSAL SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN if (ore is null) then set ore = 0; end IF; /* aggiorna un campo fittizzio che userà nella execute statement, questo perche la f_somma60esimi nella statement fa casino in quanto il campo ore con le || diventa per esempio 3,00000 e la virgola viene presa come separatore parametri*/ if (ore > 0) then begin update tt_timesheet_somma_azione set ORE_GIORNO_TMP_PER_SOMMA = ore where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione = xfk_azione; /* set @sql_string = 'update tt_timesheet_somma_azione set ore_giorno_'||gg||'=f_somma60esimi('|| 'ORE_GIORNO_TMP_PER_SOMMA' ||',ore_giorno_'||gg||') where fk_anag ='||xfk_anag||' and anno='||xanno||' and mese ='||xmese||' and fk_azione ='||xfk_azione||' and nsal = '||xnsal; */ SET @sql_string = CONCAT( 'UPDATE tt_timesheet_somma_azione ', 'SET ore_giorno_', GG, ' = f_somma60esimi(ORE_GIORNO_TMP_PER_SOMMA, ore_giorno_', GG, ') ', 'WHERE fk_anag = ', xFK_ANAG, ' AND anno = ', xANNO, ' AND mese = ', xMESE, ' AND fk_azione = ', xFK_AZIONE, ' AND nsal = ', xNSAL ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end; end IF; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_AGGIORNA_TIMESHEET_SOMMA_AZIONE`( IN xFK_ANAG INTEGER, IN xFK_AZIONE INTEGER, IN xANNO SMALLINT, IN xMESE SMALLINT, IN xNSAL SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN if (ore is null) then set ore = 0; end IF; /* aggiorna un campo fittizzio che userà nella execute statement, questo perche la f_somma60esimi nella statement fa casino in quanto il campo ore con le || diventa per esempio 3,00000 e la virgola viene presa come separatore parametri*/ if (ore > 0) then begin update tt_timesheet_somma_azione set ORE_GIORNO_TMP_PER_SOMMA = ore where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione = xfk_azione; /* set @sql_string = 'update tt_timesheet_somma_azione set ore_giorno_'||gg||'=f_somma60esimi('|| 'ORE_GIORNO_TMP_PER_SOMMA' ||',ore_giorno_'||gg||') where fk_anag ='||xfk_anag||' and anno='||xanno||' and mese ='||xmese||' and fk_azione ='||xfk_azione||' and nsal = '||xnsal; */ SET @sql_string = CONCAT( 'UPDATE tt_timesheet_somma_azione ', 'SET ore_giorno_', GG, ' = f_somma60esimi(ORE_GIORNO_TMP_PER_SOMMA, ore_giorno_', GG, ') ', 'WHERE fk_anag = ', xFK_ANAG, ' AND anno = ', xANNO, ' AND mese = ', xMESE, ' AND fk_azione = ', xFK_AZIONE, ' AND nsal = ', xNSAL ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end; end IF; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 44. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_AGGIORNA_TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_AGGIORNA_TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE`( IN XFK_ANAG INTEGER, IN XFK_AZIONE INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN if (ore is null) then set ore = 0; end IF; /* aggiorna un campo fittizzio che userà nella execute statement, questo perche la f_somma60esimi nella statement fa casino in quanto il campo ore con le || diventa per esempio 3,00000 e la virgola viene presa come separatore parametri*/ if (ore > 0) then begin update tt_timesheet_somma_sottliv_anno_mese set ORE_GIORNO_TMP_PER_SOMMA = ore where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione = xfk_azione; /* set @sql_string = 'update tt_timesheet_somma_sottliv_anno_mese set ore_giorno_'||gg||'=f_somma60esimi('|| 'ORE_GIORNO_TMP_PER_SOMMA' ||',ore_giorno_'||gg||') where fk_anag ='||xfk_anag||' and anno='||xanno||' and mese ='||xmese||' and fk_azione ='||xfk_azione; */ SET @sql_string = CONCAT( 'UPDATE tt_timesheet_somma_sottliv_anno_mese ', 'SET ore_giorno_', GG, ' = f_somma60esimi(ORE_GIORNO_TMP_PER_SOMMA, ore_giorno_', GG, ') ', 'WHERE fk_anag = ', XFK_ANAG, ' AND anno = ', XANNO, ' AND mese = ', XMESE, ' AND fk_azione = ', XFK_AZIONE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end; end IF; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_AGGIORNA_TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE`( IN XFK_ANAG INTEGER, IN XFK_AZIONE INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN if (ore is null) then set ore = 0; end IF; /* aggiorna un campo fittizzio che userà nella execute statement, questo perche la f_somma60esimi nella statement fa casino in quanto il campo ore con le || diventa per esempio 3,00000 e la virgola viene presa come separatore parametri*/ if (ore > 0) then begin update tt_timesheet_somma_sottliv_anno_mese set ORE_GIORNO_TMP_PER_SOMMA = ore where fk_anag = xfk_anag and anno = xanno and mese = xmese and fk_azione = xfk_azione; /* set @sql_string = 'update tt_timesheet_somma_sottliv_anno_mese set ore_giorno_'||gg||'=f_somma60esimi('|| 'ORE_GIORNO_TMP_PER_SOMMA' ||',ore_giorno_'||gg||') where fk_anag ='||xfk_anag||' and anno='||xanno||' and mese ='||xmese||' and fk_azione ='||xfk_azione; */ SET @sql_string = CONCAT( 'UPDATE tt_timesheet_somma_sottliv_anno_mese ', 'SET ore_giorno_', GG, ' = f_somma60esimi(ORE_GIORNO_TMP_PER_SOMMA, ore_giorno_', GG, ') ', 'WHERE fk_anag = ', XFK_ANAG, ' AND anno = ', XANNO, ' AND mese = ', XMESE, ' AND fk_azione = ', XFK_AZIONE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end; end IF; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 38. SQL Error: 1064 - Creating routine tempus_innodb.ELABORAZIONE_ROLLBACK_TIMBRATURE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_ROLLBACK_TIMBRATURE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN set ore = ore * -1; /* set @sql_string = 'update tt_timbrature_test_cancella set ore_giorno_'||gg||'=f_calcola_differenza_ore(ore_giorno_'||gg||','||ore||') where fk_anag ='||xfk_anag||' and anno='||xanno||' and mese ='||xmese; */ SET @sql_string = CONCAT( 'UPDATE tt_timbrature_test_cancella SET ore_giorno_', GG, ' = f_calcola_differenza_ore(ore_giorno_', GG, ', ', ORE, ') WHERE fk_anag = ', XFK_ANAG, ' AND anno = ', XANNO, ' AND mese = ', XMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; END - Creating routine tempus_innodb.ELABORAZIONE_ROLLBACK_TIMESHEET_RIEPILOGO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_ROLLBACK_TIMESHEET_RIEPILOGO`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN set ore = ore * -1; /* set @sql_string = 'update TT_TIMESHEET_RIEPILOGO set ore_giorno_'||gg||'=f_somma60esimi('||ore||',ORE_giorno_'||gg||') where fk_anag ='||xfk_anag||'and anno='||xanno||'and mese ='||xmese; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMESHEET_RIEPILOGO SET ore_giorno_', GG, ' = f_somma60esimi(', ORE, ', ORE_giorno_', GG, ') WHERE fk_anag = ', XFK_ANAG, ' AND anno = ', XANNO, ' AND mese = ', XMESE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; END - Creating routine tempus_innodb.ELABORAZIONE_ROLLBACK_TIMESHEET_SOMMA_AZIONE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ELABORAZIONE_ROLLBACK_TIMESHEET_SOMMA_AZIONE`( IN XFK_ANAG INTEGER, IN XFK_AZIONE INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN set ore = ore * -1; /* set @sql_string = 'update TT_TIMESHEET_SOMMA_AZIONE set ore_giorno_'||gg||'=f_somma60esimi('||ore||',ORE_giorno_'||gg||') where fk_anag ='||xfk_anag||' and anno='||xanno||' and mese ='||xmese||' and fk_azione ='||xfk_azione; */ SET @sql_string = CONCAT( 'UPDATE TT_TIMESHEET_SOMMA_AZIONE SET ore_giorno_', GG, ' = f_somma60esimi(', ORE, ', ORE_giorno_', GG, ') WHERE fk_anag = ', XFK_ANAG, ' AND anno = ', XANNO, ' AND mese = ', XMESE, ' AND fk_azione = ', XFK_AZIONE ); prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; END - Creating routine tempus_innodb.ESTRAE_COSTO_STANDARD_DIPENDENTE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ESTRAE_COSTO_STANDARD_DIPENDENTE`( IN XANNO SMALLINT, IN XFK_ANAG INTEGER, IN XFK_AZIONE_STRUTTURA INTEGER, OUT XCOSTO DOUBLE PRECISION ) mycheck: BEGIN declare xtipo_costo_progetto CHAR(1); declare xtipo_costo_standard SMALLINT; declare xtipo_costo_standard_fisso char(1); declare xalto char(1); declare xmedio char(1); declare xbasso char(1); declare xcostoalto1 double precision; declare xcostomedio1 double precision; declare xcostobasso1 double precision; declare xcostoalto2 double precision; declare xcostomedio2 double precision; declare xcostobasso2 double precision; SELECT a.COSTO_STANDARD, a.costo_standard_1_2_zero_per_no, a.FLAG_COSTO_STD_FISSO, a.CSTD_ALTO1, a.CSTD_ALTO2, a.CSTD_MEDIO1, a.CSTD_MEDIO2, a.CSTD_BASSO1, a.CSTD_BASSO2 INTO xtipo_costo_progetto, xtipo_costo_standard, xtipo_costo_standard_fisso, xcostoalto1, xcostoalto2, xcostomedio1, xcostomedio2, xcostobasso1, xcostobasso2 FROM ts_azione a JOIN ts_azione_struttura s ON a.pk_progressivo = s.fk_azione WHERE s.pk_progressivo = xfk_azione_struttura; -- Se non sono stati trovati dati, restituisci un costo di 0 IF xtipo_costo_progetto IS NULL THEN SET xcosto = 0; LEAVE mycheck; END IF; /* costo progetto a CMO prende il costo dalla tabella costi personale */ if (xtipo_costo_progetto = 'N') then begin select costo_orario_arrotondato into xcosto from tt_anag_personale_costi where fk_anag = xfk_anag and anno = xanno; end; end IF; if (xtipo_costo_progetto = 'S' and xtipo_costo_standard_fisso = 'N') then begin /* costo progetto a costo standard prende il costo dalla tabella costi personale assecondo del tipo standard 1 o 2*/ if (xtipo_costo_standard = 1) then select COSTO_ORARIO_STANDARD_ARROTONDATO into xcosto from tt_anag_personale_costi where fk_anag = xfk_anag and anno = xanno; end IF; if (xtipo_costo_standard = 2) then select COSTO_ORARIO_STANDARD_ARROTONDATO2 into xcosto from tt_anag_personale_costi where fk_anag = xfk_anag and anno = xanno; end IF; end; end IF; if (xtipo_costo_progetto = 'S' and xtipo_costo_standard_fisso = 'S') then begin /* costo progetto a costo standard ma immutabile nel tempo prende il costo dalla stessa tabella azioni secondo il livello del dipendente Alto Medio Basso che recupera dalla anagrafico*/ select LIVELLO_COSTO_STANDARD_ALTO, LIVELLO_COSTO_STANDARD_medio, LIVELLO_COSTO_STANDARD_basso into xalto, xmedio, xbasso from tt_anag_personale where pk_progressivo = xfk_anag; -- Determinazione del costo in base al livello IF xtipo_costo_standard = 1 THEN SET XCOSTO = CASE WHEN xalto = 'S' THEN xcostoalto1 WHEN xmedio = 'S' THEN xcostomedio1 WHEN xbasso = 'S' THEN xcostobasso1 ELSE 0 END; ELSEIF xtipo_costo_standard = 2 THEN SET XCOSTO = CASE WHEN xalto = 'S' THEN xcostoalto2 WHEN xmedio = 'S' THEN xcostomedio2 WHEN xbasso = 'S' THEN xcostobasso2 ELSE 0 END; END IF; end; end IF; if (xcosto is null) then set xcosto = 0; end IF; END - Creating routine tempus_innodb.EXCEPTION_MESSAGE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `EXCEPTION_MESSAGE`(in `message_search` varchar(70), out `message_err` varchar(100)) begin declare done bool default false; declare result_search varchar(100); declare cursor_message cursor for select except_message from internal_execptions where except_name = message_search; declare continue handler for not found set done = true; /* Maiuscole per evitare che venga passato per errore il nome in minuscolo */ set message_search = upper(message_search); set result_search = 'Non trovato'; open cursor_message; read_loop : loop fetch cursor_message into result_search; if done then leave read_loop; end if; end loop; close cursor_message; set message_err = result_search; end - Creating routine tempus_innodb.GENERA_PLAN_ODS Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_PLAN_ODS`( IN XPK_ODS INTEGER) BEGIN declare xfk_anag integer; declare xmm_in smallint; declare xaa_in smallint; declare xmm_fi smallint; declare xaa_fi smallint; declare xaa smallint; declare xmm smallint; declare xdiff_date smallint; declare done bool default false; declare cursor_ods cursor for SELECT b.fk_anag, EXTRACT(MONTH FROM data_in), EXTRACT(YEAR FROM data_in), EXTRACT(MONTH FROM data_fi), EXTRACT(YEAR FROM data_fi), DATEDIFF(data_fi, data_in) / 30 FROM TT_LISTA_PERSONALE_MASTER a JOIN TT_LISTA_PERSONALE_DETAIL b ON a.pk_progressivo = b.fk_master WHERE a.pk_progressivo = XPK_ODS; declare continue handler for not found set done = true; open cursor_ods; read_loop : loop fetch cursor_ods into xfk_anag, xmm_in, xaa_in, xmm_fi, xaa_fi, xdiff_date; if done then leave read_loop; end if; set xmm = xmm_in; -- Controllo su xdiff_date: se è inferiore a 1 ma maggiore di 0, impostiamo 1 IF xdiff_date < 1 AND xdiff_date > 0 THEN SET xdiff_date = 1; END IF; while (xaa_fi >= xaa_in) do begin insert into tt1_ods_plan values (0, XPK_ODS, xfk_anag, xaa_in, xmm, 0); set xmm = xmm +1; set xdiff_date = xdiff_date - 1; if (xdiff_date < 1) then begin set xaa_in = 9999; set xmm=9999; end; end IF; if (xmm > 12) then begin set xmm = 1; set xaa_in = xaa_in +1; end; end IF; end; end while; end loop; close cursor_ods; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_PLAN_ODS`( IN XPK_ODS INTEGER) BEGIN declare xfk_anag integer; declare xmm_in smallint; declare xaa_in smallint; declare xmm_fi smallint; declare xaa_fi smallint; declare xaa smallint; declare xmm smallint; declare xdiff_date smallint; declare done bool default false; declare cursor_ods cursor for SELECT b.fk_anag, EXTRACT(MONTH FROM data_in), EXTRACT(YEAR FROM data_in), EXTRACT(MONTH FROM data_fi), EXTRACT(YEAR FROM data_fi), DATEDIFF(data_fi, data_in) / 30 FROM TT_LISTA_PERSONALE_MASTER a JOIN TT_LISTA_PERSONALE_DETAIL b ON a.pk_progressivo = b.fk_master WHERE a.pk_progressivo = XPK_ODS; declare continue handler for not found set done = true; open cursor_ods; read_loop : loop fetch cursor_ods into xfk_anag, xmm_in, xaa_in, xmm_fi, xaa_fi, xdiff_date; if done then leave read_loop; end if; set xmm = xmm_in; -- Controllo su xdiff_date: se è inferiore a 1 ma maggiore di 0, impostiamo 1 IF xdiff_date < 1 AND xdiff_date > 0 THEN SET xdiff_date = 1; END IF; while (xaa_fi >= xaa_in) do begin insert into tt1_ods_plan values (0, XPK_ODS, xfk_anag, xaa_in, xmm, 0); set xmm = xmm +1; set xdiff_date = xdiff_date - 1; if (xdiff_date < 1) then begin set xaa_in = 9999; set xmm=9999; end; end IF; if (xmm > 12) then begin set xmm = 1; set xaa_in = xaa_in +1; end; end IF; end; end while; end loop; close cursor_ods; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 67. SQL Error: 1064 - Creating routine tempus_innodb.GENERA_PROJECT_PLAN Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_PROJECT_PLAN`(IN XPK_RICLASSIFICATO INTEGER) BEGIN -- Dichiarazione variabili DECLARE xnsal_interni INTEGER; DECLARE xnsal_ufficiali INTEGER; DECLARE xdata_in DATE; DECLARE xdata_fi DATE; DECLARE data_in_milestone DATE; DECLARE data_fi_milestone DATE; DECLARE gg_calc_milestone SMALLINT; DECLARE xidx_milestone SMALLINT; DECLARE pk_progressivo_generato INTEGER; DECLARE pk_progressivo_detail INTEGER; DECLARE budget_detail DOUBLE PRECISION; DECLARE budget_detail_scrivi DOUBLE PRECISION; DECLARE data_in_detail DATE; DECLARE data_fi_detail DATE; DECLARE gg_calc_detail SMALLINT; DECLARE data_in_detail_scrivi DATE; DECLARE data_fi_detail_scrivi DATE; DECLARE budget_detail_gg DOUBLE PRECISION; DECLARE xfk_costo INTEGER; DECLARE done BOOL DEFAULT FALSE; -- Dichiarazione dei cursori DECLARE cursor_riclass CURSOR FOR SELECT a.nsal_ufficiali, a.nsal_interni, b.data_inizio, b.data_fine, (DATEDIFF(data_fine, data_inizio) / a.nsal_ufficiali) FROM TS1_RICLASSIFICA_PROGETTO a JOIN ts_macrogruppo b ON a.fk_macrogruppo = b.pk_progressivo WHERE a.pk_progressivo = XPK_RICLASSIFICATO; DECLARE cursor_plan CURSOR FOR SELECT pk_progressivo, idx_milestone, milestone_dal, milestone_al FROM TT1_PROJECT_PLAN WHERE fk_riclassifica = XPK_RICLASSIFICATO; DECLARE cursor_detail CURSOR FOR SELECT pk_progressivo, data_in_tmp, data_fi, gg_tmp, f_arrotonda(budget_gg_tmp, 2), budget_tmp_calcoli, fk_tipo_costo FROM TS1_RICLASSIFICA_PROGETTO_DETAIL WHERE FK_PARAM_PROGETTO = XPK_RICLASSIFICATO AND flag_attivo = 'S' AND data_in_tmp >= data_in_milestone AND data_in_tmp <= data_fi_milestone AND budget_tmp_calcoli > 0; -- Dichiarazione dei gestori di errore DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; -- Elimina i dati esistenti DELETE FROM tt1_project_plan WHERE fk_riclassifica = XPK_RICLASSIFICATO; -- Ripristina i valori di budget nelle righe di dettaglio UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = budget, data_in_tmp = data_in WHERE FK_PARAM_PROGETTO = XPK_RICLASSIFICATO AND flag_attivo = 'S'; -- Apertura del cursore riclassifica OPEN cursor_riclass; read_loop1: LOOP FETCH cursor_riclass INTO xnsal_ufficiali, xnsal_interni, xdata_in, xdata_fi, gg_calc_milestone; IF done THEN LEAVE read_loop1; END IF; -- Impostazione della data iniziale per le milestone SET data_in_milestone = xdata_in; SET xidx_milestone = 1; -- Ciclo per creare le milestone WHILE xidx_milestone <= xnsal_ufficiali DO BEGIN SET data_fi_milestone = ADDDATE(data_in_milestone, INTERVAL gg_calc_milestone DAY); -- Se è l'ultima milestone, forza la data di fine progetto IF xidx_milestone = xnsal_ufficiali THEN SET data_fi_milestone = xdata_fi; END IF; -- Inserimento della milestone nel piano progetto INSERT INTO TT1_PROJECT_PLAN VALUES (0, XPK_RICLASSIFICATO, xidx_milestone, data_in_milestone, data_fi_milestone); -- Impostazione della data di inizio per la prossima milestone SET data_in_milestone = ADDDATE(data_fi_milestone, INTERVAL 1 DAY); SET xidx_milestone = xidx_milestone + 1; END; END WHILE; END LOOP; CLOSE cursor_riclass; -- Riapertura dei cursori per il piano e i dettagli SET done = FALSE; OPEN cursor_plan; read_loop2: LOOP FETCH cursor_plan INTO pk_progressivo_generato, xidx_milestone, data_in_milestone, data_fi_milestone; IF done THEN LEAVE read_loop2; END IF; OPEN cursor_detail; read_loop3: LOOP FETCH cursor_detail INTO pk_progressivo_detail, data_in_detail, data_fi_detail, gg_calc_detail, budget_detail_gg, budget_detail, xfk_costo; IF done THEN LEAVE read_loop3; END IF; -- Controllo se i dettagli rientrano nel range della milestone IF data_fi_detail <= data_fi_milestone THEN BEGIN -- Assegna il budget e aggiorna le date di dettaglio SET data_fi_detail_scrivi = data_fi_detail; SET data_in_detail_scrivi = data_in_detail; INSERT INTO TT1_PROJECT_PLAN_TASK VALUES (0, pk_progressivo_generato, pk_progressivo_detail, data_in_detail_scrivi, data_fi_detail_scrivi, budget_detail, xfk_costo, xidx_milestone, 0); -- Azzeramento dei calcoli per il dettaglio UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = 0, data_in_tmp = data_in WHERE pk_progressivo = pk_progressivo_detail; END; END IF; -- Se la data di fine del dettaglio supera la milestone, calcola la quota di budget IF data_fi_detail > data_fi_milestone THEN BEGIN SET data_fi_detail_scrivi = data_fi_milestone; SET budget_detail_scrivi = budget_detail_gg * gg_calc_milestone; -- Assicurati che il budget non superi quello disponibile IF budget_detail_scrivi > budget_detail THEN SET budget_detail_scrivi = budget_detail; END IF; -- Impostazione della data di inizio per il dettaglio SET data_in_detail_scrivi = data_in_milestone; -- Inserimento della quota parte del budget nella task INSERT INTO TT1_PROJECT_PLAN_TASK VALUES (0, pk_progressivo_generato, pk_progressivo_detail, data_in_detail_scrivi, data_fi_detail_scrivi, budget_detail_scrivi, xfk_costo, xidx_milestone, 0); -- Aggiornamento del budget residuo e della data di inizio UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = budget_tmp_calcoli - budget_detail_scrivi, data_in_tmp = ADDDATE(data_fi_detail_scrivi, INTERVAL 1 DAY) WHERE pk_progressivo = pk_progressivo_detail; END; END IF; END LOOP; CLOSE cursor_detail; SET done = FALSE; END LOOP; CLOSE cursor_plan; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_PROJECT_PLAN`(IN XPK_RICLASSIFICATO INTEGER) BEGIN -- Dichiarazione variabili DECLARE xnsal_interni INTEGER; DECLARE xnsal_ufficiali INTEGER; DECLARE xdata_in DATE; DECLARE xdata_fi DATE; DECLARE data_in_milestone DATE; DECLARE data_fi_milestone DATE; DECLARE gg_calc_milestone SMALLINT; DECLARE xidx_milestone SMALLINT; DECLARE pk_progressivo_generato INTEGER; DECLARE pk_progressivo_detail INTEGER; DECLARE budget_detail DOUBLE PRECISION; DECLARE budget_detail_scrivi DOUBLE PRECISION; DECLARE data_in_detail DATE; DECLARE data_fi_detail DATE; DECLARE gg_calc_detail SMALLINT; DECLARE data_in_detail_scrivi DATE; DECLARE data_fi_detail_scrivi DATE; DECLARE budget_detail_gg DOUBLE PRECISION; DECLARE xfk_costo INTEGER; DECLARE done BOOL DEFAULT FALSE; -- Dichiarazione dei cursori DECLARE cursor_riclass CURSOR FOR SELECT a.nsal_ufficiali, a.nsal_interni, b.data_inizio, b.data_fine, (DATEDIFF(data_fine, data_inizio) / a.nsal_ufficiali) FROM TS1_RICLASSIFICA_PROGETTO a JOIN ts_macrogruppo b ON a.fk_macrogruppo = b.pk_progressivo WHERE a.pk_progressivo = XPK_RICLASSIFICATO; DECLARE cursor_plan CURSOR FOR SELECT pk_progressivo, idx_milestone, milestone_dal, milestone_al FROM TT1_PROJECT_PLAN WHERE fk_riclassifica = XPK_RICLASSIFICATO; DECLARE cursor_detail CURSOR FOR SELECT pk_progressivo, data_in_tmp, data_fi, gg_tmp, f_arrotonda(budget_gg_tmp, 2), budget_tmp_calcoli, fk_tipo_costo FROM TS1_RICLASSIFICA_PROGETTO_DETAIL WHERE FK_PARAM_PROGETTO = XPK_RICLASSIFICATO AND flag_attivo = 'S' AND data_in_tmp >= data_in_milestone AND data_in_tmp <= data_fi_milestone AND budget_tmp_calcoli > 0; -- Dichiarazione dei gestori di errore DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; -- Elimina i dati esistenti DELETE FROM tt1_project_plan WHERE fk_riclassifica = XPK_RICLASSIFICATO; -- Ripristina i valori di budget nelle righe di dettaglio UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = budget, data_in_tmp = data_in WHERE FK_PARAM_PROGETTO = XPK_RICLASSIFICATO AND flag_attivo = 'S'; -- Apertura del cursore riclassifica OPEN cursor_riclass; read_loop1: LOOP FETCH cursor_riclass INTO xnsal_ufficiali, xnsal_interni, xdata_in, xdata_fi, gg_calc_milestone; IF done THEN LEAVE read_loop1; END IF; -- Impostazione della data iniziale per le milestone SET data_in_milestone = xdata_in; SET xidx_milestone = 1; -- Ciclo per creare le milestone WHILE xidx_milestone <= xnsal_ufficiali DO BEGIN SET data_fi_milestone = ADDDATE(data_in_milestone, INTERVAL gg_calc_milestone DAY); -- Se è l'ultima milestone, forza la data di fine progetto IF xidx_milestone = xnsal_ufficiali THEN SET data_fi_milestone = xdata_fi; END IF; -- Inserimento della milestone nel piano progetto INSERT INTO TT1_PROJECT_PLAN VALUES (0, XPK_RICLASSIFICATO, xidx_milestone, data_in_milestone, data_fi_milestone); -- Impostazione della data di inizio per la prossima milestone SET data_in_milestone = ADDDATE(data_fi_milestone, INTERVAL 1 DAY); SET xidx_milestone = xidx_milestone + 1; END; END WHILE; END LOOP; CLOSE cursor_riclass; -- Riapertura dei cursori per il piano e i dettagli SET done = FALSE; OPEN cursor_plan; read_loop2: LOOP FETCH cursor_plan INTO pk_progressivo_generato, xidx_milestone, data_in_milestone, data_fi_milestone; IF done THEN LEAVE read_loop2; END IF; OPEN cursor_detail; read_loop3: LOOP FETCH cursor_detail INTO pk_progressivo_detail, data_in_detail, data_fi_detail, gg_calc_detail, budget_detail_gg, budget_detail, xfk_costo; IF done THEN LEAVE read_loop3; END IF; -- Controllo se i dettagli rientrano nel range della milestone IF data_fi_detail <= data_fi_milestone THEN BEGIN -- Assegna il budget e aggiorna le date di dettaglio SET data_fi_detail_scrivi = data_fi_detail; SET data_in_detail_scrivi = data_in_detail; INSERT INTO TT1_PROJECT_PLAN_TASK VALUES (0, pk_progressivo_generato, pk_progressivo_detail, data_in_detail_scrivi, data_fi_detail_scrivi, budget_detail, xfk_costo, xidx_milestone, 0); -- Azzeramento dei calcoli per il dettaglio UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = 0, data_in_tmp = data_in WHERE pk_progressivo = pk_progressivo_detail; END; END IF; -- Se la data di fine del dettaglio supera la milestone, calcola la quota di budget IF data_fi_detail > data_fi_milestone THEN BEGIN SET data_fi_detail_scrivi = data_fi_milestone; SET budget_detail_scrivi = budget_detail_gg * gg_calc_milestone; -- Assicurati che il budget non superi quello disponibile IF budget_detail_scrivi > budget_detail THEN SET budget_detail_scrivi = budget_detail; END IF; -- Impostazione della data di inizio per il dettaglio SET data_in_detail_scrivi = data_in_milestone; -- Inserimento della quota parte del budget nella task INSERT INTO TT1_PROJECT_PLAN_TASK VALUES (0, pk_progressivo_generato, pk_progressivo_detail, data_in_detail_scrivi, data_fi_detail_scrivi, budget_detail_scrivi, xfk_costo, xidx_milestone, 0); -- Aggiornamento del budget residuo e della data di inizio UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = budget_tmp_calcoli - budget_detail_scrivi, data_in_tmp = ADDDATE(data_fi_detail_scrivi, INTERVAL 1 DAY) WHERE pk_progressivo = pk_progressivo_detail; END; END IF; END LOOP; CLOSE cursor_detail; SET done = FALSE; END LOOP; CLOSE cursor_plan; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 155. SQL Error: 1064 - Creating routine tempus_innodb.GENERA_PROJECT_PLAN_DOCUMENTI Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_PROJECT_PLAN_DOCUMENTI`(IN XPK_RICLASSIFICATO INTEGER) BEGIN DECLARE xpk_fatt INTEGER; DECLARE xpk_plan INTEGER; DECLARE xpk_task INTEGER; DECLARE xfk_costo INTEGER; DECLARE xdata_doc DATE; DECLARE xtotale_costo DOUBLE PRECISION; DECLARE done BOOL DEFAULT FALSE; /* Carica le fatture collegate al riclassificato */ DECLARE cursor_fatture CURSOR FOR SELECT DISTINCT b.pk_progressivo, c.pk_progressivo, c.totale_costo FROM TT1_PROJECT_PLAN a JOIN tt1_project_plan_task b ON a.pk_progressivo = b.fk_master_plan JOIN TT1_FATTURE_IMPORT c ON b.fk_costo = c.fk_tipo_costo WHERE a.fk_riclassifica = XPK_RICLASSIFICATO AND c.fk_riclassificato = a.fk_riclassifica AND b.milestone_dal <= c.data_documento AND b.milestone_al >= c.data_documento; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cursor_fatture; read_loop: LOOP FETCH cursor_fatture INTO xpk_task, xpk_fatt, xtotale_costo; IF done THEN LEAVE read_loop; END IF; -- Inserisce il documento nella tabella di collegamento INSERT INTO TT1_PROJECT_PLAN_DOCUMENTI VALUES (0, xpk_task, xpk_fatt); -- Aggiorna l'importo totale dei documenti associati al task UPDATE TT1_PROJECT_PLAN_TASK SET importo_documenti = importo_documenti + xtotale_costo WHERE pk_progressivo = xpk_task; END LOOP; CLOSE cursor_fatture; END - Creating routine tempus_innodb.GENERA_PROJECT_PLAN_TASK Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_PROJECT_PLAN_TASK`(IN XPK_RICLASSIFICATO INTEGER) BEGIN DECLARE data_in_milestone DATE; DECLARE data_fi_milestone DATE; DECLARE xidx_milestone SMALLINT; DECLARE pk_progressivo_generato INTEGER; DECLARE pk_progressivo_detail INTEGER; DECLARE budget_detail DOUBLE PRECISION; DECLARE budget_detail_scrivi DOUBLE PRECISION; DECLARE data_in_detail DATE; DECLARE data_fi_detail DATE; DECLARE gg_calc_detail SMALLINT; DECLARE budget_detail_gg DOUBLE PRECISION; DECLARE fk_costo INTEGER; DECLARE done BOOL DEFAULT FALSE; DECLARE cursor_plan CURSOR FOR SELECT pk_progressivo, idx_milestone, milestone_dal, milestone_al FROM TT1_PROJECT_PLAN WHERE fk_riclassifica = XPK_RICLASSIFICATO; DECLARE cursor_riclass CURSOR FOR SELECT pk_progressivo, data_in_tmp, data_fi, gg_tmp, f_arrotonda(budget_gg_tmp, 2), budget_tmp_calcoli, fk_tipo_costo FROM TS1_RICLASSIFICA_PROGETTO_DETAIL WHERE FK_PARAM_PROGETTO = XPK_RICLASSIFICATO AND flag_attivo = 'S' AND data_in_tmp >= data_in_milestone AND data_in_tmp <= data_fi_milestone AND budget_tmp_calcoli > 0; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; -- Ripristina il budget calcolabile UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = budget, data_in_tmp = data_in WHERE FK_PARAM_PROGETTO = XPK_RICLASSIFICATO AND flag_attivo = 'S'; OPEN cursor_plan; read_loop1: LOOP FETCH cursor_plan INTO pk_progressivo_generato, xidx_milestone, data_in_milestone, data_fi_milestone; IF done THEN LEAVE read_loop1; END IF; OPEN cursor_riclass; read_loop2: LOOP FETCH cursor_riclass INTO pk_progressivo_detail, data_in_detail, data_fi_detail, gg_calc_detail, budget_detail_gg, budget_detail, fk_costo; IF done THEN LEAVE read_loop2; END IF; -- Calcola il budget_detail_scrivi in base ai giorni e budget disponibili SET budget_detail_scrivi = CASE WHEN (budget_detail_gg * gg_calc_detail > budget_detail) THEN budget_detail ELSE (budget_detail_gg * gg_calc_detail) END; -- Inserisce i dati in TT1_PROJECT_PLAN_TASK INSERT INTO TT1_PROJECT_PLAN_TASK VALUES ( 0, pk_progressivo_generato, pk_progressivo_detail, CASE WHEN data_fi_detail <= data_fi_milestone THEN data_in_detail ELSE data_in_milestone END, CASE WHEN data_fi_detail <= data_fi_milestone THEN data_fi_detail ELSE data_fi_milestone END, budget_detail_scrivi, fk_costo, xidx_milestone, 0 ); -- Aggiorna i dettagli in TS1_RICLASSIFICA_PROGETTO_DETAIL IF (data_fi_detail > data_fi_milestone) THEN UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = budget_tmp_calcoli - budget_detail_scrivi, data_in_tmp = DATE_ADD(data_fi_milestone, INTERVAL 1 DAY) WHERE pk_progressivo = pk_progressivo_detail; ELSE UPDATE TS1_RICLASSIFICA_PROGETTO_DETAIL SET budget_tmp_calcoli = 0, data_in_tmp = data_in WHERE pk_progressivo = pk_progressivo_detail; END IF; END LOOP; CLOSE cursor_riclass; SET done = FALSE; END LOOP; CLOSE cursor_plan; SET done = FALSE; END - Creating routine tempus_innodb.GENERA_SOMME_ORE_PERSONALE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_SOMME_ORE_PERSONALE`( IN XFK_ANAG INTEGER ) BEGIN UPDATE TT_TIMESHEET_TMP_SOMMA SET totale_ore = F_SOMMA60ESIMI( (SELECT SUM(totale_ore) FROM TT_TIMESHEET_SOMMA_AZIONE WHERE fk_anag = XFK_ANAG), totale_ore ) WHERE fk_anag = XFK_ANAG; END - Creating routine tempus_innodb.GENERA_STRUTTURA_SIMULAZIONE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_STRUTTURA_SIMULAZIONE`( IN XPK_PROGRESSIVO INTEGER ) BEGIN declare xnsal smallint; select max(nsal) into xnsal from ts_azione_sal a join ts_azione_struttura b on (a.fk_azione = b.fk_azione) where b.pk_progressivo = xpk_progressivo; if (xnsal is null) then set xnsal = 1; end IF; insert into ts_azione_struttura_simula select 0, pk_progressivo, fk_azione, fk_anag_progetto, fk_azione_sottolivelli, flag_bloccato, xnsal, fk_master_ods from ts_azione_struttura where pk_progressivo = xpk_progressivo; END - Creating routine tempus_innodb.GENERA_TR Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `GENERA_TR`() BEGIN declare pk integer; declare tore double precision; declare tore_ist double precision; declare tcosto double precision; declare intermedio_ore double precision; declare intermedio_costo double precision; declare xfk_anag integer; declare intermedio_ore_ist double precision; declare xanno smallint; declare xmese smallint; declare done bool default false; declare cursor_azsot cursor for select fk_azione_sottoliv from tr_azione_sottolivelli; declare cursor_azstrutt cursor for select totale_ore, costo_orario, fk_anag, anno, mese from tt_timesheet where fk_azione_struttura in (select pk_progressivo from ts_azione_struttura where fk_azione_sottolivelli = pk); declare cursor_timbrature cursor for select totale_mese from tt_timbrature_storico where anno = xanno and mese = xmese and fk_anag = xfk_anag; declare continue handler for not found set done = true; delete from tr_azione_sottolivelli; delete from tr_azione; delete from tr_mgruppo; insert into tr_mgruppo select 0, pk_progressivo, 0, 0, 0 from ts_macrogruppo; insert into tr_azione select 0, pk_progressivo, 0, 0, 0 from ts_azione; insert into tr_azione_sottolivelli select 0, pk_progressivo, 0, 0, 0 from ts_azione_sottolivelli; set intermedio_ore = 0; set intermedio_ore_ist = 0; set intermedio_costo = 0; open cursor_azsot; read_loop1 : loop fetch cursor_azsot into pk; if done then leave read_loop1; end if; open cursor_azstrutt; read_loop2 : loop fetch cursor_azstrutt into tore, tcosto, xfk_anag, xanno, xmese; if done then leave read_loop2; end if; set intermedio_ore = f_somma60esimi(intermedio_ore, tore); set intermedio_costo = intermedio_costo + (tore * tcosto); open cursor_timbrature; read_loop3 : loop fetch cursor_timbrature into tore_ist; if done then leave read_loop3; end if; set intermedio_ore_ist = f_somma60esimi(intermedio_ore_ist, tore_ist); end loop; close cursor_timbrature; set done = false; update tr_azione_sottolivelli set tot_ore = f_arrotonda(intermedio_ore,2), tot_costo = f_arrotonda(intermedio_costo,2), tot_ore_istituzionali = f_arrotonda(intermedio_ore_ist,2) where fk_azione_sottoliv = pk; update tr_azione set tot_ore = f_somma60esimi(tot_ore, intermedio_ore), tot_ore_istituzionali = f_somma60esimi(tot_ore_istituzionali, intermedio_ore_ist), tot_costo = f_arrotonda((tot_costo + intermedio_costo),2) where fk_azione = (select distinct fk_azione from ts_azione_struttura where fk_azione_sottolivelli = pk); update tr_mgruppo set tot_ore = f_somma60esimi(tot_ore, intermedio_ore), tot_ore_istituzionali = f_somma60esimi(tot_ore_istituzionali, intermedio_ore_ist), tot_costo = f_arrotonda((tot_costo + intermedio_costo),2) where fk_mg = (select fk_macrogruppo from ts_azione where pk_progressivo = (select distinct fk_azione from ts_azione_struttura where fk_azione_sottolivelli = pk)); set intermedio_ore = 0; set intermedio_ore_ist = 0; set intermedio_costo = 0; end loop; close cursor_azstrutt; set done = false; end loop; close cursor_azsot; set done = false; END - Creating routine tempus_innodb.LANCIA_ELABORAZIONE_PROGETTO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `LANCIA_ELABORAZIONE_PROGETTO`(IN PK_PROGRESSIVO_PARAMS INTEGER, OUT ESEGUITO CHAR(1)) BEGIN declare xanno SMALLINT; declare sal SMALLINT; declare xfk_azione_sottolivello INTEGER; declare xfk_azione INTEGER; declare xfk_sottolivelli INTEGER; declare tot_ore FLOAT; declare tot_costo DOUBLE PRECISION; set eseguito = 'N'; select anno, fk_azione_sottolivelli, sal into xanno, xfk_azione_sottolivello, sal from ts_parametri_elaborazione where pk_progressivo = PK_PROGRESSIVO_PARAMS and flag_elaborato = 'N'; if (xanno is null) then set xanno = 0; end IF; if (xanno > 0) then begin select fk_azione, fk_sottolivelli into xfk_azione, xfk_sottolivelli from ts_azione_sottolivelli where pk_progressivo = xfk_azione_sottolivello; call elaborazione_00_params_calcolo_azione_sal(xanno, xfk_azione, xfk_sottolivelli, sal); call elaborazione_01_calcola_ore(xanno, xfk_azione, xfk_sottolivelli, sal); call elaborazione_02_crea_timesheet(xanno, xfk_azione, xfk_sottolivelli, sal); call elaborazione_03_assegna_ore(xanno, xfk_azione, xfk_sottolivelli, sal); call elaborazione_040_compila_timesheet(xanno, xfk_azione, xfk_sottolivelli, sal); select sum(totale_ore), sum(totale_ore * costo_orario) into tot_ore, tot_costo from tt_timesheet where fk_azione_struttura in (select c.pk_progressivo from ts_azione_struttura c where c.fk_azione_sottolivelli = xfk_azione_sottolivello) and nsal = sal; if (tot_ore is null) then set tot_ore = 0; end IF; if (tot_costo is null) then set tot_costo = 0; end IF; update ts_parametri_elaborazione set flag_elaborato = 'S', flag_abortito = 'N', importo_calcolato = tot_costo, tot_ore_calcolate = tot_ore where pk_progressivo = pk_progressivo_params; set eseguito = 'S'; end; end IF; delete from tt_timesheet_tmp_per_somme_azione; /* nella tt_timesheet_tmp_per_somme_azione c'e' trigger che aggiorna la tabella TT_TIMESHEET_SOMMA_AZIONE attraverso questa insert */ select anno, sal into xanno, sal from TS_PARAMETRI_ELABORAZIONE where pk_progressivo = pk_progressivo_params; insert into tt_timesheet_tmp_per_somme_azione select * from tt_timesheet where anno = xanno and nsal = sal and fk_azione_struttura in (select pk_progressivo_azstrut from ts_azione_struttura_simula where fk_azione_sottolivelli = xfk_azione_sottolivello); END - Creating routine tempus_innodb.STAMPA_CALCOLA_SOMMA_ALTRI_PROGETTI Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `STAMPA_CALCOLA_SOMMA_ALTRI_PROGETTI`( IN XFK_AZIONE INTEGER, IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT ) BEGIN declare intermedio_ore double precision; declare xore_giorno_1 double precision; declare xore_giorno_2 double precision; declare xore_giorno_3 double precision; declare xore_giorno_4 double precision; declare xore_giorno_5 double precision; declare xore_giorno_6 double precision; declare xore_giorno_7 double precision; declare xore_giorno_8 double precision; declare xore_giorno_9 double precision; declare xore_giorno_10 double precision; declare xore_giorno_11 double precision; declare xore_giorno_12 double precision; declare xore_giorno_13 double precision; declare xore_giorno_14 double precision; declare xore_giorno_15 double precision; declare xore_giorno_16 double precision; declare xore_giorno_17 double precision; declare xore_giorno_18 double precision; declare xore_giorno_19 double precision; declare xore_giorno_20 double precision; declare xore_giorno_21 double precision; declare xore_giorno_22 double precision; declare xore_giorno_23 double precision; declare xore_giorno_24 double precision; declare xore_giorno_25 double precision; declare xore_giorno_26 double precision; declare xore_giorno_27 double precision; declare xore_giorno_28 double precision; declare xore_giorno_29 double precision; declare xore_giorno_30 double precision; declare xore_giorno_31 double precision; declare ore_float float; declare done bool default false; declare cursor_timesheet cursor for select ore_giorno_1,ore_giorno_2,ore_giorno_3,ore_giorno_4,ore_giorno_5,ore_giorno_6,ore_giorno_7,ore_giorno_8,ore_giorno_9,ore_giorno_10, ore_giorno_11,ore_giorno_12,ore_giorno_13,ore_giorno_14,ore_giorno_15,ore_giorno_16,ore_giorno_17,ore_giorno_18,ore_giorno_19,ore_giorno_20,ore_giorno_21,ore_giorno_22,ore_giorno_23, ore_giorno_24,ore_giorno_25,ore_giorno_26,ore_giorno_27,ore_giorno_28,ore_giorno_29,ore_giorno_30,ore_giorno_31 from tt_timesheet a where anno = xanno and mese = xmese and fk_anag = xfk_anag /* somma tutti i progetti diversi da quello in stampa */ /* FONDAMENTALE */ and fk_azione_struttura NOT in (select pk_progressivo_azstrut from ts_azione_struttura_simula where fk_azione = xfk_azione); declare continue handler for not found set done = true; delete from TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP; /* questa tabella raccorda tutte le ore delle altre azioni diverse da quella in stampa quindi NON DEVE AVERE IL CAMPO AZIONE */ insert into TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP values (0, xfk_anag, xanno, xmese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); open cursor_timesheet; read_loop1 : loop fetch cursor_timesheet into xore_giorno_1, xore_giorno_2, xore_giorno_3, xore_giorno_4, xore_giorno_5, xore_giorno_6, xore_giorno_7, xore_giorno_8, xore_giorno_9, xore_giorno_10, xore_giorno_11, xore_giorno_12, xore_giorno_13, xore_giorno_14, xore_giorno_15, xore_giorno_16, xore_giorno_17, xore_giorno_18, xore_giorno_19, xore_giorno_20, xore_giorno_21, xore_giorno_22, xore_giorno_23, xore_giorno_24, xore_giorno_25, xore_giorno_26, xore_giorno_27, xore_giorno_28, xore_giorno_29, xore_giorno_30, xore_giorno_31; if done then leave read_loop1; end if; update TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP set ore_giorno_1 = f_somma60esimi(xore_giorno_1, ore_giorno_1), ore_giorno_2 = f_somma60esimi(xore_giorno_2, ore_giorno_2), ore_giorno_3 = f_somma60esimi(xore_giorno_3, ore_giorno_3), ore_giorno_4 = f_somma60esimi(xore_giorno_4, ore_giorno_4), ore_giorno_5 = f_somma60esimi(xore_giorno_5, ore_giorno_5), ore_giorno_6 = f_somma60esimi(xore_giorno_6, ore_giorno_6), ore_giorno_7 = f_somma60esimi(xore_giorno_7, ore_giorno_7), ore_giorno_8 = f_somma60esimi(xore_giorno_8, ore_giorno_8), ore_giorno_9 = f_somma60esimi(xore_giorno_9, ore_giorno_9), ore_giorno_10 = f_somma60esimi(xore_giorno_10, ore_giorno_10), ore_giorno_11 = f_somma60esimi(xore_giorno_11, ore_giorno_11), ore_giorno_12 = f_somma60esimi(xore_giorno_12, ore_giorno_12), ore_giorno_13 = f_somma60esimi(xore_giorno_13, ore_giorno_13), ore_giorno_14 = f_somma60esimi(xore_giorno_14, ore_giorno_14), ore_giorno_15 = f_somma60esimi(xore_giorno_15, ore_giorno_15), ore_giorno_16 = f_somma60esimi(xore_giorno_16, ore_giorno_16), ore_giorno_17 = f_somma60esimi(xore_giorno_17, ore_giorno_17), ore_giorno_18 = f_somma60esimi(xore_giorno_18, ore_giorno_18), ore_giorno_19 = f_somma60esimi(xore_giorno_19, ore_giorno_19), ore_giorno_20 = f_somma60esimi(xore_giorno_20, ore_giorno_20), ore_giorno_21 = f_somma60esimi(xore_giorno_21, ore_giorno_21), ore_giorno_22 = f_somma60esimi(xore_giorno_22, ore_giorno_22), ore_giorno_23 = f_somma60esimi(xore_giorno_23, ore_giorno_23), ore_giorno_24 = f_somma60esimi(xore_giorno_24, ore_giorno_24), ore_giorno_25 = f_somma60esimi(xore_giorno_25, ore_giorno_25), ore_giorno_26 = f_somma60esimi(xore_giorno_26, ore_giorno_26), ore_giorno_27 = f_somma60esimi(xore_giorno_27, ore_giorno_27), ore_giorno_28 = f_somma60esimi(xore_giorno_28, ore_giorno_28), ore_giorno_29 = f_somma60esimi(xore_giorno_29, ore_giorno_29), ore_giorno_30 = f_somma60esimi(xore_giorno_30, ore_giorno_30), ore_giorno_31 = f_somma60esimi(xore_giorno_31, ore_giorno_31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end loop; close cursor_timesheet; set done = false; END - Creating routine tempus_innodb.STAMPA_CALCOLA_SOMMA_ALTRI_PROGETTI_ACCORPA Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `STAMPA_CALCOLA_SOMMA_ALTRI_PROGETTI_ACCORPA`( IN FK_AZIONE INTEGER, IN FK_ANAG INTEGER, IN ANNO SMALLINT, IN MESE_IN SMALLINT, IN MESE_FI SMALLINT ) BEGIN declare xmese smallint; declare intermedio_ore double precision; declare xore_giorno_1 double precision; declare xore_giorno_2 double precision; declare xore_giorno_3 double precision; declare xore_giorno_4 double precision; declare xore_giorno_5 double precision; declare xore_giorno_6 double precision; declare xore_giorno_7 double precision; declare xore_giorno_8 double precision; declare xore_giorno_9 double precision; declare xore_giorno_10 double precision; declare xore_giorno_11 double precision; declare xore_giorno_12 double precision; declare xore_giorno_13 double precision; declare xore_giorno_14 double precision; declare xore_giorno_15 double precision; declare xore_giorno_16 double precision; declare xore_giorno_17 double precision; declare xore_giorno_18 double precision; declare xore_giorno_19 double precision; declare xore_giorno_20 double precision; declare xore_giorno_21 double precision; declare xore_giorno_22 double precision; declare xore_giorno_23 double precision; declare xore_giorno_24 double precision; declare xore_giorno_25 double precision; declare xore_giorno_26 double precision; declare xore_giorno_27 double precision; declare xore_giorno_28 double precision; declare xore_giorno_29 double precision; declare xore_giorno_30 double precision; declare xore_giorno_31 double precision; declare ore_float float; declare check_record integer; declare done bool default false; /* gestione progetti interni */ declare uso_interno char(1); declare xfk_azione_struttura integer; declare cursor_timesheet cursor for select fk_azione_struttura, ore_giorno_1,ore_giorno_2,ore_giorno_3,ore_giorno_4,ore_giorno_5,ore_giorno_6,ore_giorno_7,ore_giorno_8,ore_giorno_9,ore_giorno_10, ore_giorno_11,ore_giorno_12,ore_giorno_13,ore_giorno_14,ore_giorno_15,ore_giorno_16,ore_giorno_17,ore_giorno_18,ore_giorno_19,ore_giorno_20,ore_giorno_21,ore_giorno_22,ore_giorno_23, ore_giorno_24,ore_giorno_25,ore_giorno_26,ore_giorno_27,ore_giorno_28,ore_giorno_29,ore_giorno_30,ore_giorno_31 from tt_timesheet a where anno = xanno and mese = xmese and fk_anag = xfk_anag /* somma tutti i progetti diversi da quello in stampa */ /* FONDAMENTALE */ and fk_azione_struttura NOT in (select pk_progressivo_azstrut from ts_azione_struttura_simula where fk_azione = xfk_azione); declare continue handler for not found set done = true; delete from TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP; /* questa tabella raccorda tutte le ore delle altre azioni diverse da quella in stampa quindi NON DEVE AVERE IL CAMPO AZIONE */ set xmese = xmese_in; while (xmese <= xmese_fi) do begin insert into TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP values (0, xfk_anag, xanno, xmese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); /* esegue un count per vedere se non ha altri progetti, in caso non ne abbia esegue le stesse cose del loop principale ma forzando la somma di zero in questa maniera riesce a create tt_timbrature_interni che altrimenti il loop successivo non avrebbe creato */ select count(*) into check_record from tt_timesheet a where anno = xanno and mese = xmese and fk_anag = xfk_anag /* somma tutti i progetti diversi da quello in stampa */ /* FONDAMENTALE */ and fk_azione_struttura NOT in (select pk_progressivo_azstrut from ts_azione_struttura_simula where fk_azione = xfk_azione); if (check_record is null) then set check_record = 0; end IF; if (check_record = 0) then begin /* fa le stesse cose che farebbe nel loop successivo solo che le variabile che contengono le ore sono tutte a zero perche non ha timesheet in altri progetti */ /* filtro uso interno */ select flag_uso_interno into uso_interno from ts_macrogruppo where pk_progressivo = ( select fk_macrogruppo from ts_azione where pk_progressivo = (select distinct fk_azione from ts_azione_struttura_simula where PK_PROGRESSIVO_AZSTRUT = xfk_azione_struttura) ); if (uso_interno is null) then set uso_interno = 'N'; end IF; if (uso_interno = 'N') then begin /* cancella e ricostruisce le timbrature senza progetti interni */ delete from TT_TIMBRATURE_INTERNI where anno = xanno and mese = xmese and fk_anag = xfk_anag; insert into TT_TIMBRATURE_INTERNI select * from tt_timbrature where anno = xanno and mese = xmese and fk_anag = xfk_anag; update TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP set ore_giorno_1 = f_somma60esimi(0, ore_giorno_1), ore_giorno_2 = f_somma60esimi(0, ore_giorno_2), ore_giorno_3 = f_somma60esimi(0, ore_giorno_3), ore_giorno_4 = f_somma60esimi(0, ore_giorno_4), ore_giorno_5 = f_somma60esimi(0, ore_giorno_5), ore_giorno_6 = f_somma60esimi(0, ore_giorno_6), ore_giorno_7 = f_somma60esimi(0, ore_giorno_7), ore_giorno_8 = f_somma60esimi(0, ore_giorno_8), ore_giorno_9 = f_somma60esimi(0, ore_giorno_9), ore_giorno_10 = f_somma60esimi(0, ore_giorno_10), ore_giorno_11 = f_somma60esimi(0, ore_giorno_11), ore_giorno_12 = f_somma60esimi(0, ore_giorno_12), ore_giorno_13 = f_somma60esimi(0, ore_giorno_13), ore_giorno_14 = f_somma60esimi(0, ore_giorno_14), ore_giorno_15 = f_somma60esimi(0, ore_giorno_15), ore_giorno_16 = f_somma60esimi(0, ore_giorno_16), ore_giorno_17 = f_somma60esimi(0, ore_giorno_17), ore_giorno_18 = f_somma60esimi(0, ore_giorno_18), ore_giorno_19 = f_somma60esimi(0, ore_giorno_19), ore_giorno_20 = f_somma60esimi(0, ore_giorno_20), ore_giorno_21 = f_somma60esimi(0, ore_giorno_21), ore_giorno_22 = f_somma60esimi(0, ore_giorno_22), ore_giorno_23 = f_somma60esimi(0, ore_giorno_23), ore_giorno_24 = f_somma60esimi(0, ore_giorno_24), ore_giorno_25 = f_somma60esimi(0, ore_giorno_25), ore_giorno_26 = f_somma60esimi(0, ore_giorno_26), ore_giorno_27 = f_somma60esimi(0, ore_giorno_27), ore_giorno_28 = f_somma60esimi(0, ore_giorno_28), ore_giorno_29 = f_somma60esimi(0, ore_giorno_29), ore_giorno_30 = f_somma60esimi(0, ore_giorno_30), ore_giorno_31 = f_somma60esimi(0, ore_giorno_31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end; end IF; if (uso_interno = 'S') then begin /* cancella e ricostruisce le timbrature con progetti interni */ delete from TT_TIMBRATURE_INTERNI where anno = xanno and mese = xmese and fk_anag = xfk_anag; insert into TT_TIMBRATURE_INTERNI select * from tt_timbrature where anno = xanno and mese = xmese and fk_anag = xfk_anag; /* aggiunge alle timbrature le ore del progetto interno che non ha stampato sopra */ update TT_TIMBRATURE_INTERNI set ore_giorno_1 = f_somma60esimi(0, ore_giorno_1), ore_giorno_2 = f_somma60esimi(0, ore_giorno_2), ore_giorno_3 = f_somma60esimi(0, ore_giorno_3), ore_giorno_4 = f_somma60esimi(0, ore_giorno_4), ore_giorno_5 = f_somma60esimi(0, ore_giorno_5), ore_giorno_6 = f_somma60esimi(0, ore_giorno_6), ore_giorno_7 = f_somma60esimi(0, ore_giorno_7), ore_giorno_8 = f_somma60esimi(0, ore_giorno_8), ore_giorno_9 = f_somma60esimi(0, ore_giorno_9), ore_giorno_10 = f_somma60esimi(0, ore_giorno_10), ore_giorno_11 = f_somma60esimi(0, ore_giorno_11), ore_giorno_12 = f_somma60esimi(0, ore_giorno_12), ore_giorno_13 = f_somma60esimi(0, ore_giorno_13), ore_giorno_14 = f_somma60esimi(0, ore_giorno_14), ore_giorno_15 = f_somma60esimi(0, ore_giorno_15), ore_giorno_16 = f_somma60esimi(0, ore_giorno_16), ore_giorno_17 = f_somma60esimi(0, ore_giorno_17), ore_giorno_18 = f_somma60esimi(0, ore_giorno_18), ore_giorno_19 = f_somma60esimi(0, ore_giorno_19), ore_giorno_20 = f_somma60esimi(0, ore_giorno_20), ore_giorno_21 = f_somma60esimi(0, ore_giorno_21), ore_giorno_22 = f_somma60esimi(0, ore_giorno_22), ore_giorno_23 = f_somma60esimi(0, ore_giorno_23), ore_giorno_24 = f_somma60esimi(0, ore_giorno_24), ore_giorno_25 = f_somma60esimi(0, ore_giorno_25), ore_giorno_26 = f_somma60esimi(0, ore_giorno_26), ore_giorno_27 = f_somma60esimi(0, ore_giorno_27), ore_giorno_28 = f_somma60esimi(0, ore_giorno_28), ore_giorno_29 = f_somma60esimi(0, ore_giorno_29), ore_giorno_30 = f_somma60esimi(0, ore_giorno_30), ore_giorno_31 = f_somma60esimi(0, ore_giorno_31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end; end IF; end; end IF; open cursor_timesheet; read_loop1 : loop fetch cursor_timesheet into xfk_azione_struttura, xore_giorno_1, xore_giorno_2, xore_giorno_3, xore_giorno_4, xore_giorno_5, xore_giorno_6, xore_giorno_7, xore_giorno_8, xore_giorno_9, xore_giorno_10, xore_giorno_11, xore_giorno_12, xore_giorno_13, xore_giorno_14, xore_giorno_15, xore_giorno_16, xore_giorno_17, xore_giorno_18, xore_giorno_19, xore_giorno_20, xore_giorno_21, xore_giorno_22, xore_giorno_23, xore_giorno_24, xore_giorno_25, xore_giorno_26, xore_giorno_27, xore_giorno_28, xore_giorno_29, xore_giorno_30, xore_giorno_31; if done then leave read_loop1; end if; /* filtro uso interno */ select flag_uso_interno into uso_interno from ts_macrogruppo where pk_progressivo = ( select fk_macrogruppo from ts_azione where pk_progressivo = (select distinct fk_azione from ts_azione_struttura_simula where PK_PROGRESSIVO_AZSTRUT = xfk_azione_struttura) ); if (uso_interno is null) then set uso_interno = 'N'; end IF; if (uso_interno = 'N') then begin /* cancella e ricostruisce le timbrature senza progetti interni */ delete from TT_TIMBRATURE_INTERNI where anno = xanno and mese = xmese and fk_anag = xfk_anag; insert into TT_TIMBRATURE_INTERNI select * from tt_timbrature where anno = xanno and mese = xmese and fk_anag = xfk_anag; update TT_TIMESHEET_TMP_SOMMA_AZIONI_PER_STP set ore_giorno_1 = f_somma60esimi(xore_giorno_1, ore_giorno_1), ore_giorno_2 = f_somma60esimi(xore_giorno_2, ore_giorno_2), ore_giorno_3 = f_somma60esimi(xore_giorno_3, ore_giorno_3), ore_giorno_4 = f_somma60esimi(xore_giorno_4, ore_giorno_4), ore_giorno_5 = f_somma60esimi(xore_giorno_5, ore_giorno_5), ore_giorno_6 = f_somma60esimi(xore_giorno_6, ore_giorno_6), ore_giorno_7 = f_somma60esimi(xore_giorno_7, ore_giorno_7), ore_giorno_8 = f_somma60esimi(xore_giorno_8, ore_giorno_8), ore_giorno_9 = f_somma60esimi(xore_giorno_9, ore_giorno_9), ore_giorno_10 = f_somma60esimi(xore_giorno_10, ore_giorno_10), ore_giorno_11 = f_somma60esimi(xore_giorno_11, ore_giorno_11), ore_giorno_12 = f_somma60esimi(xore_giorno_12, ore_giorno_12), ore_giorno_13 = f_somma60esimi(xore_giorno_13, ore_giorno_13), ore_giorno_14 = f_somma60esimi(xore_giorno_14, ore_giorno_14), ore_giorno_15 = f_somma60esimi(xore_giorno_15, ore_giorno_15), ore_giorno_16 = f_somma60esimi(xore_giorno_16, ore_giorno_16), ore_giorno_17 = f_somma60esimi(xore_giorno_17, ore_giorno_17), ore_giorno_18 = f_somma60esimi(xore_giorno_18, ore_giorno_18), ore_giorno_19 = f_somma60esimi(xore_giorno_19, ore_giorno_19), ore_giorno_20 = f_somma60esimi(xore_giorno_20, ore_giorno_20), ore_giorno_21 = f_somma60esimi(xore_giorno_21, ore_giorno_21), ore_giorno_22 = f_somma60esimi(xore_giorno_22, ore_giorno_22), ore_giorno_23 = f_somma60esimi(xore_giorno_23, ore_giorno_23), ore_giorno_24 = f_somma60esimi(xore_giorno_24, ore_giorno_24), ore_giorno_25 = f_somma60esimi(xore_giorno_25, ore_giorno_25), ore_giorno_26 = f_somma60esimi(xore_giorno_26, ore_giorno_26), ore_giorno_27 = f_somma60esimi(xore_giorno_27, ore_giorno_27), ore_giorno_28 = f_somma60esimi(xore_giorno_28, ore_giorno_28), ore_giorno_29 = f_somma60esimi(xore_giorno_29, ore_giorno_29), ore_giorno_30 = f_somma60esimi(xore_giorno_30, ore_giorno_30), ore_giorno_31 = f_somma60esimi(xore_giorno_31, ore_giorno_31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end; end IF; if (uso_interno = 'S') then begin /* cancella e ricostruisce le timbrature con progetti interni */ delete from TT_TIMBRATURE_INTERNI where anno = xanno and mese = xmese and fk_anag = xfk_anag; insert into TT_TIMBRATURE_INTERNI select * from tt_timbrature where anno = xanno and mese = xmese and fk_anag = xfk_anag; /* aggiunge alle timbrature le ore del progetto interno che non ha stampato sopra */ update TT_TIMBRATURE_INTERNI set ore_giorno_1 = f_somma60esimi(xore_giorno_1, ore_giorno_1), ore_giorno_2 = f_somma60esimi(xore_giorno_2, ore_giorno_2), ore_giorno_3 = f_somma60esimi(xore_giorno_3, ore_giorno_3), ore_giorno_4 = f_somma60esimi(xore_giorno_4, ore_giorno_4), ore_giorno_5 = f_somma60esimi(xore_giorno_5, ore_giorno_5), ore_giorno_6 = f_somma60esimi(xore_giorno_6, ore_giorno_6), ore_giorno_7 = f_somma60esimi(xore_giorno_7, ore_giorno_7), ore_giorno_8 = f_somma60esimi(xore_giorno_8, ore_giorno_8), ore_giorno_9 = f_somma60esimi(xore_giorno_9, ore_giorno_9), ore_giorno_10 = f_somma60esimi(xore_giorno_10, ore_giorno_10), ore_giorno_11 = f_somma60esimi(xore_giorno_11, ore_giorno_11), ore_giorno_12 = f_somma60esimi(xore_giorno_12, ore_giorno_12), ore_giorno_13 = f_somma60esimi(xore_giorno_13, ore_giorno_13), ore_giorno_14 = f_somma60esimi(xore_giorno_14, ore_giorno_14), ore_giorno_15 = f_somma60esimi(xore_giorno_15, ore_giorno_15), ore_giorno_16 = f_somma60esimi(xore_giorno_16, ore_giorno_16), ore_giorno_17 = f_somma60esimi(xore_giorno_17, ore_giorno_17), ore_giorno_18 = f_somma60esimi(xore_giorno_18, ore_giorno_18), ore_giorno_19 = f_somma60esimi(xore_giorno_19, ore_giorno_19), ore_giorno_20 = f_somma60esimi(xore_giorno_20, ore_giorno_20), ore_giorno_21 = f_somma60esimi(xore_giorno_21, ore_giorno_21), ore_giorno_22 = f_somma60esimi(xore_giorno_22, ore_giorno_22), ore_giorno_23 = f_somma60esimi(xore_giorno_23, ore_giorno_23), ore_giorno_24 = f_somma60esimi(xore_giorno_24, ore_giorno_24), ore_giorno_25 = f_somma60esimi(xore_giorno_25, ore_giorno_25), ore_giorno_26 = f_somma60esimi(xore_giorno_26, ore_giorno_26), ore_giorno_27 = f_somma60esimi(xore_giorno_27, ore_giorno_27), ore_giorno_28 = f_somma60esimi(xore_giorno_28, ore_giorno_28), ore_giorno_29 = f_somma60esimi(xore_giorno_29, ore_giorno_29), ore_giorno_30 = f_somma60esimi(xore_giorno_30, ore_giorno_30), ore_giorno_31 = f_somma60esimi(xore_giorno_31, ore_giorno_31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end; end IF; end loop; close cursor_timesheet; set done = false; set xmese = xmese + 1; end; end while; END - Creating routine tempus_innodb.STAMPA_TIMESHEET_CROSS_TABLE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `STAMPA_TIMESHEET_CROSS_TABLE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XFK_AZIONE INTEGER ) BEGIN declare mese_max smallint; declare mese_min smallint; declare check_mese smallint; /***************** cancella dati utente dalle tabelle CROSS *****/ delete from TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL where fk_anag = xfk_anag and anno = xanno; delete from tt_timesheet_cross_table where fk_anag = xfk_anag and anno = xanno; /*and fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); */ delete from tt_timesheet_cross_table_altri_progetti where fk_anag = xfk_anag and anno = xanno; /*and fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); */ delete from tt_timesheet_cross_table_attivita_ordinaria where fk_anag = xfk_anag and anno = xanno; /******** fine cancellazione ************/ /********* inserisce ************/ /* progetto in stampa */ insert into tt_timesheet_cross_table select distinct 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, a.mese, a.totale_mese, a.totale_ore, a.costo_orario from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); /* altri progetti diversi da quello in stampa */ insert into tt_timesheet_cross_table_altri_progetti select distinct /* 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, a.mese, sum(a.totale_mese), sum(a.totale_ore), avg(a.costo_orario) */ 0, 0, 0, a.fk_anag, a.anno, a.mese, sum(a.totale_mese), sum(a.totale_ore), avg(a.costo_orario), 'Altri progetti finanziati (n.ore)' from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) group by a.fk_anag, a.anno, a.mese; /* timbrature già ricalcolate rispetto alle originali */ insert into tt_timesheet_cross_table_attivita_ordinaria select distinct 0, a.fk_anag, a.anno, a.mese, 0, a.totale_mese, 0, 'Attività ordinaria' from TT_TIMBRATURE a where a.fk_anag = xfk_anag and a.anno = xanno; /******** fine inserimento *********/ /***** compila i mesi che mancano da inizio anno se sta stampando da aprile a dicembre inserisce gennaio a marzo lo fa su tutte e tre le tabelle ma separatamente perche gli altri progetti e le attivita ordinarie potrebbero essere compilate ****/ select min(mese) from tt_timesheet_cross_table where fk_anag = xfk_anag and anno = xanno and fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) into mese_min; set check_mese = mese_min; while (check_mese >1) do begin set check_mese = check_mese - 1; insert into tt_timesheet_cross_table select distinct 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, check_mese, 0, 0, 0 from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) and mese = mese_min; end; end while; /***** compila i mesi che mancano per terminare anno se sta stampando da gennaio a marzo mette a zero da aprile a dicembre lo fa su tutte e tre le tabelle ma separatamente perche gli altri progetti e le attivita ordinarie potrebbero essere compilate ****/ select max(mese) into mese_max from tt_timesheet_cross_table where fk_anag = xfk_anag and anno = xanno and fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); set check_mese = mese_max; while (check_mese <12) do begin set check_mese = check_mese +1; insert into tt_timesheet_cross_table select distinct 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, check_mese, 0, 0, 0 from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) and mese = mese_max; end; end while; select max(mese) into mese_max from tt_timesheet_cross_table_altri_progetti where fk_anag = xfk_anag and anno = xanno and fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); set check_mese = mese_max; while (check_mese <12) do begin set check_mese = check_mese +1; insert into tt_timesheet_cross_table_altri_progetti select distinct /* 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, check_mese, 0, 0, 0 */ 0, 0, 0, a.fk_anag, a.anno, check_mese, 0, 0, 0, 'Altri progetti finanziati (n.ore)' from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) and mese = mese_max; end; end while; select max(mese) into mese_max from tt_timesheet_cross_table_attivita_ordinaria where fk_anag = xfk_anag and anno = xanno; set check_mese = mese_max; while (check_mese <12) do begin set check_mese = check_mese +1; insert into tt_timesheet_cross_table_attivita_ordinaria select distinct 0, a.fk_anag, a.anno, check_mese, 0, 0, 0, 'Attività ordinaria' from tt_timbrature a where a.fk_anag = xfk_anag and a.anno = xanno; end; end while; /***** fine compilazione ********/ /*** compila tabella CROSS riepilogativa con le righe di stampa 1/2/3 *******/ insert into TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL select a.*, 'Attività svolta sul progetto', 1 from TT_TIMESHEET_CROSS_TABLE a where fk_anag = xfk_anag and anno = xanno; insert into TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL select a.*, 2 from tt_timesheet_cross_table_altri_progetti a where fk_anag = xfk_anag and anno = xanno; insert into TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL select 0, 0, 0, fk_anag, anno, mese, totale_mese, totale_ore, costo_orario, attivita_stp, 3 from tt_timesheet_cross_table_attivita_ordinaria a where fk_anag = xfk_anag and anno = xanno; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `STAMPA_TIMESHEET_CROSS_TABLE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XFK_AZIONE INTEGER ) BEGIN declare mese_max smallint; declare mese_min smallint; declare check_mese smallint; /***************** cancella dati utente dalle tabelle CROSS *****/ delete from TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL where fk_anag = xfk_anag and anno = xanno; delete from tt_timesheet_cross_table where fk_anag = xfk_anag and anno = xanno; /*and fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); */ delete from tt_timesheet_cross_table_altri_progetti where fk_anag = xfk_anag and anno = xanno; /*and fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); */ delete from tt_timesheet_cross_table_attivita_ordinaria where fk_anag = xfk_anag and anno = xanno; /******** fine cancellazione ************/ /********* inserisce ************/ /* progetto in stampa */ insert into tt_timesheet_cross_table select distinct 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, a.mese, a.totale_mese, a.totale_ore, a.costo_orario from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); /* altri progetti diversi da quello in stampa */ insert into tt_timesheet_cross_table_altri_progetti select distinct /* 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, a.mese, sum(a.totale_mese), sum(a.totale_ore), avg(a.costo_orario) */ 0, 0, 0, a.fk_anag, a.anno, a.mese, sum(a.totale_mese), sum(a.totale_ore), avg(a.costo_orario), 'Altri progetti finanziati (n.ore)' from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) group by a.fk_anag, a.anno, a.mese; /* timbrature già ricalcolate rispetto alle originali */ insert into tt_timesheet_cross_table_attivita_ordinaria select distinct 0, a.fk_anag, a.anno, a.mese, 0, a.totale_mese, 0, 'Attività ordinaria' from TT_TIMBRATURE a where a.fk_anag = xfk_anag and a.anno = xanno; /******** fine inserimento *********/ /***** compila i mesi che mancano da inizio anno se sta stampando da aprile a dicembre inserisce gennaio a marzo lo fa su tutte e tre le tabelle ma separatamente perche gli altri progetti e le attivita ordinarie potrebbero essere compilate ****/ select min(mese) from tt_timesheet_cross_table where fk_anag = xfk_anag and anno = xanno and fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) into mese_min; set check_mese = mese_min; while (check_mese >1) do begin set check_mese = check_mese - 1; insert into tt_timesheet_cross_table select distinct 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, check_mese, 0, 0, 0 from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) and mese = mese_min; end; end while; /***** compila i mesi che mancano per terminare anno se sta stampando da gennaio a marzo mette a zero da aprile a dicembre lo fa su tutte e tre le tabelle ma separatamente perche gli altri progetti e le attivita ordinarie potrebbero essere compilate ****/ select max(mese) into mese_max from tt_timesheet_cross_table where fk_anag = xfk_anag and anno = xanno and fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); set check_mese = mese_max; while (check_mese <12) do begin set check_mese = check_mese +1; insert into tt_timesheet_cross_table select distinct 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, check_mese, 0, 0, 0 from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) and mese = mese_max; end; end while; select max(mese) into mese_max from tt_timesheet_cross_table_altri_progetti where fk_anag = xfk_anag and anno = xanno and fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione); set check_mese = mese_max; while (check_mese <12) do begin set check_mese = check_mese +1; insert into tt_timesheet_cross_table_altri_progetti select distinct /* 0, a.fk_azione_struttura, a.nsal, a.fk_anag, a.anno, check_mese, 0, 0, 0 */ 0, 0, 0, a.fk_anag, a.anno, check_mese, 0, 0, 0, 'Altri progetti finanziati (n.ore)' from tt_timesheet a where a.fk_anag = xfk_anag and a.anno = xanno and a.fk_azione_struttura not in (select distinct pk_progressivo from ts_azione_struttura where fk_azione = xfk_azione) and mese = mese_max; end; end while; select max(mese) into mese_max from tt_timesheet_cross_table_attivita_ordinaria where fk_anag = xfk_anag and anno = xanno; set check_mese = mese_max; while (check_mese <12) do begin set check_mese = check_mese +1; insert into tt_timesheet_cross_table_attivita_ordinaria select distinct 0, a.fk_anag, a.anno, check_mese, 0, 0, 0, 'Attività ordinaria' from tt_timbrature a where a.fk_anag = xfk_anag and a.anno = xanno; end; end while; /***** fine compilazione ********/ /*** compila tabella CROSS riepilogativa con le righe di stampa 1/2/3 *******/ insert into TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL select a.*, 'Attività svolta sul progetto', 1 from TT_TIMESHEET_CROSS_TABLE a where fk_anag = xfk_anag and anno = xanno; insert into TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL select a.*, 2 from tt_timesheet_cross_table_altri_progetti a where fk_anag = xfk_anag and anno = xanno; insert into TT_TIMESHEET_CROSS_TABLE_SUMMARY_ALL select 0, 0, 0, fk_anag, anno, mese, totale_mese, totale_ore, costo_orario, attivita_stp, 3 from tt_timesheet_cross_table_attivita_ordinaria a where fk_anag = xfk_anag and anno = xanno; END$$ ' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 188. SQL Error: 1064 - Creating routine tempus_innodb.test_cancella Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `test_cancella`(out sql_comm integer) BEGIN declare aa integer; set aa = 2023; set @sql_string = 'select count(*) into @valore from TT_TIMESHEET where anno = '||aa; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; select @valore into sql_comm; END - Creating routine tempus_innodb.UTILS_ASSEGNA_PERMESSI_AUDITOR Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `UTILS_ASSEGNA_PERMESSI_AUDITOR`( IN XUTENTE CHAR(10), IN XFK_ANAG INTEGER, IN ASSEGNA_REVOCA SMALLINT) BEGIN /* revoca i permessi */ delete from sys_utenti_pgm where fk_prog_utenti = xfk_anag and utente = xutente and fk_tag in (select distinct fk_tag from sys_utenti_pgm_auditor); delete from sys_utenti_mansione where fk_utente = xfk_anag and mansione_tabella = 'AU'; update sys_config_utente set flag_auditor = 'N' where fk_utente = xfk_anag; /* se richiesta di assegnazione li assegna e avendoli prima cancellati non da errore */ if assegna_revoca = 0 then begin update sys_utenti_pgm_auditor set fk_prog_utenti = xfk_anag, utente = xutente; insert into sys_utenti_pgm select 0, fk_prog_utenti, utente, fk_tag, tag_autorizzato from sys_utenti_pgm_auditor; insert into sys_utenti_mansione values (0, xfk_anag, xutente, 'AU'); update sys_config_utente set flag_auditor = 'S' where fk_utente = xfk_anag; end; end IF; END - Creating routine tempus_innodb.UTILS_ASSEGNA_PERMESSI_REFQUAL Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `UTILS_ASSEGNA_PERMESSI_REFQUAL`( IN XUTENTE CHAR(10), IN XFK_ANAG INTEGER, IN ASSEGNA_REVOCA SMALLINT) BEGIN /* revoca i permessi */ delete from sys_utenti_pgm where fk_prog_utenti = xfk_anag and utente = xutente and fk_tag in (select distinct fk_tag from sys_utenti_pgm_refqual); delete from sys_utenti_mansione where fk_utente = xfk_anag and mansione_tabella = 'RQ'; update sys_config_utente set flag_refqual = 'N' where fk_utente = xfk_anag; /* se richiesta di assegnazione li assegna e avendoli prima cancellati non da errore */ if assegna_revoca = 0 then begin update sys_utenti_pgm_refqual set fk_prog_utenti = xfk_anag, utente = xutente; insert into sys_utenti_pgm select 0, fk_prog_utenti, utente, fk_tag, tag_autorizzato from sys_utenti_pgm_refqual; insert into sys_utenti_mansione values (0, xfk_anag, xutente, 'RQ'); update sys_config_utente set flag_refqual = 'S' where fk_utente = xfk_anag; end; end IF; END - Creating routine tempus_innodb.UTILS_ASSEGNA_PERMESSI_RESPONSABILE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `UTILS_ASSEGNA_PERMESSI_RESPONSABILE`( IN XUTENTE CHAR(10), IN XFK_ANAG INTEGER, IN ASSEGNA_REVOCA SMALLINT) BEGIN /* revoca i permessi */ delete from sys_utenti_pgm where fk_prog_utenti = xfk_anag and utente = xutente and fk_tag in (select distinct fk_tag from SYS_UTENTI_PGM_RESPONSABILE); update sys_config_utente set flag_responsabile = 'N' where fk_utente = xfk_anag; /* se richiesta di assegnazione li assegna e avendoli prima cancellati non da errore */ if assegna_revoca = 0 then begin update SYS_UTENTI_PGM_RESPONSABILE set fk_prog_utenti = xfk_anag, utente = xutente; insert into sys_utenti_pgm select 0, fk_prog_utenti, utente, fk_tag, tag_autorizzato from SYS_UTENTI_PGM_RESPONSABILE; update sys_config_utente set flag_responsabile = 'S' where fk_utente = xfk_anag; end; end IF; END - Creating routine tempus_innodb.UTILS_ASSEGNA_PERMESSI_UTENTE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `UTILS_ASSEGNA_PERMESSI_UTENTE`( IN XUTENTE CHAR(10), IN XFK_ANAG INTEGER, IN ASSEGNA_REVOCA SMALLINT) BEGIN /* assegna_revoca = 0 assegna assegna_revova = 1 revoca */ /* revoca i permessi lo fa anche con 0 e poi li ricostruisce */ delete from sys_utenti_pgm where fk_prog_utenti = xfk_anag and fk_tag in (select distinct fk_tag from sys_utenti_pgm_utente); update sys_config_utente set flag_responsabile = 'N', flag_auditor = 'N', flag_refqual = 'N' where pk_progressivo = xfk_anag; DELETE FROM sys_utenti_mansione WHERE fk_utente = xfk_anag AND mansione_tabella = 'UT'; /* se richiesta di assegnazione li assegna e avendoli prima cancellati non da errore */ if assegna_revoca = 0 then begin /* inutile passo i valori di utente e pk_progressivo dalle var della proc update sys_utenti_pgm_utente set fk_prog_utenti = xfk_anag, utente = xutente; */ insert into sys_utenti_pgm select 0, xfk_anag, xutente, fk_tag, tag_autorizzato from sys_utenti_pgm_utente; insert into sys_utenti_mansione values (0, xfk_anag, xutente, 'UT'); end; end IF; END - Creating routine tempus_innodb.UTILS_RICALCOLA_IDX_RISCHIO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `UTILS_RICALCOLA_IDX_RISCHIO`() BEGIN declare xpk_progressivo integer; declare xindice_gravita smallint; declare xindice_rilevabilita smallint; declare done bool default false; declare cursor_statistiche cursor for select a.pk_progressivo, indice_gravita, indice_rilevabilita from nc_sezionec_1 a, sys_statistiche_gravita b, sys_statistiche_rilevabilita c where a.fk_gravita = b.pk_progressivo and a.fk_rilevabilita = c.pk_progressivo and c.indice_rilevabilita < 9999 and b.indice_gravita < 9999; declare continue handler for not found set done = true; open cursor_statistiche; read_loop : loop fetch cursor_statistiche into xpk_progressivo, xindice_gravita, xindice_rilevabilita; if done then leave read_loop; end if; update nc_sezionec_1 set idx_rischio = (xindice_gravita * xindice_rilevabilita) where pk_progressivo = xpk_progressivo; end loop; close cursor_statistiche; END - Creating routine tempus_innodb.VALIDA_TIMESHEET_MANUALE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `VALIDA_TIMESHEET_MANUALE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN declare xfk_azione integer; declare conta_rec smallint; declare ore01 double precision; declare ore02 double precision; declare ore03 double precision; declare ore04 double precision; declare ore05 double precision; declare ore06 double precision; declare ore07 double precision; declare ore08 double precision; declare ore09 double precision; declare ore10 double precision; declare ore11 double precision; declare ore12 double precision; declare ore13 double precision; declare ore14 double precision; declare ore15 double precision; declare ore16 double precision; declare ore17 double precision; declare ore18 double precision; declare ore19 double precision; declare ore20 double precision; declare ore21 double precision; declare ore22 double precision; declare ore23 double precision; declare ore24 double precision; declare ore25 double precision; declare ore26 double precision; declare ore27 double precision; declare ore28 double precision; declare ore29 double precision; declare ore30 double precision; declare ore31 double precision; /* morexx sono le ore del ts manuale servono per calcolare la differenza tra originale e manuale*/ declare more01 double precision; declare more02 double precision; declare more03 double precision; declare more04 double precision; declare more05 double precision; declare more06 double precision; declare more07 double precision; declare more08 double precision; declare more09 double precision; declare more10 double precision; declare more11 double precision; declare more12 double precision; declare more13 double precision; declare more14 double precision; declare more15 double precision; declare more16 double precision; declare more17 double precision; declare more18 double precision; declare more19 double precision; declare more20 double precision; declare more21 double precision; declare more22 double precision; declare more23 double precision; declare more24 double precision; declare more25 double precision; declare more26 double precision; declare more27 double precision; declare more28 double precision; declare more29 double precision; declare more30 double precision; declare more31 double precision; /* dorexx sono le differenze tra ts originale e manuale usate per ricalcolare ore attivita istituzionale*/ declare dore01 double precision; declare dore02 double precision; declare dore03 double precision; declare dore04 double precision; declare dore05 double precision; declare dore06 double precision; declare dore07 double precision; declare dore08 double precision; declare dore09 double precision; declare dore10 double precision; declare dore11 double precision; declare dore12 double precision; declare dore13 double precision; declare dore14 double precision; declare dore15 double precision; declare dore16 double precision; declare dore17 double precision; declare dore18 double precision; declare dore19 double precision; declare dore20 double precision; declare dore21 double precision; declare dore22 double precision; declare dore23 double precision; declare dore24 double precision; declare dore25 double precision; declare dore26 double precision; declare dore27 double precision; declare dore28 double precision; declare dore29 double precision; declare dore30 double precision; declare dore31 double precision; /* salvo i dati del timesheet manuale */ select count(*) into conta_rec from tt_timesheet_manuale where anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura and fk_anag = xfk_anag and flag_validato = 'S'; if (conta_rec is null) then set conta_rec = 0; end IF; if (conta_rec > 0) then begin /* memorizza il timesheet originale */ select ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31 into ore01, ore02, ore03, ore04, ore05, ore06, ore07, ore08, ore09, ore10, ore11, ore12, ore13, ore14, ore15, ore16, ore17, ore18, ore19, ore20, ore21, ore22, ore23, ore24, ore25, ore26, ore27, ore28, ore29, ore30, ore31 from tt_timesheet where anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura and fk_anag = xfk_anag; /* scala le ore del timesheet originale dalla somma della azione */ select distinct fk_azione into xfk_azione from ts_azione_struttura where pk_progressivo = xfk_azione_struttura; update tt_timesheet_somma_azione set ore_giorno_1 = f_somma60esimi_negativi(ore_giorno_1, (ore01 * -1)), ore_giorno_2 = f_somma60esimi_negativi(ore_giorno_2, (ore02 * -1)), ore_giorno_3 = f_somma60esimi_negativi(ore_giorno_3, (ore03 * -1)), ore_giorno_4 = f_somma60esimi_negativi(ore_giorno_4, (ore04 * -1)), ore_giorno_5 = f_somma60esimi_negativi(ore_giorno_5, (ore05 * -1)), ore_giorno_6 = f_somma60esimi_negativi(ore_giorno_6, (ore06 * -1)), ore_giorno_7 = f_somma60esimi_negativi(ore_giorno_7, (ore07 * -1)), ore_giorno_8 = f_somma60esimi_negativi(ore_giorno_8, (ore08 * -1)), ore_giorno_9 = f_somma60esimi_negativi(ore_giorno_9, (ore09 * -1)), ore_giorno_10= f_somma60esimi_negativi(ore_giorno_10, (ore10 * -1)), ore_giorno_11= f_somma60esimi_negativi(ore_giorno_11, (ore11 * -1)), ore_giorno_12= f_somma60esimi_negativi(ore_giorno_12, (ore12 * -1)), ore_giorno_13= f_somma60esimi_negativi(ore_giorno_13, (ore13 * -1)), ore_giorno_14= f_somma60esimi_negativi(ore_giorno_14, (ore14 * -1)), ore_giorno_15= f_somma60esimi_negativi(ore_giorno_15, (ore15 * -1)), ore_giorno_16= f_somma60esimi_negativi(ore_giorno_16, (ore16 * -1)), ore_giorno_17= f_somma60esimi_negativi(ore_giorno_17, (ore17 * -1)), ore_giorno_18= f_somma60esimi_negativi(ore_giorno_18, (ore18 * -1)), ore_giorno_19= f_somma60esimi_negativi(ore_giorno_19, (ore19 * -1)), ore_giorno_20= f_somma60esimi_negativi(ore_giorno_20, (ore20 * -1)), ore_giorno_21= f_somma60esimi_negativi(ore_giorno_21, (ore21 * -1)), ore_giorno_22= f_somma60esimi_negativi(ore_giorno_22, (ore22 * -1)), ore_giorno_23= f_somma60esimi_negativi(ore_giorno_23, (ore23 * -1)), ore_giorno_24= f_somma60esimi_negativi(ore_giorno_24, (ore24 * -1)), ore_giorno_25= f_somma60esimi_negativi(ore_giorno_25, (ore25 * -1)), ore_giorno_26= f_somma60esimi_negativi(ore_giorno_26, (ore26 * -1)), ore_giorno_27= f_somma60esimi_negativi(ore_giorno_27, (ore27 * -1)), ore_giorno_28= f_somma60esimi_negativi(ore_giorno_28, (ore28 * -1)), ore_giorno_29= f_somma60esimi_negativi(ore_giorno_29, (ore29 * -1)), ore_giorno_30= f_somma60esimi_negativi(ore_giorno_30, (ore30 * -1)), ore_giorno_31= f_somma60esimi_negativi(ore_giorno_31, (ore31 * -1)) where fk_azione = xfk_azione and anno = xanno and mese = xmese and fk_anag = xfk_anag; /* scala le ore dal riepilogo generale */ update tt_timesheet_riepilogo set ore_giorno_1 = f_somma60esimi_negativi(ore_giorno_1, (ore01 * -1)), ore_giorno_2 = f_somma60esimi_negativi(ore_giorno_2, (ore02 * -1)), ore_giorno_3 = f_somma60esimi_negativi(ore_giorno_3, (ore03 * -1)), ore_giorno_4 = f_somma60esimi_negativi(ore_giorno_4, (ore04 * -1)), ore_giorno_5 = f_somma60esimi_negativi(ore_giorno_5, (ore05 * -1)), ore_giorno_6 = f_somma60esimi_negativi(ore_giorno_6, (ore06 * -1)), ore_giorno_7 = f_somma60esimi_negativi(ore_giorno_7, (ore07 * -1)), ore_giorno_8 = f_somma60esimi_negativi(ore_giorno_8, (ore08 * -1)), ore_giorno_9 = f_somma60esimi_negativi(ore_giorno_9, (ore09 * -1)), ore_giorno_10= f_somma60esimi_negativi(ore_giorno_10, (ore10 * -1)), ore_giorno_11= f_somma60esimi_negativi(ore_giorno_11, (ore11 * -1)), ore_giorno_12= f_somma60esimi_negativi(ore_giorno_12, (ore12 * -1)), ore_giorno_13= f_somma60esimi_negativi(ore_giorno_13, (ore13 * -1)), ore_giorno_14= f_somma60esimi_negativi(ore_giorno_14, (ore14 * -1)), ore_giorno_15= f_somma60esimi_negativi(ore_giorno_15, (ore15 * -1)), ore_giorno_16= f_somma60esimi_negativi(ore_giorno_16, (ore16 * -1)), ore_giorno_17= f_somma60esimi_negativi(ore_giorno_17, (ore17 * -1)), ore_giorno_18= f_somma60esimi_negativi(ore_giorno_18, (ore18 * -1)), ore_giorno_19= f_somma60esimi_negativi(ore_giorno_19, (ore19 * -1)), ore_giorno_20= f_somma60esimi_negativi(ore_giorno_20, (ore20 * -1)), ore_giorno_21= f_somma60esimi_negativi(ore_giorno_21, (ore21 * -1)), ore_giorno_22= f_somma60esimi_negativi(ore_giorno_22, (ore22 * -1)), ore_giorno_23= f_somma60esimi_negativi(ore_giorno_23, (ore23 * -1)), ore_giorno_24= f_somma60esimi_negativi(ore_giorno_24, (ore24 * -1)), ore_giorno_25= f_somma60esimi_negativi(ore_giorno_25, (ore25 * -1)), ore_giorno_26= f_somma60esimi_negativi(ore_giorno_26, (ore26 * -1)), ore_giorno_27= f_somma60esimi_negativi(ore_giorno_27, (ore27 * -1)), ore_giorno_28= f_somma60esimi_negativi(ore_giorno_28, (ore28 * -1)), ore_giorno_29= f_somma60esimi_negativi(ore_giorno_29, (ore29 * -1)), ore_giorno_30= f_somma60esimi_negativi(ore_giorno_30, (ore30 * -1)), ore_giorno_31= f_somma60esimi_negativi(ore_giorno_31, (ore31 * -1)) where anno = xanno and mese = xmese and fk_anag = xfk_anag; /* Legge il ts manuale e aggiorna il timesheet originale */ select ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31 into more01, more02, more03, more04, more05, more06, more07, more08, more09, more10, more11, more12, more13, more14, more15, more16, more17, more18, more19, more20, more21, more22, more23, more24, more25, more26, more27, more28, more29, more30, more31 from tt_timesheet_manuale where anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura and fk_anag = xfk_anag and flag_validato = 'S'; /* aggiorno il timesheet con i dati del manuale i trigger dovrebbero aggiornare tutte le altre tabelle*/ update tt_timesheet set ore_giorno_1 = more01, ore_giorno_2 = more02, ore_giorno_3 = more03, ore_giorno_4 = more04, ore_giorno_5 = more05, ore_giorno_6 = more06, ore_giorno_7 = more07, ore_giorno_8 = more08, ore_giorno_9 = more09, ore_giorno_10 = more10, ore_giorno_11 = more11, ore_giorno_12 = more12, ore_giorno_13 = more13, ore_giorno_14 = more14, ore_giorno_15 = more15, ore_giorno_16 = more16, ore_giorno_17 = more17, ore_giorno_18 = more18, ore_giorno_19 = more19, ore_giorno_20 = more20, ore_giorno_21 = more21, ore_giorno_22 = more22, ore_giorno_23 = more23, ore_giorno_24 = more24, ore_giorno_25 = more25, ore_giorno_26 = more26, ore_giorno_27 = more27, ore_giorno_28 = more28, ore_giorno_29 = more29, ore_giorno_30 = more30, ore_giorno_31 = more31 where fk_anag = xfk_anag and fk_azione_struttura = xfk_azione_struttura and anno = xanno and mese = xmese; /* ricalcola la somma della azione che contiene il totale di tutte le fk_azione_struttura e quindi lavora per fk_azione */ update tt_timesheet_somma_azione set ore_giorno_1 = f_somma60esimi(ore_giorno_1,more01), ore_giorno_2 = f_somma60esimi(ore_giorno_2,more02), ore_giorno_3 = f_somma60esimi(ore_giorno_3,more03), ore_giorno_4 = f_somma60esimi(ore_giorno_4,more04), ore_giorno_5 = f_somma60esimi(ore_giorno_5,more05), ore_giorno_6 = f_somma60esimi(ore_giorno_6,more06), ore_giorno_7 = f_somma60esimi(ore_giorno_7,more07), ore_giorno_8 = f_somma60esimi(ore_giorno_8,more08), ore_giorno_9 = f_somma60esimi(ore_giorno_9,more09), ore_giorno_10= f_somma60esimi(ore_giorno_10,more10), ore_giorno_11= f_somma60esimi(ore_giorno_11,more11), ore_giorno_12= f_somma60esimi(ore_giorno_12,more12), ore_giorno_13= f_somma60esimi(ore_giorno_13,more13), ore_giorno_14= f_somma60esimi(ore_giorno_14,more14), ore_giorno_15= f_somma60esimi(ore_giorno_15,more15), ore_giorno_16= f_somma60esimi(ore_giorno_16,more16), ore_giorno_17= f_somma60esimi(ore_giorno_17,more17), ore_giorno_18= f_somma60esimi(ore_giorno_18,more18), ore_giorno_19= f_somma60esimi(ore_giorno_19,more19), ore_giorno_20= f_somma60esimi(ore_giorno_20,more20), ore_giorno_21= f_somma60esimi(ore_giorno_21,more21), ore_giorno_22= f_somma60esimi(ore_giorno_22,more22), ore_giorno_23= f_somma60esimi(ore_giorno_23,more23), ore_giorno_24= f_somma60esimi(ore_giorno_24,more24), ore_giorno_25= f_somma60esimi(ore_giorno_25,more25), ore_giorno_26= f_somma60esimi(ore_giorno_26,more26), ore_giorno_27= f_somma60esimi(ore_giorno_27,more27), ore_giorno_28= f_somma60esimi(ore_giorno_28,more28), ore_giorno_29= f_somma60esimi(ore_giorno_29,more29), ore_giorno_30= f_somma60esimi(ore_giorno_30,more30), ore_giorno_31= f_somma60esimi(ore_giorno_31,more31) where fk_azione = xfk_azione and anno = xanno and mese = xmese and fk_anag = xfk_anag; /* ricalcola il riepilogo generale */ update tt_timesheet_riepilogo set ore_giorno_1 = f_somma60esimi(ore_giorno_1,more01), ore_giorno_2 = f_somma60esimi(ore_giorno_2,more02), ore_giorno_3 = f_somma60esimi(ore_giorno_3,more03), ore_giorno_4 = f_somma60esimi(ore_giorno_4,more04), ore_giorno_5 = f_somma60esimi(ore_giorno_5,more05), ore_giorno_6 = f_somma60esimi(ore_giorno_6,more06), ore_giorno_7 = f_somma60esimi(ore_giorno_7,more07), ore_giorno_8 = f_somma60esimi(ore_giorno_8,more08), ore_giorno_9 = f_somma60esimi(ore_giorno_9,more09), ore_giorno_10= f_somma60esimi(ore_giorno_10,more10), ore_giorno_11= f_somma60esimi(ore_giorno_11,more11), ore_giorno_12= f_somma60esimi(ore_giorno_12,more12), ore_giorno_13= f_somma60esimi(ore_giorno_13,more13), ore_giorno_14= f_somma60esimi(ore_giorno_14,more14), ore_giorno_15= f_somma60esimi(ore_giorno_15,more15), ore_giorno_16= f_somma60esimi(ore_giorno_16,more16), ore_giorno_17= f_somma60esimi(ore_giorno_17,more17), ore_giorno_18= f_somma60esimi(ore_giorno_18,more18), ore_giorno_19= f_somma60esimi(ore_giorno_19,more19), ore_giorno_20= f_somma60esimi(ore_giorno_20,more20), ore_giorno_21= f_somma60esimi(ore_giorno_21,more21), ore_giorno_22= f_somma60esimi(ore_giorno_22,more22), ore_giorno_23= f_somma60esimi(ore_giorno_23,more23), ore_giorno_24= f_somma60esimi(ore_giorno_24,more24), ore_giorno_25= f_somma60esimi(ore_giorno_25,more25), ore_giorno_26= f_somma60esimi(ore_giorno_26,more26), ore_giorno_27= f_somma60esimi(ore_giorno_27,more27), ore_giorno_28= f_somma60esimi(ore_giorno_28,more28), ore_giorno_29= f_somma60esimi(ore_giorno_29,more29), ore_giorno_30= f_somma60esimi(ore_giorno_30,more30), ore_giorno_31= f_somma60esimi(ore_giorno_31,more31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; /* calcola se il delta tra ore orig e manuali sono negative o meno */ if (ore01 >= more01) then set dore01 = f_calcola_differenza_ore(ore01, more01); end IF; if (ore01 < more01) then set dore01 = f_calcola_differenza_ore(ore01, more01) * -1; end IF; if (ore02 >= more02) then set dore02 = f_calcola_differenza_ore(ore02, more02); end IF; if (ore02 < more02) then set dore02 = f_calcola_differenza_ore(ore02, more02) * -1; end IF; if (ore03 >= more03) then set dore03 = f_calcola_differenza_ore(ore03, more03); end IF; if (ore03 < more03) then set dore03 = f_calcola_differenza_ore(ore03, more03) * -1; end IF; if (ore04 >= more04) then set dore04 = f_calcola_differenza_ore(ore04, more04); end IF; if (ore04 < more04) then set dore04 = f_calcola_differenza_ore(ore04, more04) * -1; end IF; if (ore05 >= more05) then set dore05 = f_calcola_differenza_ore(ore05, more05); end IF; if (ore05 < more05) then set dore05 = f_calcola_differenza_ore(ore05, more05) * -1; end IF; if (ore06 >= more06) then set dore06 = f_calcola_differenza_ore(ore06, more06); end IF; if (ore06 < more06) then set dore06 = f_calcola_differenza_ore(ore06, more06) * -1; end IF; if (ore07 >= more07) then set dore07 = f_calcola_differenza_ore(ore07, more07); end IF; if (ore07 < more07) then set dore07 = f_calcola_differenza_ore(ore07, more07) * -1; end IF; if (ore08 >= more08) then set dore08 = f_calcola_differenza_ore(ore08, more08); end IF; if (ore08 < more08) then set dore08 = f_calcola_differenza_ore(ore08, more08) * -1; end IF; if (ore09 >= more09) then set dore09 = f_calcola_differenza_ore(ore09, more09); end IF; if (ore09 < more09) then set dore09 = f_calcola_differenza_ore(ore09, more09) * -1; end IF; if (ore10 >= more10) then set dore10 = f_calcola_differenza_ore(ore10, more10); end IF; if (ore10 < more10) then set dore10 = f_calcola_differenza_ore(ore10, more10) * -1; end IF; if (ore11 >= more11) then set dore11 = f_calcola_differenza_ore(ore11, more11); end IF; if (ore11 < more11) then set dore11 = f_calcola_differenza_ore(ore11, more11) * -1; end IF; if (ore12 >= more12) then set dore12 = f_calcola_differenza_ore(ore12, more12); end IF; if (ore12 < more12) then set dore12 = f_calcola_differenza_ore(ore12, more12) * -1; end IF; if (ore13 >= more13) then set dore13 = f_calcola_differenza_ore(ore13, more13); end IF; if (ore13 < more13) then set dore13 = f_calcola_differenza_ore(ore13, more13) * -1; end IF; if (ore14 >= more14) then set dore14 = f_calcola_differenza_ore(ore14, more14); end IF; if (ore14 < more14) then set dore14 = f_calcola_differenza_ore(ore14, more14) * -1; end IF; if (ore15 >= more15) then set dore15 = f_calcola_differenza_ore(ore15, more15); end IF; if (ore15 < more15) then set dore15 = f_calcola_differenza_ore(ore15, more15) * -1; end IF; if (ore16 >= more16) then set dore16 = f_calcola_differenza_ore(ore16, more16); end IF; if (ore16 < more16) then set dore16 = f_calcola_differenza_ore(ore16, more16) * -1; end IF; if (ore17 >= more17) then set dore17 = f_calcola_differenza_ore(ore17, more17); end IF; if (ore17 < more17) then set dore17 = f_calcola_differenza_ore(ore17, more17) * -1; end IF; if (ore18 >= more18) then set dore18 = f_calcola_differenza_ore(ore18, more18); end IF; if (ore18 < more18) then set dore18 = f_calcola_differenza_ore(ore18, more18) * -1; end IF; if (ore19 >= more19) then set dore19 = f_calcola_differenza_ore(ore19, more19); end IF; if (ore19 < more19) then set dore19 = f_calcola_differenza_ore(ore19, more19) * -1; end IF; if (ore20 >= more20) then set dore20 = f_calcola_differenza_ore(ore20, more20); end IF; if (ore20 < more20) then set dore20 = f_calcola_differenza_ore(ore20, more20) * -1; end IF; if (ore21 >= more21) then set dore21 = f_calcola_differenza_ore(ore21, more21); end IF; if (ore21 < more21) then set dore21 = f_calcola_differenza_ore(ore21, more21) * -1; end IF; if (ore22 >= more22) then set dore22 = f_calcola_differenza_ore(ore22, more22); end IF; if (ore22 < more22) then set dore22 = f_calcola_differenza_ore(ore22, more22) * -1; end IF; if (ore23 >= more23) then set dore23 = f_calcola_differenza_ore(ore23, more23); end IF; if (ore23 < more23) then set dore23 = f_calcola_differenza_ore(ore23, more23) * -1; end IF; if (ore24 >= more24) then set dore24 = f_calcola_differenza_ore(ore24, more24); end IF; if (ore24 < more24) then set dore24 = f_calcola_differenza_ore(ore24, more24) * -1; end IF; if (ore25 >= more25) then set dore25 = f_calcola_differenza_ore(ore25, more25); end IF; if (ore25 < more25) then set dore25 = f_calcola_differenza_ore(ore25, more25) * -1; end IF; if (ore26 >= more26) then set dore26 = f_calcola_differenza_ore(ore26, more26); end IF; if (ore26 < more26) then set dore26 = f_calcola_differenza_ore(ore26, more26) * -1; end IF; if (ore27 >= more27) then set dore27 = f_calcola_differenza_ore(ore27, more27); end IF; if (ore27 < more27) then set dore27 = f_calcola_differenza_ore(ore27, more27) * -1; end IF; if (ore28 >= more28) then set dore28 = f_calcola_differenza_ore(ore28, more28); end IF; if (ore28 < more28) then set dore28 = f_calcola_differenza_ore(ore28, more28) * -1; end IF; if (ore29 >= more29) then set dore29 = f_calcola_differenza_ore(ore29, more29); end IF; if (ore29 < more29) then set dore29 = f_calcola_differenza_ore(ore29, more29) * -1; end IF; if (ore30 >= more30) then set dore30 = f_calcola_differenza_ore(ore30, more30); end IF; if (ore30 < more30) then set dore30 = f_calcola_differenza_ore(ore30, more30) * -1; end IF; if (ore31 >= more31) then set dore31 = f_calcola_differenza_ore(ore31, more31); end IF; if (ore31 < more31) then set dore31 = f_calcola_differenza_ore(ore31, more31) * -1; end IF; /* scala la differenza tra ore dalle timbrature che in realtà è il totale delle attivita ordinarie e le nuove ore */ update tt_timbrature set ore_giorno_1 = f_somma60esimi_negativi_positivi(ore_giorno_1, dore01), ore_giorno_2 = f_somma60esimi_negativi_positivi(ore_giorno_2, dore02), ore_giorno_3 = f_somma60esimi_negativi_positivi(ore_giorno_3, dore03), ore_giorno_4 = f_somma60esimi_negativi_positivi(ore_giorno_4, dore04), ore_giorno_5 = f_somma60esimi_negativi_positivi(ore_giorno_5, dore05), ore_giorno_6 = f_somma60esimi_negativi_positivi(ore_giorno_6, dore06), ore_giorno_7 = f_somma60esimi_negativi_positivi(ore_giorno_7, dore07), ore_giorno_8 = f_somma60esimi_negativi_positivi(ore_giorno_8, dore08), ore_giorno_9 = f_somma60esimi_negativi_positivi(ore_giorno_9, dore09), ore_giorno_10= f_somma60esimi_negativi_positivi(ore_giorno_10, dore10), ore_giorno_11= f_somma60esimi_negativi_positivi(ore_giorno_11, dore11), ore_giorno_12= f_somma60esimi_negativi_positivi(ore_giorno_12, dore12), ore_giorno_13= f_somma60esimi_negativi_positivi(ore_giorno_13, dore13), ore_giorno_14= f_somma60esimi_negativi_positivi(ore_giorno_14, dore14), ore_giorno_15= f_somma60esimi_negativi_positivi(ore_giorno_15, dore15), ore_giorno_16= f_somma60esimi_negativi_positivi(ore_giorno_16, dore16), ore_giorno_17= f_somma60esimi_negativi_positivi(ore_giorno_17, dore17), ore_giorno_18= f_somma60esimi_negativi_positivi(ore_giorno_18, dore18), ore_giorno_19= f_somma60esimi_negativi_positivi(ore_giorno_19, dore19), ore_giorno_20= f_somma60esimi_negativi_positivi(ore_giorno_20, dore20), ore_giorno_21= f_somma60esimi_negativi_positivi(ore_giorno_21, dore21), ore_giorno_22= f_somma60esimi_negativi_positivi(ore_giorno_22, dore22), ore_giorno_23= f_somma60esimi_negativi_positivi(ore_giorno_23, dore23), ore_giorno_24= f_somma60esimi_negativi_positivi(ore_giorno_24, dore24), ore_giorno_25= f_somma60esimi_negativi_positivi(ore_giorno_25, dore25), ore_giorno_26= f_somma60esimi_negativi_positivi(ore_giorno_26, dore26), ore_giorno_27= f_somma60esimi_negativi_positivi(ore_giorno_27, dore27), ore_giorno_28= f_somma60esimi_negativi_positivi(ore_giorno_28, dore28), ore_giorno_29= f_somma60esimi_negativi_positivi(ore_giorno_29, dore29), ore_giorno_30= f_somma60esimi_negativi_positivi(ore_giorno_30, dore30), ore_giorno_31= f_somma60esimi_negativi_positivi(ore_giorno_31, dore31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end; end IF; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `VALIDA_TIMESHEET_MANUALE`( IN XFK_ANAG INTEGER, IN XANNO SMALLINT, IN XMESE SMALLINT, IN GG SMALLINT, IN ORE DOUBLE PRECISION ) BEGIN declare xfk_azione integer; declare conta_rec smallint; declare ore01 double precision; declare ore02 double precision; declare ore03 double precision; declare ore04 double precision; declare ore05 double precision; declare ore06 double precision; declare ore07 double precision; declare ore08 double precision; declare ore09 double precision; declare ore10 double precision; declare ore11 double precision; declare ore12 double precision; declare ore13 double precision; declare ore14 double precision; declare ore15 double precision; declare ore16 double precision; declare ore17 double precision; declare ore18 double precision; declare ore19 double precision; declare ore20 double precision; declare ore21 double precision; declare ore22 double precision; declare ore23 double precision; declare ore24 double precision; declare ore25 double precision; declare ore26 double precision; declare ore27 double precision; declare ore28 double precision; declare ore29 double precision; declare ore30 double precision; declare ore31 double precision; /* morexx sono le ore del ts manuale servono per calcolare la differenza tra originale e manuale*/ declare more01 double precision; declare more02 double precision; declare more03 double precision; declare more04 double precision; declare more05 double precision; declare more06 double precision; declare more07 double precision; declare more08 double precision; declare more09 double precision; declare more10 double precision; declare more11 double precision; declare more12 double precision; declare more13 double precision; declare more14 double precision; declare more15 double precision; declare more16 double precision; declare more17 double precision; declare more18 double precision; declare more19 double precision; declare more20 double precision; declare more21 double precision; declare more22 double precision; declare more23 double precision; declare more24 double precision; declare more25 double precision; declare more26 double precision; declare more27 double precision; declare more28 double precision; declare more29 double precision; declare more30 double precision; declare more31 double precision; /* dorexx sono le differenze tra ts originale e manuale usate per ricalcolare ore attivita istituzionale*/ declare dore01 double precision; declare dore02 double precision; declare dore03 double precision; declare dore04 double precision; declare dore05 double precision; declare dore06 double precision; declare dore07 double precision; declare dore08 double precision; declare dore09 double precision; declare dore10 double precision; declare dore11 double precision; declare dore12 double precision; declare dore13 double precision; declare dore14 double precision; declare dore15 double precision; declare dore16 double precision; declare dore17 double precision; declare dore18 double precision; declare dore19 double precision; declare dore20 double precision; declare dore21 double precision; declare dore22 double precision; declare dore23 double precision; declare dore24 double precision; declare dore25 double precision; declare dore26 double precision; declare dore27 double precision; declare dore28 double precision; declare dore29 double precision; declare dore30 double precision; declare dore31 double precision; /* salvo i dati del timesheet manuale */ select count(*) into conta_rec from tt_timesheet_manuale where anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura and fk_anag = xfk_anag and flag_validato = 'S'; if (conta_rec is null) then set conta_rec = 0; end IF; if (conta_rec > 0) then begin /* memorizza il timesheet originale */ select ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31 into ore01, ore02, ore03, ore04, ore05, ore06, ore07, ore08, ore09, ore10, ore11, ore12, ore13, ore14, ore15, ore16, ore17, ore18, ore19, ore20, ore21, ore22, ore23, ore24, ore25, ore26, ore27, ore28, ore29, ore30, ore31 from tt_timesheet where anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura and fk_anag = xfk_anag; /* scala le ore del timesheet originale dalla somma della azione */ select distinct fk_azione into xfk_azione from ts_azione_struttura where pk_progressivo = xfk_azione_struttura; update tt_timesheet_somma_azione set ore_giorno_1 = f_somma60esimi_negativi(ore_giorno_1, (ore01 * -1)), ore_giorno_2 = f_somma60esimi_negativi(ore_giorno_2, (ore02 * -1)), ore_giorno_3 = f_somma60esimi_negativi(ore_giorno_3, (ore03 * -1)), ore_giorno_4 = f_somma60esimi_negativi(ore_giorno_4, (ore04 * -1)), ore_giorno_5 = f_somma60esimi_negativi(ore_giorno_5, (ore05 * -1)), ore_giorno_6 = f_somma60esimi_negativi(ore_giorno_6, (ore06 * -1)), ore_giorno_7 = f_somma60esimi_negativi(ore_giorno_7, (ore07 * -1)), ore_giorno_8 = f_somma60esimi_negativi(ore_giorno_8, (ore08 * -1)), ore_giorno_9 = f_somma60esimi_negativi(ore_giorno_9, (ore09 * -1)), ore_giorno_10= f_somma60esimi_negativi(ore_giorno_10, (ore10 * -1)), ore_giorno_11= f_somma60esimi_negativi(ore_giorno_11, (ore11 * -1)), ore_giorno_12= f_somma60esimi_negativi(ore_giorno_12, (ore12 * -1)), ore_giorno_13= f_somma60esimi_negativi(ore_giorno_13, (ore13 * -1)), ore_giorno_14= f_somma60esimi_negativi(ore_giorno_14, (ore14 * -1)), ore_giorno_15= f_somma60esimi_negativi(ore_giorno_15, (ore15 * -1)), ore_giorno_16= f_somma60esimi_negativi(ore_giorno_16, (ore16 * -1)), ore_giorno_17= f_somma60esimi_negativi(ore_giorno_17, (ore17 * -1)), ore_giorno_18= f_somma60esimi_negativi(ore_giorno_18, (ore18 * -1)), ore_giorno_19= f_somma60esimi_negativi(ore_giorno_19, (ore19 * -1)), ore_giorno_20= f_somma60esimi_negativi(ore_giorno_20, (ore20 * -1)), ore_giorno_21= f_somma60esimi_negativi(ore_giorno_21, (ore21 * -1)), ore_giorno_22= f_somma60esimi_negativi(ore_giorno_22, (ore22 * -1)), ore_giorno_23= f_somma60esimi_negativi(ore_giorno_23, (ore23 * -1)), ore_giorno_24= f_somma60esimi_negativi(ore_giorno_24, (ore24 * -1)), ore_giorno_25= f_somma60esimi_negativi(ore_giorno_25, (ore25 * -1)), ore_giorno_26= f_somma60esimi_negativi(ore_giorno_26, (ore26 * -1)), ore_giorno_27= f_somma60esimi_negativi(ore_giorno_27, (ore27 * -1)), ore_giorno_28= f_somma60esimi_negativi(ore_giorno_28, (ore28 * -1)), ore_giorno_29= f_somma60esimi_negativi(ore_giorno_29, (ore29 * -1)), ore_giorno_30= f_somma60esimi_negativi(ore_giorno_30, (ore30 * -1)), ore_giorno_31= f_somma60esimi_negativi(ore_giorno_31, (ore31 * -1)) where fk_azione = xfk_azione and anno = xanno and mese = xmese and fk_anag = xfk_anag; /* scala le ore dal riepilogo generale */ update tt_timesheet_riepilogo set ore_giorno_1 = f_somma60esimi_negativi(ore_giorno_1, (ore01 * -1)), ore_giorno_2 = f_somma60esimi_negativi(ore_giorno_2, (ore02 * -1)), ore_giorno_3 = f_somma60esimi_negativi(ore_giorno_3, (ore03 * -1)), ore_giorno_4 = f_somma60esimi_negativi(ore_giorno_4, (ore04 * -1)), ore_giorno_5 = f_somma60esimi_negativi(ore_giorno_5, (ore05 * -1)), ore_giorno_6 = f_somma60esimi_negativi(ore_giorno_6, (ore06 * -1)), ore_giorno_7 = f_somma60esimi_negativi(ore_giorno_7, (ore07 * -1)), ore_giorno_8 = f_somma60esimi_negativi(ore_giorno_8, (ore08 * -1)), ore_giorno_9 = f_somma60esimi_negativi(ore_giorno_9, (ore09 * -1)), ore_giorno_10= f_somma60esimi_negativi(ore_giorno_10, (ore10 * -1)), ore_giorno_11= f_somma60esimi_negativi(ore_giorno_11, (ore11 * -1)), ore_giorno_12= f_somma60esimi_negativi(ore_giorno_12, (ore12 * -1)), ore_giorno_13= f_somma60esimi_negativi(ore_giorno_13, (ore13 * -1)), ore_giorno_14= f_somma60esimi_negativi(ore_giorno_14, (ore14 * -1)), ore_giorno_15= f_somma60esimi_negativi(ore_giorno_15, (ore15 * -1)), ore_giorno_16= f_somma60esimi_negativi(ore_giorno_16, (ore16 * -1)), ore_giorno_17= f_somma60esimi_negativi(ore_giorno_17, (ore17 * -1)), ore_giorno_18= f_somma60esimi_negativi(ore_giorno_18, (ore18 * -1)), ore_giorno_19= f_somma60esimi_negativi(ore_giorno_19, (ore19 * -1)), ore_giorno_20= f_somma60esimi_negativi(ore_giorno_20, (ore20 * -1)), ore_giorno_21= f_somma60esimi_negativi(ore_giorno_21, (ore21 * -1)), ore_giorno_22= f_somma60esimi_negativi(ore_giorno_22, (ore22 * -1)), ore_giorno_23= f_somma60esimi_negativi(ore_giorno_23, (ore23 * -1)), ore_giorno_24= f_somma60esimi_negativi(ore_giorno_24, (ore24 * -1)), ore_giorno_25= f_somma60esimi_negativi(ore_giorno_25, (ore25 * -1)), ore_giorno_26= f_somma60esimi_negativi(ore_giorno_26, (ore26 * -1)), ore_giorno_27= f_somma60esimi_negativi(ore_giorno_27, (ore27 * -1)), ore_giorno_28= f_somma60esimi_negativi(ore_giorno_28, (ore28 * -1)), ore_giorno_29= f_somma60esimi_negativi(ore_giorno_29, (ore29 * -1)), ore_giorno_30= f_somma60esimi_negativi(ore_giorno_30, (ore30 * -1)), ore_giorno_31= f_somma60esimi_negativi(ore_giorno_31, (ore31 * -1)) where anno = xanno and mese = xmese and fk_anag = xfk_anag; /* Legge il ts manuale e aggiorna il timesheet originale */ select ore_giorno_1, ore_giorno_2, ore_giorno_3, ore_giorno_4, ore_giorno_5, ore_giorno_6, ore_giorno_7, ore_giorno_8, ore_giorno_9, ore_giorno_10, ore_giorno_11, ore_giorno_12, ore_giorno_13, ore_giorno_14, ore_giorno_15, ore_giorno_16, ore_giorno_17, ore_giorno_18, ore_giorno_19, ore_giorno_20, ore_giorno_21, ore_giorno_22, ore_giorno_23, ore_giorno_24, ore_giorno_25, ore_giorno_26, ore_giorno_27, ore_giorno_28, ore_giorno_29, ore_giorno_30, ore_giorno_31 into more01, more02, more03, more04, more05, more06, more07, more08, more09, more10, more11, more12, more13, more14, more15, more16, more17, more18, more19, more20, more21, more22, more23, more24, more25, more26, more27, more28, more29, more30, more31 from tt_timesheet_manuale where anno = xanno and mese = xmese and fk_azione_struttura = xfk_azione_struttura and fk_anag = xfk_anag and flag_validato = 'S'; /* aggiorno il timesheet con i dati del manuale i trigger dovrebbero aggiornare tutte le altre tabelle*/ update tt_timesheet set ore_giorno_1 = more01, ore_giorno_2 = more02, ore_giorno_3 = more03, ore_giorno_4 = more04, ore_giorno_5 = more05, ore_giorno_6 = more06, ore_giorno_7 = more07, ore_giorno_8 = more08, ore_giorno_9 = more09, ore_giorno_10 = more10, ore_giorno_11 = more11, ore_giorno_12 = more12, ore_giorno_13 = more13, ore_giorno_14 = more14, ore_giorno_15 = more15, ore_giorno_16 = more16, ore_giorno_17 = more17, ore_giorno_18 = more18, ore_giorno_19 = more19, ore_giorno_20 = more20, ore_giorno_21 = more21, ore_giorno_22 = more22, ore_giorno_23 = more23, ore_giorno_24 = more24, ore_giorno_25 = more25, ore_giorno_26 = more26, ore_giorno_27 = more27, ore_giorno_28 = more28, ore_giorno_29 = more29, ore_giorno_30 = more30, ore_giorno_31 = more31 where fk_anag = xfk_anag and fk_azione_struttura = xfk_azione_struttura and anno = xanno and mese = xmese; /* ricalcola la somma della azione che contiene il totale di tutte le fk_azione_struttura e quindi lavora per fk_azione */ update tt_timesheet_somma_azione set ore_giorno_1 = f_somma60esimi(ore_giorno_1,more01), ore_giorno_2 = f_somma60esimi(ore_giorno_2,more02), ore_giorno_3 = f_somma60esimi(ore_giorno_3,more03), ore_giorno_4 = f_somma60esimi(ore_giorno_4,more04), ore_giorno_5 = f_somma60esimi(ore_giorno_5,more05), ore_giorno_6 = f_somma60esimi(ore_giorno_6,more06), ore_giorno_7 = f_somma60esimi(ore_giorno_7,more07), ore_giorno_8 = f_somma60esimi(ore_giorno_8,more08), ore_giorno_9 = f_somma60esimi(ore_giorno_9,more09), ore_giorno_10= f_somma60esimi(ore_giorno_10,more10), ore_giorno_11= f_somma60esimi(ore_giorno_11,more11), ore_giorno_12= f_somma60esimi(ore_giorno_12,more12), ore_giorno_13= f_somma60esimi(ore_giorno_13,more13), ore_giorno_14= f_somma60esimi(ore_giorno_14,more14), ore_giorno_15= f_somma60esimi(ore_giorno_15,more15), ore_giorno_16= f_somma60esimi(ore_giorno_16,more16), ore_giorno_17= f_somma60esimi(ore_giorno_17,more17), ore_giorno_18= f_somma60esimi(ore_giorno_18,more18), ore_giorno_19= f_somma60esimi(ore_giorno_19,more19), ore_giorno_20= f_somma60esimi(ore_giorno_20,more20), ore_giorno_21= f_somma60esimi(ore_giorno_21,more21), ore_giorno_22= f_somma60esimi(ore_giorno_22,more22), ore_giorno_23= f_somma60esimi(ore_giorno_23,more23), ore_giorno_24= f_somma60esimi(ore_giorno_24,more24), ore_giorno_25= f_somma60esimi(ore_giorno_25,more25), ore_giorno_26= f_somma60esimi(ore_giorno_26,more26), ore_giorno_27= f_somma60esimi(ore_giorno_27,more27), ore_giorno_28= f_somma60esimi(ore_giorno_28,more28), ore_giorno_29= f_somma60esimi(ore_giorno_29,more29), ore_giorno_30= f_somma60esimi(ore_giorno_30,more30), ore_giorno_31= f_somma60esimi(ore_giorno_31,more31) where fk_azione = xfk_azione and anno = xanno and mese = xmese and fk_anag = xfk_anag; /* ricalcola il riepilogo generale */ update tt_timesheet_riepilogo set ore_giorno_1 = f_somma60esimi(ore_giorno_1,more01), ore_giorno_2 = f_somma60esimi(ore_giorno_2,more02), ore_giorno_3 = f_somma60esimi(ore_giorno_3,more03), ore_giorno_4 = f_somma60esimi(ore_giorno_4,more04), ore_giorno_5 = f_somma60esimi(ore_giorno_5,more05), ore_giorno_6 = f_somma60esimi(ore_giorno_6,more06), ore_giorno_7 = f_somma60esimi(ore_giorno_7,more07), ore_giorno_8 = f_somma60esimi(ore_giorno_8,more08), ore_giorno_9 = f_somma60esimi(ore_giorno_9,more09), ore_giorno_10= f_somma60esimi(ore_giorno_10,more10), ore_giorno_11= f_somma60esimi(ore_giorno_11,more11), ore_giorno_12= f_somma60esimi(ore_giorno_12,more12), ore_giorno_13= f_somma60esimi(ore_giorno_13,more13), ore_giorno_14= f_somma60esimi(ore_giorno_14,more14), ore_giorno_15= f_somma60esimi(ore_giorno_15,more15), ore_giorno_16= f_somma60esimi(ore_giorno_16,more16), ore_giorno_17= f_somma60esimi(ore_giorno_17,more17), ore_giorno_18= f_somma60esimi(ore_giorno_18,more18), ore_giorno_19= f_somma60esimi(ore_giorno_19,more19), ore_giorno_20= f_somma60esimi(ore_giorno_20,more20), ore_giorno_21= f_somma60esimi(ore_giorno_21,more21), ore_giorno_22= f_somma60esimi(ore_giorno_22,more22), ore_giorno_23= f_somma60esimi(ore_giorno_23,more23), ore_giorno_24= f_somma60esimi(ore_giorno_24,more24), ore_giorno_25= f_somma60esimi(ore_giorno_25,more25), ore_giorno_26= f_somma60esimi(ore_giorno_26,more26), ore_giorno_27= f_somma60esimi(ore_giorno_27,more27), ore_giorno_28= f_somma60esimi(ore_giorno_28,more28), ore_giorno_29= f_somma60esimi(ore_giorno_29,more29), ore_giorno_30= f_somma60esimi(ore_giorno_30,more30), ore_giorno_31= f_somma60esimi(ore_giorno_31,more31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; /* calcola se il delta tra ore orig e manuali sono negative o meno */ if (ore01 >= more01) then set dore01 = f_calcola_differenza_ore(ore01, more01); end IF; if (ore01 < more01) then set dore01 = f_calcola_differenza_ore(ore01, more01) * -1; end IF; if (ore02 >= more02) then set dore02 = f_calcola_differenza_ore(ore02, more02); end IF; if (ore02 < more02) then set dore02 = f_calcola_differenza_ore(ore02, more02) * -1; end IF; if (ore03 >= more03) then set dore03 = f_calcola_differenza_ore(ore03, more03); end IF; if (ore03 < more03) then set dore03 = f_calcola_differenza_ore(ore03, more03) * -1; end IF; if (ore04 >= more04) then set dore04 = f_calcola_differenza_ore(ore04, more04); end IF; if (ore04 < more04) then set dore04 = f_calcola_differenza_ore(ore04, more04) * -1; end IF; if (ore05 >= more05) then set dore05 = f_calcola_differenza_ore(ore05, more05); end IF; if (ore05 < more05) then set dore05 = f_calcola_differenza_ore(ore05, more05) * -1; end IF; if (ore06 >= more06) then set dore06 = f_calcola_differenza_ore(ore06, more06); end IF; if (ore06 < more06) then set dore06 = f_calcola_differenza_ore(ore06, more06) * -1; end IF; if (ore07 >= more07) then set dore07 = f_calcola_differenza_ore(ore07, more07); end IF; if (ore07 < more07) then set dore07 = f_calcola_differenza_ore(ore07, more07) * -1; end IF; if (ore08 >= more08) then set dore08 = f_calcola_differenza_ore(ore08, more08); end IF; if (ore08 < more08) then set dore08 = f_calcola_differenza_ore(ore08, more08) * -1; end IF; if (ore09 >= more09) then set dore09 = f_calcola_differenza_ore(ore09, more09); end IF; if (ore09 < more09) then set dore09 = f_calcola_differenza_ore(ore09, more09) * -1; end IF; if (ore10 >= more10) then set dore10 = f_calcola_differenza_ore(ore10, more10); end IF; if (ore10 < more10) then set dore10 = f_calcola_differenza_ore(ore10, more10) * -1; end IF; if (ore11 >= more11) then set dore11 = f_calcola_differenza_ore(ore11, more11); end IF; if (ore11 < more11) then set dore11 = f_calcola_differenza_ore(ore11, more11) * -1; end IF; if (ore12 >= more12) then set dore12 = f_calcola_differenza_ore(ore12, more12); end IF; if (ore12 < more12) then set dore12 = f_calcola_differenza_ore(ore12, more12) * -1; end IF; if (ore13 >= more13) then set dore13 = f_calcola_differenza_ore(ore13, more13); end IF; if (ore13 < more13) then set dore13 = f_calcola_differenza_ore(ore13, more13) * -1; end IF; if (ore14 >= more14) then set dore14 = f_calcola_differenza_ore(ore14, more14); end IF; if (ore14 < more14) then set dore14 = f_calcola_differenza_ore(ore14, more14) * -1; end IF; if (ore15 >= more15) then set dore15 = f_calcola_differenza_ore(ore15, more15); end IF; if (ore15 < more15) then set dore15 = f_calcola_differenza_ore(ore15, more15) * -1; end IF; if (ore16 >= more16) then set dore16 = f_calcola_differenza_ore(ore16, more16); end IF; if (ore16 < more16) then set dore16 = f_calcola_differenza_ore(ore16, more16) * -1; end IF; if (ore17 >= more17) then set dore17 = f_calcola_differenza_ore(ore17, more17); end IF; if (ore17 < more17) then set dore17 = f_calcola_differenza_ore(ore17, more17) * -1; end IF; if (ore18 >= more18) then set dore18 = f_calcola_differenza_ore(ore18, more18); end IF; if (ore18 < more18) then set dore18 = f_calcola_differenza_ore(ore18, more18) * -1; end IF; if (ore19 >= more19) then set dore19 = f_calcola_differenza_ore(ore19, more19); end IF; if (ore19 < more19) then set dore19 = f_calcola_differenza_ore(ore19, more19) * -1; end IF; if (ore20 >= more20) then set dore20 = f_calcola_differenza_ore(ore20, more20); end IF; if (ore20 < more20) then set dore20 = f_calcola_differenza_ore(ore20, more20) * -1; end IF; if (ore21 >= more21) then set dore21 = f_calcola_differenza_ore(ore21, more21); end IF; if (ore21 < more21) then set dore21 = f_calcola_differenza_ore(ore21, more21) * -1; end IF; if (ore22 >= more22) then set dore22 = f_calcola_differenza_ore(ore22, more22); end IF; if (ore22 < more22) then set dore22 = f_calcola_differenza_ore(ore22, more22) * -1; end IF; if (ore23 >= more23) then set dore23 = f_calcola_differenza_ore(ore23, more23); end IF; if (ore23 < more23) then set dore23 = f_calcola_differenza_ore(ore23, more23) * -1; end IF; if (ore24 >= more24) then set dore24 = f_calcola_differenza_ore(ore24, more24); end IF; if (ore24 < more24) then set dore24 = f_calcola_differenza_ore(ore24, more24) * -1; end IF; if (ore25 >= more25) then set dore25 = f_calcola_differenza_ore(ore25, more25); end IF; if (ore25 < more25) then set dore25 = f_calcola_differenza_ore(ore25, more25) * -1; end IF; if (ore26 >= more26) then set dore26 = f_calcola_differenza_ore(ore26, more26); end IF; if (ore26 < more26) then set dore26 = f_calcola_differenza_ore(ore26, more26) * -1; end IF; if (ore27 >= more27) then set dore27 = f_calcola_differenza_ore(ore27, more27); end IF; if (ore27 < more27) then set dore27 = f_calcola_differenza_ore(ore27, more27) * -1; end IF; if (ore28 >= more28) then set dore28 = f_calcola_differenza_ore(ore28, more28); end IF; if (ore28 < more28) then set dore28 = f_calcola_differenza_ore(ore28, more28) * -1; end IF; if (ore29 >= more29) then set dore29 = f_calcola_differenza_ore(ore29, more29); end IF; if (ore29 < more29) then set dore29 = f_calcola_differenza_ore(ore29, more29) * -1; end IF; if (ore30 >= more30) then set dore30 = f_calcola_differenza_ore(ore30, more30); end IF; if (ore30 < more30) then set dore30 = f_calcola_differenza_ore(ore30, more30) * -1; end IF; if (ore31 >= more31) then set dore31 = f_calcola_differenza_ore(ore31, more31); end IF; if (ore31 < more31) then set dore31 = f_calcola_differenza_ore(ore31, more31) * -1; end IF; /* scala la differenza tra ore dalle timbrature che in realtà è il totale delle attivita ordinarie e le nuove ore */ update tt_timbrature set ore_giorno_1 = f_somma60esimi_negativi_positivi(ore_giorno_1, dore01), ore_giorno_2 = f_somma60esimi_negativi_positivi(ore_giorno_2, dore02), ore_giorno_3 = f_somma60esimi_negativi_positivi(ore_giorno_3, dore03), ore_giorno_4 = f_somma60esimi_negativi_positivi(ore_giorno_4, dore04), ore_giorno_5 = f_somma60esimi_negativi_positivi(ore_giorno_5, dore05), ore_giorno_6 = f_somma60esimi_negativi_positivi(ore_giorno_6, dore06), ore_giorno_7 = f_somma60esimi_negativi_positivi(ore_giorno_7, dore07), ore_giorno_8 = f_somma60esimi_negativi_positivi(ore_giorno_8, dore08), ore_giorno_9 = f_somma60esimi_negativi_positivi(ore_giorno_9, dore09), ore_giorno_10= f_somma60esimi_negativi_positivi(ore_giorno_10, dore10), ore_giorno_11= f_somma60esimi_negativi_positivi(ore_giorno_11, dore11), ore_giorno_12= f_somma60esimi_negativi_positivi(ore_giorno_12, dore12), ore_giorno_13= f_somma60esimi_negativi_positivi(ore_giorno_13, dore13), ore_giorno_14= f_somma60esimi_negativi_positivi(ore_giorno_14, dore14), ore_giorno_15= f_somma60esimi_negativi_positivi(ore_giorno_15, dore15), ore_giorno_16= f_somma60esimi_negativi_positivi(ore_giorno_16, dore16), ore_giorno_17= f_somma60esimi_negativi_positivi(ore_giorno_17, dore17), ore_giorno_18= f_somma60esimi_negativi_positivi(ore_giorno_18, dore18), ore_giorno_19= f_somma60esimi_negativi_positivi(ore_giorno_19, dore19), ore_giorno_20= f_somma60esimi_negativi_positivi(ore_giorno_20, dore20), ore_giorno_21= f_somma60esimi_negativi_positivi(ore_giorno_21, dore21), ore_giorno_22= f_somma60esimi_negativi_positivi(ore_giorno_22, dore22), ore_giorno_23= f_somma60esimi_negativi_positivi(ore_giorno_23, dore23), ore_giorno_24= f_somma60esimi_negativi_positivi(ore_giorno_24, dore24), ore_giorno_25= f_somma60esimi_negativi_positivi(ore_giorno_25, dore25), ore_giorno_26= f_somma60esimi_negativi_positivi(ore_giorno_26, dore26), ore_giorno_27= f_somma60esimi_negativi_positivi(ore_giorno_27, dore27), ore_giorno_28= f_somma60esimi_negativi_positivi(ore_giorno_28, dore28), ore_giorno_29= f_somma60esimi_negativi_positivi(ore_giorno_29, dore29), ore_giorno_30= f_somma60esimi_negativi_positivi(ore_giorno_30, dore30), ore_giorno_31= f_somma60esimi_negativi_positivi(ore_giorno_31, dore31) where anno = xanno and mese = xmese and fk_anag = xfk_anag; end; end IF; END$$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 621. SQL Error: 1064 - Creating routine tempus_innodb.ZUCCHETTI_IMPORTA_CMO Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_CMO`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare xcfisc CHAR(16); declare xcfisc_dip CHAR(16); declare xmatricola CHAR(10); declare xaa SMALLINT; declare xcosto DOUBLE PRECISION; declare xconta SMALLINT; declare wcont SMALLINT; declare xpk_anag INTEGER; declare xpk_chr CHAR(6); declare done bool default false; declare cursor_zucchetti cursor for select distinct a.cfisc, a.CMO, a.anno, b.pk_progressivo from ZUCCHETTI_FASE_01_CMO a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.cfisc = b.codice_fiscale and a.anno = XANNO order by cfisc, anno; declare cursor_zucchetti_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'C'; declare continue handler for not found set done = true; select count(distinct cfisc) into rec_letti from ZUCCHETTI_FASE_01_CMO where anno = XANNO and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'C'; open cursor_zucchetti; read_loop1 : loop fetch cursor_zucchetti into xcfisc_dip, xcosto, xaa, xpk_anag; if done then leave read_loop1; end if; insert into ZUCCHETTI_INTERMEDIO values (0, xpk_anag, null, 0, 0, xaa, f_arrotonda(xcosto,2), 'C'); end loop; close cursor_zucchetti; set done = false; select count(distinct FK_TT_ANAG_PERSONALE) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'C'; open cursor_zucchetti_intermedio; read_loop2 : loop fetch cursor_zucchetti_intermedio into xpk_anag, xANNO, xcosto; if done then leave read_loop2; end if; select count(*) into xconta from TT_ANAG_PERSONALE_COSTI where anno = xANNO and FK_ANAG = xpk_anag; if (xconta is null) then set xconta = 0; end IF; if (xconta = 0) then begin insert into TT_ANAG_PERSONALE_COSTI (PK_PROGRESSIVO, ANNO, FK_ANAG, COSTO_ORARIO, COSTO_ORARIO_ARROTONDATO, COSTO_ORARIO_STANDARD, COSTO_ORARIO_STANDARD_ARROTONDATO, COSTO_ORARIO_STANDARD2, COSTO_ORARIO_STANDARD_ARROTONDATO2) values (0, XANNO, xpk_anag, xcosto,0,0,0,0,0); end; end IF; end loop; close cursor_zucchetti_intermedio; set done = false; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_CMO where anno = XANNO and cfisc = xcfiscale; END - Creating routine tempus_innodb.ZUCCHETTI_IMPORTA_FERIE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_FERIE`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare ore_min_100 float; declare giorno char(12); declare cfisc_dip char(16); declare xmatricola char(10); declare xgg smallint; declare xmm smallint; declare xaa smallint; declare mm_text char(3); declare ore_lavorate double precision; declare ore_int smallint; declare min_dec double precision; declare min_int smallint; declare min_int2 char(6); declare ore_min_text char(6); declare omt char(6); declare ore_lette double precision; declare conta smallint; declare wcont smallint; declare aggiorna char(200); declare wdata_ferie date; declare pk_anag integer; declare pk_chr char(6); declare done bool default false; declare cursor_ferie cursor for select distinct a.cfisc, a.ore_ferie, a.DATA_FERIE, a.giorno, a.mese, a.anno, b.pk_progressivo from ZUCCHETTI_FASE_01_FERIE a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.cfisc = b.codice_fiscale and a.anno = xanno and a.mese = xmese order by cfisc, mese, giorno; declare cursor_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, gg, mm, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'F'; declare continue handler for not found set done = true; select count(distinct cfisc) into rec_letti from ZUCCHETTI_FASE_01_FERIE where anno = xanno and mese = xmese and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'F'; open cursor_ferie; read_loop1 : loop fetch cursor_ferie into cfisc_dip, ore_min_100, wdata_ferie, xgg, xmm, xaa, pk_anag; if done then leave read_loop1; end if; insert into ZUCCHETTI_INTERMEDIO values (0, pk_anag, wdata_ferie, xgg, xmm, xaa, f_arrotonda(ore_min_100,2), 'F'); end loop; close cursor_ferie; set done = false; select count(distinct FK_TT_ANAG_PERSONALE) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'F'; open cursor_intermedio; read_loop2 : loop fetch cursor_intermedio into pk_anag, xgg, xmese, xanno, ore_lette; if done then leave read_loop2; end if; select count(*) into conta from TT_FERIE where anno = xanno and mese = xmese and FK_ANAG = pk_anag; if (conta is null) then set conta = 0; end IF; if (conta = 0) then insert into TT_FERIE values (0, pk_anag, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0); end IF; set ore_lette = f_calcola60esimi(ore_lette); set ore_int = f_tronca(ore_lette,0); set min_dec = ore_lette - f_tronca((f_arrotonda(ore_lette,2)),0); set min_dec = f_arrotonda(min_dec,2); set min_dec = min_dec * 100; set min_int = floor(min_dec); /* faccio questo perche altrimenti 0,05 sarebbe 0,50 */ if (min_int < 10) then set min_int2 = '0'||min_int; end IF; if (min_int > 9) then set min_int2 = min_int; end IF; set omt = ore_int||'.'||min_int2; set pk_chr = pk_anag; set @sql_string = 'update tt_ferie set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and fk_anag = '||' '||pk_anag||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end loop; close cursor_intermedio; set done = false; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_FERIE where anno = xanno and mese = xmese and cfisc = XCFISCALE; END - Creating routine tempus_innodb.ZUCCHETTI_IMPORTA_MALATTIA Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_MALATTIA`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare ore_min_100 float; declare giorno char(12); declare xgg smallint; declare xmm smallint; declare xaa smallint; declare mm_text char(3); declare ore_lavorate double precision; declare ore_int smallint; declare min_dec double precision; declare min_int smallint; declare min_int2 char(6); declare ore_min_text char(6); declare omt char(6); declare ore_lette double precision; declare conta smallint; declare wcont smallint; declare aggiorna char(200); declare wdata_malattia date; declare pk_anag integer; declare cfisc_dip char(16); declare done bool default false; declare cursor_malattie cursor for select distinct a.cfisc, a.ore_MALATTIA, a.DATA_MALATTIA, a.giorno, a.mese, a.anno, b.pk_progressivo from ZUCCHETTI_FASE_01_MALATTIE a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.cfisc = b.codice_fiscale and a.anno = xanno and a.mese = xmese order by cfisc, mese, giorno; declare cursor_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, gg, mm, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'M'; declare continue handler for not found set done = true; select count(*) into rec_letti from ZUCCHETTI_FASE_01_MALATTIE where anno = xanno and mese = xmese and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'M'; open cursor_malattie; read_loop1 : loop fetch cursor_malattie into cfisc_dip, ore_min_100, wdata_malattia, xgg, xmm, xaa, pk_anag; if done then leave read_loop1; end if; insert into ZUCCHETTI_INTERMEDIO values (0, pk_anag, wdata_malattia, xgg, xmm, xaa, f_arrotonda(ore_min_100,2), 'M'); end loop; close cursor_malattie; set done = false; select count(*) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'M'; open cursor_intermedio; read_loop2 : loop fetch cursor_intermedio into pk_anag, xgg, xmese, xanno, ore_lette; if done then leave read_loop2; end if; select count(*) into conta from TT_MALATTIA where anno = xanno and mese = xmese and FK_ANAG = pk_anag; if (conta is null) then set conta = 0; end IF; if (conta = 0) then insert into TT_MALATTIA values (0, pk_anag, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0); end IF; set ore_lette = f_calcola60esimi(ore_lette); set ore_int = f_tronca(ore_lette,0); set min_dec = ore_lette - f_tronca((f_arrotonda(ore_lette,2)),0); set min_dec = f_arrotonda(min_dec,2); set min_dec = min_dec * 100; set min_int = floor(min_dec); /* faccio questo perche altrimenti 0,05 sarebbe 0,50 */ if (min_int < 10) then set min_int2 = '0'||min_int; end IF; if (min_int > 9) then set min_int2 = min_int; end IF; set omt = ore_int||'.'||min_int2; set @sql_string = 'update TT_MALATTIA set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and FK_ANAG = '||' '||pk_anag||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end loop; close cursor_intermedio; set done = false; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_MALATTIE where cfisc = XCFISCALE and anno = xanno and mese = xmese; END - Creating routine tempus_innodb.ZUCCHETTI_IMPORTA_PERMESSI Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_PERMESSI`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare ore_min_100 float; declare giorno char(12); declare data_timbratura date; declare cfisc_dip char(16); declare xgg smallint; declare xmm smallint; declare xaa smallint; declare mm_text char(3); declare ore_lavorate double precision; declare ore_int smallint; declare min_dec double precision; declare min_int smallint; declare min_int2 char(6); declare ore_min_text char(6); declare omt char(6); declare ore_lette double precision; declare conta smallint; declare wcont smallint; declare aggiorna char(200); declare wdata_permesso date; declare pk_anag integer; declare done bool default false; declare cursor_permessi cursor for select distinct a.totale_permessi, a.DATA_PERMESSO, a.giorno, a.mese, a.anno, a.FK_TT_ANAG_PERSONALE from ZUCCHETTI_INTERMEDIO_PERMESSI a order by FK_TT_ANAG_PERSONALE, mese, giorno; declare cursor_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, gg, mm, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'P'; declare continue handler for not found set done = true; select count(*) into rec_letti from ZUCCHETTI_FASE_01_PERMESSI where anno = xanno and mese = xmese and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'P'; delete from ZUCCHETTI_INTERMEDIO_PERMESSI; /* questo permette di creare il totale giorno che è quello che mi interessa */ insert into ZUCCHETTI_INTERMEDIO_PERMESSI select 0, b.pk_progressivo, a.data_permesso, a.ore1, a.ore2, a.ore3, a.ore4, a.ore5, a.ore6, a.ore7, a.ore8, a.ore9, a.ore10, a.ore11, a.giorno, a.mese, a.anno, 0 from ZUCCHETTI_FASE_01_PERMESSI a, TT_ANAG_PERSONALE b where a.cfisc = b.codice_fiscale and a.cfisc = XCFISCALE and a.anno = xanno and a.mese = xmese; open cursor_permessi; read_loop1 : loop fetch cursor_permessi into ore_min_100, wdata_permesso, xgg, xmm, xaa, pk_anag; if done then leave read_loop1; end if; insert into ZUCCHETTI_INTERMEDIO values (0, pk_anag, wdata_permesso, xgg, xmm, xaa, f_arrotonda(ore_min_100,2), 'P'); end loop; close cursor_permessi; set done = false; select count(*) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'P'; open cursor_intermedio; read_loop2 : loop fetch cursor_intermedio into pk_anag, xgg, xmese, xanno, ore_lette; if done then leave read_loop2; end if; select count(*) into conta from TT_PERMESSI where anno = xanno and mese = xmese and FK_ANAG = pk_anag; if (conta is null) then set conta = 0; end IF; if (conta = 0) then insert into TT_PERMESSI values (0, pk_anag, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0); end IF; set ore_lette = f_calcola60esimi(ore_lette); set ore_int = f_tronca(ore_lette,0); set min_dec = ore_lette - f_tronca((f_arrotonda(ore_lette,2)),0); set min_dec = f_arrotonda(min_dec,2); set min_dec = min_dec * 100; set min_int = floor(min_dec); /* faccio questo perche altrimenti 0,05 sarebbe 0,50 */ if (min_int < 10) then set min_int2 = '0'||min_int; end IF; if (min_int > 9) then set min_int2 = min_int; end IF; set omt = ore_int||'.'||min_int2; set @sql_string = 'update TT_PERMESSI set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and FK_ANAG = '||' '||pk_anag||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end loop; close cursor_intermedio; set done = false; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_PERMESSI where anno = xanno and mese = xmese and cfisc = XCFISCALE; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_PERMESSI`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare ore_min_100 float; declare giorno char(12); declare data_timbratura date; declare cfisc_dip char(16); declare xgg smallint; declare xmm smallint; declare xaa smallint; declare mm_text char(3); declare ore_lavorate double precision; declare ore_int smallint; declare min_dec double precision; declare min_int smallint; declare min_int2 char(6); declare ore_min_text char(6); declare omt char(6); declare ore_lette double precision; declare conta smallint; declare wcont smallint; declare aggiorna char(200); declare wdata_permesso date; declare pk_anag integer; declare done bool default false; declare cursor_permessi cursor for select distinct a.totale_permessi, a.DATA_PERMESSO, a.giorno, a.mese, a.anno, a.FK_TT_ANAG_PERSONALE from ZUCCHETTI_INTERMEDIO_PERMESSI a order by FK_TT_ANAG_PERSONALE, mese, giorno; declare cursor_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, gg, mm, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'P'; declare continue handler for not found set done = true; select count(*) into rec_letti from ZUCCHETTI_FASE_01_PERMESSI where anno = xanno and mese = xmese and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'P'; delete from ZUCCHETTI_INTERMEDIO_PERMESSI; /* questo permette di creare il totale giorno che è quello che mi interessa */ insert into ZUCCHETTI_INTERMEDIO_PERMESSI select 0, b.pk_progressivo, a.data_permesso, a.ore1, a.ore2, a.ore3, a.ore4, a.ore5, a.ore6, a.ore7, a.ore8, a.ore9, a.ore10, a.ore11, a.giorno, a.mese, a.anno, 0 from ZUCCHETTI_FASE_01_PERMESSI a, TT_ANAG_PERSONALE b where a.cfisc = b.codice_fiscale and a.cfisc = XCFISCALE and a.anno = xanno and a.mese = xmese; open cursor_permessi; read_loop1 : loop fetch cursor_permessi into ore_min_100, wdata_permesso, xgg, xmm, xaa, pk_anag; if done then leave read_loop1; end if; insert into ZUCCHETTI_INTERMEDIO values (0, pk_anag, wdata_permesso, xgg, xmm, xaa, f_arrotonda(ore_min_100,2), 'P'); end loop; close cursor_permessi; set done = false; select count(*) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'P'; open cursor_intermedio; read_loop2 : loop fetch cursor_intermedio into pk_anag, xgg, xmese, xanno, ore_lette; if done then leave read_loop2; end if; select count(*) into conta from TT_PERMESSI where anno = xanno and mese = xmese and FK_ANAG = pk_anag; if (conta is null) then set conta = 0; end IF; if (conta = 0) then insert into TT_PERMESSI values (0, pk_anag, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0); end IF; set ore_lette = f_calcola60esimi(ore_lette); set ore_int = f_tronca(ore_lette,0); set min_dec = ore_lette - f_tronca((f_arrotonda(ore_lette,2)),0); set min_dec = f_arrotonda(min_dec,2); set min_dec = min_dec * 100; set min_int = floor(min_dec); /* faccio questo perche altrimenti 0,05 sarebbe 0,50 */ if (min_int < 10) then set min_int2 = '0'||min_int; end IF; if (min_int > 9) then set min_int2 = min_int; end IF; set omt = ore_int||'.'||min_int2; set @sql_string = 'update TT_PERMESSI set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and FK_ANAG = '||' '||pk_anag||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end loop; close cursor_intermedio; set done = false; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_PERMESSI where anno = xanno and mese = xmese and cfisc = XCFISCALE; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 152. SQL Error: 1064 - Creating routine tempus_innodb.ZUCCHETTI_IMPORTA_TIMBRATURE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_TIMBRATURE`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare qualifica CHAR(100); declare cfisc CHAR(16); declare ore_min_100 FLOAT; declare giorno CHAR(12); declare data_timbratura DATE; declare matricola CHAR(10); declare xgg SMALLINT; declare xmm SMALLINT; declare xaa SMALLINT; declare mm_text CHAR(3); declare ore_lavorate DOUBLE PRECISION; declare ore_int SMALLINT; declare min_dec DOUBLE PRECISION; declare min_int SMALLINT; declare min_int2 CHAR(6); declare ore_min_text CHAR(6); declare omt CHAR(6); declare ore_lette DOUBLE PRECISION; declare conta SMALLINT; declare aggiorna CHAR(200); declare pk_prog INTEGER; declare done bool default false; declare cursor_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, gg, mm, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'T'; declare continue handler for not found set done = true; select count(*) into rec_letti from ZUCCHETTI_FASE_01_PRESENZE where anno = xanno and mese = xmese and cfisc = XCFISCALE; /* questo è il contenitore di transito i definitivi sono bio_timbrature e bio_timbrature_originale */ update ZUCCHETTI_FASE_01_PRESENZE set qualifica = upper(qualifica) where anno = xanno and mese = xmese and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'T'; /*controlla che le qualifiche non siano gia presenti (ci sono record doppi a causa di importazioni cancellate e reinserite)*/ select count(*) into conta from TT_ANAG_PERSONALE_QUALIFICHE a, TT_ANAG_PERSONALE b where a.FK_TT_ANAG_PERSONALE = b.pk_progressivo and b.codice_fiscale = XCFISCALE and a.anno = xanno and a.mese = xmese; if (conta is null) then set conta = 0; end IF; /* se non ci sono rec qualifica allora fa tutto il ciclo altrimenti non tocca nulla perche il mese è gia stato passato significa che sta girando la routine di integrazione */ if (conta = 0) then begin /* alimenta le qualifiche nello storico */ insert into TT_ANAG_PERSONALE_QUALIFICHE select distinct 0, b.pk_progressivo, a.qualifica, a.anno, a.mese from ZUCCHETTI_FASE_01_PRESENZE a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.anno = xanno and a.mese = xmese and a.cfisc = b.codice_fiscale; /* passa le timbrature nell'intermedio */ insert into ZUCCHETTI_INTERMEDIO select distinct 0, b.pk_progressivo, a.data_timbratura, a.giorno, a.mese, a.anno, f_arrotonda(a.ore_lavorate,2), 'T' from ZUCCHETTI_FASE_01_PRESENZE a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.anno = xanno and a.mese = xmese and a.cfisc = b.codice_fiscale; select count(*) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'T'; insert into TT_TIMBRATURE_GIORNO select 0, FK_TT_ANAG_PERSONALE, DATA_TIMBRATURA, GG, MM, AA, ORE from ZUCCHETTI_INTERMEDIO where tipo_ore = 'T'; /* registra nello storico originale e in quello di lavoro senza distruggere quello di lavoro che contiene le ore decrementate dei progetti */ open cursor_intermedio; read_loop1 : loop fetch cursor_intermedio into pk_prog, xgg, xmese, xanno, ore_lette; if done then leave read_loop1; end if; select count(*) into conta from TT_TIMBRATURE_STORICO where anno = xanno and mese = xmese and fk_anag = pk_prog; if (conta is null) then set conta = 0; end IF; if (conta = 0) then insert into TT_TIMBRATURE values (0, pk_prog, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0); insert into TT_TIMBRATURE_STORICO values (0, pk_prog, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0); end IF; set ore_lette = f_calcola60esimi(ore_lette); set ore_int = f_tronca(ore_lette,0); set min_dec = ore_lette - f_tronca((f_arrotonda(ore_lette,2)),0); set min_dec = f_arrotonda(min_dec,2); set min_dec = min_dec * 100; set min_int = floor(min_dec); /* faccio questo perche altrimenti 0,05 sarebbe 0,50 */ if (min_int < 10) then set min_int2 = '0'||min_int; end IF; if (min_int > 9) then set min_int2 = min_int; end IF; set omt = ore_int||'.'||min_int2; /* puoi evitare aggiorna ed eseguire direttamente execute statement .... sql istruzioni */ set @sql_string = 'update tt_timbrature set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and fk_anag = '||' '||pk_prog||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; set @sql_string = 'update tt_timbrature_storico set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and fk_anag = '||' '||pk_prog||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end loop; close cursor_intermedio; set done = false; end; end IF; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_PRESENZE where cfisc = XCFISCALE and anno = xanno and mese = xmese; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` PROCEDURE `ZUCCHETTI_IMPORTA_TIMBRATURE`( IN XANNO SMALLINT, IN XMESE SMALLINT, IN XCFISCALE CHAR(16), OUT REC_LETTI INTEGER, OUT REC_ELABORATI INTEGER ) BEGIN declare qualifica CHAR(100); declare cfisc CHAR(16); declare ore_min_100 FLOAT; declare giorno CHAR(12); declare data_timbratura DATE; declare matricola CHAR(10); declare xgg SMALLINT; declare xmm SMALLINT; declare xaa SMALLINT; declare mm_text CHAR(3); declare ore_lavorate DOUBLE PRECISION; declare ore_int SMALLINT; declare min_dec DOUBLE PRECISION; declare min_int SMALLINT; declare min_int2 CHAR(6); declare ore_min_text CHAR(6); declare omt CHAR(6); declare ore_lette DOUBLE PRECISION; declare conta SMALLINT; declare aggiorna CHAR(200); declare pk_prog INTEGER; declare done bool default false; declare cursor_intermedio cursor for select distinct FK_TT_ANAG_PERSONALE, gg, mm, aa, ore from ZUCCHETTI_INTERMEDIO where tipo_ore = 'T'; declare continue handler for not found set done = true; select count(*) into rec_letti from ZUCCHETTI_FASE_01_PRESENZE where anno = xanno and mese = xmese and cfisc = XCFISCALE; /* questo è il contenitore di transito i definitivi sono bio_timbrature e bio_timbrature_originale */ update ZUCCHETTI_FASE_01_PRESENZE set qualifica = upper(qualifica) where anno = xanno and mese = xmese and cfisc = XCFISCALE; delete from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'T'; /*controlla che le qualifiche non siano gia presenti (ci sono record doppi a causa di importazioni cancellate e reinserite)*/ select count(*) into conta from TT_ANAG_PERSONALE_QUALIFICHE a, TT_ANAG_PERSONALE b where a.FK_TT_ANAG_PERSONALE = b.pk_progressivo and b.codice_fiscale = XCFISCALE and a.anno = xanno and a.mese = xmese; if (conta is null) then set conta = 0; end IF; /* se non ci sono rec qualifica allora fa tutto il ciclo altrimenti non tocca nulla perche il mese è gia stato passato significa che sta girando la routine di integrazione */ if (conta = 0) then begin /* alimenta le qualifiche nello storico */ insert into TT_ANAG_PERSONALE_QUALIFICHE select distinct 0, b.pk_progressivo, a.qualifica, a.anno, a.mese from ZUCCHETTI_FASE_01_PRESENZE a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.anno = xanno and a.mese = xmese and a.cfisc = b.codice_fiscale; /* passa le timbrature nell'intermedio */ insert into ZUCCHETTI_INTERMEDIO select distinct 0, b.pk_progressivo, a.data_timbratura, a.giorno, a.mese, a.anno, f_arrotonda(a.ore_lavorate,2), 'T' from ZUCCHETTI_FASE_01_PRESENZE a, TT_ANAG_PERSONALE b where a.cfisc = XCFISCALE and a.anno = xanno and a.mese = xmese and a.cfisc = b.codice_fiscale; select count(*) into REC_ELABORATI from ZUCCHETTI_INTERMEDIO where TIPO_ORE = 'T'; insert into TT_TIMBRATURE_GIORNO select 0, FK_TT_ANAG_PERSONALE, DATA_TIMBRATURA, GG, MM, AA, ORE from ZUCCHETTI_INTERMEDIO where tipo_ore = 'T'; /* registra nello storico originale e in quello di lavoro senza distruggere quello di lavoro che contiene le ore decrementate dei progetti */ open cursor_intermedio; read_loop1 : loop fetch cursor_intermedio into pk_prog, xgg, xmese, xanno, ore_lette; if done then leave read_loop1; end if; select count(*) into conta from TT_TIMBRATURE_STORICO where anno = xanno and mese = xmese and fk_anag = pk_prog; if (conta is null) then set conta = 0; end IF; if (conta = 0) then insert into TT_TIMBRATURE values (0, pk_prog, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0); insert into TT_TIMBRATURE_STORICO values (0, pk_prog, xanno, xmese, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0); end IF; set ore_lette = f_calcola60esimi(ore_lette); set ore_int = f_tronca(ore_lette,0); set min_dec = ore_lette - f_tronca((f_arrotonda(ore_lette,2)),0); set min_dec = f_arrotonda(min_dec,2); set min_dec = min_dec * 100; set min_int = floor(min_dec); /* faccio questo perche altrimenti 0,05 sarebbe 0,50 */ if (min_int < 10) then set min_int2 = '0'||min_int; end IF; if (min_int > 9) then set min_int2 = min_int; end IF; set omt = ore_int||'.'||min_int2; /* puoi evitare aggiorna ed eseguire direttamente execute statement .... sql istruzioni */ set @sql_string = 'update tt_timbrature set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and fk_anag = '||' '||pk_prog||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; set @sql_string = 'update tt_timbrature_storico set ore_giorno_'||xgg||' = '||' '||omt||''||' where anno = '||' '||xanno||''||' and mese = '||' '||xmese||''||' and fk_anag = '||' '||pk_prog||''; prepare stmt from @sql_string; execute stmt; deallocate prepare stmt; end loop; close cursor_intermedio; set done = false; end; end IF; /* alla fine cancella dati di importazione */ delete from ZUCCHETTI_FASE_01_PRESENZE where cfisc = XCFISCALE and anno = xanno and mese = xmese; END$$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 181. SQL Error: 1064 - Creating routine tempus_innodb.f_arrotonda Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_arrotonda`(val1 DOUBLE, val2 INTEGER) RETURNS double DETERMINISTIC BEGIN DECLARE result DOUBLE; -- Controllo per gestire valori NULL, restituendo 0 IF val1 IS NULL OR val2 IS NULL THEN RETURN 0; END IF; -- Calcolo dell'arrotondamento SET result = ROUND(val1, val2); RETURN result; END - Creating routine tempus_innodb.f_calcola100esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_calcola100esimi`(ore DOUBLE) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; -- Restituisce 0 se l'input è NULL IF ore IS NULL THEN RETURN 0; END IF; -- Inizializzazione SET valore_tronca = 0; -- Troncamento e arrotondamento delle ore utilizzando f_tronca SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); -- Calcolo dei minuti in centesimi SET minuti_da_fare = (ore - ore_da_fare_troncato) * 100 / 60; -- Arrotondamento a 2 decimali SET valore_tronca = 2; SET calcolato = ROUND(ore_da_fare_troncato + minuti_da_fare, valore_tronca); RETURN calcolato; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` FUNCTION `f_calcola100esimi`(ore DOUBLE) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; -- Restituisce 0 se l'input è NULL IF ore IS NULL THEN RETURN 0; END IF; -- Inizializzazione SET valore_tronca = 0; -- Troncamento e arrotondamento delle ore utilizzando f_tronca SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); -- Calcolo dei minuti in centesimi SET minuti_da_fare = (ore - ore_da_fare_troncato) * 100 / 60; -- Arrotondamento a 2 decimali SET valore_tronca = 2; SET calcolato = ROUND(ore_da_fare_troncato + minuti_da_fare, valore_tronca); RETURN calcolato; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 27. SQL Error: 1064 - Creating routine tempus_innodb.f_calcola60esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_calcola60esimi`(ore double) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; SET valore_tronca = 0; SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); SET minuti_da_fare = ore - ore_da_fare_troncato; SET minuti_da_fare = minuti_da_fare * 100; -- Moltiplicazione per centesimi SET minuti_da_fare = minuti_da_fare * 60; -- Conversione in frazione di ora SET minuti_da_fare = minuti_da_fare / 100; -- Recalcolo corretto SET minuti_da_fare = minuti_da_fare / 100; -- Seconda divisione per ottenere il risultato finale SET valore_tronca = 2; SET calcolato = ore_da_fare_troncato + minuti_da_fare; SET calcolato = ROUND(calcolato, valore_tronca); RETURN calcolato; END - Creating routine tempus_innodb.f_calcola_100esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_calcola_100esimi`(ore double) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; -- Restituisce 0 se l'input è NULL IF ore IS NULL THEN RETURN 0; END IF; -- Inizializzazione SET valore_tronca = 0; -- Troncamento e arrotondamento delle ore utilizzando f_tronca SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); -- Calcolo dei minuti in centesimi SET minuti_da_fare = (ore - ore_da_fare_troncato) * 100 / 60; -- Arrotondamento a 2 decimali SET valore_tronca = 2; SET calcolato = ROUND(ore_da_fare_troncato + minuti_da_fare, valore_tronca); RETURN calcolato; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` FUNCTION `f_calcola_100esimi`(ore double) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; -- Restituisce 0 se l'input è NULL IF ore IS NULL THEN RETURN 0; END IF; -- Inizializzazione SET valore_tronca = 0; -- Troncamento e arrotondamento delle ore utilizzando f_tronca SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); -- Calcolo dei minuti in centesimi SET minuti_da_fare = (ore - ore_da_fare_troncato) * 100 / 60; -- Arrotondamento a 2 decimali SET valore_tronca = 2; SET calcolato = ROUND(ore_da_fare_troncato + minuti_da_fare, valore_tronca); RETURN calcolato; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 28. SQL Error: 1064 - Creating routine tempus_innodb.f_calcola_60esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_calcola_60esimi`(ore double) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; SET valore_tronca = 0; SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); SET minuti_da_fare = ore - ore_da_fare_troncato; SET minuti_da_fare = minuti_da_fare * 100; -- Moltiplicazione per centesimi SET minuti_da_fare = minuti_da_fare * 60; -- Conversione in frazione di ora SET minuti_da_fare = minuti_da_fare / 100; -- Recalcolo corretto SET minuti_da_fare = minuti_da_fare / 100; -- Seconda divisione per ottenere il risultato finale SET valore_tronca = 2; SET calcolato = ore_da_fare_troncato + minuti_da_fare; SET calcolato = ROUND(calcolato, valore_tronca); RETURN calcolato; END - Creating routine tempus_innodb.f_calcola_differenza_ore Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_calcola_differenza_ore`(ore_minuendo double, ore_sottraendo double) RETURNS double DETERMINISTIC BEGIN DECLARE ore_minuendo_int, ore_sottraendo_int, calcolato_ore, par_tronca, par_arrotonda INTEGER; DECLARE result, minuti_minuendo, minuti_sottraendo, calcolato_min, temp_valore DOUBLE; /* Inverte se minuendo minore di sottraendo */ IF (ore_minuendo < ore_sottraendo) THEN SET temp_valore = ore_minuendo; SET ore_minuendo = ore_sottraendo; SET ore_sottraendo = temp_valore; END IF; SET par_tronca = 0; SET ore_minuendo_int = FLOOR(TRUNCATE(ore_minuendo, par_tronca)); SET ore_sottraendo_int = FLOOR(TRUNCATE(ore_sottraendo, par_tronca)); SET calcolato_ore = ore_minuendo_int - ore_sottraendo_int; SET minuti_minuendo = ore_minuendo - ore_minuendo_int; SET minuti_sottraendo = ore_sottraendo - ore_sottraendo_int; SET calcolato_min = minuti_minuendo - minuti_sottraendo; IF calcolato_min IS NULL THEN SET calcolato_min = 0; END IF; IF (calcolato_min < 0) THEN SET minuti_sottraendo = 0.60 - minuti_sottraendo; SET calcolato_min = minuti_minuendo + minuti_sottraendo; IF (calcolato_ore > 0) THEN SET calcolato_ore = calcolato_ore - 1; END IF; END IF; SET par_tronca = 2; SET temp_valore = calcolato_ore + calcolato_min; SET result = ROUND(temp_valore, par_tronca); RETURN result; END - Creating routine tempus_innodb.f_calcola_differenza_orep Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_calcola_differenza_orep`(ore_minuendo DOUBLE, ore_sottraendo DOUBLE) RETURNS double DETERMINISTIC BEGIN /* Calcola differenza ore, solo differenze positive > 0 In caso di risultato negativo ritorna 0. */ DECLARE ore_minuendo_int, ore_sottraendo_int, calcolato_ore INTEGER; DECLARE result, minuti_minuendo, minuti_sottraendo, calcolato_min, temp_valore DOUBLE; DECLARE par_tronca, par_arrotonda INTEGER; SET par_tronca = 0; SET ore_minuendo_int = FLOOR(f_tronca(ore_minuendo, par_tronca)); SET ore_sottraendo_int = FLOOR(f_tronca(ore_sottraendo, par_tronca)); SET calcolato_ore = ore_minuendo_int - ore_sottraendo_int; SET minuti_minuendo = ore_minuendo - ore_minuendo_int; SET minuti_sottraendo = ore_sottraendo - ore_sottraendo_int; SET calcolato_min = minuti_minuendo - minuti_sottraendo; IF calcolato_min IS NULL THEN SET calcolato_min = 0; END IF; IF (calcolato_min < 0) THEN IF (ore_minuendo_int > 0) THEN SET minuti_sottraendo = 0.60 - minuti_sottraendo; SET calcolato_min = minuti_minuendo + minuti_sottraendo; IF (calcolato_ore > 0) THEN SET calcolato_ore = calcolato_ore - 1; END IF; END IF; END IF; SET par_tronca = 2; SET temp_valore = calcolato_ore + calcolato_min; IF (temp_valore < 0) THEN SET temp_valore = 0; END IF; SET result = ROUND(temp_valore, par_tronca); RETURN result; END - Creating routine tempus_innodb.f_convert60 Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_convert60`( val DOUBLE -- Il valore da sommare, espresso in centesimi ) RETURNS double DETERMINISTIC BEGIN DECLARE ore INT; DECLARE minuti INT; DECLARE somma60esimi DOUBLE; -- Convertiamo il valore da centesimi (xx.xx) in ore e minuti SET ore = FLOOR(val / 100); SET minuti = val - (ore * 100); -- Calcoliamo la somma in 60esimi: (ore * 60 + minuti) è la somma totale in minuti SET somma60esimi = (ore * 60 + minuti) / 60; RETURN somma60esimi; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` FUNCTION `f_convert60`( val DOUBLE -- Il valore da sommare, espresso in centesimi ) RETURNS double DETERMINISTIC BEGIN DECLARE ore INT; DECLARE minuti INT; DECLARE somma60esimi DOUBLE; -- Convertiamo il valore da centesimi (xx.xx) in ore e minuti SET ore = FLOOR(val / 100); SET minuti = val - (ore * 100); -- Calcoliamo la somma in 60esimi: (ore * 60 + minuti) è la somma totale in minuti SET somma60esimi = (ore * 60 + minuti) / 60; RETURN somma60esimi; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 18. SQL Error: 1064 - Creating routine tempus_innodb.f_corregge_60min Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_corregge_60min`(ore double) RETURNS double DETERMINISTIC BEGIN declare ore_da_fare_troncato, minuti_da_fare, calcolato double; declare valore_tronca integer; set valore_tronca = 0; set ore_da_fare_troncato = f_tronca(ore, valore_tronca); set ore_da_fare_troncato = round(ore_da_fare_troncato, valore_tronca); set minuti_da_fare = ore - ore_da_fare_troncato; set minuti_da_fare = minuti_da_fare * 100; if (minuti_da_fare > 59) then begin set minuti_da_fare = 0; set ore_da_fare_troncato = ore_da_fare_troncato +1; end; end IF; set minuti_da_fare = minuti_da_fare / 100; set valore_tronca = 2; set calcolato = ore_da_fare_troncato + minuti_da_fare; set calcolato = round(calcolato, valore_tronca); return calcolato; END - Creating routine tempus_innodb.f_forza_60esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_forza_60esimi`(ore DOUBLE) RETURNS double DETERMINISTIC BEGIN DECLARE ore_da_fare_troncato, minuti_da_fare, calcolato DOUBLE; DECLARE valore_tronca INTEGER; -- Impostazioni iniziali SET valore_tronca = 0; -- Troncamento delle ore SET ore_da_fare_troncato = f_tronca(ore, valore_tronca); SET ore_da_fare_troncato = ROUND(ore_da_fare_troncato, valore_tronca); -- Calcolo dei minuti rimanenti SET minuti_da_fare = (ore - ore_da_fare_troncato) * 100; -- Gestione dei minuti tra 59 e 60 IF (minuti_da_fare > 59 AND minuti_da_fare <= 60) THEN SET minuti_da_fare = 0; SET ore_da_fare_troncato = ore_da_fare_troncato + 1; END IF; -- Gestione dei minuti superiori a 60 IF minuti_da_fare > 60 THEN SET minuti_da_fare = minuti_da_fare * 60; SET minuti_da_fare = minuti_da_fare / 100; END IF; -- Conversione finale dei minuti SET minuti_da_fare = minuti_da_fare / 100; -- Calcolo del valore finale SET valore_tronca = 2; SET calcolato = ore_da_fare_troncato + minuti_da_fare; SET calcolato = ROUND(calcolato, valore_tronca); RETURN calcolato; END - Creating routine tempus_innodb.f_somma60esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_somma60esimi`(ore1 DOUBLE, ore2 DOUBLE) RETURNS double NO SQL BEGIN DECLARE ore1_tronca DOUBLE; DECLARE ore2_tronca DOUBLE; DECLARE min1 DOUBLE; DECLARE min2 DOUBLE; DECLARE ore_sommate DOUBLE; DECLARE complemento_60_min1 DOUBLE; DECLARE valore_tronca INTEGER; -- Gestione dei valori NULL negli input IF ore1 IS NULL THEN SET ore1 = 0; END IF; IF ore2 IS NULL THEN SET ore2 = 0; END IF; -- Impostazioni iniziali SET valore_tronca = 0; -- Troncamento delle ore SET ore1_tronca = f_tronca(ore1, valore_tronca); SET ore2_tronca = f_tronca(ore2, valore_tronca); -- Calcolo dei minuti rimanenti SET min1 = ore1 - ore1_tronca; SET min2 = ore2 - ore2_tronca; SET complemento_60_min1 = 0.60 - min1; -- Gestione dei minuti e delle ore sommate IF complemento_60_min1 < min2 THEN SET min2 = min2 - complemento_60_min1; SET ore1_tronca = ore1_tronca + 1; SET ore_sommate = ore1_tronca + ore2_tronca + min2; ELSEIF complemento_60_min1 > min2 THEN SET ore_sommate = ore1_tronca + ore2_tronca + min1 + min2; ELSE -- Caso particolare per complemento = min2 IF min2 = 0 THEN SET ore_sommate = ore1_tronca + ore2_tronca; ELSE SET ore_sommate = ore1_tronca + ore2_tronca + 1; END IF; END IF; -- Arrotondamento finale SET valore_tronca = 2; SET ore_sommate = ROUND(ore_sommate, valore_tronca); -- Gestione di valori NULL (eventuali anomalie) IF ore_sommate IS NULL THEN SET ore_sommate = 0; END IF; -- Conversione finale con f_sommein60esimi SET ore_sommate = f_sommein60esimi(ore_sommate); RETURN ore_sommate; END - Creating routine tempus_innodb.f_somma_60esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_somma_60esimi`(ore1 double, ore2 double) RETURNS double NO SQL begin DECLARE ore1_tronca DOUBLE; DECLARE ore2_tronca DOUBLE; DECLARE min1 DOUBLE; DECLARE min2 DOUBLE; DECLARE ore_sommate DOUBLE; DECLARE complemento_60_min1 DOUBLE; DECLARE valore_tronca INTEGER; -- Gestione dei valori NULL negli input IF ore1 IS NULL THEN SET ore1 = 0; END IF; IF ore2 IS NULL THEN SET ore2 = 0; END IF; -- Impostazioni iniziali SET valore_tronca = 0; -- Troncamento delle ore SET ore1_tronca = f_tronca(ore1, valore_tronca); SET ore2_tronca = f_tronca(ore2, valore_tronca); -- Calcolo dei minuti rimanenti SET min1 = ore1 - ore1_tronca; SET min2 = ore2 - ore2_tronca; SET complemento_60_min1 = 0.60 - min1; -- Gestione dei minuti e delle ore sommate IF complemento_60_min1 < min2 THEN SET min2 = min2 - complemento_60_min1; SET ore1_tronca = ore1_tronca + 1; SET ore_sommate = ore1_tronca + ore2_tronca + min2; ELSEIF complemento_60_min1 > min2 THEN SET ore_sommate = ore1_tronca + ore2_tronca + min1 + min2; ELSE -- Caso particolare per complemento = min2 IF min2 = 0 THEN SET ore_sommate = ore1_tronca + ore2_tronca; ELSE SET ore_sommate = ore1_tronca + ore2_tronca + 1; END IF; END IF; -- Arrotondamento finale SET valore_tronca = 2; SET ore_sommate = ROUND(ore_sommate, valore_tronca); -- Gestione di valori NULL (eventuali anomalie) IF ore_sommate IS NULL THEN SET ore_sommate = 0; END IF; -- Conversione finale con f_sommein60esimi SET ore_sommate = f_sommein60esimi(ore_sommate); RETURN ore_sommate; END - Creating routine tempus_innodb.f_somma_60esimi_negativi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_somma_60esimi_negativi`(ore1 double, ore2 double) RETURNS double DETERMINISTIC BEGIN declare ore1_tronca, ore2_tronca, min1, min1_salva, min2, min2_salva, ore_sommate, complemento_60_min1, complemento_60_min2 double; declare valore_tronca integer; -- Controllo se le variabili di input sono nulle e le assegno a 0 IF ore1 IS NULL THEN SET ore1 = 0; END IF; IF ore2 IS NULL THEN SET ore2 = 0; END IF; set ore2 = ore2 * -1; /* IL SECONDO PARAMS arriva NEGATIVO SE FACCIO QUESTO CON somma_60esimi NON FUNZIONA IN QUANTO è pensata per sommare numeri positivi questa funziona solo se il secondo params è negativo usata nei timesheet per ricalcolare i totali quando diminuiscono le ore lavorate sul progetto */ set valore_tronca = 0; set ore1_tronca = f_tronca(ore1, valore_tronca); set ore2_tronca = f_tronca(ore2, valore_tronca); set min1 = ore1 - ore1_tronca; set min2 = ore2 - ore2_tronca; set complemento_60_min1 = 0.60 - min1; set complemento_60_min2 = 0.60 - min2; if (complemento_60_min1 < complemento_60_min2) then begin set min2_salva = complemento_60_min2 - complemento_60_min1; if (min1 < min2) then set ore1_tronca = ore1_tronca - 1; end IF; set ore_sommate = ore1_tronca - ore2_tronca + min2_salva; end; end IF; if (complemento_60_min1 > complemento_60_min2) then begin set ore1_tronca = ore1_tronca - 1; set ore_sommate = ore1_tronca - ore2_tronca + min1 + complemento_60_min2; end; end IF; /* campita solo per 30 e zero */ if (complemento_60_min1 = complemento_60_min2) then begin if (min2 >= 0) then set ore_sommate = ore1_tronca - ore2_tronca; end IF; /* if (min2 > 0) then set ore_sommate = ore1_tronca - ore2_tronca; end IF; */ end; end IF; set valore_tronca = 2; set ore_sommate = round(ore_sommate, valore_tronca); if ore_sommate is null then set ore_sommate = 0; end IF; set ore_sommate = f_sommein60esimi(ore_sommate); return ore_sommate; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` FUNCTION `f_somma_60esimi_negativi`(ore1 double, ore2 double) RETURNS double DETERMINISTIC BEGIN declare ore1_tronca, ore2_tronca, min1, min1_salva, min2, min2_salva, ore_sommate, complemento_60_min1, complemento_60_min2 double; declare valore_tronca integer; -- Controllo se le variabili di input sono nulle e le assegno a 0 IF ore1 IS NULL THEN SET ore1 = 0; END IF; IF ore2 IS NULL THEN SET ore2 = 0; END IF; set ore2 = ore2 * -1; /* IL SECONDO PARAMS arriva NEGATIVO SE FACCIO QUESTO CON somma_60esimi NON FUNZIONA IN QUANTO è pensata per sommare numeri positivi questa funziona solo se il secondo params è negativo usata nei timesheet per ricalcolare i totali quando diminuiscono le ore lavorate sul progetto */ set valore_tronca = 0; set ore1_tronca = f_tronca(ore1, valore_tronca); set ore2_tronca = f_tronca(ore2, valore_tronca); set min1 = ore1 - ore1_tronca; set min2 = ore2 - ore2_tronca; set complemento_60_min1 = 0.60 - min1; set complemento_60_min2 = 0.60 - min2; if (complemento_60_min1 < complemento_60_min2) then begin set min2_salva = complemento_60_min2 - complemento_60_min1; if (min1 < min2) then set ore1_tronca = ore1_tronca - 1; end IF; set ore_sommate = ore1_tronca - ore2_tronca + min2_salva; end; end IF; if (complemento_60_min1 > complemento_60_min2) then begin set ore1_tronca = ore1_tronca - 1; set ore_sommate = ore1_tronca - ore2_tronca + min1 + complemento_60_min2; end; end IF; /* campita solo per 30 e zero */ if (complemento_60_min1 = complemento_60_min2) then begin if (min2 >= 0) then set ore_sommate = ore1_tronca - ore2_tronca; end IF; /* if (min2 > 0) then set ore_sommate = ore1_tronca - ore2_tronca; end IF; */ end; end IF; set valore_tronca = 2; set ore_sommate = round(ore_sommate, valore_tronca); if ore_sommate is null then set ore_sommate = 0; end IF; set ore_sommate = f_sommein60esimi(ore_sommate); return ore_sommate; END$$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 69. SQL Error: 1064 - Creating routine tempus_innodb.f_somma_60esimi_negativi_positivi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_somma_60esimi_negativi_positivi`(ore1 double, ore2 double) RETURNS double DETERMINISTIC BEGIN /* controlla il secondo params e chiama la function negativi in caso di secondo params negativo chiama la function normale se il secondo params è positivo */ declare result double; if (ore2 < 0) then set result = f_somma_60esimi_negativi(ore1, ore2); else set result = f_somma_60esimi(ore1, ore2); end IF; RETURN result; END$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` FUNCTION `f_somma_60esimi_negativi_positivi`(ore1 double, ore2 double) RETURNS double DETERMINISTIC BEGIN /* controlla il secondo params e chiama la function negativi in caso di secondo params negativo chiama la function normale se il secondo params è positivo */ declare result double; if (ore2 < 0) then set result = f_somma_60esimi_negativi(ore1, ore2); else set result = f_somma_60esimi(ore1, ore2); end IF; RETURN result; END$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 16. SQL Error: 1064 - Creating routine tempus_innodb.f_sommein60esimi Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_sommein60esimi`(ore DOUBLE) RETURNS double DETERMINISTIC BEGIN DECLARE valore_tronca INT; DECLARE ora_troncata DOUBLE; DECLARE ora_risultato DOUBLE; DECLARE min_test DOUBLE; -- Gestione di input NULL IF ore IS NULL THEN RETURN 0; END IF; -- Inizializzazione variabili SET valore_tronca = 0; -- Separazione della parte intera (ore) dalla parte decimale (minuti) SET ora_troncata = f_tronca(ore, valore_tronca); SET min_test = ore - ora_troncata; -- Arrotondamento dei minuti a due cifre decimali SET valore_tronca = 2; SET min_test = ROUND(min_test, valore_tronca); -- Conversione dei minuti in formato 60esimi IF min_test > 0.59 THEN SET min_test = (min_test - 0.60) + 1; END IF; -- Calcolo del risultato finale SET ora_risultato = ora_troncata + min_test; -- Gestione di eventuali valori NULL imprevisti IF ora_risultato IS NULL THEN SET ora_risultato = 0; END IF; RETURN ora_risultato; END - Creating routine tempus_innodb.f_tronca Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `f_tronca`(val1 double, val2 integer) RETURNS double DETERMINISTIC BEGIN declare result double; set result = truncate(val1, val2); RETURN result; END - Creating routine tempus_innodb.test_exit Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` FUNCTION `test_exit`(val DOUBLE) RETURNS double DETERMINISTIC BEGIN IF val IS NULL THEN RETURN 0; -- La funzione termina qui END IF; -- Questa parte non sarà mai eseguita se val è NULL RETURN 100; END$$ WARNING: Error executing ' CREATE DEFINER=`root`@`%` FUNCTION `test_exit`(val DOUBLE) RETURNS double DETERMINISTIC BEGIN IF val IS NULL THEN RETURN 0; -- La funzione termina qui END IF; -- Questa parte non sarà mai eseguita se val è NULL RETURN 100; END$$' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 10. SQL Error: 1064 - Creating trigger tempus_innodb.sys_config_utente.sys_config_utente_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `sys_config_utente_AFTER_UPDATE` BEFORE UPDATE ON `sys_config_utente` FOR EACH ROW BEGIN declare wnominativo char(100); select concat(rtrim(cognome_utente), ' ', rtrim(nome_utente)) into wnominativo from sys_utenti where pk_progressivo = new.fk_utente; set new.nominativo = wnominativo; END - Creating trigger tempus_innodb.sys_user_online.sys_user_online_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `sys_user_online_BEFORE_INSERT` BEFORE INSERT ON `sys_user_online` FOR EACH ROW BEGIN DECLARE WUTENTE CHAR(10); DECLARE WNOME_UTENTE CHAR(30); DECLARE WCOGNOME_UTENTE CHAR(30); -- Recupera i dati dell'utente SELECT NOME_UTENTE, COGNOME_UTENTE, utente INTO WNOME_UTENTE, WCOGNOME_UTENTE, WUTENTE FROM sys_utenti WHERE PK_PROGRESSIVO = NEW.K_UTENTE; -- Imposta i campi dell'utente SET NEW.NOME_UTENTE = WNOME_UTENTE; SET NEW.COGNOME_UTENTE = WCOGNOME_UTENTE; -- Imposta il valore predefinito per ip_address SET NEW.IP_ADDRESS = IFNULL(NEW.IP_ADDRESS, 'INDEFINITO'); SET NEW.IP_ADDRESS = IF(NEW.IP_ADDRESS = '', 'INDEFINITO', NEW.IP_ADDRESS); -- Inserisce i dati nella tabella SYS_IP_ADDRESS_UTENTE INSERT INTO SYS_IP_ADDRESS_UTENTE VALUES (0, NEW.K_UTENTE, WUTENTE, NEW.IP_ADDRESS, NEW.HOST_NAME, NOW()); END - Creating trigger tempus_innodb.sys_user_online.sys_user_online_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `sys_user_online_BEFORE_UPDATE` BEFORE UPDATE ON `sys_user_online` FOR EACH ROW BEGIN IF (new.ip_address IS NULL OR new.ip_address = '') THEN SET new.ip_address = 'INDEFINITO'; END IF; END - Creating trigger tempus_innodb.sys_utenti.sys_utenti_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `sys_utenti_BEFORE_INSERT` BEFORE INSERT ON `sys_utenti` FOR EACH ROW BEGIN declare contarec smallint; declare messaggio char(250); /* vecchia gestione da eliminare il campo user_password */ set new.cognome_utente = upper(new.cognome_utente); set new.nome_utente = upper(new.nome_utente); if new.user_password is null then SET new.user_password = 1; end IF; /* SELECT COUNT(*) INTO contarec FROM sys_utenti WHERE utente = new.utente; if contarec is null then set contarec = 0; end IF; if contarec > 0 then begin call exception_message('RECORD_ESISTE', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; */ END - Creating trigger tempus_innodb.sys_utenti.sys_utenti_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `sys_utenti_AFTER_INSERT` AFTER INSERT ON `sys_utenti` FOR EACH ROW BEGIN /* la mansione utente la crea la procedure di assegna permessi*/ /*insert into sys_utenti_mansione values (0, new.pk_progressivo, new.utente, 'UT'); */ /* crea configurazione di base */ insert into sys_config_utente values (new.pk_progressivo, new.pk_progressivo, 9999, 9999, 9999, new.utente, 'N', 'N', 'N', 'N', 'N', 9999, 9999, 9999, 9999, '9999', CONCAT(rtrim(new.cognome_utente), ' ', rtrim(new.nome_utente))); /* abilito i permessi standard 0=assegna*/ /* QNC su Tempus non la uso call utils_assegna_permessi_utente(new.utente, new.pk_progressivo, 0); */ /* questa non serve in quanto sys_config_utenti ha come pk_progressivo quello di tt_anag_personale in questa maniera si risolve problema di compatibilita con mysql che non permette aggiornamenti su una tabella che ha innescato questo processo update tt_anag_personale set fk_utenti = new.pk_progressivo where pk_progressivo = new.fk_anag; */ END - Creating trigger tempus_innodb.sys_utenti.sys_utenti_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `sys_utenti_BEFORE_UPDATE` BEFORE UPDATE ON `sys_utenti` FOR EACH ROW BEGIN declare data_psw date; -- Imposta la data di scadenza della password (90 giorni dalla data corrente) set data_psw = current_date + interval 90 day; -- Converte i valori in maiuscolo set new.cognome_utente = upper(new.cognome_utente); set new.nome_utente = upper(new.nome_utente); -- Se la scadenza della password è NULL, la imposta a 90 giorni dalla data corrente if (new.scadenza_psw is null) then set new.scadenza_psw = data_psw; end IF; END - Creating trigger tempus_innodb.ts1_riclassifica_progetto.ts1_riclassifica_progetto_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts1_riclassifica_progetto_AFTER_INSERT` AFTER INSERT ON `ts1_riclassifica_progetto` FOR EACH ROW BEGIN declare pk_progressivo_costo integer; declare xbudget_mg double precision; declare xdata_inizio date; declare xdata_fine date; select pk_progressivo into pk_progressivo_costo from ts1_tipo_costi where flag_personale = 'S'; select budget_mg, data_inizio, data_fine into xbudget_mg, xdata_inizio, xdata_fine from TS_MACROGRUPPO where pk_progressivo = new.FK_MACROGRUPPO; insert into TS1_RICLASSIFICA_PROGETTO_DETAIL (pk_progressivo, fk_param_progetto, fk_tipo_costo, flag_attivo, data_in, data_fi, budget, budget_utilizzato, quota_detraibile, budget_tmp_calcoli, data_in_tmp, fk_anag) values (0, new.pk_progressivo, pk_progressivo_costo, 'S', xdata_inizio, xdata_fine, xbudget_mg, 0, 100, 0, data_inizio, 0); END - Creating trigger tempus_innodb.ts1_tipo_costi.ts1_tipo_costi_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts1_tipo_costi_BEFORE_INSERT` BEFORE INSERT ON `ts1_tipo_costi` FOR EACH ROW BEGIN declare count_rec smallint; declare messaggio char(250); if (new.flag_personale = 'S') then begin select count(*) into count_rec from TS1_TIPO_COSTI where flag_personale = 'S'; if (count_rec is null) then set count_rec = 0; end IF; if (count_rec > 0) then begin call exception_message('COSTO_PERSONALE_UNICO', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; end; end IF; END - Creating trigger tempus_innodb.ts1_tipo_costi.ts1_tipo_costi_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts1_tipo_costi_BEFORE_UPDATE` BEFORE UPDATE ON `ts1_tipo_costi` FOR EACH ROW BEGIN declare count_rec smallint; declare messaggio char(250); if (new.flag_personale = 'S') then begin select count(*) into count_rec from TS1_TIPO_COSTI where flag_personale = 'S'; if (count_rec is null) then set count_rec = 0; end IF; if (count_rec > 0) then begin call exception_message('COSTO_PERSONALE_UNICO', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; end; end IF; END - Creating trigger tempus_innodb.ts_azione.ts_azione_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_BEFORE_INSERT` BEFORE INSERT ON `ts_azione` FOR EACH ROW BEGIN DECLARE xbudget_mg DOUBLE PRECISION; DECLARE xbudget_test DOUBLE PRECISION; DECLARE chk_chiuso CHAR(1); DECLARE chk_plan CHAR(1); DECLARE messaggio CHAR(250); SELECT flag_chiuso, flag_plan INTO chk_chiuso, chk_plan FROM ts_macrogruppo WHERE pk_progressivo = new.fk_macrogruppo; SET new.flag_plan = chk_plan; IF (chk_chiuso IS NULL) THEN SET chk_chiuso = 'N'; END IF; IF (chk_chiuso = 'S') THEN CALL exception_message('PROGETTO_CHIUSO', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; IF (new.costo_standard = 'S' AND new.COSTO_STANDARD_1_2_ZERO_PER_NO = 0) THEN CALL exception_message('CTRL_COSTO_STANDARD', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; IF (new.CUP IS NULL OR new.CUP = '') THEN CALL exception_message('CTRL_CUP', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; IF (new.descrizione IS NULL) THEN SET new.descrizione = new.azione; END IF; IF (new.monte_ore IS NULL OR new.monte_ore = 0) THEN CALL exception_message('CTRL_MONTE_ORE', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; IF (new.data_inizio IS NULL OR new.data_fine IS NULL) THEN CALL exception_message('CTRL_DATE', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; IF (new.data_inizio > new.data_fine) THEN CALL exception_message('CTRL_DATE_CONGRUE', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; SELECT IFNULL(budget_mg, 0) INTO xbudget_mg FROM ts_macrogruppo WHERE pk_progressivo = new.FK_MACROGRUPPO; SELECT IFNULL(SUM(budget_azione), 0) INTO xbudget_test FROM ts_azione WHERE fk_macrogruppo = new.fk_macrogruppo; IF (xbudget_mg > 0 AND (xbudget_test + new.budget_azione) > xbudget_mg) THEN CALL exception_message('BUDGET_ERRATO', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET message_text = messaggio; END IF; SET xbudget_test = xbudget_test + new.budget_azione; UPDATE ts_macrogruppo SET budget_mg_assegnato = xbudget_test WHERE pk_progressivo = new.fk_macrogruppo; END - Creating trigger tempus_innodb.ts_azione.ts_azione_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_AFTER_INSERT` AFTER INSERT ON `ts_azione` FOR EACH ROW BEGIN if (new.flag_plan = 'S') then begin /* ripropone i params impostati in macrogruppo */ insert into TS_AZIONE_PLAN select 0, new.pk_progressivo, fk_macrogruppo, flag_escludi_sabato, flag_escludi_domenica, flag_ogni_giorno, flag_giorni_alterni, percentuale_max_giorno, totale_ore, totale_ore_plan, totale_costo from ts_macrogruppo_plan where fk_macrogruppo = new.fk_macrogruppo; end; end IF; END - Creating trigger tempus_innodb.ts_azione.ts_azione_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_BEFORE_UPDATE` BEFORE UPDATE ON `ts_azione` FOR EACH ROW BEGIN -- Dichiarazione delle variabili declare xbudget_mg DOUBLE PRECISION; -- Variabile per il budget del macrogruppo declare xbudget_test DOUBLE PRECISION; -- Variabile per il budget totale delle azioni declare chk_chiuso char(1); -- Variabile per il controllo dello stato di chiusura del macrogruppo declare messaggio char(250); -- Variabile per memorizzare il messaggio di errore -- Seleziona lo stato del macrogruppo (chiuso o meno) in base alla chiave esterna fk_macrogruppo select flag_chiuso into chk_chiuso from ts_macrogruppo where pk_progressivo = new.fk_macrogruppo; -- Se il valore è nullo, imposta il flag su 'N' (non chiuso) if (chk_chiuso is null) then set chk_chiuso = 'N'; end IF; -- Se il progetto è chiuso, segnala l'errore if (chk_chiuso = 'S') then begin call exception_message('PROGETTO_CHIUSO', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; -- Arrotonda i valori per il budget azione set new.BUDGET_AZIONE_USATO=f_arrotonda(new.BUDGET_AZIONE_USATO,2); set new.BUDGET_AZIONE_ASSEGNATO=f_arrotonda(new.BUDGET_AZIONE_ASSEGNATO,2); -- Controllo sul costo standard: se è 'S' deve esserci un valore non nullo per COSTO_STANDARD_1_2_ZERO_PER_NO if (new.costo_standard = 'S') then if (new.COSTO_STANDARD_1_2_ZERO_PER_NO = 0) then begin call exception_message('CTRL_COSTO_STANDARD', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; end IF; -- Se il costo standard è 'N', imposta il valore di COSTO_STANDARD_1_2_ZERO_PER_NO a 0 if (new.costo_standard = 'N') then set new.COSTO_STANDARD_1_2_ZERO_PER_NO = 0; end IF; -- Controllo sulla validità del CUP: non deve essere nullo o vuoto if (new.CUP is null) or (new.CUP = '') then begin call exception_message('CTRL_CUP', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; -- Se la descrizione è nulla, imposta il valore della descrizione uguale a quello dell'azione if (new.descrizione is null) then set new.descrizione = new.azione; end IF; -- Controllo sul monte ore: non deve essere nullo o pari a 0 if (new.monte_ore IS NULL or new.monte_ore = 0) then begin call exception_message('CTRL_MONTE_ORE', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; -- Controllo sulla validità delle date: data_inizio non può essere nulla e deve essere antecedente o uguale alla data_fine if (new.data_inizio is null) or (new.data_fine is null) then begin call exception_message('CTRL_DATE', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; -- Controllo sulla congruità delle date: la data di inizio non può essere successiva alla data di fine if (new.data_inizio > new.data_fine) then begin call exception_message('CTRL_DATE_CONGRUE', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; -- Seleziona il budget del macrogruppo per confrontarlo con il totale delle azioni select budget_mg into xbudget_mg from ts_macrogruppo where pk_progressivo = new.FK_MACROGRUPPO; -- Se il budget del macrogruppo è nullo, imposta il valore a 0 if (xbudget_mg is null) then set xbudget_mg = 0; end IF; -- Calcola il totale del budget delle azioni per il macrogruppo select sum(budget_azione) into xbudget_test from ts_azione where fk_macrogruppo = new.fk_macrogruppo; -- Se il totale del budget è nullo, imposta il valore a 0 if (xbudget_test is null) then set xbudget_test = 0; end IF; -- Controlla se il budget delle azioni supera il budget del macrogruppo if (xbudget_mg > 0) then if ((xbudget_test + new.budget_azione - old.budget_azione) > xbudget_mg) then begin call exception_message('BUDGET_ERRATO', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; end IF; -- Aggiusta il totale del budget delle azioni set xbudget_test = xbudget_test + new.budget_azione - old.budget_azione; -- Aggiorna il budget del macrogruppo update ts_macrogruppo set budget_mg_assegnato = xbudget_test, BUDGET_MG_USATO = BUDGET_MG_USATO - old.budget_azione_usato + new.budget_azione_usato where pk_progressivo = new.fk_macrogruppo; END - Creating trigger tempus_innodb.ts_azione.ts_azione_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_AFTER_UPDATE` AFTER UPDATE ON `ts_azione` FOR EACH ROW BEGIN if (new.flag_plan = 'S' and old.flag_plan = 'N') then /* ripropone i params impostati in macrogruppo */ insert into ts_azione_plan select 0, fk_macrogruppo, new.pk_progressivo, flag_escludi_sabato, flag_escludi_domenica, flag_ogni_giorno, flag_giorni_alterni, percentuale_max_giorno, totale_ore, totale_ore_plan, totale_costo from ts_macrogruppo_plan where fk_macrogruppo = new.fk_macrogruppo; end IF; if (new.flag_plan = 'N' and old.flag_plan = 'S') then /* ripropone i params impostati in macrogruppo */ delete from ts_azione_plan where fk_azione = new.pk_progressivo; end IF; END - Creating trigger tempus_innodb.ts_azione.ts_azione_BEFORE_DELETE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_BEFORE_DELETE` BEFORE DELETE ON `ts_azione` FOR EACH ROW BEGIN declare chk_chiuso char(1); declare messaggio char(250); SELECT flag_chiuso INTO chk_chiuso FROM ts_macrogruppo WHERE pk_progressivo = old.fk_macrogruppo; if (chk_chiuso is null) then set chk_chiuso = 'N'; end IF; if (chk_chiuso = 'S') then call exception_message('PROGETTO_CHIUSO', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end IF; UPDATE ts_macrogruppo SET budget_mg_assegnato = budget_mg_assegnato - old.budget_azione, budget_mg_usato = budget_mg_usato - old.budget_azione_usato WHERE pk_progressivo = old.fk_macrogruppo; END - Creating trigger tempus_innodb.ts_azione_parametri_calcolo.ts_azione_parametri_calcolo_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_parametri_calcolo_BEFORE_INSERT` BEFORE INSERT ON `ts_azione_parametri_calcolo` FOR EACH ROW BEGIN declare wnumero_sal smallint; declare messaggio char(250); -- Arrotondamenti dei campi numerici set new.mesi_uomo_dip = f_arrotonda(new.mesi_uomo_dip, 2); set new.importo_dip = f_arrotonda(new.importo_dip, 2); set new.ore_progetto_dip = f_arrotonda(new.ore_progetto_dip, 2); set new.ore_base_calcolo_dip = f_arrotonda(new.ore_base_calcolo_dip, 2); -- Assegnazione di numero_sal se è zero if (new.numero_sal = 0) then select ifnull(max(ts.nsal), 1) into wnumero_sal from ts_azione_sal ts join ts_azione_struttura ts_str on ts_str.fk_azione = ts.fk_azione where ts_str.pk_progressivo = new.fk_azione_struttura; set new.numero_sal = wnumero_sal; end if; -- Verifica della sovrapposizione delle date select count(*) into wnumero_sal from ts_azione_parametri_calcolo be where fk_azione_struttura = new.fk_azione_struttura and ( (data_inizio <= new.data_inizio and data_fine >= new.data_fine) or (data_inizio >= new.data_inizio and data_fine <= new.data_fine) ); -- Gestione errore in caso di sovrapposizione delle date if (wnumero_sal > 0) then call exception_message('DATE_SAL_PRESENTI', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end if; -- Arrotondamento per coeff_correzione_ore set new.coeff_correzione_ore = f_arrotonda(new.coeff_correzione_ore, 2); END - Creating trigger tempus_innodb.ts_azione_parametri_calcolo.ts_azione_parametri_calcolo_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_parametri_calcolo_BEFORE_UPDATE` BEFORE UPDATE ON `ts_azione_parametri_calcolo` FOR EACH ROW BEGIN set NEW.MESI_UOMO_DIP = round(NEW.MESI_UOMO_DIP, 2); set NEW.IMPORTO_DIP = roud(NEW.IMPORTO_DIP, 2); set NEW.ORE_PROGETTO_DIP = round(NEW.ORE_PROGETTO_DIP, 2); set NEW.ORE_BASE_CALCOLO_DIP = round(NEW.ORE_BASE_CALCOLO_DIP, 2); END - Creating trigger tempus_innodb.ts_azione_sal.ts_azione_sal_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_sal_BEFORE_INSERT` BEFORE INSERT ON `ts_azione_sal` FOR EACH ROW BEGIN DECLARE xnsal SMALLINT; -- Se esiste un SAL per quella azione e quelle date, usa il nsal esistente SELECT nsal INTO xnsal FROM ts_azione_sal WHERE fk_Azione = new.fk_azione AND data_in = new.data_in AND data_fi = new.data_fi LIMIT 1; -- Limita il risultato a un singolo valore -- Se non esiste, cerca il massimo nsal per quell'azione IF xnsal IS NULL THEN SELECT COALESCE(MAX(nsal), 0) INTO xnsal FROM ts_azione_sal WHERE fk_azione = new.fk_azione; END IF; -- Incrementa di 1 e assegna al nuovo record SET new.nsal = xnsal + 1; END - Creating trigger tempus_innodb.ts_azione_sottolivelli.ts_azione_sottolivelli_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_sottolivelli_BEFORE_INSERT` BEFORE INSERT ON `ts_azione_sottolivelli` FOR EACH ROW BEGIN declare xbudget_azione double precision; declare xbudget_azliv double precision; declare xbudget_test double precision; declare xdata_inizio_azliv date; declare xdata_fine_azliv date; declare messaggio char(250); select data_inizio, data_fine, sum(budget_azione) into xdata_inizio_azliv, xdata_fine_azliv, xbudget_azione from ts_azione where pk_progressivo = new.fk_azione group by data_inizio, data_fine ; set new.data_inizio_azliv = xdata_inizio_azliv; set new.data_fine_azliv = xdata_fine_azliv; if (xbudget_azione is null) then set xbudget_azione = 0; end IF; if (xbudget_azione > 0) then begin select sum(budget_azliv) into xbudget_azliv from ts_azione_sottolivelli where fk_azione = new.fk_azione; if (xbudget_azliv is null) then set xbudget_azliv = 0; end IF; if ((xbudget_azliv + new.budget_azliv) > xbudget_azione) then begin call exception_message('BUDGET_ERRATO_AZ', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; set xbudget_test = xbudget_azliv + new.budget_azliv; update ts_azione set budget_azione_assegnato = xbudget_test where pk_progressivo = new.fk_azione; end; end IF; END - Creating trigger tempus_innodb.ts_azione_sottolivelli.ts_azione_sottolivelli_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_sottolivelli_AFTER_INSERT` AFTER INSERT ON `ts_azione_sottolivelli` FOR EACH ROW BEGIN declare mg integer; if (new.flag_plan = 'S') then begin /* ripropone i params impostati in AZIONE */ select FK_MACROGRUPPO into mg from ts_azione where pk_progressivo = new.fk_azione; insert into TS_AZIONE_SOTTOLIVELLI_PLAN select 0, mg, new.fk_azione, new.pk_progressivo, flag_escludi_sabato, flag_escludi_domenica, flag_ogni_giorno, flag_giorni_alterni, percentuale_max_giorno, totale_ore, totale_ore_plan, totale_costo from ts_azione_plan where fk_azione = new.fk_azione; end; end IF; END - Creating trigger tempus_innodb.ts_azione_sottolivelli.ts_azione_sottolivelli_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_sottolivelli_BEFORE_UPDATE` BEFORE UPDATE ON `ts_azione_sottolivelli` FOR EACH ROW BEGIN declare xbudget_azione DOUBLE PRECISION; declare xbudget_azliv DOUBLE PRECISION; declare xbudget_test DOUBLE PRECISION; declare messaggio char(250); -- Arrotondamenti per i budget set new.BUDGET_AZLIV = f_arrotonda(new.BUDGET_AZLIV, 2); set new.BUDGET_AZLIV_USATO = f_arrotonda(new.BUDGET_AZLIV_USATO, 2); -- Calcolo del budget totale assegnato all'azione select ifnull(sum(budget_azione), 0) into xbudget_azione from ts_azione where pk_progressivo = new.fk_azione; -- Verifica se il budget assegnato è maggiore di zero if (xbudget_azione > 0) then -- Calcolo del budget totale a livello di sottolivelli select ifnull(sum(budget_azliv), 0) into xbudget_azliv from ts_azione_sottolivelli where fk_azione = new.fk_azione; -- Controllo che il nuovo budget non superi il totale assegnato if (round((xbudget_azliv + new.budget_azliv - old.budget_azliv), 2) > xbudget_azione) then call exception_message('BUDGET_ERRATO_AZ', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end if; -- Aggiornamento del budget assegnato all'azione set xbudget_test = xbudget_azliv + new.budget_azliv - old.budget_azliv; update ts_azione set budget_azione_assegnato = xbudget_test where pk_progressivo = new.fk_azione; end if; -- Verifica modifiche nel budget usato if (new.BUDGET_AZLIV_USATO <> old.BUDGET_AZLIV_USATO) then update ts_azione set BUDGET_AZIONE_USATO = BUDGET_AZIONE_USATO + new.BUDGET_AZLIV_USATO - old.BUDGET_AZLIV_USATO where pk_progressivo = new.fk_azione; end if; END - Creating trigger tempus_innodb.ts_azione_sottolivelli.ts_azione_sottolivelli_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_sottolivelli_AFTER_UPDATE` AFTER UPDATE ON `ts_azione_sottolivelli` FOR EACH ROW BEGIN declare mg integer; if (new.flag_plan = 'S' and old.flag_plan = 'N') then begin /* ripropone i params impostati in macrogruppo */ select FK_MACROGRUPPO into mg from ts_azione where pk_progressivo = new.fk_azione; insert into ts_azione_sottolivelli_plan select 0, mg, new.fk_azione, new.pk_progressivo, flag_escludi_sabato, flag_escludi_domenica, flag_ogni_giorno, flag_giorni_alterni, percentuale_max_giorno, totale_ore, totale_ore_plan, totale_costo from ts_azione_plan where fk_azione = new.fk_azione; end; end IF; if (new.flag_plan = 'N' and old.flag_plan = 'S') then /* ripropone i params impostati in macrogruppo */ delete from ts_azione_sottolivelli_plan where fk_azione_sottoliv = new.pk_progressivo; end IF; END - Creating trigger tempus_innodb.ts_azione_sottolivelli.ts_azione_sottolivelli_BEFORE_DELETE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_azione_sottolivelli_BEFORE_DELETE` BEFORE DELETE ON `ts_azione_sottolivelli` FOR EACH ROW BEGIN update ts_azione set budget_azione_assegnato = budget_azione_assegnato - old.budget_azliv, budget_azione_usato = budget_azione_usato - old.budget_azliv_usato where pk_progressivo = old.fk_azione; END - Creating trigger tempus_innodb.ts_cdc.ts_cdc_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_cdc_BEFORE_INSERT` BEFORE INSERT ON `ts_cdc` FOR EACH ROW BEGIN if (new.FLAG_ATTIVO is null) then set new.FLAG_ATTIVO = 'S'; end IF; END - Creating trigger tempus_innodb.ts_macrogruppo.ts_macrogruppo_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_macrogruppo_BEFORE_INSERT` BEFORE INSERT ON `ts_macrogruppo` FOR EACH ROW BEGIN IF (NEW.FLAG_MG_SOSPESO IS NULL) THEN set NEW.FLAG_MG_SOSPESO = 'N'; end IF; END - Creating trigger tempus_innodb.ts_macrogruppo.ts_macrogruppo_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_macrogruppo_AFTER_INSERT` AFTER INSERT ON `ts_macrogruppo` FOR EACH ROW BEGIN if (new.flag_plan = 'S') then insert into TS_MACROGRUPPO_PLAN (pk_progressivo, fk_macrogruppo) values (0, new.pk_progressivo); end IF; END - Creating trigger tempus_innodb.ts_macrogruppo.ts_macrogruppo_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_macrogruppo_BEFORE_UPDATE` BEFORE UPDATE ON `ts_macrogruppo` FOR EACH ROW BEGIN declare xbudget_azione double precision; declare xbudget_test double precision; declare messaggio char(250); SELECT SUM(budget_azione) INTO xbudget_test FROM ts_azione WHERE fk_macrogruppo = new.pk_progressivo; if (xbudget_test is null) then set xbudget_test = 0; end IF; if (xbudget_test > 0) then begin if (xbudget_test > new.budget_mg) then begin call exception_message('BUDGET_ERRATO_MG', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; end; end IF; if (new.flag_chiuso = 'S') then update ts_azione set flag_chiuso = 'S' where fk_macrogruppo = new.pk_progressivo; end IF; END - Creating trigger tempus_innodb.ts_macrogruppo.ts_macrogruppo_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_macrogruppo_AFTER_UPDATE` AFTER UPDATE ON `ts_macrogruppo` FOR EACH ROW BEGIN if (new.flag_plan = 'S' and old.flag_plan = 'N') then insert into TS_MACROGRUPPO_PLAN (pk_progressivo, fk_macrogruppo) values (0, new.pk_progressivo); end IF; if (new.flag_plan = 'N' and old.flag_plan = 'S') then delete from TS_MACROGRUPPO_PLAN where fk_macrogruppo = new.pk_progressivo; end IF; END - Creating trigger tempus_innodb.ts_parametri_elaborazione.ts_parametri_elaborazione_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `ts_parametri_elaborazione_BEFORE_UPDATE` BEFORE UPDATE ON `ts_parametri_elaborazione` FOR EACH ROW BEGIN set new.IMPORTO_CALCOLATO = round(NEW.IMPORTO_CALCOLATO, 2); END - Creating trigger tempus_innodb.tt1_fatture_import_allegati.tt1_fatture_import_doc_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt1_fatture_import_doc_AFTER_INSERT` AFTER INSERT ON `tt1_fatture_import_allegati` FOR EACH ROW BEGIN update TT1_FATTURE_IMPORT set flag_doc_presente = 'S' where pk_progressivo = new.fk_fattimp; END - Creating trigger tempus_innodb.tt1_fatture_import_allegati.tt1_fatture_import_doc_AFTER_DELETE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt1_fatture_import_doc_AFTER_DELETE` AFTER DELETE ON `tt1_fatture_import_allegati` FOR EACH ROW BEGIN declare count_rec smallint; select count(*) into count_rec from tt1_fatture_import_doc where fk_fattimp = old.fk_fattimp and pk_progressivo <> old.pk_progressivo; if (count_rec is null) then set count_rec = 0; end IF; if (count_rec = 0) then update TT1_FATTURE_IMPORT set flag_doc_presente = 'N' where pk_progressivo = old.fk_fattimp; end IF; END - Creating trigger tempus_innodb.tt_allegati_path.tt_allegati_path_AFTER_DELETE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_allegati_path_AFTER_DELETE` AFTER DELETE ON `tt_allegati_path` FOR EACH ROW BEGIN /* Va a cancellare da archivio path i riferimenti del documento */ /* archivi path è per tutti quindi non gestito con foreign key */ if (old.sezione_allegato = 'OS') then delete from TT_ODS_DOC where PK_PROGRESSIVO = old.FK_ALL_SEZIONI; end IF; END - Creating trigger tempus_innodb.tt_anag_personale.tt_anag_personale_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_anag_personale_BEFORE_INSERT` BEFORE INSERT ON `tt_anag_personale` FOR EACH ROW BEGIN /* Questo trigger ingloba la gestione dell'inserimento in varie tabelle che in InterBase veniva fatta con un meccanismo di trigger in cascata sulle varie tabelle. MySQL non gestisce l'aggiornamento di una tabella da parte di un trigger su un'altra tabella se ha lanciato il trigger di partenza. */ DECLARE conta_utenti SMALLINT; DECLARE messaggio CHAR(250); /* provvisoriamente mette la fk generica che esiste in sys_utenti */ SET new.fk_utenti = 99999; SET new.nominativo = CONCAT(RTRIM(new.cognome_utente), ' ', RTRIM(new.nome_utente)); IF (NEW.flag_amministrativo_sn IS NULL) THEN SET new.flag_amministrativo_sn = 'X'; END IF; IF (new.livello_costo_standard_alto IS NULL) THEN SET new.livello_costo_standard_alto = 'N'; END IF; IF (new.livello_costo_standard_medio IS NULL) THEN SET new.livello_costo_standard_medio = 'N'; END IF; IF (new.livello_costo_standard_basso IS NULL) THEN SET new.livello_costo_standard_basso = 'N'; END IF; IF (new.livello_costo_standard_alto = 'X') THEN SET new.livello_costo_standard_alto = 'S'; END IF; IF (new.livello_costo_standard_medio = 'X') THEN SET new.livello_costo_standard_medio = 'S'; END IF; IF (new.livello_costo_standard_basso = 'X') THEN SET new.livello_costo_standard_basso = 'S'; END IF; IF (new.flag_tempo_determinato IS NULL) THEN SET new.flag_tempo_determinato = 'N'; END IF; /* Verifica se esiste già un utente con la stessa FK_ANAG */ SELECT COUNT(*) INTO conta_utenti FROM sys_utenti WHERE FK_ANAG = new.pk_progressivo; IF (conta_utenti IS NULL) THEN SET conta_utenti = 0; END IF; IF (conta_utenti > 0) THEN BEGIN CALL exception_message('anagrafica_utente_presente', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = messaggio; END; END IF; END - Creating trigger tempus_innodb.tt_anag_personale.tt_anag_personale_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_anag_personale_AFTER_INSERT` AFTER INSERT ON `tt_anag_personale` FOR EACH ROW BEGIN /* set @id_anag = last_insert_id(); insert into sys_utenti_asinc values (new.pk_progressivo, new.matricola, new.nome_utente, new.cognome_utente, '1', '','','','',current_timestamp(), 'N', new.utente_num, @id_anag); */ /* vecchio sistema password in disuso lascio il codice fino a cambio struttura tabella */ insert into sys_utenti values (new.pk_progressivo, new.matricola, new.nome_utente, new.cognome_utente, '1', '','','','',(DATE_ADD(CURRENT_DATE(), INTERVAL 90 DAY)), 'N', new.utente_num, new.pk_progressivo); /* Non genera record di base ci penserà la login */ /* insert into ts_pswduser values (0, new.pk_progressivo, '', '', current_timestamp()); */ /* cancella record dalla lista non trovati questo record potrebbe anche non esserci se hanno inserito anagrafica prima del passaggio delle timbrature che contiene la persona o le persone non registrate in anagrafico cosi ho la lista degli errori pulita */ delete from ts_cfisc_nontrovati where cfisc = new.codice_fiscale; END - Creating trigger tempus_innodb.tt_anag_personale.tt_anag_personale_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_anag_personale_BEFORE_UPDATE` BEFORE UPDATE ON `tt_anag_personale` FOR EACH ROW BEGIN -- Converte i nomi in maiuscolo SET new.cognome_utente = UPPER(new.cognome_utente); SET new.nome_utente = UPPER(new.nome_utente); -- Se i campi cognome_utente o nome_utente sono cambiati, aggiorna il nominativo IF (new.cognome_utente <> old.cognome_utente OR new.nome_utente <> old.nome_utente) THEN SET new.nominativo = CONCAT(RTRIM(new.cognome_utente), ' ', RTRIM(new.nome_utente)); -- Aggiorna sys_utenti solo se i valori sono cambiati IF (new.cognome_utente <> old.cognome_utente) THEN UPDATE sys_utenti SET cognome_utente = new.cognome_utente WHERE pk_progressivo = new.fk_utenti; END IF; IF (new.nome_utente <> old.nome_utente) THEN UPDATE sys_utenti SET nome_utente = new.nome_utente WHERE pk_progressivo = new.fk_utenti; END IF; END IF; -- Imposta fk_cdc a 9999 se è NULL IF (new.fk_cdc IS NULL) THEN SET new.fk_cdc = 9999; END IF; END - Creating trigger tempus_innodb.tt_anag_personale_costi.tt_anag_personale_costi_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_anag_personale_costi_BEFORE_INSERT` BEFORE INSERT ON `tt_anag_personale_costi` FOR EACH ROW BEGIN if (new.costo_orario is null) then set new.costo_orario = 0; end IF; if (new.costo_orario_arrotondato is null) then set new.costo_orario_arrotondato = 0; end IF; if (new.costo_orario > 0) then set new.costo_orario_arrotondato = f_arrotonda(new.costo_orario, 2); end IF; if (new.costo_orario_standard is null) then set new.costo_orario_standard = 0; end IF; if (new.costo_orario_standard2 is null) then set new.costo_orario_standard2 = 0; end IF; if (new.costo_orario_standard_arrotondato is null) then set new.costo_orario_standard_arrotondato = 0; end IF; if (new.costo_orario_standard_arrotondato2 is null) then set new.costo_orario_standard_arrotondato2 = 0; end IF; if (new.costo_orario_standard > 0) then set new.costo_orario_standard_arrotondato = f_arrotonda(new.costo_orario_standard, 2); end IF; if (new.costo_orario_standard2 > 0) then set new.costo_orario_standard_arrotondato2 = f_arrotonda(new.costo_orario_standard2, 2); end IF; END - Creating trigger tempus_innodb.tt_anag_personale_costi.tt_anag_personale_costi_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_anag_personale_costi_BEFORE_UPDATE` BEFORE UPDATE ON `tt_anag_personale_costi` FOR EACH ROW BEGIN if (new.costo_orario is null) then set new.costo_orario = 0; end IF; if (new.costo_orario_arrotondato is null) then set new.costo_orario_arrotondato = 0; end IF; if (new.costo_orario > 0) then set new.costo_orario_arrotondato = f_arrotonda(new.costo_orario, 2); end IF; if (new.costo_orario_standard is null) then set new.costo_orario_standard = 0; end IF; if (new.costo_orario_standard2 is null) then set new.costo_orario_standard2 = 0; end IF; if (new.costo_orario_standard_arrotondato is null) then set new.costo_orario_standard_arrotondato = 0; end IF; if (new.costo_orario_standard_arrotondato2 is null) then set new.costo_orario_standard_arrotondato2 = 0; end IF; if (new.costo_orario_standard > 0) then set new.costo_orario_standard_arrotondato = f_arrotonda(new.costo_orario_standard, 2); end IF; if (new.costo_orario_standard2 > 0) then set new.costo_orario_standard_arrotondato2 = f_arrotonda(new.costo_orario_standard2, 2); end IF; END - Creating trigger tempus_innodb.tt_ferie.tt_ferie_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_ferie_BEFORE_UPDATE` BEFORE UPDATE ON `tt_ferie` FOR EACH ROW BEGIN declare intermedio_ore double precision; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_mese = F_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.tt_lista_personale_detail.tt_lista_personale_detail_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_lista_personale_detail_AFTER_UPDATE` AFTER UPDATE ON `tt_lista_personale_detail` FOR EACH ROW BEGIN /* questo permette di sospendere tutto il personale con un colpo solo */ if (new.FLAG_SOSPESO = 'N') then update TT_LISTA_PERSONALE_MASTER set FLAG_SOSPESO = 'N' where pk_progressivo = new.fk_master; end IF; END - Creating trigger tempus_innodb.tt_lista_personale_master.tt_lista_personale_master_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_lista_personale_master_AFTER_UPDATE` AFTER UPDATE ON `tt_lista_personale_master` FOR EACH ROW BEGIN /* questo permette di sospendere tutto il personale con un colpo solo */ if (new.FLAG_SOSPESO = 'S') then update TT_LISTA_PERSONALE_DETAIL set FLAG_SOSPESO = 'S' where fk_master = new.pk_progressivo; end IF; END - Creating trigger tempus_innodb.tt_malattia.tt_malattia_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_malattia_BEFORE_UPDATE` BEFORE UPDATE ON `tt_malattia` FOR EACH ROW BEGIN declare intermedio_ore double precision; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_mese = F_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.tt_permessi.tt_permessi_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_permessi_BEFORE_UPDATE` BEFORE UPDATE ON `tt_permessi` FOR EACH ROW BEGIN declare intermedio_ore double precision; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_mese = F_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.tt_riepilogo_assegnazioni.tt_riepilogo_assegnazioni_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_riepilogo_assegnazioni_BEFORE_INSERT` BEFORE INSERT ON `tt_riepilogo_assegnazioni` FOR EACH ROW BEGIN if (new.costo_assegnato is null) then set new.costo_assegnato = 0; end IF; if (new.ore_assegnate is null) then set new.ore_assegnate = 0; end IF; if (new.ore_caricate is null) then set new.ore_caricate = 0; end IF; if (new.ore_da_caricare is null) then set new.ore_da_caricare = 0; end IF; END - Creating trigger tempus_innodb.tt_riepilogo_assegnazioni.tt_riepilogo_assegnazioni_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_riepilogo_assegnazioni_BEFORE_UPDATE` BEFORE UPDATE ON `tt_riepilogo_assegnazioni` FOR EACH ROW BEGIN if (new.costo_assegnato is null) then set new.costo_assegnato = 0; end IF; if (new.ore_assegnate is null) then set new.ore_assegnate = 0; end IF; if (new.ore_caricate is null) then set new.ore_caricate = 0; end IF; if (new.ore_da_caricare is null) then set new.ore_da_caricare = 0; end IF; if (new.ore_da_caricare > 0) then if (new.ore_assegnate > new.ore_da_caricare) then set new.ore_da_caricare = new.ore_da_caricare * -1; end IF; end IF; END - Creating trigger tempus_innodb.tt_timbrature.tt_timbrature_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timbrature_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timbrature` FOR EACH ROW BEGIN declare intermedio_ore DOUBLE PRECISION; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_MESE = F_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.tt_timbrature_interni.tt_timbrature_interni_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timbrature_interni_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timbrature_interni` FOR EACH ROW BEGIN declare intermedio_ore DOUBLE PRECISION; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_MESE = F_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.tt_timbrature_storico.tt_timbrature_storico_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timbrature_storico_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timbrature_storico` FOR EACH ROW BEGIN declare intermedio_ore double precision; set new.ORE_GIORNO_1 = F_corregge_60min(new.ORE_GIORNO_1); set new.ORE_GIORNO_2 = F_corregge_60min(new.ORE_GIORNO_2); set new.ORE_GIORNO_3 = F_corregge_60min(new.ORE_GIORNO_3); set new.ORE_GIORNO_4 = F_corregge_60min(new.ORE_GIORNO_4); set new.ORE_GIORNO_5 = F_corregge_60min(new.ORE_GIORNO_5); set new.ORE_GIORNO_6 = F_corregge_60min(new.ORE_GIORNO_6); set new.ORE_GIORNO_7 = F_corregge_60min(new.ORE_GIORNO_7); set new.ORE_GIORNO_8 = F_corregge_60min(new.ORE_GIORNO_8); set new.ORE_GIORNO_9 = F_corregge_60min(new.ORE_GIORNO_9); set new.ORE_GIORNO_10 = F_corregge_60min(new.ORE_GIORNO_10); set new.ORE_GIORNO_11 = F_corregge_60min(new.ORE_GIORNO_11); set new.ORE_GIORNO_12 = F_corregge_60min(new.ORE_GIORNO_12); set new.ORE_GIORNO_13 = F_corregge_60min(new.ORE_GIORNO_13); set new.ORE_GIORNO_14 = F_corregge_60min(new.ORE_GIORNO_14); set new.ORE_GIORNO_15 = F_corregge_60min(new.ORE_GIORNO_15); set new.ORE_GIORNO_16 = F_corregge_60min(new.ORE_GIORNO_16); set new.ORE_GIORNO_17 = F_corregge_60min(new.ORE_GIORNO_17); set new.ORE_GIORNO_18 = F_corregge_60min(new.ORE_GIORNO_18); set new.ORE_GIORNO_19 = F_corregge_60min(new.ORE_GIORNO_19); set new.ORE_GIORNO_20 = F_corregge_60min(new.ORE_GIORNO_20); set new.ORE_GIORNO_21 = F_corregge_60min(new.ORE_GIORNO_21); set new.ORE_GIORNO_22 = F_corregge_60min(new.ORE_GIORNO_22); set new.ORE_GIORNO_23 = F_corregge_60min(new.ORE_GIORNO_23); set new.ORE_GIORNO_24 = F_corregge_60min(new.ORE_GIORNO_24); set new.ORE_GIORNO_25 = F_corregge_60min(new.ORE_GIORNO_25); set new.ORE_GIORNO_26 = F_corregge_60min(new.ORE_GIORNO_26); set new.ORE_GIORNO_27 = F_corregge_60min(new.ORE_GIORNO_27); set new.ORE_GIORNO_28 = F_corregge_60min(new.ORE_GIORNO_28); set new.ORE_GIORNO_29 = F_corregge_60min(new.ORE_GIORNO_29); set new.ORE_GIORNO_30 = F_corregge_60min(new.ORE_GIORNO_30); set new.ORE_GIORNO_31 = F_corregge_60min(new.ORE_GIORNO_31); set intermedio_ore = f_somma60esimi(new.ORE_GIORNO_1, new.ORE_GIORNO_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ORE_GIORNO_31); set new.totale_mese = F_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.tt_timesheet.tt_timesheet_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_BEFORE_INSERT` BEFORE INSERT ON `tt_timesheet` FOR EACH ROW BEGIN declare costo DOUBLE PRECISION; declare intermedio_ore DOUBLE PRECISION; declare tipo_costo_progetto CHAR(1); declare tipo_costo_standard SMALLINT; declare tipo_costo_standard_fisso char(1); declare alto char(1); declare medio char(1); declare basso char(1); declare costoalto1 double precision; declare costomedio1 double precision; declare costobasso1 double precision; declare costoalto2 double precision; declare costomedio2 double precision; declare costobasso2 double precision; declare giorno int; SELECT a.COSTO_STANDARD, a.costo_standard_1_2_zero_per_no, a.FLAG_COSTO_STD_FISSO, a.CSTD_ALTO1, a.CSTD_ALTO2, a.CSTD_MEDIO1, a.CSTD_MEDIO2, a.CSTD_BASSO1, a.CSTD_BASSO2 INTO tipo_costo_progetto, tipo_costo_standard, tipo_costo_standard_fisso, costoalto1, costoalto2, costomedio1, costomedio2, costobasso1, costobasso2 FROM ts_azione a INNER JOIN ts_azione_struttura s ON a.pk_progressivo = s.fk_azione WHERE s.pk_progressivo = NEW.fk_azione_struttura; /* costo progetto a CMO prende il costo dalla tabella costi personale */ if (tipo_costo_progetto = 'N') then select costo_orario_arrotondato into costo from tt_anag_personale_costi where fk_anag = new.fk_anag and anno = new.anno; end IF; if (tipo_costo_progetto = 'S' and tipo_costo_standard_fisso = 'N') then begin /* costo progetto a costo standard prende il costo dalla tabella costi personale assecondo del tipo standard 1 o 2*/ if (tipo_costo_standard = 1) then select COSTO_ORARIO_STANDARD_ARROTONDATO into costo from tt_anag_personale_costi where fk_anag = new.fk_anag and anno = new.anno; end IF; if (tipo_costo_standard = 2) then select COSTO_ORARIO_STANDARD_ARROTONDATO2 into costo from tt_anag_personale_costi where fk_anag = new.fk_anag and anno = new.anno; end IF; end; end IF; if (tipo_costo_progetto = 'S' and tipo_costo_standard_fisso = 'S') then begin /* costo progetto a costo standard ma immutabile nel tempo prende il costo dalla stessa tabella azioni secondo il livello del dipendente Alto Medio Basso che recupera dalla anagrafico*/ select LIVELLO_COSTO_STANDARD_ALTO, LIVELLO_COSTO_STANDARD_medio, LIVELLO_COSTO_STANDARD_basso into alto, medio, basso from tt_anag_personale where pk_progressivo = new.fk_anag; IF tipo_costo_standard = 1 THEN SET costo = CASE WHEN alto = 'S' THEN costoalto1 WHEN medio = 'S' THEN costomedio1 WHEN basso = 'S' THEN costobasso1 ELSE 0 END; ELSEIF tipo_costo_standard = 2 THEN SET costo = CASE WHEN alto = 'S' THEN costoalto2 WHEN medio = 'S' THEN costomedio2 WHEN basso = 'S' THEN costobasso2 ELSE 0 END; END IF; end; end IF; if (costo is null) then set costo = 0; end IF; set new.costo_orario = costo; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_ore = f_corregge_60min(intermedio_ore); set new.totale_mese = new.totale_ore * new.costo_orario; END - Creating trigger tempus_innodb.tt_timesheet.tt_timesheet_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_AFTER_INSERT` AFTER INSERT ON `tt_timesheet` FOR EACH ROW BEGIN declare xfk_azione INTEGER; declare count_rec SMALLINT; select distinct fk_azione into xfk_azione from ts_azione_struttura_simula where PK_PROGRESSIVO_AZSTRUT = new.FK_AZIONE_STRUTTURA; select count(*) into count_rec from TT_TIMESHEET_SOMMA_AZIONE where fk_Azione = xfk_Azione and nsal = new.nsal and anno = new.anno and mese = new.mese and fk_anag = new.fk_anag; if (count_rec is null) then set count_rec = 0; end IF; if (count_rec = 0) then insert into TT_TIMESHEET_SOMMA_AZIONE (PK_PROGRESSIVO, FK_AZIONE, NSAL, FK_ANAG, ANNO, MESE, ORE_GIORNO_1, ORE_GIORNO_2, ORE_GIORNO_3, ORE_GIORNO_4, ORE_GIORNO_5, ORE_GIORNO_6, ORE_GIORNO_7, ORE_GIORNO_8, ORE_GIORNO_9, ORE_GIORNO_10, ORE_GIORNO_11, ORE_GIORNO_12, ORE_GIORNO_13, ORE_GIORNO_14, ORE_GIORNO_15, ORE_GIORNO_16, ORE_GIORNO_17, ORE_GIORNO_18, ORE_GIORNO_19, ORE_GIORNO_20, ORE_GIORNO_21, ORE_GIORNO_22, ORE_GIORNO_23, ORE_GIORNO_24, ORE_GIORNO_25, ORE_GIORNO_26, ORE_GIORNO_27, ORE_GIORNO_28, ORE_GIORNO_29, ORE_GIORNO_30, ORE_GIORNO_31, TOTALE_MESE, TOTALE_ORE, TOTALE_GIORNATE_POSSIBILI, COSTO_ORARIO, ORE_GIORNO_TMP_PER_SOMMA) values (0, xfk_azione, new.nsal, new.fk_anag, new.anno, new.mese, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,new.costo_orario, 0); end IF; END - Creating trigger tempus_innodb.tt_timesheet.tt_timesheet_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet` FOR EACH ROW BEGIN declare costo DOUBLE PRECISION; declare intermedio_ore DOUBLE PRECISION; declare totale_ore_int DOUBLE PRECISION; declare totale_ore_min DOUBLE PRECISION; declare ore_da_fare_troncato INTEGER; declare minuti_da_fare DOUBLE PRECISION; declare tipo_costo_progetto CHAR(1); declare tipo_costo_standard SMALLINT; declare tipo_costo_standard_fisso char(1); declare alto char(1); declare medio char(1); declare basso char(1); declare costoalto1 double precision; declare costomedio1 double precision; declare costobasso1 double precision; declare costoalto2 double precision; declare costomedio2 double precision; declare costobasso2 double precision; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_ore = f_corregge_60min(intermedio_ore); set new.totale_mese = new.totale_ore * new.costo_orario; set new.totale_giornate_possibili = 0; if (new.giorno_1 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_2 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_3 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_4 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_5 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_6 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_7 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_8 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_9 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_10 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_11 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_12 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_13 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_14 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_15 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_16 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_17 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_18 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_19 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_20 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_21 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_22 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_23 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_24 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_25 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_26 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_27 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_28 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_29 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_30 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; if (new.giorno_31 > 0) then set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end IF; set new.totale_ore = f_corregge_60min(new.totale_ore); update TT_RIEPILOGO_ASSEGNAZIONI set ore_caricate = new.totale_ore, ore_da_caricare = f_arrotonda(f_calcola_differenza_ore(ore_assegnate , new.totale_ore),2), totale_gg_possibili = new.totale_giornate_possibili where fk_azione_struttura = new.fk_azione_struttura and fk_anag = new.fk_anag and anno = new.anno and mese = new.mese; update TS_AZIONE_SOTTOLIVELLI set BUDGET_AZLIV_USATO = BUDGET_AZLIV_USATO + (new.totale_ore * new.costo_orario) - (old.totale_ore * old.costo_orario) where pk_progressivo = (select fk_azione_sottolivelli from ts_azione_struttura where pk_progressivo = new.fk_azione_struttura); SELECT a.COSTO_STANDARD, a.costo_standard_1_2_zero_per_no, a.FLAG_COSTO_STD_FISSO, a.CSTD_ALTO1, a.CSTD_ALTO2, a.CSTD_MEDIO1, a.CSTD_MEDIO2, a.CSTD_BASSO1, a.CSTD_BASSO2 INTO tipo_costo_progetto, tipo_costo_standard, tipo_costo_standard_fisso, costoalto1, costoalto2, costomedio1, costomedio2, costobasso1, costobasso2 FROM ts_azione a INNER JOIN ts_azione_struttura s ON a.pk_progressivo = s.fk_azione WHERE s.pk_progressivo = NEW.fk_azione_struttura; /* costo progetto a CMO prende il costo dalla tabella costi personale */ if (tipo_costo_progetto = 'N') then select costo_orario_arrotondato into costo from tt_anag_personale_costi where fk_anag = new.fk_anag and anno = new.anno; end IF; if (tipo_costo_progetto = 'S' and tipo_costo_standard_fisso = 'N') then begin /* costo progetto a costo standard prende il costo dalla tabella costi personale assecondo del tipo standard 1 o 2*/ if (tipo_costo_standard = 1) then select COSTO_ORARIO_STANDARD_ARROTONDATO into costo from tt_anag_personale_costi where fk_anag = new.fk_anag and anno = new.anno; end IF; if (tipo_costo_standard = 2) then select COSTO_ORARIO_STANDARD_ARROTONDATO2 into costo from tt_anag_personale_costi where fk_anag = new.fk_anag and anno = new.anno; end IF; end; end IF; if (tipo_costo_progetto = 'S' and tipo_costo_standard_fisso = 'S') then begin /* costo progetto a costo standard ma immutabile nel tempo prende il costo dalla stessa tabella azioni secondo il livello del dipendente Alto Medio Basso che recupera dalla anagrafico*/ select LIVELLO_COSTO_STANDARD_ALTO, LIVELLO_COSTO_STANDARD_medio, LIVELLO_COSTO_STANDARD_basso into alto, medio, basso from tt_anag_personale where pk_progressivo = new.fk_anag; IF tipo_costo_standard = 1 THEN SET costo = CASE WHEN alto = 'S' THEN costoalto1 WHEN medio = 'S' THEN costomedio1 WHEN basso = 'S' THEN costobasso1 ELSE 0 END; ELSEIF tipo_costo_standard = 2 THEN SET costo = CASE WHEN alto = 'S' THEN costoalto2 WHEN medio = 'S' THEN costomedio2 WHEN basso = 'S' THEN costobasso2 ELSE 0 END; END IF; end; end IF; if (costo is null) then set costo = 0; end IF; set new.costo_orario = costo; set new.totale_mese = new.totale_ore * new.costo_orario; END - Creating trigger tempus_innodb.tt_timesheet.tt_timesheet_BEFORE_DELETE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_BEFORE_DELETE` BEFORE DELETE ON `tt_timesheet` FOR EACH ROW BEGIN declare gg SMALLINT; declare ore SMALLINT; declare xfk_azione INTEGER; declare i smallint; declare messaggio char(250); select distinct fk_azione from ts_azione_struttura where pk_progressivo = old.fk_azione_struttura into xfk_azione; if (xfk_azione is null) then set xfk_azione = 0; end IF; if (xfk_azione = 0) then begin call exception_message('azione_non_trovata_rollback_timesheet', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; /* if (old.ore_giorno_1 > 0) then begin set ore = old.ore_giorno_1; set gg = 1; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_2 > 0) then begin set ore = old.ore_giorno_2; set gg = 2; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_3 > 0) then begin set ore = old.ore_giorno_3; set gg = 3; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_4 > 0) then begin set ore = old.ore_giorno_4; set gg = 4; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_5 > 0) then begin set ore = old.ore_giorno_5; set gg = 5; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_6 > 0) then begin set ore = old.ore_giorno_6; set gg = 6; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_7 > 0) then begin set ore = old.ore_giorno_7; set gg = 7; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_8 > 0) then begin set ore = old.ore_giorno_8; set gg = 8; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_9 > 0) then begin set ore = old.ore_giorno_9; set gg = 9; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_10 > 0) then begin set ore = old.ore_giorno_10; set gg = 10; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_11 > 0) then begin set ore = old.ore_giorno_11; set gg = 11; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_12 > 0) then begin set ore = old.ore_giorno_12; set gg = 12; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_13 > 0) then begin set ore = old.ore_giorno_13; set gg = 13; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_14 > 0) then begin set ore = old.ore_giorno_14; set gg = 14; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_15 > 0) then begin set ore = old.ore_giorno_15; set gg = 15; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_16 > 0) then begin set ore = old.ore_giorno_16; set gg = 16; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_17 > 0) then begin set ore = old.ore_giorno_17; set gg = 17; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_18 > 0) then begin set ore = old.ore_giorno_18; set gg = 18; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_19 > 0) then begin set ore = old.ore_giorno_19; set gg = 19; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_20 > 0) then begin set ore = old.ore_giorno_20; set gg = 20; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_21 > 0) then begin set ore = old.ore_giorno_21; set gg = 21; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_22 > 0) then begin set ore = old.ore_giorno_22; set gg = 22; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_23 > 0) then begin set ore = old.ore_giorno_23; set gg = 23; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_24 > 0) then begin set ore = old.ore_giorno_24; set gg = 24; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_25 > 0) then begin set ore = old.ore_giorno_25; set gg = 25; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_26 > 0) then begin set ore = old.ore_giorno_26; set gg = 26; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_27 > 0) then begin set ore = old.ore_giorno_27; set gg = 27; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_28 > 0) then begin set ore = old.ore_giorno_28; set gg = 28; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_29 > 0) then begin set ore = old.ore_giorno_29; set gg = 29; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_30 > 0) then begin set ore = old.ore_giorno_30; set gg = 30; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; if (old.ore_giorno_31 > 0) then begin set ore = old.ore_giorno_31; set gg = 31; call elaborazione_rollback_timbrature(old.fk_anag, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_somma_azione(old.fk_anag, xfk_azione, old.anno, old.mese, gg, ore); call elaborazione_rollback_timesheet_riepilogo(old.fk_anag, old.anno, old.mese, gg, ore); end; end IF; */ -- Ciclo attraverso i giorni (1-31) e eseguo le operazioni di rollback SET i = 1; WHILE i <= 31 DO -- Usa un CASE per determinare se eseguire le operazioni in base al valore di ore_giorno_X SET ore = CASE i WHEN 1 THEN OLD.ore_giorno_1 WHEN 2 THEN OLD.ore_giorno_2 WHEN 3 THEN OLD.ore_giorno_3 WHEN 4 THEN OLD.ore_giorno_4 WHEN 5 THEN OLD.ore_giorno_5 WHEN 6 THEN OLD.ore_giorno_6 WHEN 7 THEN OLD.ore_giorno_7 WHEN 8 THEN OLD.ore_giorno_8 WHEN 9 THEN OLD.ore_giorno_9 WHEN 10 THEN OLD.ore_giorno_10 WHEN 11 THEN OLD.ore_giorno_11 WHEN 12 THEN OLD.ore_giorno_12 WHEN 13 THEN OLD.ore_giorno_13 WHEN 14 THEN OLD.ore_giorno_14 WHEN 15 THEN OLD.ore_giorno_15 WHEN 16 THEN OLD.ore_giorno_16 WHEN 17 THEN OLD.ore_giorno_17 WHEN 18 THEN OLD.ore_giorno_18 WHEN 19 THEN OLD.ore_giorno_19 WHEN 20 THEN OLD.ore_giorno_20 WHEN 21 THEN OLD.ore_giorno_21 WHEN 22 THEN OLD.ore_giorno_22 WHEN 23 THEN OLD.ore_giorno_23 WHEN 24 THEN OLD.ore_giorno_24 WHEN 25 THEN OLD.ore_giorno_25 WHEN 26 THEN OLD.ore_giorno_26 WHEN 27 THEN OLD.ore_giorno_27 WHEN 28 THEN OLD.ore_giorno_28 WHEN 29 THEN OLD.ore_giorno_29 WHEN 30 THEN OLD.ore_giorno_30 WHEN 31 THEN OLD.ore_giorno_31 END; -- Se ore > 0, esegui le operazioni di rollback if (ore is null) then set ore = 0; end IF; IF ore > 0 THEN SET gg = i; -- Chiamata alle procedure di rollback CALL elaborazione_rollback_timbrature(OLD.fk_anag, OLD.anno, OLD.mese, gg, ore); CALL elaborazione_rollback_timesheet_somma_azione(OLD.fk_anag, xfk_azione, OLD.anno, OLD.mese, gg, ore); CALL elaborazione_rollback_timesheet_riepilogo(OLD.fk_anag, OLD.anno, OLD.mese, gg, ore); END IF; SET i = i + 1; END WHILE; END - Creating trigger tempus_innodb.tt_timesheet.tt_timesheet_AFTER_DELETE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_AFTER_DELETE` AFTER DELETE ON `tt_timesheet` FOR EACH ROW BEGIN update TS_AZIONE_SOTTOLIVELLI set BUDGET_AZLIV_USATO = BUDGET_AZLIV_USATO - (old.totale_ore * old.costo_orario) where pk_progressivo = (select fk_azione_sottolivelli from ts_azione_struttura where pk_progressivo = old.fk_azione_struttura); END - Creating trigger tempus_innodb.tt_timesheet_doc.tt_timesheet_doc_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_doc_BEFORE_INSERT` BEFORE INSERT ON `tt_timesheet_doc` FOR EACH ROW BEGIN declare conta_rec smallint; declare xfk_anag integer; declare desc_azione text(500); declare desc_sottliv char(100); declare etichetta char(30); declare xazione char(20); declare compone_messaggio text(1000); declare xanno smallint; declare xmese smallint; declare nome_mese char(20); declare messaggio char(250); /* controlla se c'è il doc firmato */ select count(*) into conta_rec from tt_timesheet_doc where fk_timesheet = new.fk_timesheet and flag_firmato = 'S'; if (conta_rec is null) then set conta_rec = 0; end IF; /* se firmato solleva eccezione */ if (conta_rec > 0) then begin call exception_message('ts_documento_presente', @message_err); SELECT @message_err INTO messaggio; signal sqlstate '45000' set message_text=messaggio; end; end IF; /* se presente ma non firmato lo cancella e lo reinserisce */ select count(*) into conta_rec from tt_timesheet_doc where fk_timesheet = new.fk_timesheet and flag_firmato = 'N' and tipo_documento = new.tipo_documento; if (conta_rec is null) then set conta_rec = 0; end IF; if (conta_rec > 0) then delete from tt_timesheet_doc where fk_timesheet = new.fk_timesheet and flag_firmato = 'N' and tipo_documento = new.tipo_documento; end IF; /* legge l'utente intestatario del TS */ select fk_anag into xfk_anag from tt_timesheet where pk_progressivo = new.fk_timesheet; /* va a leggere la fk alla tabella sys_utenti dell'utente intestatario */ select fk_utenti into xfk_anag from tt_anag_personale where pk_progressivo = xfk_anag; if (new.tipo_documento = 'PD') then begin select a.anno, a.mese, c.azione, c.descrizione, e.descrizione, e.etichetta_misura_stampa into xanno, xmese, xazione, desc_azione, desc_sottliv, etichetta from tt_timesheet a join ts_azione_struttura b on a.fk_azione_struttura = b.pk_progressivo join ts_azione c on b.fk_azione = c.pk_progressivo join ts_azione_sottolivelli d on b.fk_azione_sottolivelli = d.pk_progressivo join ts_sottolivelli e on d.fk_sottolivelli = e.pk_progressivo where a.pk_progressivo = new.fk_timesheet and a.fk_anag = b.fk_anag_progetto; select distinct nome_mese into nome_mese from ts_calendario where anno = xanno and mm = xmese; set compone_messaggio = CONCAT( 'TS disponibile in formato PDF per il controllo e la firma', ASCII_CHAR(13), 'Anno ', xanno, ' Mese ', nome_mese, ASCII_CHAR(13), 'Progetto ', desc_azione, ASCII_CHAR(13), 'Misura ', desc_sottliv ); insert into NC_MESSAGGI values ( 0, 99999, xfk_anag, NOW(), null, null, new.fk_timesheet, '', compone_messaggio, 'N', 'S', new.tipo_documento, 'N' ); /* crea la scadenza */ insert into tt_scadenze_user values (0, xfk_anag, NOW(), NOW(), compone_messaggio, 'N', new.fk_timesheet); end; end IF; END - Creating trigger tempus_innodb.tt_timesheet_doc.tt_timesheet_doc_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_doc_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_doc` FOR EACH ROW BEGIN if (new.flag_firmato = 'N') then set new.data_firma = null; end IF; END - Creating trigger tempus_innodb.tt_timesheet_doc_altri.tt_timesheet_doc_altri_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_doc_altri_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_doc_altri` FOR EACH ROW BEGIN if (new.flag_firmato = 'N') then set new.data_firma = null; end IF; END - Creating trigger tempus_innodb.tt_timesheet_manuale.tt_timesheet_manuale_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_manuale_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_manuale` FOR EACH ROW BEGIN declare costo double precision; declare intermedio_ore double precision; declare intermedio_ore1 double precision; declare intermedio_ore2 double precision; declare intermedio_ore3 double precision; declare intermedio_ore4 double precision; declare intermedio_ore5 double precision; declare intermedio_ore6 double precision; declare intermedio_ore7 double precision; declare intermedio_ore8 double precision; declare intermedio_ore9 double precision; declare intermedio_ore10 double precision; declare intermedio_ore11 double precision; declare intermedio_ore12 double precision; declare intermedio_ore13 double precision; declare intermedio_ore14 double precision; declare intermedio_ore15 double precision; declare intermedio_ore16 double precision; declare intermedio_ore17 double precision; declare intermedio_ore18 double precision; declare intermedio_ore19 double precision; declare intermedio_ore20 double precision; declare intermedio_ore21 double precision; declare intermedio_ore22 double precision; declare intermedio_ore23 double precision; declare intermedio_ore24 double precision; declare intermedio_ore25 double precision; declare intermedio_ore26 double precision; declare intermedio_ore27 double precision; declare intermedio_ore28 double precision; declare intermedio_ore29 double precision; declare intermedio_ore30 double precision; declare intermedio_ore31 double precision; /* aggiorna i relativi record di totalizzatori per evitare un loop infinito sul trigger di aggiornamento controllo che il record attuale sia quello con sort_dato = 1 altrimenti non uscirebbe mai */ /* questo esempio permette di verificare che i calcoli siano sempre giusti se arrivano i minuti sia positivi che negativi select f_somma_60esimi_negativi_positivi(f_somma_60esimi(1.10 , -1.20), 1.58) da 1.48 select f_somma_60esimi_negativi_positivi(f_somma_60esimi(1.10 , 1.20), -1.58) da 0.32 */ if (new.sort_dato = 1) then begin /* totale progetti */ UPDATE tt_timesheet_manuale SET ore_giorno_1 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_1, (old.ore_giorno_1 * -1)), new.ore_giorno_1), ore_giorno_2 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_2, (old.ore_giorno_2 * -1)), new.ore_giorno_2), ore_giorno_3 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_3, (old.ore_giorno_3 * -1)), new.ore_giorno_3), ore_giorno_4 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_4, (old.ore_giorno_4 * -1)), new.ore_giorno_4), ore_giorno_5 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_5, (old.ore_giorno_5 * -1)), new.ore_giorno_5), ore_giorno_6 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_6, (old.ore_giorno_6 * -1)), new.ore_giorno_6), ore_giorno_7 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_7, (old.ore_giorno_7 * -1)), new.ore_giorno_7), ore_giorno_8 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_8, (old.ore_giorno_8 * -1)), new.ore_giorno_8), ore_giorno_9 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_9, (old.ore_giorno_9 * -1)), new.ore_giorno_9), ore_giorno_10 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_10, (old.ore_giorno_10 * -1)), new.ore_giorno_10), ore_giorno_11 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_11, (old.ore_giorno_11 * -1)), new.ore_giorno_11), ore_giorno_12 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_12, (old.ore_giorno_12 * -1)), new.ore_giorno_12), ore_giorno_13 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_13, (old.ore_giorno_13 * -1)), new.ore_giorno_13), ore_giorno_14 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_14, (old.ore_giorno_14 * -1)), new.ore_giorno_14), ore_giorno_15 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_15, (old.ore_giorno_15 * -1)), new.ore_giorno_15), ore_giorno_16 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_16, (old.ore_giorno_16 * -1)), new.ore_giorno_16), ore_giorno_17 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_17, (old.ore_giorno_17 * -1)), new.ore_giorno_17), ore_giorno_18 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_18, (old.ore_giorno_18 * -1)), new.ore_giorno_18), ore_giorno_19 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_19, (old.ore_giorno_19 * -1)), new.ore_giorno_19), ore_giorno_20 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_20, (old.ore_giorno_20 * -1)), new.ore_giorno_20), ore_giorno_21 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_21, (old.ore_giorno_21 * -1)), new.ore_giorno_21), ore_giorno_22 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_22, (old.ore_giorno_22 * -1)), new.ore_giorno_22), ore_giorno_23 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_23, (old.ore_giorno_23 * -1)), new.ore_giorno_23), ore_giorno_24 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_24, (old.ore_giorno_24 * -1)), new.ore_giorno_24), ore_giorno_25 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_25, (old.ore_giorno_25 * -1)), new.ore_giorno_25), ore_giorno_26 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_26, (old.ore_giorno_26 * -1)), new.ore_giorno_26), ore_giorno_27 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_27, (old.ore_giorno_27 * -1)), new.ore_giorno_27), ore_giorno_28 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_28, (old.ore_giorno_28 * -1)), new.ore_giorno_28), ore_giorno_29 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_29, (old.ore_giorno_29 * -1)), new.ore_giorno_29), ore_giorno_30 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_30, (old.ore_giorno_30 * -1)), new.ore_giorno_30), ore_giorno_31 = f_somma_60esimi_negativi_positivi(f_somma_60esimi(ore_giorno_31, (old.ore_giorno_31 * -1)), new.ore_giorno_31) WHERE fk_anag = new.fk_anag AND anno = new.anno AND mese = new.mese AND fk_azione_struttura = new.fk_azione_struttura AND sort_dato = 6; /* stabilisce se in aumento o diminuizione altrimenti la routine f_calcola_differenza_ore non calcola giusto nel caso di diminuizione */ if (new.ore_giorno_1 > old.ore_giorno_1) then set intermedio_ore1= (f_calcola_differenza_ore(old.ore_giorno_1, new.ore_giorno_1) * -1); else set intermedio_ore1= f_calcola_differenza_ore(old.ore_giorno_1, new.ore_giorno_1); end if; if (new.ore_giorno_2 > old.ore_giorno_2) then set intermedio_ore2= (f_calcola_differenza_ore(old.ore_giorno_2, new.ore_giorno_2) * -1); else set intermedio_ore2= f_calcola_differenza_ore(old.ore_giorno_2, new.ore_giorno_2); end if; if (new.ore_giorno_3 > old.ore_giorno_3) then set intermedio_ore3 = (f_calcola_differenza_ore(old.ore_giorno_3, new.ore_giorno_3) * -1); else set intermedio_ore3 = f_calcola_differenza_ore(old.ore_giorno_3, new.ore_giorno_3); end if; if (new.ore_giorno_4 > old.ore_giorno_4) then set intermedio_ore4 = (f_calcola_differenza_ore(old.ore_giorno_4, new.ore_giorno_4) * -1); else set intermedio_ore4 = f_calcola_differenza_ore(old.ore_giorno_4, new.ore_giorno_4); end if; if (new.ore_giorno_5 > old.ore_giorno_5) then set intermedio_ore5 = (f_calcola_differenza_ore(old.ore_giorno_5, new.ore_giorno_5) * -1); else set intermedio_ore5 = f_calcola_differenza_ore(old.ore_giorno_5, new.ore_giorno_5); end if; if (new.ore_giorno_6 > old.ore_giorno_6) then set intermedio_ore6 = (f_calcola_differenza_ore(old.ore_giorno_6, new.ore_giorno_6) * -1); else set intermedio_ore6 = f_calcola_differenza_ore(old.ore_giorno_6, new.ore_giorno_6); end if; if (new.ore_giorno_7 > old.ore_giorno_7) then set intermedio_ore7 = (f_calcola_differenza_ore(old.ore_giorno_7, new.ore_giorno_7) * -1); else set intermedio_ore7 = f_calcola_differenza_ore(old.ore_giorno_7, new.ore_giorno_7); end if; if (new.ore_giorno_8 > old.ore_giorno_8) then set intermedio_ore8 = (f_calcola_differenza_ore(old.ore_giorno_8, new.ore_giorno_8) * -1); else set intermedio_ore8 = f_calcola_differenza_ore(old.ore_giorno_8, new.ore_giorno_8); end if; if (new.ore_giorno_9 > old.ore_giorno_9) then set intermedio_ore9 = (f_calcola_differenza_ore(old.ore_giorno_9, new.ore_giorno_9) * -1); else set intermedio_ore9 = f_calcola_differenza_ore(old.ore_giorno_9, new.ore_giorno_9); end if; if (new.ore_giorno_10 > old.ore_giorno_10) then set intermedio_ore10 = (f_calcola_differenza_ore(old.ore_giorno_10, new.ore_giorno_10) * -1); else set intermedio_ore10 = f_calcola_differenza_ore(old.ore_giorno_10, new.ore_giorno_10); end if; if (new.ore_giorno_11 > old.ore_giorno_11) then set intermedio_ore11 = (f_calcola_differenza_ore(old.ore_giorno_11, new.ore_giorno_11) * -1); else set intermedio_ore11 = f_calcola_differenza_ore(old.ore_giorno_11, new.ore_giorno_11); end if; if (new.ore_giorno_12 > old.ore_giorno_12) then set intermedio_ore12 = (f_calcola_differenza_ore(old.ore_giorno_12, new.ore_giorno_12) * -1); else set intermedio_ore12 = f_calcola_differenza_ore(old.ore_giorno_12, new.ore_giorno_12); end if; if (new.ore_giorno_13 > old.ore_giorno_13) then set intermedio_ore13 = (f_calcola_differenza_ore(old.ore_giorno_13, new.ore_giorno_13) * -1); else set intermedio_ore13 = f_calcola_differenza_ore(old.ore_giorno_13, new.ore_giorno_13); end if; if (new.ore_giorno_14 > old.ore_giorno_14) then set intermedio_ore14 = (f_calcola_differenza_ore(old.ore_giorno_14, new.ore_giorno_14) * -1); else set intermedio_ore14 = f_calcola_differenza_ore(old.ore_giorno_14, new.ore_giorno_14); end if; if (new.ore_giorno_15 > old.ore_giorno_15) then set intermedio_ore15 = (f_calcola_differenza_ore(old.ore_giorno_15, new.ore_giorno_15) * -1); else set intermedio_ore15 = f_calcola_differenza_ore(old.ore_giorno_15, new.ore_giorno_15); end if; if (new.ore_giorno_16 > old.ore_giorno_16) then set intermedio_ore16 = (f_calcola_differenza_ore(old.ore_giorno_16, new.ore_giorno_16) * -1); else set intermedio_ore16 = f_calcola_differenza_ore(old.ore_giorno_16, new.ore_giorno_16); end if; if (new.ore_giorno_17 > old.ore_giorno_17) then set intermedio_ore17 = (f_calcola_differenza_ore(old.ore_giorno_17, new.ore_giorno_17) * -1); else set intermedio_ore17 = f_calcola_differenza_ore(old.ore_giorno_17, new.ore_giorno_17); end if; if (new.ore_giorno_18 > old.ore_giorno_18) then set intermedio_ore18 = (f_calcola_differenza_ore(old.ore_giorno_18, new.ore_giorno_18) * -1); else set intermedio_ore18 = f_calcola_differenza_ore(old.ore_giorno_18, new.ore_giorno_18); end if; if (new.ore_giorno_19 > old.ore_giorno_19) then set intermedio_ore19 = (f_calcola_differenza_ore(old.ore_giorno_19, new.ore_giorno_19) * -1); else set intermedio_ore19 = f_calcola_differenza_ore(old.ore_giorno_19, new.ore_giorno_19); end if; if (new.ore_giorno_20 > old.ore_giorno_20) then set intermedio_ore20 = (f_calcola_differenza_ore(old.ore_giorno_20, new.ore_giorno_20) * -1); else set intermedio_ore20 = f_calcola_differenza_ore(old.ore_giorno_20, new.ore_giorno_20); end if; if (new.ore_giorno_21 > old.ore_giorno_21) then set intermedio_ore21 = (f_calcola_differenza_ore(old.ore_giorno_21, new.ore_giorno_21) * -1); else set intermedio_ore21 = f_calcola_differenza_ore(old.ore_giorno_21, new.ore_giorno_21); end if; if (new.ore_giorno_22 > old.ore_giorno_22) then set intermedio_ore22 = (f_calcola_differenza_ore(old.ore_giorno_22, new.ore_giorno_22) * -1); else set intermedio_ore22 = f_calcola_differenza_ore(old.ore_giorno_22, new.ore_giorno_22); end if; if (new.ore_giorno_23 > old.ore_giorno_23) then set intermedio_ore23 = (f_calcola_differenza_ore(old.ore_giorno_23, new.ore_giorno_23) * -1); else set intermedio_ore23 = f_calcola_differenza_ore(old.ore_giorno_23, new.ore_giorno_23); end if; if (new.ore_giorno_24 > old.ore_giorno_24) then set intermedio_ore24 = (f_calcola_differenza_ore(old.ore_giorno_24, new.ore_giorno_24) * -1); else set intermedio_ore24 = f_calcola_differenza_ore(old.ore_giorno_24, new.ore_giorno_24); end if; if (new.ore_giorno_25 > old.ore_giorno_25) then set intermedio_ore25 = (f_calcola_differenza_ore(old.ore_giorno_25, new.ore_giorno_25) * -1); else set intermedio_ore25 = f_calcola_differenza_ore(old.ore_giorno_25, new.ore_giorno_25); end if; if (new.ore_giorno_26 > old.ore_giorno_26) then set intermedio_ore26 = (f_calcola_differenza_ore(old.ore_giorno_26, new.ore_giorno_26) * -1); else set intermedio_ore26 = f_calcola_differenza_ore(old.ore_giorno_26, new.ore_giorno_26); end if; if (new.ore_giorno_27 > old.ore_giorno_27) then set intermedio_ore27 = (f_calcola_differenza_ore(old.ore_giorno_27, new.ore_giorno_27) * -1); else set intermedio_ore27 = f_calcola_differenza_ore(old.ore_giorno_27, new.ore_giorno_27); end if; if (new.ore_giorno_28 > old.ore_giorno_28) then set intermedio_ore28 = (f_calcola_differenza_ore(old.ore_giorno_28, new.ore_giorno_28) * -1); else set intermedio_ore28 = f_calcola_differenza_ore(old.ore_giorno_28, new.ore_giorno_28); end if; if (new.ore_giorno_29 > old.ore_giorno_29) then set intermedio_ore29 = (f_calcola_differenza_ore(old.ore_giorno_29, new.ore_giorno_29) * -1); else set intermedio_ore29 = f_calcola_differenza_ore(old.ore_giorno_29, new.ore_giorno_29); end if; if (new.ore_giorno_30 > old.ore_giorno_30) then set intermedio_ore30 = (f_calcola_differenza_ore(old.ore_giorno_30, new.ore_giorno_30) * -1); else set intermedio_ore30 = f_calcola_differenza_ore(old.ore_giorno_30, new.ore_giorno_30); end if; if (new.ore_giorno_31 > old.ore_giorno_31) then set intermedio_ore31 = (f_calcola_differenza_ore(old.ore_giorno_31, new.ore_giorno_31) * -1); else set intermedio_ore31 = f_calcola_differenza_ore(old.ore_giorno_31, new.ore_giorno_31); end if; /* totale attivita istituzionali */ update tt_timesheet_manuale set ore_giorno_1 = f_somma60esimi_negativi_positivi(ore_giorno_1, intermedio_ore1), ore_giorno_2 = f_somma60esimi_negativi_positivi(ore_giorno_2, intermedio_ore2), ore_giorno_3 = f_somma60esimi_negativi_positivi(ore_giorno_3, intermedio_ore3), ore_giorno_4 = f_somma60esimi_negativi_positivi(ore_giorno_4, intermedio_ore4), ore_giorno_5 = f_somma60esimi_negativi_positivi(ore_giorno_5, intermedio_ore5), ore_giorno_6 = f_somma60esimi_negativi_positivi(ore_giorno_6, intermedio_ore6), ore_giorno_7 = f_somma60esimi_negativi_positivi(ore_giorno_7, intermedio_ore7), ore_giorno_8 = f_somma60esimi_negativi_positivi(ore_giorno_8, intermedio_ore8), ore_giorno_9 = f_somma60esimi_negativi_positivi(ore_giorno_9, intermedio_ore9), ore_giorno_10 = f_somma60esimi_negativi_positivi(ore_giorno_10, intermedio_ore10), ore_giorno_11 = f_somma60esimi_negativi_positivi(ore_giorno_11, intermedio_ore11), ore_giorno_12 = f_somma60esimi_negativi_positivi(ore_giorno_12, intermedio_ore12), ore_giorno_13 = f_somma60esimi_negativi_positivi(ore_giorno_13, intermedio_ore13), ore_giorno_14 = f_somma60esimi_negativi_positivi(ore_giorno_14, intermedio_ore14), ore_giorno_15 = f_somma60esimi_negativi_positivi(ore_giorno_15, intermedio_ore15), ore_giorno_16 = f_somma60esimi_negativi_positivi(ore_giorno_16, intermedio_ore16), ore_giorno_17 = f_somma60esimi_negativi_positivi(ore_giorno_17, intermedio_ore17), ore_giorno_18 = f_somma60esimi_negativi_positivi(ore_giorno_18, intermedio_ore18), ore_giorno_19 = f_somma60esimi_negativi_positivi(ore_giorno_19, intermedio_ore19), ore_giorno_20 = f_somma60esimi_negativi_positivi(ore_giorno_20, intermedio_ore20), ore_giorno_21 = f_somma60esimi_negativi_positivi(ore_giorno_21, intermedio_ore21), ore_giorno_22 = f_somma60esimi_negativi_positivi(ore_giorno_22, intermedio_ore22), ore_giorno_23 = f_somma60esimi_negativi_positivi(ore_giorno_23, intermedio_ore23), ore_giorno_24 = f_somma60esimi_negativi_positivi(ore_giorno_24, intermedio_ore24), ore_giorno_25 = f_somma60esimi_negativi_positivi(ore_giorno_25, intermedio_ore25), ore_giorno_26 = f_somma60esimi_negativi_positivi(ore_giorno_26, intermedio_ore26), ore_giorno_27 = f_somma60esimi_negativi_positivi(ore_giorno_27, intermedio_ore27), ore_giorno_28 = f_somma60esimi_negativi_positivi(ore_giorno_28, intermedio_ore28), ore_giorno_29 = f_somma60esimi_negativi_positivi(ore_giorno_29, intermedio_ore29), ore_giorno_30 = f_somma60esimi_negativi_positivi(ore_giorno_30, intermedio_ore30), ore_giorno_31 = f_somma60esimi_negativi_positivi(ore_giorno_31, intermedio_ore31) where fk_anag = new.fk_anag and anno = new.anno and mese = new.mese and fk_azione_struttura = new.fk_azione_struttura and sort_dato = 7; end; end IF; END - Creating trigger tempus_innodb.tt_timesheet_manuale.tt_timesheet_manuale_AFTER_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_manuale_AFTER_UPDATE` AFTER UPDATE ON `tt_timesheet_manuale` FOR EACH ROW BEGIN if (new.flag_validato <> old.flag_validato) then if (new.flag_validato = 'S') then begin /* salva il timesheet manuale come log */ insert into tt_timesheet_manuale_validato select 0, a.*, now() from tt_timesheet_manuale a where a.pk_progressivo = new.pk_progressivo; /* lancia la proc che aggiorna il timesheet originale */ call valida_timesheet_manuale(new.fk_anag, new.fk_azione_struttura, new.anno, new.mese); end; end IF; end IF; END - Creating trigger tempus_innodb.tt_timesheet_riepilogo.tt_timesheet_riepilogo_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_riepilogo_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_riepilogo` FOR EACH ROW BEGIN declare intermedio_ore double precision; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_mese = f_corregge_60min(intermedio_ore); set new.totale_ore = f_corregge_60min(intermedio_ore); set new.totale_giornate_possibili = 0; if (new.giorno_1 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_2 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_3 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_4 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_5 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_6 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_7 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_8 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_9 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_10 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_11 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_12 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_13 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_14 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_15 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_16 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_17 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_18 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_19 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_20 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_21 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_22 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_23 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_24 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_25 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_26 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_27 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_28 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_29 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_30 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; if (new.giorno_31 > 0) then begin set new.totale_giornate_possibili = new.totale_giornate_possibili + 1; end; end IF; END - Creating trigger tempus_innodb.tt_timesheet_somma_azione.tt_timesheet_somma_azione_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_somma_azione_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_somma_azione` FOR EACH ROW BEGIN DECLARE costo DOUBLE PRECISION; DECLARE intermedio_ore DOUBLE PRECISION; DECLARE tipo_costo_progetto CHAR(1); DECLARE tipo_costo_standard SMALLINT; DECLARE tipo_costo_standard_fisso CHAR(1); DECLARE alto CHAR(1); DECLARE medio CHAR(1); DECLARE basso CHAR(1); DECLARE costoalto1 DOUBLE PRECISION; DECLARE costomedio1 DOUBLE PRECISION; DECLARE costobasso1 DOUBLE PRECISION; DECLARE costoalto2 DOUBLE PRECISION; DECLARE costomedio2 DOUBLE PRECISION; DECLARE costobasso2 DOUBLE PRECISION; SELECT COSTO_STANDARD, costo_standard_1_2_zero_per_no, FLAG_COSTO_STD_FISSO, CSTD_ALTO1, CSTD_ALTO2, CSTD_MEDIO1, CSTD_MEDIO2, CSTD_BASSO1, CSTD_BASSO2 INTO tipo_costo_progetto, tipo_costo_standard, tipo_costo_standard_fisso, costoalto1, costoalto2, costomedio1, costomedio2, costobasso1, costobasso2 FROM ts_azione WHERE pk_progressivo = NEW.fk_azione; -- Determinazione del costo in base al tipo di progetto SET costo = CASE WHEN tipo_costo_progetto = 'N' THEN (SELECT costo_orario_arrotondato FROM tt_anag_personale_costi WHERE fk_anag = NEW.fk_anag AND anno = NEW.anno) WHEN tipo_costo_progetto = 'S' AND tipo_costo_standard_fisso = 'N' THEN (SELECT CASE tipo_costo_standard WHEN 1 THEN COSTO_ORARIO_STANDARD_ARROTONDATO WHEN 2 THEN COSTO_ORARIO_STANDARD_ARROTONDATO2 END FROM tt_anag_personale_costi WHERE fk_anag = NEW.fk_anag AND anno = NEW.anno) WHEN tipo_costo_progetto = 'S' AND tipo_costo_standard_fisso = 'S' THEN (SELECT CASE tipo_costo_standard WHEN 1 THEN CASE WHEN alto = 'S' THEN costoalto1 WHEN medio = 'S' THEN costomedio1 WHEN basso = 'S' THEN costobasso1 END WHEN 2 THEN CASE WHEN alto = 'S' THEN costoalto2 WHEN medio = 'S' THEN costomedio2 WHEN basso = 'S' THEN costobasso2 END END FROM tt_anag_personale WHERE pk_progressivo = NEW.fk_anag) ELSE 0 END; -- Calcolo delle ore SET intermedio_ore = f_somma60esimi(NEW.ore_giorno_1, NEW.ore_giorno_2); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_3); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_4); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_5); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_6); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_7); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_8); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_9); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_10); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_11); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_12); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_13); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_14); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_15); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_16); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_17); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_18); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_19); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_20); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_21); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_22); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_23); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_24); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_25); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_26); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_27); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_28); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_29); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_30); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_31); SET NEW.totale_ore = f_corregge_60min(intermedio_ore); SET NEW.costo_orario = costo; SET NEW.totale_mese = costo * NEW.totale_ore; END - Creating trigger tempus_innodb.tt_timesheet_somma_sottliv_anno_mese.tt_timesheet_somma_sottliv_anno_mese_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_somma_sottliv_anno_mese_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_somma_sottliv_anno_mese` FOR EACH ROW BEGIN DECLARE costo DOUBLE PRECISION; DECLARE intermedio_ore DOUBLE PRECISION; DECLARE tipo_costo_progetto CHAR(1); DECLARE tipo_costo_standard SMALLINT; DECLARE tipo_costo_standard_fisso CHAR(1); DECLARE alto CHAR(1); DECLARE medio CHAR(1); DECLARE basso CHAR(1); DECLARE costoalto1 DOUBLE PRECISION; DECLARE costomedio1 DOUBLE PRECISION; DECLARE costobasso1 DOUBLE PRECISION; DECLARE costoalto2 DOUBLE PRECISION; DECLARE costomedio2 DOUBLE PRECISION; DECLARE costobasso2 DOUBLE PRECISION; SELECT COSTO_STANDARD, costo_standard_1_2_zero_per_no, FLAG_COSTO_STD_FISSO, CSTD_ALTO1, CSTD_ALTO2, CSTD_MEDIO1, CSTD_MEDIO2, CSTD_BASSO1, CSTD_BASSO2 INTO tipo_costo_progetto, tipo_costo_standard, tipo_costo_standard_fisso, costoalto1, costoalto2, costomedio1, costomedio2, costobasso1, costobasso2 FROM ts_azione WHERE pk_progressivo = NEW.fk_azione; /* Determina il costo in base al tipo di costo */ SET costo = CASE WHEN tipo_costo_progetto = 'N' THEN (SELECT costo_orario_arrotondato FROM tt_anag_personale_costi WHERE fk_anag = NEW.fk_anag AND anno = NEW.anno) WHEN tipo_costo_progetto = 'S' AND tipo_costo_standard_fisso = 'N' THEN CASE WHEN tipo_costo_standard = 1 THEN (SELECT COSTO_ORARIO_STANDARD_ARROTONDATO FROM tt_anag_personale_costi WHERE fk_anag = NEW.fk_anag AND anno = NEW.anno) WHEN tipo_costo_standard = 2 THEN (SELECT COSTO_ORARIO_STANDARD_ARROTONDATO2 FROM tt_anag_personale_costi WHERE fk_anag = NEW.fk_anag AND anno = NEW.anno) END WHEN tipo_costo_progetto = 'S' AND tipo_costo_standard_fisso = 'S' THEN CASE WHEN tipo_costo_standard = 1 THEN CASE WHEN alto = 'S' THEN costoalto1 WHEN medio = 'S' THEN costomedio1 WHEN basso = 'S' THEN costobasso1 END WHEN tipo_costo_standard = 2 THEN CASE WHEN alto = 'S' THEN costoalto2 WHEN medio = 'S' THEN costomedio2 WHEN basso = 'S' THEN costobasso2 END END ELSE 0 END; /* Se il costo è nullo, impostalo a 0 */ IF costo IS NULL THEN SET costo = 0; END IF; /* Somma le ore giornaliere utilizzando una funzione */ SET intermedio_ore = 0; SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_1); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_2); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_3); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_4); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_5); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_6); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_7); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_8); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_9); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_10); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_11); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_12); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_13); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_14); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_15); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_16); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_17); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_18); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_19); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_20); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_21); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_22); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_23); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_24); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_25); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_26); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_27); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_28); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_29); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_30); SET intermedio_ore = f_somma60esimi(intermedio_ore, NEW.ore_giorno_31); /* Calcola i valori finali */ SET NEW.totale_ore = f_corregge_60min(intermedio_ore); SET NEW.costo_orario = costo; SET NEW.totale_mese = costo * NEW.totale_ore; END - Creating trigger tempus_innodb.tt_timesheet_tmp_per_somme_azione.tt_timesheet_tmp_per_somme_azione_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_tmp_per_somme_azione_AFTER_INSERT` AFTER INSERT ON `tt_timesheet_tmp_per_somme_azione` FOR EACH ROW BEGIN DECLARE gg SMALLINT; DECLARE ore DOUBLE PRECISION; DECLARE xfk_azione INTEGER; DECLARE messaggio CHAR(250); DECLARE i SMALLINT; -- Recupero dell'azione SELECT DISTINCT fk_azione FROM ts_azione_struttura_simula WHERE pk_progressivo_azstrut = NEW.fk_azione_struttura INTO xfk_azione; IF (xfk_azione IS NULL) THEN SET xfk_azione = 0; END IF; IF (xfk_azione = 0) THEN CALL exception_message('azione_non_trovata_rollback_timesheet', @message_err); SELECT @message_err INTO messaggio; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = messaggio; END IF; -- Ciclo per i giorni da 1 a 31 SET i = 1; WHILE i <= 31 DO -- Uso della struttura CASE per determinare le ore SET ore = CASE WHEN i = 1 THEN NEW.ore_giorno_1 WHEN i = 2 THEN NEW.ore_giorno_2 WHEN i = 3 THEN NEW.ore_giorno_3 WHEN i = 4 THEN NEW.ore_giorno_4 WHEN i = 5 THEN NEW.ore_giorno_5 WHEN i = 6 THEN NEW.ore_giorno_6 WHEN i = 7 THEN NEW.ore_giorno_7 WHEN i = 8 THEN NEW.ore_giorno_8 WHEN i = 9 THEN NEW.ore_giorno_9 WHEN i = 10 THEN NEW.ore_giorno_10 WHEN i = 11 THEN NEW.ore_giorno_11 WHEN i = 12 THEN NEW.ore_giorno_12 WHEN i = 13 THEN NEW.ore_giorno_13 WHEN i = 14 THEN NEW.ore_giorno_14 WHEN i = 15 THEN NEW.ore_giorno_15 WHEN i = 16 THEN NEW.ore_giorno_16 WHEN i = 17 THEN NEW.ore_giorno_17 WHEN i = 18 THEN NEW.ore_giorno_18 WHEN i = 19 THEN NEW.ore_giorno_19 WHEN i = 20 THEN NEW.ore_giorno_20 WHEN i = 21 THEN NEW.ore_giorno_21 WHEN i = 22 THEN NEW.ore_giorno_22 WHEN i = 23 THEN NEW.ore_giorno_23 WHEN i = 24 THEN NEW.ore_giorno_24 WHEN i = 25 THEN NEW.ore_giorno_25 WHEN i = 26 THEN NEW.ore_giorno_26 WHEN i = 27 THEN NEW.ore_giorno_27 WHEN i = 28 THEN NEW.ore_giorno_28 WHEN i = 29 THEN NEW.ore_giorno_29 WHEN i = 30 THEN NEW.ore_giorno_30 WHEN i = 31 THEN NEW.ore_giorno_31 ELSE 0 END; -- Se le ore sono maggiori di 0, aggiorna i dati IF (ore > 0) THEN SET gg = i; CALL elaborazione_aggiorna_timesheet_somma_azione(NEW.fk_anag, xfk_azione, NEW.anno, NEW.mese, NEW.nsal, gg, ore); CALL ELABORAZIONE_AGGIORNA_TT_TIMESHEET_SOMMA_SOTTLIV_ANNO_MESE(NEW.fk_anag, xfk_azione, NEW.anno, NEW.mese, gg, ore); END IF; -- Incremento del giorno SET i = i + 1; END WHILE; END - Creating trigger tempus_innodb.tt_timesheet_tmp_somma_azioni_per_stp.tt_timesheet_tmp_somma_azioni_per_stp_BEFORE_UPDATE Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `tt_timesheet_tmp_somma_azioni_per_stp_BEFORE_UPDATE` BEFORE UPDATE ON `tt_timesheet_tmp_somma_azioni_per_stp` FOR EACH ROW BEGIN declare intermedio_ore double precision; set intermedio_ore = f_somma60esimi(new.ore_giorno_1, new.ore_giorno_2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_11); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_12); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_13); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_14); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_15); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_16); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_17); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_18); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_19); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_20); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_21); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_22); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_23); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_24); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_25); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_26); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_27); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_28); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_29); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_30); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore_giorno_31); set new.totale_ore = f_corregge_60min(intermedio_ore); END - Creating trigger tempus_innodb.zucchetti_fase_01_cmo.zucchetti_fase_01_cmo_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `zucchetti_fase_01_cmo_BEFORE_INSERT` BEFORE INSERT ON `zucchetti_fase_01_cmo` FOR EACH ROW BEGIN declare xmatricola char(10); select utente_num into xmatricola from tt_anag_personale where codice_fiscale = new.cfisc; set new.matricola = xmatricola; END - Creating trigger tempus_innodb.zucchetti_fase_01_permessi.zucchetti_fase_01_permessi_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `zucchetti_fase_01_permessi_BEFORE_INSERT` BEFORE INSERT ON `zucchetti_fase_01_permessi` FOR EACH ROW BEGIN if (new.ore1 is null) then set new.ore1 = 0; end IF; if (new.ore2 is null) then set new.ore2 = 0; end IF; if (new.ore3 is null) then set new.ore3 = 0; end IF; if (new.ore4 is null) then set new.ore4 = 0; end IF; if (new.ore5 is null) then set new.ore5 = 0; end IF; if (new.ore6 is null) then set new.ore6 = 0; end IF; if (new.ore7 is null) then set new.ore7 = 0; end IF; if (new.ore8 is null) then set new.ore8 = 0; end IF; if (new.ore9 is null) then set new.ore9 = 0; end IF; if (new.ore10 is null) then set new.ore10 = 0; end IF; if (new.ore11 is null) then set new.ore11 = 0; end IF; END - Creating trigger tempus_innodb.zucchetti_file_importati.zucchetti_file_importati_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `zucchetti_file_importati_BEFORE_INSERT` BEFORE INSERT ON `zucchetti_file_importati` FOR EACH ROW BEGIN INSERT INTO TT_ALLEGATI_MASTER (TIPO_ALLEGATO, FK_ALLEGATO) VALUES (NEW.TIPO_FILE, NEW.PK_PROGRESSIVO); END - Creating trigger tempus_innodb.zucchetti_import_anag.zucchetti_import_anag_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `zucchetti_import_anag_BEFORE_INSERT` BEFORE INSERT ON `zucchetti_import_anag` FOR EACH ROW BEGIN declare conta smallint; /* ATTENZIONE il flag_anag_presente gira all'inverso in quanto mi serve per far apparire l'icona verde o rossa nella list view */ /* il suo significato non e' presente ma "da importare si no " /* controlla se presente in anagrafico */ select count(*) into conta from tt_anag_personale where codice_fiscale = new.cfisc; if (conta is null) then set conta = 0; end IF; if (conta = 0) then set new.flag_anag_presente = 'S'; else set new.flag_anag_presente = 'N'; end IF; /* controlla se presente in se stesso esempio : file ripassato piu volte */ select count(*) into conta from zucchetti_import_anag where cfisc = new.cfisc; if (conta is null) then set conta = 0; end IF; /* se presente in zucchetti piu di una volta non importo nessun record del tizio */ if (conta > 0) then set new.flag_anag_presente = 'N'; end IF; END - Creating trigger tempus_innodb.zucchetti_import_anag.zucchetti_import_anag_AFTER_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `zucchetti_import_anag_AFTER_INSERT` AFTER INSERT ON `zucchetti_import_anag` FOR EACH ROW BEGIN declare conta smallint; declare sino char(1); /* ATTENZIONE il flag_anag_presente gira all'inverso in quanto mi serve per far apparire l'icona verde o rossa nella list view */ /* il suo significato non e' presente ma "da importare si no " /* controlla se presente in anagrafico */ select count(*) into conta from tt_anag_personale where codice_fiscale = new.cfisc; if (conta is null) then set conta = 0; end IF; if (conta = 0) then set sino = 'S'; else set sino = 'N'; end IF; /* controlla se presente in se stesso esempio : file ripassato piu volte */ select count(*) into conta from zucchetti_import_anag where cfisc = new.cfisc; if (conta is null) then set conta = 0; end IF; /* se presente in zucchetti piu di una volta non importo nessun record del tizio */ if (conta > 1) then set sino = 'N'; end IF; update zucchetti_import_anag set flag_anag_presente = sino where cfisc = new.cfisc; END - Creating trigger tempus_innodb.zucchetti_intermedio_permessi.zucchetti_intermedio_permessi_BEFORE_INSERT Execute statement: USE `tempus_innodb` Execute statement: CREATE DEFINER=`root`@`%` TRIGGER `zucchetti_intermedio_permessi_BEFORE_INSERT` BEFORE INSERT ON `zucchetti_intermedio_permessi` FOR EACH ROW BEGIN declare intermedio_ore double precision; set intermedio_ore = f_somma60esimi(new.ore1, new.ore2); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore3); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore4); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore5); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore6); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore7); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore8); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore9); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore10); set intermedio_ore = f_somma60esimi(intermedio_ore, new.ore11); set new.totale_permessi = f_corregge_60min(intermedio_ore); END Scripts for 128 tables, 27 views and 38 routines were executed for schema tempus_innodb - Executing postamble script... Execute statement: SET FOREIGN_KEY_CHECKS = 1 - Schema created Create Schemas and Objects finished Tasks finished with warnings and/or errors; view the logs for details Finished performing tasks.