public function getData()
 {
     global $database;
     $depts = Department::find_all();
     $role = Roles::find_all();
     $country = Country::find_all();
     $vendors = Vendor::find_all();
     $countAcc = count(Cproduct::find_by_client($_SESSION["client_ident"]));
     $schedule = Cproduct::getNextSchedule($_SESSION["client_ident"]);
     $countTic = count(Ticket::find_by_client($_SESSION['client_ident']));
     $zone = Zone::find_by_sql("SELECT * FROM zone");
     $startups = array("departs" => $depts, "country" => $country, "zone" => $zone, "vendors" => $vendors, "role" => $role, "countProd" => $countAcc, "countTick" => $countTic, "Schel" => $schedule);
     return $startups;
 }
 public function getData()
 {
     global $database;
     $depts = Department::find_all();
     $role = Roles::find_all();
     $country = Country::find_all();
     $vendors = Vendor::find_all();
     $countAcc = count(Cproduct::find_by_client($_SESSION["client_ident"]));
     $schedule = Cproduct::getNextSchedule($_SESSION["client_ident"]);
     $OnSchedule = Schedule::find_by_sql("SELECT * FROM schedule WHERE client_id='" . $_SESSION['client_ident'] . "' AND maint_type !='Activation'  AND (status='Open' OR status='In Progress') ORDER BY id DESC LIMIT 10");
     $OnScheduleAct = Schedule::find_by_sql("SELECT * FROM schedule WHERE client_id='" . $_SESSION['client_ident'] . "' AND maint_type='Activation' AND  (status='Open' OR status='In Progress') ORDER BY id DESC LIMIT 10");
     $countTicketOpen = count(Ticket::find_by_sql("SELECT * FROM support_ticket WHERE client_id ='" . $_SESSION['client_ident'] . "' AND status ='Open'"));
     $countTicketClose = count(Ticket::find_by_sql("SELECT * FROM support_ticket WHERE client_id ='" . $_SESSION['client_ident'] . "' AND status ='Closed'"));
     $countTicketPending = count(Ticket::find_by_sql("SELECT * FROM support_ticket WHERE client_id ='" . $_SESSION['client_ident'] . "' AND (status ='Admin Reply' OR status='Customer Reply')"));
     $countTic = count(Ticket::find_by_client($_SESSION['client_ident']));
     $countuser = count(Clientuser::find_by_client($_SESSION['client_ident']));
     $zone = Zone::find_by_sql("SELECT * FROM zone");
     $startups = array("cschedule" => $OnSchedule, "departs" => $depts, "country" => $country, "zone" => $zone, "vendors" => $vendors, "role" => $role, "countProd" => $countAcc, "countTick" => $countTic, "Schel" => $schedule, "SchelAct" => $OnScheduleAct, "CountPending" => $countTicketPending, "CountOpent" => $countTicketOpen, "CountClosed" => $countTicketClose, "CountUsers" => $countuser);
     return $startups;
 }
 public function createSchedule()
 {
     if (!empty($_POST['taskdate']) && !empty($_POST['cid']) && !empty($_POST['empid'])) {
         $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['cid']));
         $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['empid']));
         $thisSchedule = new Schedule();
         $thisSchedule->emp_id = $_POST['empid'];
         $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname;
         $thisSchedule->client_id = "   ";
         $thisSchedule->prod_id = $_POST['cid'];
         $thisSchedule->prod_name = $thisclientproduct->prod_name;
         $thisSchedule->s_date = $_POST['taskdate'];
         //$thisSchedule->s_time_in       ;
         //$thisSchedule->s_time_out;
         $thisSchedule->issue = $_POST["tissue"];
         $thisSchedule->datecreated = date("Y-m-d H:i:s");
         $thisSchedule->maint_type = $_POST['mtype'];
         $msg = "Maintenance task alert for {$thisclientproduct->prod_name} at";
         $msg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch;
         $msg .= "\r\n issue:" . $_POST["tissue"];
         if ($thisSchedule->create()) {
             sendSms($thisemployee->emp_phone, $msg);
             return true;
         } else {
             return false;
         }
     }
 }
