Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ("include/check.php");
- include ('function.php');
- if($role != 'admin')
- {
- header('Location: add/customer');
- }
- $cby = $_GET['cby'];
- $crequirment = $_GET['crequirment'];
- $cdepartment = $_GET['cdepartment'];
- $period = $_GET['period'];
- $ccontact = $_GET['ccontact'];
- $cattend = $_GET['cattend'];
- if($period == "cw")
- {
- $d = strtotime("+1 week -1 day");
- $start_week = strtotime("last saturday midnight",$d);
- $end_week = strtotime("thursday",$d);
- $start = date("Y-m-d",$start_week);
- $end = date("Y-m-d",$end_week);
- }else if($period == "lw")
- {
- $d = strtotime("today");
- $start_week = strtotime("last saturday midnight",$d);
- $end_week = strtotime("last thursday",$d);
- $start = date("Y-m-d",$start_week);
- $end = date("Y-m-d",$end_week);
- }else if($period == "lm")
- {
- $last_month_first_day=strtotime('first day of last month');
- $date_value=$last_month_first_day;
- $start = date('Y-m-d',$date_value);
- $last_month_last_day=strtotime('last day of last month');
- $date_value2=$last_month_last_day;
- $end = date('Y-m-d',$date_value2);
- }else if($period == "pickdate")
- {
- $start = $_GET["from"];
- $end = $_GET["to"];
- }
- if(
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE cby = $cby");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none")
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE crequirment = $crequirment");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none")
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE ccontact = '$ccontact' ");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none")
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE cattend = '$cattend' ");
- }
- // two fields set
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- crequirment = $crequirment
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- crequirment = $crequirment
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- crequirment = $crequirment
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- crequirment = $crequirment
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cdepartment = $cdepartment
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cdepartment = $cdepartment
- AND
- ctime BETWEEN '$start' AND '$end' ");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cdepartment = $cdepartment
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- ctime BETWEEN '$start' AND '$end'
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- ctime BETWEEN '$start' AND '$end'
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- ccontact = '$ccontact'
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment == "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cdepartment = $cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cdepartment = $cdepartment
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cdepartment = $cdepartment
- AND
- cattend = '$cattend'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- ccontact = '$ccontact'
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cattend = '$cattend'
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby != "none"
- && $crequirment == "none"
- && $cdepartment == "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- cattend = '$cattend'
- AND
- ccontact = '$ccontact'");
- }
- --------------------------------------
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- ctime BETWEEN '$start' AND '$end'
- AND
- crequirment = $crequirment
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- ccontact = '$ccontact'
- AND
- crequirment = $crequirment
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cattend = '$cattend'
- AND
- crequirment = $crequirment
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- ccontact = '$ccontact'
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cattend = '$cattend'
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- cdepartment = $cdepartment");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cattend = '$cattend'
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- ccontact = '$ccontact'");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = crequirment
- AND
- cdepartment = cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = crequirment
- AND
- cdepartment = cdepartment
- AND
- ccontact = '$ccontact'
- ");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = crequirment
- AND
- cdepartment = cdepartment
- AND
- cattend = '$cattend'
- ");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- crequirment = crequirment
- AND
- cdepartment = cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- ccontact = '$ccontact'
- ");
- }
- else if (
- $cby == "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- crequirment = crequirment
- AND
- cdepartment = cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- cattend = '$cattend'
- ");
- }
- else if (
- $cby == "none"
- && $crequirment == "none"
- && $cdepartment != "none"
- && $period == "none"
- && $ccontact != "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cdepartment = cdepartment
- AND
- cattend = '$cattend'
- AND
- ccontact = '$ccontact'
- ");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact != "none"
- && $cattend == "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- cdepartment = cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- ccontact = '$ccontact'
- ");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact == "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- cdepartment = cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- cattend = '$cattend'
- ");
- }
- else if (
- $cby != "none"
- && $crequirment != "none"
- && $cdepartment != "none"
- && $period != "none"
- && $ccontact != "none"
- && $cattend != "none"
- )
- {
- $query = mysqli_query($db, "SELECT * FROM customer WHERE
- cby = $cby
- AND
- crequirment = $crequirment
- AND
- cdepartment = cdepartment
- AND
- ctime BETWEEN '$start' AND '$end'
- AND
- cattend = '$cattend'
- AND
- ccontact = '$ccontact'
- ");
- }
- else
- {
- echo "Nothing Found";
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled Document</title>
- </head>
- <body>
- <div align="right">
- <table width="250px" border="1" cellpadding="5" cellspacing="5" style="border-collapse: collapse; margin-bottom:20px;">
- <tbody>
- <tr>
- <td width="150px" bgcolor="#000000" style="color: #FFFFFF;"><strong>Total Records</strong></td>
- <td><?php echo mysqli_num_rows($query); ?></td>
- </tr>
- </tbody>
- </table>
- </div>
- <table width="100%" border="1" cellpadding="5" cellspacing="5" style="border-collapse: collapse;">
- <tbody>
- <tr>
- <td width="8%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Username</strong></td>
- <td width="13%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Customer Name</strong></td>
- <td width="10%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Number</strong></td>
- <td width="12%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Email</strong></td>
- <td width="15%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Department</strong></td>
- <td width="15%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Requirement</strong></td>
- <td width="11%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Contact Source</strong></td>
- <td width="5%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Ph. Attnd</strong></td>
- <td width="12%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Date</strong></td>
- </tr>
- <?php
- if (mysqli_num_rows($query) > 0) {
- // output data of each row
- $count = 1;
- while($row = mysqli_fetch_assoc($query)) {
- ?>
- <tr>
- <td><?php echo username($row['cby']); ?></td>
- <td><?php echo $row['cname'];?></td>
- <td><?php echo $row['cnumber']?></td>
- <td><?php echo $row['cemail'];?></td>
- <td><?php echo departmentname($row['cdepartment']);?></td>
- <td><?php echo requirements($row['crequirment']);?></td>
- <td><?php echo $row['ccontact'];?></td>
- <td><?php echo $row['cattend'];?></td>
- <td><?php echo $row['ctime'];?></td>
- </tr>
- <?php } }else
- {
- echo mysqli_error($db);
- }?>
- </tbody>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement