久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='1gdEo'></small><noframes id='1gdEo'>

  • <legend id='1gdEo'><style id='1gdEo'><dir id='1gdEo'><q id='1gdEo'></q></dir></style></legend>

  • <tfoot id='1gdEo'></tfoot>

          <bdo id='1gdEo'></bdo><ul id='1gdEo'></ul>
        <i id='1gdEo'><tr id='1gdEo'><dt id='1gdEo'><q id='1gdEo'><span id='1gdEo'><b id='1gdEo'><form id='1gdEo'><ins id='1gdEo'></ins><ul id='1gdEo'></ul><sub id='1gdEo'></sub></form><legend id='1gdEo'></legend><bdo id='1gdEo'><pre id='1gdEo'><center id='1gdEo'></center></pre></bdo></b><th id='1gdEo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1gdEo'><tfoot id='1gdEo'></tfoot><dl id='1gdEo'><fieldset id='1gdEo'></fieldset></dl></div>

        休假申請月報

        Monthly report for leave apply(休假申請月報)
        <legend id='gplwy'><style id='gplwy'><dir id='gplwy'><q id='gplwy'></q></dir></style></legend>

                <tfoot id='gplwy'></tfoot>
                • <bdo id='gplwy'></bdo><ul id='gplwy'></ul>
                    <tbody id='gplwy'></tbody>
                • <i id='gplwy'><tr id='gplwy'><dt id='gplwy'><q id='gplwy'><span id='gplwy'><b id='gplwy'><form id='gplwy'><ins id='gplwy'></ins><ul id='gplwy'></ul><sub id='gplwy'></sub></form><legend id='gplwy'></legend><bdo id='gplwy'><pre id='gplwy'><center id='gplwy'></center></pre></bdo></b><th id='gplwy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gplwy'><tfoot id='gplwy'></tfoot><dl id='gplwy'><fieldset id='gplwy'></fieldset></dl></div>

                  <small id='gplwy'></small><noframes id='gplwy'>

                  本文介紹了休假申請月報的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有兩個表,一個是 tblemployee,其中包含員工姓名、員工 ID,另一個表 tblleaves 包含 empid、Leave_Date、fromDate、toDate、Description.

                  I have two tables one is tblemployee having employee name, employee id and another table tblleaves having empid,Leave_Date, fromDate, toDate, Description.

                  如果員工選擇一個休假日期,它會將日期值存儲到 Leave_Date,如果員工選擇多個日期,它會存儲從日期和截止日期的值.

                  If employee choose one date leave it stores the date value to Leave_Date and if employee choose multiple dates it store value of from date and to date.

                  在輸出頁面中,我想要一個員工姓名、休假天數(shù)和休假日期.休假日期包含 Leave_date、FromDate 和 ToDate 中的日期.

                  In the output page I want an employee name, Leave Days and Leave Dates. Leave Dates have dates from Leave_date, FromDate and ToDate.

                       <?php 
                  
                  
                          if(isset($_POST['apply'])){
                  
                          $ym=$_POST['month'];
                          list($Year, $Month) = explode("-", "$ym", 2);
                  
                          $sql = "SELECT 
                         tblemployees.FirstName,
                         tblemployees.LastName,
                         count(tblleaves.empid) as Leave_Days,
                         GROUP_CONCAT( tblleaves.Leave_Date SEPARATOR ', ' ) AS leave_dates
                      FROM
                         tblleaves
                         JOIN tblemployees
                            ON tblleaves.empid = tblemployees.id
                      WHERE YEAR(Leave_Date) = $Year
                         AND MONTH(Leave_Date) = $Month
                      GROUP BY tblemployees.EmpId";
                  
                          $query = $dbh -> prepare($sql);
                          $query->execute();
                          $results=$query->fetchAll(PDO::FETCH_OBJ);
                  
                          $cnt=1;
                          if($query->rowCount() > 0)
                          {
                          foreach($results as $result)
                          {               ?>  
                            <tr>
                              <td> <?php echo htmlentities($cnt);?></td>
                                <td><?php echo htmlentities($result->FirstName);?>&nbsp;<?php echo htmlentities($result->LastName);?></td>
                                 <td><?php echo htmlentities($result->Leave_Days);
                       ?></td>
                  <td><?php echo htmlentities($result->leave_dates);
                  
                      ?></td><?php $cnt++;}}}?>
                  </tr>
                  </tbody>
                  </table>
                  

                  我希望頁面的輸出是

                  employee name     Leave Days      Leave Dates 
                  KrishnanR            3              12-06-2019, 13-06-2019, 14-06-2019
                                                       (FromDate and ToDate)
                  PrakashR             1              12-06-2019
                                                       (Leave_Date)
                  
                  SelvaK               3        12-06-2019,13-06-2019&14-06-2019,|  14-06-2019
                                                        (FromDate and ToDate) |  (Leave_Date)
                  

                  推薦答案

                  考慮下面這個粗略的例子...

                  Consider the following crude example...

                  示例模式(借用并改編自 P.Salmon):

                  Sample schema (borrowed and adapted from P.Salmon):

                  DROP TABLE IF EXISTS employee_leave;
                  CREATE TABLE employee_leave
                  (leave_id SERIAL PRIMARY KEY
                  ,employee_id INT NOT NULL
                  ,leave_from DATE NOT NULL
                  ,leave_to DATE NOT NULL
                  );
                  
                  INSERT INTO employee_leave
                  (employee_id
                  ,leave_from
                  ,leave_to
                  ) VALUES
                  (11,'2019-05-30','2019-06-02'),
                  (11,'2019-06-05','2019-06-05'),
                  (11,'2019-06-06','2019-06-06'),
                  (11,'2019-06-30','2019-07-11'),
                  (12,'2019-05-30','2019-07-11'),
                  (13,'2019-05-11','2019-05-12');
                  

                  示例代碼:

                  <?php
                  
                  include('path/to/connection/stateme.nts');
                  
                  $query = "
                  SELECT employee_id
                       , leave_from
                       , leave_to
                       , datediff(leave_to,leave_from)+1 days
                    FROM employee_leave
                   ORDER
                      BY employee_id
                       , leave_from; -- ORDER BY is not strictly necessary, as the ordering can be done in presentation code.
                  ";
                  
                  $result = mysqli_query($conn,$query);
                  
                  $array = array();
                  
                  while($row = mysqli_fetch_assoc($result)){
                    $array[] = $row;
                  }
                  
                  $new_array = array();
                  
                  foreach($array as $k=>$v){
                    if($v['days']>1){
                      $days = ' days'; } else { $days = ' day'; }
                    $new_array[$v['employee_id']][] = $v['leave_from'].' - '.$v['leave_to'].' ('.$v['days'].$days.')';
                  }
                  
                  print_r($new_array);
                  ?>
                  

                  使用上面的架構(gòu),此代碼輸出...

                  Using the schema above, this code outputs...

                  Array
                  (
                      [11] => Array
                          (
                              [0] => 2019-05-30 - 2019-06-02 (4 days)
                              [1] => 2019-06-05 - 2019-06-05 (1 day)
                              [2] => 2019-06-06 - 2019-06-06 (1 day)
                              [3] => 2019-06-30 - 2019-07-11 (12 days)
                          )
                  
                      [12] => Array
                          (
                              [0] => 2019-05-30 - 2019-07-11 (43 days)
                          )
                  
                      [13] => Array
                          (
                              [0] => 2019-05-11 - 2019-05-12 (2 days)
                          )
                  
                  )
                  

                  請注意,此結(jié)果將所有天視為工作日

                  Note that this result considers all days as working days

                  這篇關(guān)于休假申請月報的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                        <tbody id='R9ck7'></tbody>
                    • <legend id='R9ck7'><style id='R9ck7'><dir id='R9ck7'><q id='R9ck7'></q></dir></style></legend>

                      <i id='R9ck7'><tr id='R9ck7'><dt id='R9ck7'><q id='R9ck7'><span id='R9ck7'><b id='R9ck7'><form id='R9ck7'><ins id='R9ck7'></ins><ul id='R9ck7'></ul><sub id='R9ck7'></sub></form><legend id='R9ck7'></legend><bdo id='R9ck7'><pre id='R9ck7'><center id='R9ck7'></center></pre></bdo></b><th id='R9ck7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='R9ck7'><tfoot id='R9ck7'></tfoot><dl id='R9ck7'><fieldset id='R9ck7'></fieldset></dl></div>

                      <small id='R9ck7'></small><noframes id='R9ck7'>

                        <tfoot id='R9ck7'></tfoot>
                            <bdo id='R9ck7'></bdo><ul id='R9ck7'></ul>
                          • 主站蜘蛛池模板: 人人玩人人干 | 亚洲国产欧美在线人成 | 色综合99| 亚洲欧美视频一区 | 国产成人免费网站 | 日韩看片 | 99久久久国产精品免费消防器 | 免费国产一区二区视频 | 99这里只有精品视频 | 福利视频网站 | 精品91 | 久久99久久98精品免观看软件 | 91精品久久久久久久99 | 精品成人av| 成人夜晚看av | 黄色免费av | 亚洲在线一区二区三区 | 国产成人免费网站 | 日韩欧美在线观看视频 | 在线欧美视频 | 久久大 | 中文字幕日韩一区 | 狠狠躁天天躁夜夜躁婷婷老牛影视 | 欧美激情一区 | 999久久久久久久久6666 | 久久精品久久久久久 | 国产欧美日韩一区二区三区在线 | 做a的各种视频 | 天天操天天插天天干 | 久久福利网站 | 国产一区二| 一区二区三区国产好 | 国产成人精品免费 | 黄色毛片在线观看 | 91在线视频国产 | 伊色综合久久之综合久久 | 日韩一区二区在线视频 | 高清久久久 | 日本激情一区二区 | 中文字幕高清一区 | 亚洲综合色自拍一区 |