Exemple #4
0
    <div class="col-lg-6">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">Activation Requests</h3>
                <div class="box-tools pull-right">
                    <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                </div>
            </div><!-- /.box-headerclass="table no-margin" -->
            <div class="box-body">
                <div class="table-responsive">
                    <?php 
if (count($this->cscheduleActivation) > 0) {
    echo "<table class='pure-table'  width='100%'>\n                    \t\t\t<thead><tr>\n                    \t\t\t\t<th>Term. ID</th><th>Location</th><th>Schedule Date</th><th>Engineer</th><th></th><th></th>\n                    \t\t\t</tr>\n                    \t\t\t</thead>\n                    \t\t\t<tbody>";
    foreach ($this->cscheduleActivation as $sched) {
        $cproduct = Cproduct::find_by_id($sched->prod_id);
        // var_dump($cproduct);
        if ($cproduct) {
            echo "<tr><td>" . $cproduct->terminal_id . "</td><td>" . $cproduct->install_address . "</td><td>" . date_format(date_create($sched->s_date), "M d Y ") . "</td><td>{$sched->emp_name}</td>\n                            <td><span class='";
            if (strtolower($sched->status) == "open") {
                echo " label bg-red ";
            } elseif (strtolower($sched->status) == "closed") {
                echo " label bg-green ";
            } elseif (strtolower($sched->status) == "in progress") {
                echo " label bg-blue ";
            }
            echo "'>{$sched->status}</span></td><td><a href='" . $uri->link("supportticket/actdetails/{$sched->ticket_id}") . "'>Details</a></td></tr>";
        }
    }
    echo "</tbody>\n\t\t\t                     </table>";
}
    echo $uri->link("itdepartment/index");
} elseif ($session->rolename == "Customer Support Services" && in_array("support", $session->privil)) {
    echo $uri->link("support/index");
} elseif ($session->department == "Humman Resource" || $session == "Human Resource Deparment") {
} elseif (($session->rolename == "Super Admin" || $session->rolename == "General Manager") && $session->department == "Technical Department") {
    echo $uri->link("dashboard/index");
}
?>
"><span class="btn  right  btn-primary button" style="display:inline"> &laquo;Back To Dashboard</span></a>
    <a href="<?php 
echo $uri->link("support/worksheetlist");
?>
"><span class="btn btn-danger  right button" style="display:inline"> &laquo;Back To Listing</span></a>
</div>
<?php 
$cproduct = Cproduct::find_by_id($this->myworksheet->prod_id);
?>

<h4 class="headline3"><?php 
echo $cproduct->prod_name;
?>
</h4>
<div class="row">
<div class="large-4 columns">
    
    </div>
    <div class="large-8 columns">
        <div class="row">
            
            <div class='large-4 columns'><strong>Location</strong>:</div><div class='large-8 columns'><p><?php 
