|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
[php] turno lavoratori
Salve gente,
vorrei creare un programmino che mi dia la possibilità di fare i servizi. Vorrei che le persone vengano inserite nei turni in base al giorno della settimana. Mi spiego: i turni sono: feriali (dal lunedi al giovedi), turno del venerdi, turno del sabato, turno festivo. Chiaramente le persone vanno inserite per anzianità, e tra un servizio ed un'altro devono passare 4 giorni almeno. Le tabelle le ho già fatte, il form per inserite gli utenti che faranno i servizi anche. Mi sono bloccato su come fare: 1 - creare la suddivisone delle date; 2 - creare la query che mi da come risultato la persona che monta quel giorno. Chi avesse voglia di darmi un'aiuto possiamo creare un gruppo di lavoro. posso rendere tutto disponibile e sarà tutto opensource. Grazie Ultima modifica di zebmckey : 28-04-2016 alle 10:56. |
|
|
|
|
|
#2 |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
Chiedo scusa se solo oggi mi faccio risentire, ma per problemi non mi è stato possibile.
Il sistema è su Centos 6 httpd-2.2.15-47.el6.centos.4.x86_64 mysql-5.1.73-5.el6_7.1.x86_64 php-5.3.3-46.el6_7.1.x86_64 di seguito il database Codice:
-- MySQL dump 10.13 Distrib 5.1.73, for redhat-linux-gnu (x86_64) -- -- Host: localhost Database: servizi -- ------------------------------------------------------ -- Server version 5.1.73 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `assenze` -- DROP TABLE IF EXISTS `assenze`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `assenze` ( `id_assenza` int(11) NOT NULL AUTO_INCREMENT, `id_utente` int(11) NOT NULL, `tipo` varchar(45) DEFAULT NULL, `data_da` date DEFAULT NULL, `data_al` date DEFAULT NULL, PRIMARY KEY (`id_assenza`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `assenze` -- LOCK TABLES `assenze` WRITE; /*!40000 ALTER TABLE `assenze` DISABLE KEYS */; /*!40000 ALTER TABLE `assenze` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `grado` -- DROP TABLE IF EXISTS `grado`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `grado` ( `id_grado` int(11) NOT NULL AUTO_INCREMENT, `grado` varchar(45) DEFAULT NULL, PRIMARY KEY (`id_grado`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `grado` -- LOCK TABLES `grado` WRITE; /*!40000 ALTER TABLE `grado` DISABLE KEYS */; /*!40000 ALTER TABLE `grado` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `recupero` -- DROP TABLE IF EXISTS `recupero`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `recupero` ( `id_recupero` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `id_utente` int(11) NOT NULL, `id_servizio` int(11) NOT NULL, `dataservizio` date DEFAULT NULL, PRIMARY KEY (`id_recupero`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `recupero` -- LOCK TABLES `recupero` WRITE; /*!40000 ALTER TABLE `recupero` DISABLE KEYS */; /*!40000 ALTER TABLE `recupero` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tipo_servizio` -- DROP TABLE IF EXISTS `tipo_servizio`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tipo_servizio` ( `id_servizio` int(11) NOT NULL AUTO_INCREMENT, `servizio` varchar(45) DEFAULT NULL, PRIMARY KEY (`id_servizio`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tipo_servizio` -- LOCK TABLES `tipo_servizio` WRITE; /*!40000 ALTER TABLE `tipo_servizio` DISABLE KEYS */; /*!40000 ALTER TABLE `tipo_servizio` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `turno1fes` -- DROP TABLE IF EXISTS `turno1fes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `turno1fes` ( `id_t1` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `id_utente` int(11) NOT NULL, `id_servizio` int(11) NOT NULL, `data` date DEFAULT NULL, PRIMARY KEY (`id_t1`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `turno1fes` -- LOCK TABLES `turno1fes` WRITE; /*!40000 ALTER TABLE `turno1fes` DISABLE KEYS */; /*!40000 ALTER TABLE `turno1fes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `turno2PF` -- DROP TABLE IF EXISTS `turno2PF`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `turno2PF` ( `id_t2` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `id_utente` int(11) NOT NULL, `id_servizio` int(11) NOT NULL, `data` date DEFAULT NULL, PRIMARY KEY (`id_t2`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `turno2PF` -- LOCK TABLES `turno2PF` WRITE; /*!40000 ALTER TABLE `turno2PF` DISABLE KEYS */; /*!40000 ALTER TABLE `turno2PF` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `turno3V` -- DROP TABLE IF EXISTS `turno3V`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `turno3V` ( `id_t3` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `id_utente` int(11) NOT NULL, `id_servizio` int(11) NOT NULL, `data` date DEFAULT NULL, PRIMARY KEY (`id_t3`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `turno3V` -- LOCK TABLES `turno3V` WRITE; /*!40000 ALTER TABLE `turno3V` DISABLE KEYS */; /*!40000 ALTER TABLE `turno3V` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `turno4fer` -- DROP TABLE IF EXISTS `turno4fer`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `turno4fer` ( `id_t4` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `id_utente` int(11) NOT NULL, `id_servizio` int(11) NOT NULL, `data` date DEFAULT NULL, PRIMARY KEY (`id_t4`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `turno4fer` -- LOCK TABLES `turno4fer` WRITE; /*!40000 ALTER TABLE `turno4fer` DISABLE KEYS */; /*!40000 ALTER TABLE `turno4fer` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `turno5SF` -- DROP TABLE IF EXISTS `turno5SF`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `turno5SF` ( `id_t5` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `id_utente` int(11) NOT NULL, `id_servizio` int(11) NOT NULL, `data` date DEFAULT NULL, PRIMARY KEY (`id_t5`), KEY `utente_ind` (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `turno5SF` -- LOCK TABLES `turno5SF` WRITE; /*!40000 ALTER TABLE `turno5SF` DISABLE KEYS */; /*!40000 ALTER TABLE `turno5SF` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `utente` -- DROP TABLE IF EXISTS `utente`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `utente` ( `id_utente` int(11) NOT NULL AUTO_INCREMENT, `id_grado` int(11) NOT NULL, `cognome` varchar(45) DEFAULT NULL, `nome` varchar(45) DEFAULT NULL, `anzianita` date NOT NULL, `id_servizio` int(11) NOT NULL, PRIMARY KEY (`id_utente`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `utente` -- LOCK TABLES `utente` WRITE; /*!40000 ALTER TABLE `utente` DISABLE KEYS */; /*!40000 ALTER TABLE `utente` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2016-05-02 13:49:58 Le tabelle grado e servizio le devo ancora popolare. Codice:
<html>
<body>
<table width="420" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="personale_form" method="post" action="act_utente.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFDEAD">
<tr>
<td colspan="4" style="text-align:center"><strong>Inserimento Dati </strong></td>
</tr>
<tr>
<td>Grado</td>
<td>:</td>
<td style="width: 279px"><select name="mod_grado" >
<option value="000" selected="selected">[Seleziona]</option>
<optgroup label="Ufficiali">
<option value="1">Gen.C.A. </option>
<option value="2">Gen.Div. </option>
<option value="3">Gen.B. </option>
<option value="4">Col. </option>
<option value="5">Ten.Col. </option>
<option value="6">Magg. </option>
<option value="7">Cap. </option>
<option value="8">Ten. </option>
<option value="9">S.Ten. </option>
<optgroup label="Marescialli">
<option value="10">1° Mar.Luogt. </option>
<option value="11">1° Mar. </option>
<option value="12">Mar.Ca. </option>
<option value="13">Mar.Ord. </option>
<option value="14">Mar. </option>
<optgroup label="Sergenti">
<option value="15">Serg.Magg.Ca. </option>
<option value="16">Serg. Magg. </option>
<option value="17">Serg. </option>
<optgroup label="Truppa">
<option value="18">C.le Magg.Ca.Sc. </option>
<option value="19">C.le Magg.Ca. </option>
<option value="20">C.le Magg.Sc. </option>
<option value="21">1° C.le Magg. </option>
<option value="22">C.le Magg. </option>
<option value="23">C.le </option>
</select>
</td>
</tr>
<tr>
<td>Cognome</td>
<td>:</td>
<td style="width: 279px"><input name="mod_cognome" type="text" id="mod_cognome">
</td>
</tr>
<tr>
<td>Nome</td>
<td>:</td>
<td style="width: 279px"><input name="mod_nome" type="text" id="mod_nome">
</td>
</tr>
<tr>
<td>Anzianita'</td>
<td>:</td>
<td style="width: 279px"><input name="mod_anz" type="data" id="mod_anz">
</td>
</tr>
<tr>
<td>Servizio</td>
<td>:</td>
<td style="width: 279px"><select name="mod_serv" >
<option value="000" selected="selected">[Seleziona]</option>
<option value="1">Ufficiale di ispezione</option>
<option value="2">Ufficiale di picchetto</option>
<option value="3">Sottufficiale di ispezione </option>
<option value="4">Comandante della guardia</option>
</select>
</td>
</tr>
<td> </td>
<td> </td>
<td style="width: 279px" class="style1"><input type="submit" name="Submit" value="Inserisci"></td>
<td> </td>
</tr>
</table>
</table>
<br>
<br>
</body>
</html>
Codice PHP:
1. chi non ha effettuato il servizio 2. tra chi non è montato mi dia un'ordine in base all'anzinità 3. se la data è festiva dal più anziano al più giovane, se feriale dal più giovane al più anziano. La vedo dura intanto vado avanti e man mano metterò i vari aggiornamenti. Grazie |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Mar 2001
Città: MI
Messaggi: 1801
|
ciao, ora è più facile poterti aiutare
di dove sei? (se fossimo vicini diventerebbe ancora più facile) Ciao
__________________
italiarec.com forum italiano di registrazione e mixaggio estilocaballero.es ssdoptimizer.eu cambioeuro.eu doflamingo.com studiolegalesangalli.com stilegentiluomo.it italiarec.com italiarec.it arteincasa.it |
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Mar 2001
Città: MI
Messaggi: 1801
|
hai già fatto un'analisi del tutto?
perchè noi sicuramente ti proporremmo soluzioni leggermente diverse
__________________
italiarec.com forum italiano di registrazione e mixaggio estilocaballero.es ssdoptimizer.eu cambioeuro.eu doflamingo.com studiolegalesangalli.com stilegentiluomo.it italiarec.com italiarec.it arteincasa.it |
|
|
|
|
|
#5 |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
|
|
|
|
|
|
#6 |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
Ho apprtato degli aggiornamenti nel file sql , chiaramente ho dovuto modificare anche i file html e php.
turni-di-lavoro su github |
|
|
|
|
|
#7 |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
Continuo con il mio lavoretto ,anche se purtroppo a singhiozzi per carico lavorativo.
non riesco a risolvere un piccolo problema Codice PHP:
Chiaramente il codice sopra non funziona. Come posso fare? |
|
|
|
|
|
#8 |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
Ok risolto!
Codice PHP:
Questa può essere una soluzione. Se riesco a vedere anche la "P" non sarebbe male. |
|
|
|
|
|
#9 |
|
Senior Member
Iscritto dal: Mar 2001
Città: MI
Messaggi: 1801
|
ciao Zeb, scusa il ritardo non ti ho più filato
riprendo il tuo precedente commento (stai sbagliando un pelo la sintassi): if ('A'==$esente) { echo ('<td><a href="motivoassenza.php?id=' . $ID . '">' . $esente . '</a></td>'); } else if ('P'==$esente) { echo "<td>$esente</td>"; } e attento alle parentesi, chiudile in line dove le apri altrimenti non si capisce
__________________
italiarec.com forum italiano di registrazione e mixaggio estilocaballero.es ssdoptimizer.eu cambioeuro.eu doflamingo.com studiolegalesangalli.com stilegentiluomo.it italiarec.com italiarec.it arteincasa.it |
|
|
|
|
|
#10 | |
|
Member
Iscritto dal: Apr 2016
Messaggi: 72
|
Grazieee, porca pupazza che errore da pivello
Quote:
|
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:21.




















