Monthly report for leave apply

后端 未结 2 1243
一向
一向 2020-12-22 13:58

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

If employe

2条回答
  •  生来不讨喜
    2020-12-22 14:37

    Updated your code based on your requirement, didn't tested it. Let's give it a try.

     prepare($sql);
    $query->execute();
    $results=$query->fetchAll(PDO::FETCH_OBJ);
    
    $cnt=1;
    if($query->rowCount() > 0)
    {
    foreach($results as $result)
    {               
    $leavedates = explode(',', $result->Leave_Dates);
    $period = new DatePeriod(
         new DateTime($leavedates[0]),
         new DateInterval('P1D'),
         new DateTime($leavedates[1])
    );
    $listofleaves = [];
    foreach ($period as $key => $value) {
        $listofleaves[] = $value->format('Y-m-d');       
    }
    $listofleaves[] = $leavedates[2];
        ?>  
      
         
          FirstName);?> LastName);?>
           Leave_Days);
    ?>
    
    
    
    
       
    

提交回复
热议问题