echo $cproduct->install_address;
 /**
  * section to update 
  * work sheet on support
  * or care resource
  * supply
  */
 public function updateWorkSheet($id)
 {
     if (isset($_POST['pgid'])) {
         if (isset($_POST["prod_id"])) {
             $cproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST["prod_id"]));
         }
         $WorkSheet = Worksheet::find_by_id((int) preg_replace('#[^0-9]#i', '', $id));
         $WorkSheet->prod_id = isset($_POST["prod_id"]) && !empty($_POST["prod_id"]) ? $_POST["prod_id"] : $WorkSheet->prod_id;
         $WorkSheet->prod_name = isset($_POST["prod_id"]) && !empty($_POST["prod_id"]) ? $cproduct->prod_name : $WorkSheet->prod_name;
         $WorkSheet->sheet_date = isset($_POST["w_date"]) && !empty($_POST["w_date"]) ? $_POST["w_date"] : $WorkSheet->sheet_date;
         $WorkSheet->time_in = isset($_POST["time_in"]) && !empty($_POST["time_in"]) ? $_POST["time_in"] : $WorkSheet->time_in;
         $WorkSheet->time_out = isset($_POST["time_out"]) && !empty($_POST["time_out"]) ? $_POST["time_out"] : $WorkSheet->time_out;
         $WorkSheet->contact_person = isset($_POST["contact_person"]) && !empty($_POST["contact_person"]) ? $_POST["contact_person"] : $WorkSheet->contact_person;
         $WorkSheet->cse_emp_id = isset($_POST["emp_id"]) && !empty($_POST["emp_id"]) ? $_POST["emp_id"] : $WorkSheet->emp_id;
         $WorkSheet->problem = isset($_POST["problem"]) && !empty($_POST["problem"]) ? $_POST["problem"] : $WorkSheet->problem;
         $WorkSheet->cause = isset($_POST["cause"]) && !empty($_POST["cause"]) ? $_POST["cause"] : $WorkSheet->cause;
         $WorkSheet->corrective_action = isset($_POST["corrective_action"]) && !empty($_POST["corrective_action"]) ? $_POST["corrective_action"] : $WorkSheet->corrective_action;
         $WorkSheet->part_changed = isset($_POST["part_changed"]) && !empty($_POST["part_changed"]) ? $_POST["part_changed"] : $WorkSheet->part_changed;
         $WorkSheet->cse_remark = isset($_POST["cse_remark"]) && !empty($_POST["cse_remark"]) ? $_POST["cse_remark"] : $WorkSheet->cse_remark;
         $WorkSheet->client_remark = isset($_POST["client_remark"]) && !empty($_POST["client_remark"]) ? $_POST["client_remark"] : $WorkSheet->client_remark;
         $WorkSheet->datemodified = date("Y-m-d H:i:s");
         $WorkSheet->fund = isset($_POST["fund"]) && !empty($_POST["fund"]) ? $_POST["fund"] : $WorkSheet->fund;
         $WorkSheet->part_supplied = isset($_POST["parts"]) && !empty($_POST["parts"]) ? $_POST["parts"] : $WorkSheet->part_supplied;
         global $session;
         if ($WorkSheet->update()) {
             $_SESSION["message"] = "<div data-alert class='alert-box success'>Record Saved <a href='#' class='close'>&times;</a></div>";
             return 1;
             //returns 1 on success
         } else {
             $_SESSION["message"] = "<div data-alert class='alert-box alert'>Unexpected Error! Record not Saved <a href='#' class='close'>&times;</a></div>";
             return 2;
             // returns 2 on insert error
         }
     }
 }
 public function create()
 {
     //if( !empty($_POST["issue"]) ){
     $newticket = new Ticket();
     $error = array();
     if (isset($_POST["cname"])) {
         if ($_POST['cname'] != "") {
             $newticket->contact_name = $_POST['cname'];
         } else {
             array_push($error, "Name");
         }
     } else {
         array_push($error, "Name");
     }
     if (isset($_POST["terminal_id"])) {
         if ($_POST['terminal_id'] != "") {
             $newticket->terminal_id = $_POST['terminal_id'];
         } else {
             array_push($error, "Terminal ID");
         }
     } else {
         array_push($error, "Terminal ID");
     }
     if (isset($_POST["atm_type"])) {
         if ($_POST['atm_type'] != "") {
             $newticket->atm_type = $_POST['atm_type'];
         } else {
             array_push($error, "ATM TYPE");
         }
     } else {
         array_push($error, "ATM TYPE");
     }
     if (isset($_POST["branch"])) {
         if ($_POST['branch'] != "") {
             $newticket->branch = $_POST['branch'];
         } else {
             array_push($error, "Branch");
         }
     } else {
         array_push($error, "Branch");
     }
     if (isset($_POST["email"])) {
         if ($_POST['email'] != "" && preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})\$/i", $_POST["email"])) {
             $newticket->contact_email = $_POST['email'];
         } else {
             array_push($error, "Email");
         }
     } else {
         array_push($error, "Email");
     }
     if (isset($_POST["phone"])) {
         if ($_POST['phone'] != "" && ctype_digit($_POST['phone'])) {
             $newticket->contact_phone = $_POST['phone'];
         } else {
             array_push($error, "Phone Number");
         }
     } else {
         array_push($error, "Phone Number");
     }
     if (isset($_POST["location"])) {
         $newticket->location = $_POST["location"];
     } else {
         array_push($error, "Location");
     }
     if (isset($_POST["plevel"])) {
         $newticket->priority = $_POST["plevel"];
     } else {
         array_push($error, "Priority");
     }
     if (isset($_POST["issue"])) {
         $newticket->issue = htmlspecialchars($_POST['issue']);
     } else {
         array_push($error, "Issue");
     }
     if (isset($_POST["subject"])) {
         $newticket->subject = htmlspecialchars($_POST['subject']);
     } else {
         $newticket->subject = htmlspecialchars($_POST['issue']);
     }
     $newticket->department = $_POST["dept"];
     $newticket->datecreated = $newticket->datemodified = date("Y-m-d H:i:s");
     $newticket->status = "Open";
     $newticket->client_id = $_SESSION["client_ident"];
     if (!empty($_FILES['fupload']['name']) && $_FILES['fupload']['error'] == 0) {
         //if file upload is set
         move_uploaded_file($_FILES['fupload']['tmp_name'], "public/uploads/" . basename($_FILES['fupload']['name']));
         $ext = pathinfo($_FILES['fupload']['name'], PATHINFO_EXTENSION);
         $new_name = uniqid() . "_" . time() . $ext;
         //new name for the image
         rename("public/uploads/" . basename($_FILES['fupload']['name']), "public/uploads/" . $new_name);
         $photo = $new_name;
         $newticket->file = $photo;
     }
     if (empty($error)) {
         if (Cproduct::find_by_terminal($_POST['terminal_id'])) {
             $cproduct = Cproduct::find_by_terminal($_POST['terminal_id']);
             $cproduct->client_id = $_SESSION["client_ident"];
             //$cproduct->client_name				=	$_POST["clientname"];
             $cproduct->prod_id = $_POST['terminal_id'];
             $cproduct->terminal_id = $_POST['terminal_id'];
             $cproduct->prod_name = $_POST['product_name'];
             $cproduct->branch = $_POST['branch'];
             $cproduct->atm_type = $_POST['atm_type'];
             $cproduct->install_status = 1;
             $cproduct->status = 1;
             $cproduct->client_id = $_SESSION['client_ident'];
             $cproduct->install_city = $_POST['city'];
             $cproduct->install_address = $_POST['location'];
             $cproduct->install_state = $_POST['state'];
             $cproduct->update();
             $newticket->prod_id = $cproduct->id;
         } else {
             $cproduct = new Cproduct();
             $cproduct->client_id = $_SESSION["client_ident"];
             //$cproduct->client_name				=	$_POST["clientname"];
             $cproduct->prod_id = $_POST['terminal_id'];
             $cproduct->terminal_id = $_POST['terminal_id'];
             $cproduct->prod_name = $_POST['product_name'];
             $cproduct->branch = $_POST['branch'];
             $cproduct->atm_type = $_POST['atm_type'];
             $cproduct->install_status = 1;
             $cproduct->status = 1;
             $cproduct->datecreated = date("Y-m-d H:i:s");
             $cproduct->install_city = $_POST['city'];
             $cproduct->install_address = $_POST['location'];
             $cproduct->install_state = $_POST['state'];
             $cproduct->create();
             $newticket->prod_id = $cproduct->id;
             $newticket->prod_id = $cproduct->id;
         }
         // }
         $newticket->terminal_id = $cproduct->terminal_id;
         if ($newticket->create()) {
             $ddticket = Ticket::find_by_id($newticket->id);
             $issue = array();
             $objIssue = Issue::find_all();
             $ddticket->subject = "";
             foreach ($objIssue as $objI) {
                 if (isset($_POST[$objI->issue_accronym])) {
                     $issueLog = new Issuelog();
                     $issueLog->ticket_id = $newticket->id;
                     $issueLog->issue_id = $objI->id;
                     $issueLog->issue_accronym = $objI->issue_accronym;
                     $issueLog->issue_name = $objI->issue_name;
                     $issueLog->prod_id = $newticket->prod_id;
                     $issueLog->datecreated = date("Y-m-d H:i:s");
                     $ddticket->subject .= $_POST[$objI->issue_accronym] . ", ";
                     $issueLog->create();
                 }
             }
             $ddticket->issue = $ddticket->subject . "\r\n" . $_POST['issue'];
             $ddticket->update();
             //					=		Ticket::find_by_id($newticket->id);
             $newReply = new Ticketreply();
             $newReply->sender_id = $newticket->client_id;
             $newReply->ticket_id = $newticket->id;
             $theCustomer = Client::find_by_id($_SESSION["client_ident"]);
             $newReply->sender_name = $theCustomer->name;
             $newReply->sender_type = "Client";
             $newReply->message = $ddticket->issue;
             $newReply->datecreated = date("Y-m-d H:i:s");
             $newReply->create();
             if (!empty($_POST['ccemail'])) {
                 $emails = explode(",", $_POST['ccemail']);
                 $emaillenght = count($emails);
                 for ($j = 0; $j < $emaillenght; $j++) {
                     if (preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})\$/i", trim($emails[$j]))) {
                         $ccemail = new Ccemail();
                         $ccemail->email = trim($emails[$j]);
                         $ccemail->ticket_id = $newticket->id;
                         $ccemail->create();
                     }
                 }
             }
             $this->sendMail($newReply->id);
             return 1;
             //returns 1 on success
         } else {
             return 2;
             // returns 2 on insert error
         }
     } else {
         $message = "Please check the following errors: ";
         $lenght = count($error);
         for ($i = 0; $i < $lenght; $i++) {
             $message = $message . $error[$i] . ", ";
         }
         echo "<div data-alert class='alert-box error'><a href='#' class='close'>&times;</a>{$message}</div>";
     }
 }
 public function updateSchedule()
 {
     if (!empty($_POST['sdate']) && !empty($_POST['cid'])) {
         $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['cid']));
         $postable = $_POST['sdate'];
         $thisclientproduct->last_maint_date = $postable;
         $date = new DateTime($postable);
         $interval = new DateInterval('P3M');
         $date->add($interval);
         $thisclientproduct->next_maint_date = $date->format("Y-m-d H:i:s");
         if ($thisclientproduct->update()) {
             return true;
         } else {
             return false;
         }
     }
 }
