PageRenderTime 26ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/httpdocs/1564fd6a87s65fd41as32df18aw7e5sd12yx1c/inc.openup.php

http://dj-r-old-admin.googlecode.com/
PHP | 251 lines | 211 code | 23 blank | 17 comment | 53 complexity | 6c70fb969d4e18875eec088403f2672b MD5 | raw file
  1. <?
  2. if (!$_GET['mois_ouverture'])
  3. {$_SESSION['mois_ouverture']=date("m");}
  4. function affiche_ligne_openup ($heures)
  5. {
  6. if ($heures == -1) {$color="#FF5050"; $print="";}
  7. elseif ($heures == 0) {$color="#A4D1FF"; $print="";}
  8. elseif ($heures == -2) {$color="#FFF832"; $print="";}
  9. else {$color="#CDFEE0"; $print=$heures*1;}
  10. return "<td bgcolor=$color align=center>$print</td>";
  11. }
  12. $limit=0;
  13. function liste_openups($sql_openup,$db)
  14. {
  15. global $limit;
  16. print "<table border=\"0\">
  17. <tr>
  18. <td></td>
  19. <td>Date</td>
  20. <td></td>
  21. <td><a href=\"pop.openup_expo_csv.php?who=hugo_h&sql_openup=$sql_openup\" target=_blank>Hug</a></td>
  22. <td><a href=\"pop.openup_expo_csv.php?who=samuel_h&sql_openup=$sql_openup\" target=_blank>Sam</a></td>
  23. <td><a href=\"pop.openup_expo_csv.php?who=david_h&sql_openup=$sql_openup\" target=_blank>Dav</a></td>
  24. <td><a href=\"pop.openup_expo_csv.php?who=justin_h&sql_openup=$sql_openup\" target=_blank>Jus</a></td>
  25. <td><a href=\"pop.openup_expo_csv.php?who=mike_h&sql_openup=$sql_openup\" target=_blank>Mik</a></td>
  26. <td><a href=\"pop.openup_expo_csv.php?who=yann_h&sql_openup=$sql_openup\" target=_blank>Yan</a></td>".
  27. //"<td><a href=\"pop.openup_expo_csv.php?who=jc_h&sql_openup=$sql_openup\" target=_blank>JC</a></td>".
  28. "<td><a href=\"pop.openup_expo_csv.php?who=nicolas_h&sql_openup=$sql_openup\" target=_blank>Nic</a></td>
  29. <td><a href=\"pop.openup_expo_csv.php?who=matthieu_h&sql_openup=$sql_openup\" target=_blank>Mat</a></td>".
  30. //"<td><a href=\"pop.openup_expo_csv.php?who=yannick_h&sql_openup=$sql_openup\" target=_blank>Yannick</a></td>".
  31. "<td>Help</td>
  32. </tr>";
  33. $res_openup=mysql_query($sql_openup,$db);
  34. while($ligne_openup=mysql_fetch_object($res_openup))
  35. {
  36. $i++;
  37. $tbl_color="#FFFFFF";
  38. if (!$ligne_openup->ouvert)
  39. {$tbl_color="#FF5050";}
  40. $joliedate=format_datetime2($ligne_openup->ouverture,"D d");
  41. if (substr($joliedate,0,3)!="Lun" && substr($joliedate,0,3)!="Jeu" && substr($joliedate,0,3)!="Ven" && substr($joliedate,0,3)!="Sam")
  42. {
  43. if (!$ligne_openup->ouvert)
  44. {$tbl_color="#FF9999";}
  45. else
  46. {$tbl_color="#99FF99";}
  47. }
  48. $date_abs=substr($ligne_openup->ouverture,0,10);
  49. $totaltemps=$totaltemps+$ligne_openup->duree;
  50. $ligne_openup->duree=($ligne_openup->duree/3600);
  51. if ($ligne_openup->hugo_h > 0) {$hugo_h_t=$hugo_h_t+$ligne_openup->hugo_h;}
  52. if ($ligne_openup->samuel_h > 0) {$samuel_h_t=$samuel_h_t+$ligne_openup->samuel_h;}
  53. if ($ligne_openup->david_h > 0) {$david_h_t=$david_h_t+$ligne_openup->david_h;}
  54. if ($ligne_openup->justin_h > 0) {$justin_h_t=$justin_h_t+$ligne_openup->justin_h;}
  55. if ($ligne_openup->mike_h > 0) {$mike_h_t=$mike_h_t+$ligne_openup->mike_h;}
  56. if ($ligne_openup->yann_h > 0) {$yann_h_t=$yann_h_t+$ligne_openup->yann_h;}
  57. if ($ligne_openup->jc_h > 0) {$jc_h_t=$jc_h_t+$ligne_openup->jc_h;}
  58. if ($ligne_openup->nicolas_h > 0) {$nicolas_h_t=$nicolas_h_t+$ligne_openup->nicolas_h;}
  59. if ($ligne_openup->matthieu_h > 0) {$matthieu_h_t=$matthieu_h_t+$ligne_openup->matthieu_h;}
  60. //if ($ligne_openup->yannick_h > 0) {$yannick_h_t=$yannick_h_t+$ligne_openup->yannick_h;}
  61. if ($ligne_openup->autre_h > 0) {$autre_h_t=$autre_h_t+$ligne_openup->autre_h;}
  62. // la ptite flčche qui montre la prochaine ouverture
  63. echo'<tr><td>';
  64. if ($date_abs>=date("Y-m-d") && $limit<1)
  65. {
  66. print '<div align="right"><img src="../images/fleche_ve_dr25.gif" ></div>';
  67. $limit=1;
  68. }
  69. echo'</td>';
  70. print "
  71. <td height=\"25\" bgcolor=\"$tbl_color\" width=\"60\"><a href=\"?loc_date=$date_abs\">$joliedate</a></td>
  72. <td width=\"20\">".mklink_simple("pop.form.ouverture.php?ouverture=$ligne_openup->ouverture",350, 450, 20, 20, "saisieouverture")."$ligne_openup->duree h</a></td>";
  73. print affiche_ligne_openup($ligne_openup->hugo_h);
  74. print affiche_ligne_openup($ligne_openup->samuel_h);
  75. print affiche_ligne_openup($ligne_openup->david_h);
  76. print affiche_ligne_openup($ligne_openup->justin_h);
  77. print affiche_ligne_openup($ligne_openup->mike_h);
  78. print affiche_ligne_openup($ligne_openup->yann_h);
  79. //print affiche_ligne_openup($ligne_openup->jc_h);
  80. print affiche_ligne_openup($ligne_openup->nicolas_h);
  81. print affiche_ligne_openup($ligne_openup->matthieu_h);
  82. //print affiche_ligne_openup($ligne_openup->yannick_h);
  83. print affiche_ligne_openup($ligne_openup->autre_h);
  84. print "<td>";
  85. if ($ligne_openup->commentaire)
  86. {
  87. print "<strong>$ligne_openup->commentaire</strong><br>";
  88. }
  89. echo '<table border=0><tr>';
  90. $sql_events="SELECT date_in, date_in_deplace, date_out, fiches_loc.id, prix_fact, fiches_loc_etats.nom_public as etat, fiches_loc.etat as etat_num, fiches_loc.type_fact, fiches_loc_types.nom as type_fact_texte FROM fiches_loc, fiches_loc_etats, fiches_loc_types WHERE
  91. etat != 7 AND
  92. fiches_loc_etats.id = fiches_loc.etat AND
  93. fiches_loc_types.id = fiches_loc.type_fact AND
  94. (
  95. ((date_out='$date_abs' OR date_in='$date_abs' OR date_in_deplace='$date_abs') AND etat !=1)
  96. OR
  97. (etat = 1 AND (date_out='$date_abs') AND date_out >= NOW())
  98. )
  99. ORDER BY date_out DESC, etat_num";
  100. $res_events=mysql_query($sql_events,$db);
  101. $total_loc_out=0;
  102. $total_loc_in=0;
  103. $total_presta_out=0;
  104. $total_presta_in=0;
  105. $total_devis_out=0;
  106. while($ligne_events=mysql_fetch_assoc($res_events))
  107. {
  108. echo '<td bgcolor="#FFFFFF" width="35">';
  109. if ($ligne_events[date_out]==substr($ligne_openup->ouverture,0,10))
  110. {
  111. if ($ligne_events[etat_num]>1 && $ligne_events[etat_num]<=3)
  112. {$image='sortie.gif';}
  113. elseif ($ligne_events[etat_num]==1)
  114. {$image='sortie_devis.gif';}
  115. else
  116. {$image='sortie_ok.gif';}
  117. }
  118. else
  119. {
  120. if ($ligne_events[etat_num]>=4.5)
  121. {$image='retour_ok.gif';}
  122. elseif ($ligne_events[etat_num]==1)
  123. {$image='retour_devis.gif';}
  124. else
  125. {$image='retour.gif';}
  126. }
  127. echo '<spans style="font-size: 9px"><a href="?nv_devis=1&continue='.$ligne_events[id].'"><img src="../images/ouvertures/'.$image.'" border="0" Title="'.$ligne_events[type_fact_texte].' '. $ligne_events[id].' '.$ligne_events[etat].' ('.$ligne_events[prix_fact].')"></a></span>';
  128. if ($ligne_events[date_out]==$date_abs && $ligne_events[etat_num]==1)
  129. {
  130. $total_devis_out=$total_devis_out+$ligne_events[prix_fact];
  131. //echo 'Lo';
  132. }
  133. if (($ligne_events[type_fact]==1 || $ligne_events[type_fact]==2) && $ligne_events[date_out]==$date_abs && $ligne_events[etat_num]<4 && $ligne_events[etat_num]>1)
  134. {
  135. $total_loc_out=$total_loc_out+$ligne_events[prix_fact];
  136. //echo 'Lo';
  137. }
  138. elseif (($ligne_events[type_fact]==1 || $ligne_events[type_fact]==2) && ($ligne_events[date_in]==$date_abs || $ligne_events[date_in_deplace]==$date_abs) && $ligne_events[etat_num]<=4)
  139. {
  140. $total_loc_in=$total_loc_in+$ligne_events[prix_fact];
  141. //echo 'Li';
  142. }
  143. elseif($ligne_events[type_fact]==3 && $ligne_events[date_out]==$date_abs && $ligne_events[etat_num]<4 && $ligne_events[etat_num]>1)
  144. {
  145. $total_presta_out=$total_presta_out+$ligne_events[prix_fact];
  146. //echo 'Po';
  147. }
  148. elseif($ligne_events[type_fact]==3 && ($ligne_events[date_in]==$date_abs || $ligne_events[date_in_deplace]==$date_abs) && $ligne_events[etat_num]<=4)
  149. {
  150. $total_presta_in=$total_presta_in+$ligne_events[prix_fact];
  151. //echo 'Pi';
  152. }
  153. echo '</td>';
  154. }
  155. $resume_out="";
  156. $warning="";
  157. if ($total_loc_in) $resume_out=$resume_out." Loc Ret ".$total_loc_in.' / ';
  158. if ($total_loc_out) $resume_out=$resume_out." Loc Sor ".$total_loc_out.' / ';
  159. if ($total_presta_in) $resume_out=$resume_out." Prest Sor ".$total_presta_in.' / ';
  160. if ($total_presta_out) $resume_out=$resume_out." Prest Ret ".$total_presta_out.' / ';
  161. if ($total_devis_out) {$resume_out=$resume_out.'<font color="#999999"> Devis Sort '.$total_devis_out.'</font>'.' / ';}
  162. if ($total_loc_in+$total_loc_out>800 AND $date_abs >= date ("Y-m-d")) $warning='<br><font color="#FF0000"><strong>ATTENTION!!! total loc in/out confirmées: '.($total_loc_in+$total_loc_out).'</strong></font>';
  163. echo '</tr></table>'.$resume_out.''.$warning;
  164. }
  165. $totaltemps=($totaltemps/3600);
  166. $totalpresence=$david_h_t+$justin_h_t+$mike_h_t+$nicolas_h_t+$matthieu_h_t+$yannick_h_t+$autre_h_t;
  167. print"<tr><td></td><td align=right>Total ouverture<br>Total présences</td>";
  168. print"<td>$totaltemps<br>$totalpresence</td>";
  169. print"<td>$hugo_h_t</td>";
  170. print"<td>$samuel_h_t</td>";
  171. print"<td>$david_h_t</td>";
  172. print"<td>$justin_h_t</td>";
  173. print"<td>$mike_h_t</td>";
  174. print"<td>$yann_h_t</td>";
  175. //print"<td>$jc_h_t</td>";
  176. print"<td>$nicolas_h_t</td>";
  177. print"<td>$matthieu_h_t</td>";
  178. //print"<td>$yannick_h_t</td>";
  179. print"<td>$autre_h_t</td>";
  180. print "</tr>";
  181. print "</table>";
  182. }
  183. ?>
  184. <strong>Mois en cours (<? print date("M y"); ?>)</strong>
  185. <br>
  186. <?
  187. // lien vers le popup d'édition de tout le mois
  188. echo mklink_simple("pop.form.ouverture.mois.php?mois=".date("Y-m")."",450, 600, 20, 20, "saisiemois")."<img src =\"../images/switch_info25.gif\" border=\"0\"></a>";
  189. ?>
  190. <?
  191. liste_openups("SELECT * FROM ouverture WHERE ouverture >= '".date("Y-m-01 00:00:00")."' AND ouverture < '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture']+1,1,date("Y")))."' ORDER BY ouverture",$db);
  192. ?>
  193. <br><br>
  194. <strong>Mois prochain(<? print date("M y",mktime(0,0,0,$_SESSION['mois_ouverture']+1,1,date("Y"))); ?>)</strong>
  195. <br>
  196. <?
  197. // lien vers le popup d'édition de tout le mois
  198. echo mklink_simple("pop.form.ouverture.mois.php?mois=".date("Y-m",mktime(0,0,0,date("m")+1,1,date("Y")))."",450, 600, 20, 20, "saisiemois")."<img src =\"../images/switch_info25.gif\" border=\"0\"></a>";
  199. ?>
  200. <?
  201. liste_openups("SELECT * FROM ouverture WHERE ouverture >= '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture']+1,1,date("Y")))."' AND ouverture < '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture']+2,1,date("Y")))."'ORDER BY ouverture",$db);
  202. ?>
  203. <br><br>
  204. <strong>Dans 2 mois (<? print date("M y",mktime(0,0,0,$_SESSION['mois_ouverture']+2,1,date("Y"))); ?>)</strong>
  205. <br>
  206. <?
  207. // lien vers le popup d'édition de tout le mois
  208. echo mklink_simple("pop.form.ouverture.mois.php?mois=".date("Y-m",mktime(0,0,0,date("m")+2,1,date("Y")))."",450, 600, 20, 20, "saisiemois")."<img src =\"../images/switch_info25.gif\" border=\"0\"></a>";
  209. ?>
  210. <?
  211. liste_openups("SELECT * FROM ouverture WHERE ouverture >= '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture']+2,1,date("Y")))."' AND ouverture < '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture']+3,1,date("Y")))."'ORDER BY ouverture",$db);
  212. ?>
  213. <br><br>
  214. <strong>Mois passé (<? print date("M y",mktime(0,0,0,$_SESSION['mois_ouverture']-1,1,date("Y"))); ?>)</strong>
  215. <?
  216. liste_openups("SELECT * FROM ouverture WHERE ouverture >= '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture']-1,1,date("Y")))."' AND ouverture < '".date("Y-m-d H:i:s",mktime(0,0,0,$_SESSION['mois_ouverture'],1,date("Y")))."'ORDER BY ouverture",$db);
  217. ?>
  218. <br><br>
  219. <strong>100 derničres ouvertures depuis le mois passé (<? print date("M y",mktime(0,0,0,$_SESSION['mois_ouverture']-1,1,date("Y"))); ?>)</strong> --> script ŕ décommenter dans le fichier inc.openup.php
  220. <? /*
  221. liste_openups("SELECT * FROM ouverture WHERE ouverture < '".date("Y-m-01 00:00:00")."'ORDER BY ouverture DESC LIMIT 0,100",$db); */
  222. ?>
  223. <?
  224. include_once("../ical/expo_ical.php");
  225. fopen("http://www.dj-r.ch/ical/presta_ical.php?silent=1",r);
  226. ?>
  227. <br />
  228. <a href="ical://www.dj-r.ch/ical/prestations.ics">ical://www.dj-r.ch/ical/prestations.ics</a>