function ajouter_emploi($emp, $fil, $conn) { $str = $emp; $time = array("1" => 8, "2" => 10, "3" => 13, "4" => 15); $php = json_decode($str); $json = json_encode($php, JSON_PRETTY_PRINT); $dsemestre = "2015-09-14"; $dsemestre = new DateTime($dsemestre); $id_f = $fil; $dsemestre = $dsemestre->format("Y-m-d h:i:s"); $sql_s = 'INSERT INTO `disponibilite` (`id_s`, `id_ens`, `id_mat`, `sdebut`, `sfin`, `hour`, `day`,`id_f`) VALUES '; $sql = "INSERT INTO emplois (id_m,id_f,id_e,date_debut,date_fin,id_s) VALUES "; foreach ($php as $key => $day) { $weekdate = add_date($dsemestre, $key - 1); //echo $weekdate .' week date <br>'; foreach ($day as $keey => $class) { // $keey => séance key foreach ($class as $clas) { $daydate = add_date($weekdate, ($clas->sdebut - 1) * 7); //echo $daydate .' day date <br>'; $sdate = $daydate; $sql_s .= '(' . $clas->salle . ',' . $clas->enseignant . ',' . $clas->matiere . ',' . $clas->sdebut . ',' . $clas->sfin . ',' . $keey . ',' . $key . ',' . $fil . '),'; for ($i = 0; $i < $clas->sfin - $clas->sdebut + 1; $i++) { //echo $sdate .' Semaine '. ($class[0]->sdebut+$i) .' <br>'; $sql .= '(' . $clas->matiere . ',' . $id_f . ',' . $clas->enseignant . ',"' . add_hours($sdate, $time[$keey]) . '","' . add_hours($sdate, $time[$keey] + 2) . '",' . $clas->salle . '),'; $sdate = add_date($sdate, 7); } } } } $sql = rtrim($sql, ','); $sql_s = rtrim($sql_s, ','); $request = $conn->query($sql); $request_s = $conn->query($sql_s); echo "1"; }
$total_free = '0:00'; $total_paid = '0:00'; $total_meal = '0:00'; while ($row2 = mysql_fetch_assoc($result2)) { if (strtoupper($row2['ratestr']) == 'SICK' || strtoupper($row2['ratestr']) == 'ANNUAL' || strtoupper($row2['ratestr']) == 'BEREAVE') { $total_free = add_hours($total_free, '0:00'); $total_paid = add_hours($total_paid, '0:00'); $total_meal = add_hours($total_meal, '0:00'); $atnd_data[$attend_ct] = $row2['ratestr']; } else { if (0 == (double) $row2['total']) { $total_free = add_hours($total_free, $row2['hours']); } else { $total_paid = add_hours($total_paid, $row2['hours']); } $total_meal = add_hours($total_meal, empty($row2['breaks']) ? '0:00' : $row2['breaks']); $atnd_data[$attend_ct] = $row2['start'] . ' - ' . $row2['finish']; } if ($row2['note'] == "AL") { $bgc = "31B404"; } if ($row2['note'] == "D") { $bgc = "CCCCCC"; } if ($row2['note'] == "I") { $bgc = "99CCFF"; } if ($row2['note'] == "M") { $bgc = "9F0"; } if ($row2['note'] == "S") {
<?php ob_start(); // Output buffering - allows header rewrites to happen at anytime before flushing the buffer session_start(); require_once "incdir.php.inc"; require_once "config.php"; include_php_dir("includes"); mysql_init(); document_header(); echo include_javascript_dir("js", $debug); echo include_stylesheet_dir("stylesheets", $debug); check_validated(); //Pre-page logic goes here: if (isset($_POST['addhours-submit'])) { add_hours($_POST['user_id'], $_SESSION['user_id'], $_POST['amount'], $_POST['pp']); } if (isset($_GET['pp'])) { $pp = $_GET['pp']; } else { $pp = current_payperiod(); } open_page("Add Hours"); draw_page(); close_page(); ob_end_flush(); // Flush the buffer out to client document_footer(); mysql_end(); function draw_page() {
if (0==(float)$row5['total']) { $total_othr = add_hours($total_othr,$row5['hours']); } else { $total_paid = add_hours($total_paid,$row5['hours']); } } } $taxTime = strtotime('+1 day',$taxEndTime); } while ($taxTime <= $endTime); $all_tax += $taxTotal; $all_sick = add_hours($all_sick,$total_sick); $all_aliv = add_hours($all_aliv,$total_aliv); $all_othr = add_hours($all_othr,$total_othr); $all_paid = add_hours($all_paid,$total_paid); ?> <td style="text-align:right;">$ <?=number_format($taxTotal,2,'.','');?></td> <?php $netTotal = $total - $taxTotal; $all_net += $netTotal; ?> <td style="text-align:right;"><b style="color:green;">$ <?=number_format($netTotal,2,'.','');?></b></td> <?php $super = (float)$row2['supr']; $all_sup += $super; ?> <td style="text-align:right;">$ <?=number_format($super,2,'.','');?></td> <td style="text-align:center;"><?=$total_paid;?></td> <td style="text-align:center;"><?=$total_aliv;?></td> <td style="text-align:center;"><?=$total_sick;?></td>