Exemple #9
0
          <section>
            <p class="title" data-section-title ><a href="#panel2">Maintenance History</a></p>
            <div class="content" data-section-content >
                <p><h4>Maintainannce Records </h4>
                <table  width='100%'>
<thead><tr>
	<th>S/N</th><th>Product/Machine</th><th>Issue</th><th>Status</th><th>Technician</th><th>Date Generated </th><th>Expenses</th><th></th><th></th><th></th>
</tr>
			</thead>
			<tbody>
                <?php 
if ($this->worksheet) {
    $x = 1;
    foreach ($this->worksheet as $worksheet) {
        $worksheetlisting .= "<tr>\n    \t<td>{$x}</td><td>";
        $cprod = Cproduct::find_by_id($worksheet->prod_id);
        $worksheetlisting .= $cprod->prod_name . " " . $cprod->install_address . " " . $cprod->install_city;
        //print_r($worksheet->cse_emp_id);
        $worksheetlisting .= "</td><td>{$worksheet->problem}</td><td>{$worksheet->status} </td><td>";
        $emp = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $worksheet->cse_emp_id));
        //print_r($cprod);
        $worksheetlisting .= $emp->emp_fname . " " . $emp->emp_lname;
        $worksheetlisting .= "</td><td>" . date_format(new DateTime($worksheet->sheet_date), "M d Y H:i:s") . "</td><td>" . Worksheet::getExpensesById($worksheet->id) . "</td>";
        /**
         * section to set grant and\
         * previledge
         */
        global $session;
        $worksheetlisting .= "";
        $worksheetlisting .= "</tr>";
        $x++;
} elseif ($session->rolename == "Customer Support Services" && in_array("support", $session->privil)) {
    echo $uri->link("support/index");
} elseif ($session->department == "Humman Resource" || $session == "Human Resource Deparment") {
} elseif (($session->rolename == "Super Admin" || $session->rolename == "General Manager") && $session->department == "Technical Department") {
    echo $uri->link("dashboard/index");
}
?>
"><span class="btn  right  btn-primary button" style="display:inline"> &laquo;Back To Dashboard</span></a>
    <a href="<?php 
