⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 get_csv.php

📁 网页打卡钟系统,源码提供给大家学习一下啦!希望给大家带来帮助
💻 PHP
📖 第 1 页 / 共 4 页
字号:
                                  }                              } else {                                  if (!empty($tmp_display_ip)) {                                      if ($z == $punch_cnt) {                                            $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n";                                      } else {                                      $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n";                                      }                                  } else {                                      if ($z == $punch_cnt) {                                            $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n";                                      } else {                                          $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n";                                      }                                  }                              }                              $tmp_z++;                          }                      } else {                          if (strtolower($user_or_display) == "display") {                              $string .= "$employees_displayname[$x], $info_date[$y], $hours, ,\n";                          } else {                              $string .= "$employees_empfullname[$x], $info_date[$y], $hours, ,\n";                          }                      }                  }                  $secs = 0;                  $punch_cnt = 0;              }          } else {              $secs = 0;              $status = "in";              $in_time = $info_timestamp[$y];              $previous_days_end_time = $info_end_time[$y] + 1;              if ($y == $info_cnt - 1) {                  if (($info_timestamp[$y] <= $rpt_stamp) && ($rpt_stamp < ($to_timestamp + $tzo)) && ($info_date[$y] == $rpt_date)) {                      $secs = $secs + ($rpt_stamp - $info_timestamp[$y]);                      $currently_punched_in = '1';                  } elseif (($info_timestamp[$y] <= $rpt_stamp) && ($info_date[$y] == $rpt_date)) {                      $secs = $secs + (($to_timestamp + $tzo) - $info_timestamp[$y]);                      $currently_punched_in = '1';                  } else {                      $secs = $secs + (($info_end_time[$y] + 1) - $info_timestamp[$y]);                  }              }              if ($y == $info_cnt - 1) {                  $hours = secsToHours($secs, $tmp_round_time);                  $total_hours = $total_hours + $hours;                  $hours = number_format($hours, 2);                  if ($y == $info_cnt - 1) {                      $hours = secsToHours($secs, $tmp_round_time);                      $total_hours = $total_hours + $hours;                      if ($tmp_show_details == "1") {                          for ($z=$tmp_z;$z<=$punch_cnt;$z++) {                              $time_formatted = date($timefmt, $info_timestamp[$z]);                              if (strtolower($user_or_display) == "display") {                                  if (!empty($tmp_display_ip)) {                                      if ($z == $punch_cnt) {                                            $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n";                                      } else {                                            $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n";                                      }                                  } else {                                      if ($z == $punch_cnt) {                                            $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n";                                      } else {                                          $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n";                                      }                                  }                              } else {                                  if (!empty($tmp_display_ip)) {                                      if ($z == $punch_cnt) {                                            $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n";                                      } else {                                      $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n";                                      }                                  } else {                                      if ($z == $punch_cnt) {                                            $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n";                                      } else {                                          $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n";                                      }                                  }                              }                              $tmp_z++;                          }                      } else {                          if (strtolower($user_or_display) == "display") {                              $string .= "$employees_displayname[$x], $info_date[$y], $hours, ,\n";                          } else {                              $string .= "$employees_empfullname[$x], $info_date[$y], $hours, ,\n";                          }                      }                  }                  $secs = 0;                  $punch_cnt = 0;              }          }      } // ends if (isset($tmp_info_date))    } // ends for $y    unset($in_time);    unset($out_time);    unset($previous_days_end_time);    unset($status);    unset($tmp_info_date);    unset($date_formatted);    $my_total_hours = number_format($total_hours, 2);    if ($tmp_show_details == "1") {        if (strtolower($user_or_display) == "display") {            if (!empty($tmp_display_ip)) {                $string .= "$employees_displayname[$x], , , , , , , $my_total_hours,\n";            } else {                $string .= "$employees_displayname[$x], , , , , , $my_total_hours,\n";            }        } else {            if (!empty($tmp_display_ip)) {                $string .= "$employees_empfullname[$x], , , , , , , $my_total_hours, \n";            } else {                $string .= "$employees_empfullname[$x], , , , , , $my_total_hours\n";            }        }    } else {        if (strtolower($user_or_display) == "display") {            $string .= "$employees_displayname[$x], , , $my_total_hours,\n";        } else {            $string .= "$employees_empfullname[$x], , , $my_total_hours, \n";        }    }    //// reset everything before running the loop on the next user ////    $tmp_z = 0;    $row_count = 0;    $total_hours = 0;    $my_total_hours = 0;    $info_cnt = 0;    $punch_cnt = 0;    $secs = 0;    unset($info_fullname);    unset($info_inout);    unset($info_timestamp);    unset($info_notes);    unset($info_ipaddress);    unset($punchlist_in_or_out);    unset($punchlist_punchitems);    unset($punchlist_color);    unset($info_date);    unset($info_start_time);    unset($info_end_time);    unset($tmp_info_date);    unset($hours);    unset($date_formatted);    unset($currently_punched_in);    } // end if} // end for $xheader("Content-type: application/x-msdownload");header("Content-Disposition: attachment; filename=total_hours.csv");header("Pragma: no-cache");header("Expires: 0");echo "$headings$string";} elseif (($_GET['rpt'] == 'auditlog') && (isset($_GET['csv'])) && (isset($_GET['from'])) && (isset($_GET['to'])) && (isset($_GET['tzo']))) {$tmp_csv = $_GET['csv'];$from_timestamp = $_GET['from'];$to_timestamp = $_GET['to'];$tzo = $_GET['tzo'];$row_count = 0;$page_count = 0;$cnt = 0;$modified_when = array();$modified_from = array();$modified_to = array();$modified_by_ip = array();$modified_by_user = array();$modified_why = array();$row_color = $color2; // Initial row color$query = "select * from ".$db_prefix."audit where modified_when >= '".$from_timestamp."' and modified_when <= '".$to_timestamp."'          order by modified_when asc";$result = mysql_query($query);while ($row=mysql_fetch_array($result)) {  $modified_when[] = "".$row["modified_when"]."";  $modified_from[] = "".$row["modified_from"]."";  $modified_to[] = "".$row["modified_to"]."";  $modified_by_ip[] = "".$row["modified_by_ip"]."";  $modified_by_user[] = stripslashes("".$row["modified_by_user"]."");  $modified_why[] = "".$row["modified_why"]."";  $cnt++;}$headings = "Action Taken, Modified When, Modified From, Modified To, Modified By, Modified By IP,\n";$string = "";for ($x=0;$x<$cnt;$x++) {    if (!empty($modified_when[$x])) {        $modified_when_time = date($timefmt, $modified_when[$x]);        $modified_when_date = date($datefmt, $modified_when[$x]);    } else {        exit;    }    if (!empty($modified_from[$x])) {        $modified_from_time = date($timefmt, $modified_from[$x]);        $modified_from_date = date($datefmt, $modified_from[$x]);    } else {        $modified_from_time = "".$row["modified_from"]."";        $modified_from_date = "".$row["modified_from"]."";    }    if (!empty($modified_to[$x])) {        $modified_to_time = date($timefmt, $modified_to[$x]);        $modified_to_date = date($datefmt, $modified_to[$x]);    } else {        $modified_to_time = "".$row["modified_to"]."";        $modified_to_date = "".$row["modified_to"]."";    }    if ((!empty($modified_from[$x])) && (empty($modified_to[$x]))) {        $modified_status = "Deleted";        $modified_color = "#FF0000";    } elseif ((!empty($modified_from[$x])) && (!empty($modified_to[$x]))) {        $modified_status = "Edited";        $modified_color = "#FF9900";    } elseif ((empty($modified_from[$x])) && (!empty($modified_to[$x]))) {        $modified_status = "Added";        $modified_color = "#009900";    }    $string .= "$modified_status, $modified_when_date $modified_when_time, $modified_from_date $modified_from_time, $modified_to_date $modified_to_time, $modified_by_user[$x], $modified_by_ip[$x],\n";}header("Content-type: application/x-msdownload");header("Content-Disposition: attachment; filename=total_hours.csv");header("Pragma: no-cache");header("Expires: 0");echo "$headings$string";}exit;?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -