Advertisement
Guest User

Untitled

a guest
May 6th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.34 KB | None | 0 0
  1. timesheet:
  2.  
  3. <head>
  4. <meta http-equiv=Content-Type content="text/html; charset=utf-8" />
  5. <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.js"></script>
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  7. <LINK rel=stylesheet type="text/css" href="main.css">
  8. <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/minified/jquery-ui.min.css" type="text/css" />
  9. <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
  10. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
  11. <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
  12. <script type="text/javascript" src="script/calcul.js">
  13. </script>
  14. </head>
  15.  
  16. <?php include("Log.php"); ?>
  17. <?php include("changedate.php"); ?>
  18. <!--création des dates -->
  19. <?php
  20. $today =
  21. $date = date('Y/m/d', strtotime('last Sunday', strtotime(date("Y/m/d"))));
  22. $date1 = date('Y/m/d', strtotime($date)+86400);
  23. $date2 = date('Y/m/d', strtotime($date1)+86400);
  24. $date3 = date('Y/m/d', strtotime($date2)+86400);
  25. $date4 = date('Y/m/d', strtotime($date3)+86400);
  26. $date5 = date('Y/m/d', strtotime($date4)+86400);
  27. $date6 = date('Y/m/d', strtotime($date5)+86400);
  28. $date7 = date('Y/m/d', strtotime($date6)+86400);
  29. ?>
  30. <!--image de ohmega-->
  31. <div id="pic">
  32. <img src="ohm.png" width="100" height="85" align="left" hspace="6" vspace="6"/>
  33. </div>
  34.  
  35. <h1>Feuille de temps du Groupe Ohméga inc.</h1>
  36. <form>
  37. </br>
  38. <div id="welcome">
  39. <input value="recherche un numéro" type="button" name="search" id="search" onClick="window.open('datagrid.html','Fiche','toolbar=no,status=no,width=800 ,height=700,scrollbars=yes,location=center,resize=yes,menubar=yes')">
  40. </div>
  41. <div id="welcome">
  42. Bienvenue: <?php echo$usrUserName; '\t' ?>
  43.  
  44. </div>
  45. <div id="welcome">
  46. Semaine du :
  47. <input align="center" type="text" name="timesheetdate" id="timesheetdate" value=<?php echo $date ?> disabled>
  48.  
  49. </div>
  50.  
  51.  
  52. <?php include "autocomplete.php" ; ?>
  53.  
  54. <!-- creation des radiobuttons pour le choix. -->
  55. <div id="radioover" align="center" >
  56. <input type="radio" value="1" name="group"style="background-color:transparent" id="option1" onClick="getvote();" /><strong>mettre en banque </strong>
  57. <input type="radio" value="2" name="group" style="background-color:transparent" id="option2" onClick="getvote();" /><strong>Paye nombre d'heure</strong>
  58. </div>
  59.  
  60. <div id="radiounder" align="center"></br>
  61. <input type="radio" value="3" name="group" style="background-color:transparent " id="option3" onclick="getvote();" /><strong>Prendre heures en banque</strong>
  62. <input type="radio" value="4" name="group" style="background-color:transparent " id="option4" onclick="getvote();" /><strong>Paye nombre d'heure</strong>
  63. </div>
  64.  
  65. <!--creation de la case commentaire. -->
  66. <div class="header">
  67. Commentaires spéciaux :
  68. </br>
  69. <textarea rows="4" cols="88" id="timComments" name="timComments"> </textarea>
  70. </br>
  71. </br>
  72. </div>
  73. </form>
  74.  
  75. insert.php :
  76. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
  77. <LINK rel=stylesheet type="text/css" href="main.css">
  78. <?php
  79. session_start();
  80. // connection a la BD
  81. try
  82. {
  83. $bdd = new PDO('mysql:host=localhost;dbname=cruel', 'root', '');
  84. }
  85. catch (Exception $e)
  86. {
  87. die('Erreur : ' . $e->getMessage());
  88. }
  89. $timId = "" ;
  90.  
  91. // cherche information du dimanche
  92. if (isSet($_POST['tempsd']))
  93. {
  94. $usrUserName = $_POST['usrUserName'] ;
  95. $lieudim = $_POST['lieudim'] ;
  96. $prodescdim = $_POST['prodescdim'] ;
  97. $timDateStartOfWeek = $_POST['data'] ;
  98. $Selectdimanche = $_POST['Selectdimanche'] ;
  99. $projdim = $_POST['projdim'] ;
  100. $date1 = $_POST['date1'] ;
  101. $tempsd = $_POST['tempsd'] ;
  102. }
  103. // cherche information lundi
  104. if (isSet($_POST['projdesclundi']))
  105. {
  106. $usrUserName = $_POST['usrUserName'] ;
  107. $lieu1 = $_POST['lieu1'] ;
  108. $projdesclundi = $_POST['projdesclundi'] ;
  109. $timDateStartOfWeek = $_POST['data'] ;
  110. $Selectlundi = $_POST['Selectlundi'] ;
  111. $projlundi = $_POST['projlundi'] ;
  112. $date2 = $_POST['date2'] ;
  113. $tempsl = $_POST['tempsl'] ;
  114. }
  115. //cherche information mardi
  116. if (isSet($_POST['projdescmardi']))
  117. {
  118. $usrUserName = $_POST['usrUserName'] ;
  119. $lieumardi = $_POST['lieumardi'] ;
  120. $projdescmardi = $_POST['projdescmardi'] ;
  121. $timDateStartOfWeek = $_POST['data'] ;
  122. $Selectmardi = $_POST['Selectmardi'] ;
  123. $projetmardi = $_POST['projetmardi'] ;
  124. $date3 = $_POST['date3'] ;
  125. $tempsma = $_POST['tempsma'] ;
  126. }
  127. // cherche information mercredi
  128.  
  129. if (isSet($_POST['projetdescmercredi']))
  130. {
  131. $usrUserName = $_POST['usrUserName'] ;
  132. $lieumercredi = $_POST['lieumercredi'] ;
  133. $projetdescmercredi = $_POST['projetdescmercredi'] ;
  134. $timDateStartOfWeek = $_POST['data'] ;
  135. $Selectmercredi = $_POST['Selectmercredi'] ;
  136. $projmercredi = $_POST['projmercredi'] ;
  137. $date4 = $_POST['date4'] ;
  138. $tempsme = $_POST['tempsme'] ;
  139. }
  140. // cherche information Jeudi
  141. if (isSet($_POST['projDescjeudi']))
  142. {
  143. $usrUserName = $_POST['usrUserName'] ;
  144. $lieujeudi = $_POST['lieujeudi'] ;
  145. $projDescjeudi = $_POST['projDescjeudi'] ;
  146. $timDateStartOfWeek = $_POST['data'] ;
  147. $selectjeudi = $_POST['selectjeudi'] ;
  148. $projetjeudi = $_POST['projetjeudi'] ;
  149. $date5 = $_POST['date5'] ;
  150. $tempsje = $_POST['tempsje'] ;
  151. }
  152. //vendredi
  153. if (isSet($_POST['projdesvendredi']))
  154. {
  155. $usrUserName = $_POST['usrUserName'] ;
  156. $lieuvendredi = $_POST['lieuvendredi'] ;
  157. $projdesvendredi = $_POST['projdesvendredi'] ;
  158. $timDateStartOfWeek = $_POST['data'] ;
  159. $SelectVendredi = $_POST['SelectVendredi'] ;
  160. $projvendredi = $_POST['projvendredi'] ;
  161. $date6 = $_POST['date6'] ;
  162. $tempsv = $_POST['tempsv'] ;
  163. }
  164. //samedi
  165. if (isSet($_POST['descprojsam']))
  166. {
  167. $usrUserName = $_POST['usrUserName'] ;
  168. $lieusam = $_POST['lieusam'] ;
  169. $descprojsam = $_POST['descprojsam'] ;
  170. $timDateStartOfWeek = $_POST['data'] ;
  171. $taskSam = $_POST['taskSam'] ;
  172. $projsam = $_POST['projsam'] ;
  173. $date7 = $_POST['date7'] ;
  174. $tempsam = $_POST['tempsam'] ;
  175. }
  176. // Information communes , usager , date du projet , le numéro du projet
  177. // cherche le numéro ID de l'usager
  178.  
  179. $requete = $bdd->prepare('SELECT * FROM users WHERE usrUserName =:usrUserName');
  180. $requete->execute(array('usrUserName'=> $_POST['usrUserName'])) or die(print_r($requete->errorInfo()));
  181. $resultat = $requete->fetch();
  182. $usrUserName = $resultat['usrId'];
  183. if(isset($_POST['timComments']))
  184. {
  185. $timComments = $_POST['timComments'] ;
  186. echo($timComments);
  187. }
  188. // Insertion timesheet le timUserdID, creation de la date, date de la semaine
  189. $req = $bdd->prepare('INSERT INTO timesheets (timUserID,timCreatedDate, timDateStartOfWeek,timComments) VALUES(:usrUserName, CURDATE(),:timDateStartOfWeek,:timComments) ');
  190. $req->execute(array('usrUserName' => $usrUserName,'timDateStartOfWeek' => $timDateStartOfWeek,'timComments' => $timComments));
  191. // cherche le num projet timesheet
  192. $requete = $bdd->prepare('SELECT `timId` FROM `timesheets` ORDER BY `timId` Desc LIMIT 1 ');
  193. $requete->execute(array('timId'=> 'timId')) or die(print_r($requete->errorInfo()));
  194. $resultat = $requete->fetch();
  195. $timId = $resultat['timId'];
  196. //---------------------------- INSERTION dimanche--------------------------------------
  197. // Insertion description,location tache, numero de projet
  198. $req = $bdd->prepare('INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)VALUES(:prodescdim, :lieudim ,:Selectdimanche, :projdim, :date1, :tempsd, :timId )');
  199. $req->execute(array(
  200. 'prodescdim' => $prodescdim,
  201. 'lieudim' => $lieudim,
  202. 'Selectdimanche'=> $Selectdimanche,
  203. 'projdim'=> $projdim,
  204. 'date1'=> $date1,
  205. 'tempsd'=> $tempsd,
  206. 'timId'=> $timId,
  207. ));
  208.  
  209. //dynamic row to database for sunday
  210. require("dbconn.php");
  211. if (isset($_POST['submit_val']))
  212. {
  213. if (isset($_POST['numpro']) )
  214. {
  215. $post_count = count($_POST['numpro']);
  216. for ($i=0;$i<$post_count;$i++)
  217. {
  218. if ($_POST['numpro'][$i] !="")
  219. {
  220. $numpro = mysql_real_escape_string($_POST['numpro'][$i]);
  221. $prodesc = mysql_real_escape_string($_POST['prodesc'][$i]);
  222. $tache = mysql_real_escape_string($_POST['tache'][$i]);
  223. $prolieu = mysql_real_escape_string($_POST['prolieu'][$i]);
  224. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES
  225. ( '$prodesc' ,'$prolieu', '$tache' ,'$numpro',' $date1' ,'$timId' )", $connection );
  226.  
  227. }
  228. }
  229. }
  230. }
  231. //---------------------------- INSERTION lundi--------------------------------------
  232.  
  233. // Insertion description,location tache, numero de projet
  234. $req = $bdd->prepare('INSERT INTO projetstaches
  235. (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)
  236. VALUES(:projdesclundi, :lieu1 ,:Selectlundi, :projlundi, :date2, :tempsl, :timId )');
  237. $req->execute(array(
  238.  
  239. 'projdesclundi' => $projdesclundi,
  240. 'lieu1' => $lieu1,
  241. 'Selectlundi'=> $Selectlundi,
  242. 'projlundi'=> $projlundi,
  243. 'date2'=> $date2,
  244. 'tempsl'=> $tempsl,
  245. 'timId'=> $timId,
  246.  
  247. ));
  248.  
  249. require("dbconn.php");
  250. // insertion dynamic pour lundi
  251. if (isset($_POST['submit_val'])) {
  252. if (isset($_POST['numlundi'])) {
  253.  
  254. $post_count = count($_POST['numlundi']);
  255. for ($i=0;$i<$post_count;$i++)
  256. {
  257. if ($_POST['numlundi'][$i] !="")
  258. {
  259.  
  260. $numlundi = mysql_real_escape_string($_POST['numlundi'][$i]);
  261. $prodesclun = mysql_real_escape_string($_POST['prodesclun'][$i]);
  262. $tachedivlun = mysql_real_escape_string($_POST['tachedivlun'][$i]);
  263. $prolieudivlun = mysql_real_escape_string($_POST['prolieudivlun'][$i]);
  264. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES
  265. ( '$prodesclun' ,'$prolieudivlun', '$tachedivlun' ,'$numlundi',' $date2' ,'$timId' )", $connection );
  266. }
  267.  
  268. }
  269. }
  270. }
  271.  
  272. //---------------------------- INSERTION Mardi--------------------------------------
  273.  
  274. // Insertion description,location tache, numero de projet
  275. $req = $bdd->prepare('INSERT INTO projetstaches
  276. (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)
  277. VALUES(:projdescmardi, :lieumardi ,:Selectmardi, :projetmardi, :date3, :tempsma, :timId )');
  278. $req->execute(array(
  279.  
  280. 'projdescmardi' => $projdescmardi,
  281. 'lieumardi' => $lieumardi,
  282. 'Selectmardi'=> $Selectmardi,
  283. 'projetmardi'=> $projetmardi,
  284. 'date3'=> $date3,
  285. 'tempsma'=> $tempsma,
  286. 'timId'=> $timId,
  287.  
  288. ));
  289.  
  290. // insertion dynamic pour mardi
  291. if (isset($_POST['submit_val']))
  292. {
  293. if (isset($_POST['nummar']))
  294. {
  295.  
  296. $post_count = count($_POST['nummar']);
  297. for ($i=0;$i<$post_count;$i++)
  298. {
  299. if ($_POST['nummar'][$i] !="")
  300. {
  301. $nummar = mysql_real_escape_string($_POST['nummar'][$i]);
  302. $prodescmar = mysql_real_escape_string($_POST['prodescmar'][$i]);
  303. $tachedivmar = mysql_real_escape_string($_POST['tachedivmar'][$i]);
  304. $prolieudivmar = mysql_real_escape_string($_POST['prolieudivmar'][$i]);
  305. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES
  306. ( '$prodescmar' ,'$prolieudivmar', '$tachedivmar' ,'$nummar',' $date3' ,'$timId' )", $connection );
  307. }
  308. }
  309.  
  310. }
  311. }
  312.  
  313. //---------------------------- INSERTION mercredi--------------------------------------
  314.  
  315. // Insertion description,location tache, numero de projet
  316. $req = $bdd->prepare('INSERT INTO projetstaches
  317. (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)
  318. VALUES(:projetdescmercredi, :lieumercredi,:Selectmercredi, :projmercredi, :date4, :tempsme, :timId )');
  319. $req->execute(array(
  320. 'projetdescmercredi' => $projetdescmercredi,
  321. 'lieumercredi' => $lieumercredi,
  322. 'Selectmercredi'=> $Selectmercredi,
  323. 'projmercredi'=> $projmercredi,
  324. 'date4'=> $date4,
  325. 'tempsme'=> $tempsme,
  326. 'timId'=> $timId,
  327. ));
  328. // insertion dynamic pour mercredi
  329. if (isset($_POST['submit_val'])) {
  330. if (isset($_POST['nummer']) ){
  331.  
  332. $post_count = count($_POST['nummer']);
  333. for ($i=0;$i<$post_count;$i++) {
  334. if ($_POST['nummer'][$i] !="")
  335. {
  336. $nummer = mysql_real_escape_string($_POST['nummer'][$i]);
  337. $prodescmer = mysql_real_escape_string($_POST['prodescmer'][$i]);
  338. $tachedivmer = mysql_real_escape_string($_POST['tachedivmer'][$i]);
  339. $prolieudivmmer = mysql_real_escape_string($_POST['prolieudivmmer'][$i]);
  340. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES
  341. ( '$prodescmer' ,'$prolieudivmmer', '$tachedivmer' ,'$nummer',' $date4' ,'$timId' )", $connection );
  342. }
  343. }
  344.  
  345. }
  346. }
  347. //---------------------------- INSERTION Jeudi--------------------------------------
  348.  
  349. // Insertion description,location tache, numero de projet
  350. $req = $bdd->prepare('INSERT INTO projetstaches
  351. (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)
  352. VALUES(:projDescjeudi, :lieujeudi,:selectjeudi, :projetjeudi, :date5, :tempsje, :timId )');
  353. $req->execute(array(
  354.  
  355. 'projDescjeudi' => $projDescjeudi,
  356. 'lieujeudi' => $lieujeudi,
  357. 'selectjeudi'=> $selectjeudi,
  358. 'projetjeudi'=> $projetjeudi,
  359. 'date5'=> $date5,
  360. 'tempsje'=> $tempsje,
  361. 'timId'=> $timId,
  362. ));
  363.  
  364. // insertion dynamic pour jeudi
  365. if (isset($_POST['submit_val'])) {
  366. if (isset($_POST['numjeu']) ){
  367.  
  368. $post_count = count($_POST['numjeu']);
  369. for ($i=0;$i<$post_count;$i++) {
  370. if ($_POST['numjeu'][$i] !="")
  371. {
  372. $numjeu = mysql_real_escape_string($_POST['numjeu'][$i]);
  373. $prodescjeu = mysql_real_escape_string($_POST['prodescjeu'][$i]);
  374. $protachejeu = mysql_real_escape_string($_POST['protachejeu'][$i]);
  375. $prolieudivjeu = mysql_real_escape_string($_POST['prolieudivjeu'][$i]);
  376. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES
  377. ( '$prodescjeu' ,'$prolieudivjeu', '$protachejeu' ,'$numjeu',' $date5' ,'$timId' )", $connection );
  378. }
  379. }
  380.  
  381. }
  382. }
  383. //---------------------------- INSERTION Vendredi--------------------------------------
  384.  
  385. // Insertion description,location tache, numero de projet
  386. $req = $bdd->prepare('INSERT INTO projetstaches
  387. (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)
  388. VALUES(:projdesvendredi, :lieuvendredi,:SelectVendredi, :projvendredi, :date6, :tempsv, :timId )');
  389. $req->execute(array(
  390. 'projdesvendredi' => $projdesvendredi,
  391. 'lieuvendredi' => $lieuvendredi,
  392. 'SelectVendredi'=> $SelectVendredi,
  393. 'projvendredi'=> $projvendredi,
  394. 'date6'=> $date6,
  395. 'tempsv'=> $tempsv,
  396. 'timId'=> $timId,
  397. ));
  398. // insertion dynamic pour vendredi
  399. if (isset($_POST['submit_val'])) {
  400. if (isset($_POST['numven']) ){
  401.  
  402. $post_count = count($_POST['numven']);
  403. for ($i=0;$i<$post_count;$i++) {
  404. if ($_POST['numven'][$i] !="")
  405. {
  406. $numven = mysql_real_escape_string($_POST['numven'][$i]);
  407. $prodescven = mysql_real_escape_string($_POST['prodescven'][$i]);
  408. $protacheven = mysql_real_escape_string($_POST['protacheven'][$i]);
  409. $prolieudivven = mysql_real_escape_string($_POST['prolieudivven'][$i]);
  410. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES
  411. ( '$prodescven' ,'$prolieudivven', '$protacheven' ,'$numven',' $date6' ,'$timId' )", $connection );
  412. }
  413. }
  414.  
  415. }
  416. }
  417. //------------------------------------SAMEDI------------------------------
  418.  
  419. // Insertion description,location tache, numero de projet
  420. $req = $bdd->prepare('INSERT INTO projetstaches
  421. (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTime,prtTimeSheetId)
  422. VALUES(:descprojsam, :lieusam,:taskSam, :projsam, :date7, :tempsam, :timId )');
  423. $req->execute(array(
  424. 'descprojsam' => $descprojsam,
  425. 'lieusam' => $lieusam,
  426. 'taskSam'=> $taskSam,
  427. 'projsam'=> $projsam,
  428. 'date7'=> $date7,
  429. 'tempsam'=> $tempsam,
  430. 'timId'=> $timId,
  431. ));
  432.  
  433. // insertion dynamic pour samedi
  434. if (isset($_POST['submit_val'])) {
  435. if (isset($_POST['numsam'])) {
  436.  
  437. $post_count = count($_POST['numsam']);
  438. for ($i=0;$i<$post_count;$i++)
  439. {
  440. if ($_POST['numsam'][$i] !="")
  441. {
  442. $numsam = mysql_real_escape_string($_POST['numsam'][$i]);
  443. $prodescsam = mysql_real_escape_string($_POST['prodescsam'][$i]);
  444. $protachesam = mysql_real_escape_string($_POST['protachesam'][$i]);
  445. $prolieudivsam = mysql_real_escape_string($_POST['prolieudivsam'][$i]);
  446. $query = mysql_query("INSERT INTO projetstaches (prtDescription,prtLocation,prtTaskId,prtProjetNum,prtDate,prtTimeSheetId) VALUES ( '$prodescsam' ,'$prolieudivsam', '$protachesam' ,'$numsam',' $date7' ,'$timId' )", $connection );
  447. }
  448. }
  449.  
  450. }
  451. }
  452.  
  453. ?>
  454. <form method="post" action="index.php">
  455. <input type="submit" name="retour" value="retour" />
  456. </form>
  457. <?php
  458. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement