public function getCProductByID($id) { $product = Cproduct::find_by_id($id); return in_array("id", $product) ? $product->id : 0; // $myaccount = Accounts::find_by_phone($phone); }
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; } } }
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"); }
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"> «Back To Dashboard</span></a> <a href="<?php echo $uri->link("support/worksheetlist"); ?> "><span class="btn btn-danger right button" style="display:inline"> «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;
<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>"; }
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; } } }
/** * 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'>×</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'>×</a></div>"; return 2; // returns 2 on insert error } } }
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'>×</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); } }
} 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"> «Back To Dashboard</span></a> <a href="<?php echo $uri->link("support/schedulelist"); ?> "><span class="btn btn-danger right button" style="display:inline"> «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 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'>×</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'>×</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'>×</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'>×</a></div>"; return true; } }
<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++;