echo $uri->link("support/schedulelist");
?>
"><span class="btn btn-danger  right button" style="display:inline"> &laquo;Back To Listing</span></a>
</div>

<?php 
$cproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $this->schedu->prod_id));
?>

<h4 class="headline3" style="display:"><?php 
echo $cproduct->prod_name;
?>
 <span style="display: inline; float: right;">FORM NO:<?php 
echo $this->schedu->id;
?>
</span></h4>
<div class="row">
<div class="large-4 columns">
    <img src="public/img/91_1380800432.jpg" width="235" height="204" />
    </div>
    <div class="large-8 columns">
        <div class="row">
 public function search()
 {
     $myservices = Cproduct::search(strip_tags($_POST['product']), strip_tags($_POST['serial_no']), strip_tags($_POST['location']), $_POST['date'], $_SESSION['client_ident']);
     $index_array = array("myservices" => $myservices, "mypagin" => "");
     return $index_array;
 }
 public function doAcceptTask($id = "")
 {
     @$this->loadModel("Itdepartment");
     global $session;
     $uri = new Url("");
     if ($this->model->acceptTask() === 1) {
         $_SESSION['message'] = "<div data-alert class='alert-box success'>Record Saved<a href='#' class='close'>&times;</a></div>";
         $mysched = "<div id='transalert'>";
         $mysched .= isset($_SESSION['message']) && !empty($_SESSION['message']) ? $_SESSION['message'] : "";
         $mysched .= "</div>";
         $psched = Schedule::find_by_sql("SELECT * FROM schedule WHERE status !='Closed' AND emp_id =" . $_SESSION['emp_ident'] . " ORDER BY id DESC");
         //print_r($psched);
         //$empworkdata['worksheet'];
         $x = 1;
         $mysched .= "<table  width='100%'>\n              <thead><tr>\n              \t<th>S/N</th><th>Machine</th><th>Issue</th><th>Location</th><th>Task Type</th><th>Task Date </th><th></th><th></th><th></th>\n              </tr>\n              </thead>\n              <tbody>";
         if ($psched) {
             foreach ($psched as $task) {
                 $mysched .= "<tr><td>{$x}</td><td>{$task->prod_name}</td><td>{$task->issue} </td>";
                 $machine = Cproduct::find_by_id($task->prod_id);
                 $mysched .= "<td>{$machine->install_address}  {$machine->install_city}</td><td>{$task->maint_type}</td><td>{$task->s_date}</td><td>";
                 if ($task->status == "Open") {
                     $mysched .= "<a scheddata='{$task->id}' class='acceptTask'   href='#'>Accept Task</a>";
                 }
                 if ($task->status == "In Progress") {
                     $mysched .= "<a href='" . $uri->link("itdepartment/worksheetupdateEmp/" . $task->id . "") . "'>Get Work Sheet</a>";
                 }
                 $mysched .= "\n                         \n                         <div id='myModal{$task->id}' class='reveal-modal'>\n  <h2>Accept Task </h2>\n  <p class='lead'>Click on the button  below to accept task! </p>\n  <form action='?url=itdepartment/doAcceptTask' method='post'>\n  <input type='hidden' value='{$task->id}' name='mtaskid' id='mtaskid' />\n  <p><a href='#' data-reveal-id='secondModal' class='secondary button acceptTast' >Accept</a></p>\n  </form>\n  <a class='close-reveal-modal'>&#215;</a>\n</div>\n\n\n                         \n                         \n                         </td><td></td><td></td></tr>";
                 $x++;
             }
         } else {
             $mysched .= "<tr><td colspan='8'>There is no task currently</td></tr>";
         }
         $mysched .= "</tbody></table>";
         echo $mysched;
     } elseif ($this->model->acceptTask() === 2) {
         echo "<div data-alert class='alert-box alert'>Record not saved<a href='#' class='close'>&times;</a></div>";
     }
 }
 public function delete($id)
 {
     global $session;
     $article = Cproduct::find_by_id($id);
     if ($article->delete()) {
         $_SESSION['message'] = "<div data-alert class='alert-box success'>" . $article->prod_name . " successfully deleted <a href='#' class='close'>&times;</a></div>";
         return true;
     }
 }
 public function create($id = "")
 {
     @$this->loadModel("Supportticket");
     if ($id != "") {
         $this->view->product = Cproduct::find_by_id($id);
     }
     $datum = $this->model->getData();
     $this->view->country = $datum['country'];
     $this->view->issues = $datum['issues'];
     $this->view->products = $datum['products'];
     $this->view->render("supportticket/create");
 }
 public function index()
 {
     @$this->loadModel("Dashboard");
     global $session;
     $dashData = array();
     $dashData = $this->model->getDashboardStat();
     $this->view->oticketcount = $dashData['otcount'];
     $this->view->aticketcount = $dashData['atcount'];
     $this->view->oschedule = $dashData['oschedule'];
     $this->view->oworksheet = $dashData['oworksheet'];
     $this->view->clients = $dashData['clients'];
     $this->view->pendings = $dashData['openPend'];
     $this->view->cproducts = $dashData['cproducts'];
     $lastmonth = (int) date("n") - 1;
     $curmonth = date("n");
     $this->view->monthreport = $this->model->getMonthlyReportFinance(" Month(datecreated) ='" . $curmonth . "' AND Year(datecreated)='" . date("Y") . "'");
     $this->view->lastmonthreport = $this->model->getLastMonthlyReportFinance(" Month(datecreated) ='" . $lastmonth . "' AND Year(datecreated)='" . date("Y") . "'");
     $this->view->thisquarter = $this->model->getThisQuaterReportFinance(" Quarter(datecreated) ='" . self::date_quarter() . "' AND Year(datecreated)='" . date("Y") . "'");
     global $session;
     if ($session->empright == "Super Admin") {
         $this->view->render("dashboard/index");
     } elseif ($session->empright == "Customer Support Services" || $session->empright == "Customer Support Service") {
         $this->view->render("support/index");
     } elseif ($session->empright == "Customer Support Engineer" || $session->empright == "Customer Service Engineer") {
         @$this->loadModel("Itdepartment");
         global $session;
         $datan = "";
         $uri = new Url("");
         //$empworkdata =  $this->model->getWorkSheetEmployee($id,"");
         $ptasks = Worksheet::find_by_sql("SELECT * FROM work_sheet_form WHERE cse_emp_id =" . $_SESSION['emp_ident']);
         // print_r($ptasks);
         //$empworkdata['worksheet'];
         $x = 1;
         $datan .= "<table  width='100%'>\n              <thead><tr>\n              \t<th>S/N</th><th>Prod ID</th><th>Status</th><th>Emp ID</th><th>Issue</th><th>Date Generated </th><th></th><th></th>\n              </tr>\n              </thead>\n              <tbody>";
         if ($ptasks) {
             foreach ($ptasks as $task) {
                 $datan .= "<tr><td>{$x}</td><td>{$task->prod_id}</td><td>{$task->status} </td><td>{$task->cse_emp_id}</td><td>{$task->problem}</td><td>{$task->sheet_date}</td><td><a href='" . $uri->link("itdepartment/worksheetdetail/" . $task->id . "") . "'>View Detail</a></td><td></td></tr>";
                 $x++;
             }
         } else {
             $datan .= "<tr><td colspan='8'></td></tr>";
         }
         $datan .= "</tbody></table>";
         $mysched = "<div id='transalert'>";
         $mysched .= isset($_SESSION['message']) && !empty($_SESSION['message']) ? $_SESSION['message'] : "";
         $mysched .= "</div>";
         $psched = Schedule::find_by_sql("SELECT * FROM schedule WHERE status !='Closed' AND emp_id =" . $_SESSION['emp_ident'] . " ORDER BY id DESC");
         //print_r($psched);
         //$empworkdata['worksheet'];
         $x = 1;
         $mysched .= "<table  width='100%'>\n              <thead><tr>\n              \t<th>S/N</th><th>Machine</th><th>Issue</th><th>Location</th><th>Task Type</th><th>Task Date </th><th></th><th></th><th></th>\n              </tr>\n              </thead>\n              <tbody>";
         if ($psched) {
             foreach ($psched as $task) {
                 $mysched .= "<tr><td>{$x}</td><td>{$task->prod_name}</td><td>{$task->issue} </td>";
                 $machine = Cproduct::find_by_id($task->prod_id);
                 $mysched .= "<td>{$machine->install_address}  {$machine->install_city}</td><td>{$task->maint_type}</td><td>{$task->s_date}</td><td>";
                 if ($task->status == "Open") {
                     $mysched .= "<a scheddata='{$task->id}' class='acceptTask'   href='#'>Accept Task</a>";
                 }
                 if ($task->status == "In Progress") {
                     $mysched .= "<a href='" . $uri->link("itdepartment/worksheetupdateEmp/" . $task->id . "") . "'>Get Work Sheet</a>";
                 }
                 $mysched .= "\n                         \n                         <div id='myModal{$task->id}' class='reveal-modal'>\n  <h2>Accept Task </h2>\n  <p class='lead'>Click on the button  below to accept task! </p>\n  <form action='?url=itdepartment/doAcceptTask' method='post'>\n  <input type='hidden' value='{$task->id}' name='mtaskid' id='mtaskid' />\n  <p><a href='#' data-reveal-id='secondModal' class='secondary button acceptTast' >Accept</a></p>\n  </form>\n  <a class='close-reveal-modal'>&#215;</a>\n</div>\n\n\n                         \n                         \n                         </td><td></td><td></td></tr>";
                 $x++;
             }
         } else {
             $mysched .= "<tr><td colspan='8'>There is no task currently</td></tr>";
         }
         $mysched .= "</tbody></table>";
         $this->view->oldtask = $datan;
         $this->view->schedule = $mysched;
         $this->view->mee = $this->model->getEmployee($_SESSION['emp_ident']);
         $this->view->render("itdepartment/staffaccount");
     } else {
         $this->view->render("login/index", true);
     }
 }
 public function getCProductByID($id)
 {
     $product = Cproduct::find_by_id($id);
     return in_array("id", $product) ? $product->id : 0;
     // $myaccount = Accounts::find_by_phone($phone);
 }
Exemple #17
0
                    <table id="dt_basic" class=" pure-table table table-striped table-bordered" width="100%">

                    <thead>

                    <tr>
                        <th >Date</th><th >ticketID</th><th>Terminal</th><th>Location</th><th>Client </th><th>Technician</th><th>Issue(s)</th><th>Status </th><th>Date Modified </th><th></th><th></th>
                    </tr>
                    </thead>

                    <tbody>
                    <?php 
if ($this->pendings) {
    foreach ($this->pendings as $pending) {
        echo "<tr>\n                    <td>" . date_format(date_create($pending->datecreated), "M d Y") . "</td><td>{$pending->id}</td><td>{$pending->terminal_id}</td>";
        $prod = Cproduct::find_by_terminal_id($pending->terminal_id);
        echo "<td>";
        if (empty($pending->location)) {
            echo $prod->install_address . ", " . $prod->install_city;
        } else {
            echo $pending->location;
        }
        echo " </td>";
        echo "<td>";
        //$pending->client_name
        $myclient = Client::find_by_id($pending->client_id);
        if ($myclient) {
            echo $myclient->name;
        }
        echo "</td><td>";
        $schedule = Schedule::find_by_ticket_id($pending->id);