public function listAction() { $this->checkAuth(); $this->checkLevel2(); $request = $this->getRequest(); $draw = $request->getPost('draw', 1); $start = $request->getPost('start', 0); $length = $request->getPost('length', 10); $search = $request->getPost('search', ''); $columns = $request->getPost('columns', ''); $orders = $request->getPost('order', ''); $search = $search['value']; $total = $this->databaseService->getTotalPayAction(null); $tasks = $this->databaseService->getListPay($start, $length, $search, $columns, $orders, null); $data = new DataTablesObject(); $data->recordsTotal = $total; $data->recordsFiltered = $this->databaseService->getListPayFiltered($start, $length, $search, $columns, $orders, null); $data->draw = $draw; foreach ($tasks as $task) { $item = new PayListItem(); $item->DT_RowId = $task->id; $item->title = $task->title; $item->username = $task->username; $item->date_pay = Date::changeDateSQLtoVN($task->date_pay); if ($task->type == Config::PAY_CUSTUMER) { $item->type = "Thu"; } else { $item->type = "Chi"; } if ($task->is_task == Config::PAY_ACTION_IS_TASK) { $item->money = number_format($this->databaseService->getMoneyPayAction($task->id)); } else { $item->money = number_format($task->cost); } $item->user_create = $task->user_create; array_push($data->data, $item); } echo \Zend\Json\Json::encode($data, false); exit; }
public function getlistAction() { $this->checkAuth(); $request = $this->getRequest(); $draw = $request->getPost('draw', 1); $start = $request->getPost('start', 0); $length = $request->getPost('length', 10); $search = $request->getPost('search', ''); $search = $search['value']; $total = $this->databaseService->getTotalUsers(); $users = $this->databaseService->getListUsers($start, $length, $search); $data = new DataTablesObject(); $data->recordsTotal = $total; $data->recordsFiltered = $this->databaseService->getCountUsers($search); $data->draw = $draw; foreach ($users as $user) { $user->create_date = Date::changeDateSQLtoVN($user->create_date); array_push($data->data, new UserListItem($user->id, $user->username, $user->role_name, $user->block, $user->create_date)); } echo \Zend\Json\Json::encode($data, false); exit; }
public function payhistoryAction() { $this->checkLevel2(); $request = $this->getRequest(); if ($request->isPost()) { $taks_id = $request->getPost('task_id'); $type = $request->getPost('type'); $historys = $this->databaseService->getPayHistory($taks_id, $type); $result = array(); foreach ($historys as $history) { $item = new MoneyHistory(); $item->id = $history->id; $item->username = $history->username; $item->money = number_format($history->money); $item->date_pay = Date::changeDateSQLtoVN($history->date_pay); array_push($result, $item); } } return new JsonModel($result); }
public function taskdetailAction() { $this->checkAuth(); $id = $this->params()->fromRoute('id', 0); $task = $this->databaseService->getInfoTask($id); if ($task->count() == 0) { return $this->redirect()->toRoute('tasks'); } $task = $task->current(); $task->date_open = Date::changeDateSQLtoVN($task->date_open); $task->date_end = Date::changeDateSQLtoVN($task->date_end); $task->date_open_pr = Date::changeDateSQLtoVN($task->date_open_pr); $task->date_end_pr = Date::changeDateSQLtoVN($task->date_end_pr); $task->last_update = Date::changeDateSQLtoVN($task->last_update); $listprocess = $this->databaseService->getListProcess(); $users = $this->databaseService->getListByRole(Config::ROLE_AGENCY); $pay_custumer = $this->databaseService->getTotalPay($id, Config::PAY_CUSTUMER); $pay_custumer = number_format($pay_custumer); $pay_provider = $this->databaseService->getTotalPay($id, Config::PAY_PROVIDER); $provider_debt = number_format($task->cost_buy - $pay_provider); $pay_provider = number_format($pay_provider); $task->cost_buy = number_format($task->cost_buy); $provider_historys = $this->databaseService->getPayHistory($id, Config::PAY_PROVIDER); $this->getServiceLocator()->get('ViewHelperManager')->get('HeadTitle')->set($task->id . " - " . $task->custumer); return new ViewModel(array('task' => $task, 'listprocess' => $listprocess, 'pay_provider' => $pay_provider, 'provider_historys' => $provider_historys, 'provider_debt' => $provider_debt)); }
public function listCourseAjaxAction() { $this->checkLevel2(); $request = $this->getRequest(); $draw = $request->getPost('draw', 1); $start = $request->getPost('start', 0); $length = $request->getPost('length', 10); $search = $request->getPost('search', ''); $columns = $request->getPost('columns', ''); $orders = $request->getPost('order', ''); $id = $this->params()->fromRoute('id', 1); $search = $search['value']; $total = $this->databaseService->getTotalCourse($id); $tasks = $this->databaseService->getListCourse($start, $length, $search, $columns, $orders, $id); $data = new DataTablesObject(); $data->recordsTotal = $total; $data->recordsFiltered = $this->databaseService->getCountCourseFiltered($start, $length, $search, $columns, $orders, $id); $data->draw = $draw; foreach ($tasks as $task) { $item = new CourseListItem(); $item->DT_RowId = $task->id; $item->end = Date::changeDateSQLtoVN($task->end); $item->start = Date::changeDateSQLtoVN($task->start); $item->finish = Date::changeDateSQLtoVN($task->finish); $item->month = $task->month; $item->year = $task->year; array_push($data->data, $item); } echo \Zend\Json\Json::encode($data, false); exit; }
function notify_edit_pay($task, $user_action, $pay, $pay_new, $type) { $validator = new \Zend\Validator\EmailAddress(); $email = NULL; $getcontent = file_get_contents(MailHelper::EMAIL_TEMPLETE_PATH . 'add_pay.html'); $subject = sprintf(MailHelper::EMAIL_SUBJECT_FILTER_TEMPLATE, $task['id'], $task['certificate'], "Chỉnh Sửa Thanh Toán"); // $getcontent = str_replace('{|link|}', "Nhận hồ sơ", $getcontent); $getcontent = str_replace('{|task_info|}', $task['id'] . " - " . $task['custumer'] . " - " . $task['certificate'], $getcontent); $getcontent = str_replace('{|user|}', $user_action, $getcontent); if ($pay->money != $pay_new->money) { $getcontent = str_replace('{|money|}', "<span style='text-decoration:line-through;color: red'>" . number_format($pay->money) . "</span>" . "<span style='color: #3c8dbc;'>" . number_format($pay_new->money) . "</span>", $getcontent); } else { $getcontent = str_replace('{|money|}', number_format($pay->money), $getcontent); } if (Date::changeDateSQLtoVN($pay->date_pay) != Date::changeDateSQLtoVN($pay_new->date_pay)) { $getcontent = str_replace('{|date_pay|}', "<span style='text-decoration:line-through;color: red'>" . Date::changeDateSQLtoVN($pay->date_pay) . "</span>" . "<span style='color: #3c8dbc;'>" . Date::changeDateSQLtoVN($pay_new->date_pay) . "</span>", $getcontent); } else { $getcontent = str_replace('{|date_pay|}', Date::changeDateSQLtoVN($pay->date_pay), $getcontent); } if ($pay->note != $pay_new->note) { $getcontent = str_replace('{|note|}', "<span style='text-decoration:line-through;color: red'>" . $pay->note . "</span>" . "<span style='color: #3c8dbc;'>" . $pay_new->note . "</span>", $getcontent); } else { $getcontent = str_replace('{|note|}', $pay->note, $getcontent); } if ($pay->money_option != $pay_new->money_option) { $getcontent = str_replace('{|money_option|}', "<span style='text-decoration:line-through;color: red'>" . ($pay->money_option == 1 ? "Tiền Mặt" : "Chuyển Khoản") . "</span>" . "<span style='color: #3c8dbc;'>" . ($pay_new->money_option == 1 ? "Tiền Mặt" : "Chuyển Khoản") . "</span>", $getcontent); } else { $getcontent = str_replace('{|money_option|}', $pay->money_option == 1 ? "Tiền Mặt" : "Chuyển Khoản", $getcontent); } $getcontent_tmp = str_replace('{|name|}', $task['reporter_name'], $getcontent); $getcontent_tmp = str_replace('{|link|}', MailHelper::REAL_SERVER_SITE . "/manager-tasks/detail/" . $task['id'], $getcontent_tmp); if ($validator->isValid($task['reporter_email'])) { $this->SendMail(MailHelper::EMAIL_SYSTEM_NAME, $task['reporter_email'], $subject, $getcontent_tmp); } $getcontent_tmp = str_replace('{|name|}', $task['assign_name'], $getcontent); $getcontent_tmp = str_replace('{|link|}', MailHelper::REAL_SERVER_SITE . "/manager-tasks/detail/" . $task['id'], $getcontent_tmp); if ($validator->isValid($task['assign_email'])) { $this->SendMail(MailHelper::EMAIL_SYSTEM_NAME, $task['assign_email'], $subject, $getcontent_tmp); } if ($type == Config::PAY_CUSTUMER) { $getcontent_tmp = str_replace('{|name|}', $task['agency_name'], $getcontent); $getcontent_tmp = str_replace('{|link|}', MailHelper::REAL_SERVER_SITE . "/tasks/orderdetail/" . $task['id'], $getcontent_tmp); if ($validator->isValid($task['agency_email'])) { $this->SendMail(MailHelper::EMAIL_SYSTEM_NAME, $task['agency_email'], $subject, $getcontent_tmp); } } if ($type == Config::PAY_PROVIDER) { $getcontent_tmp = str_replace('{|name|}', $task['provider_name'], $getcontent); $getcontent_tmp = str_replace('{|link|}', MailHelper::REAL_SERVER_SITE . "/tasks/taskdetail/" . $task['id'], $getcontent_tmp); if ($validator->isValid($task['provider_email'])) { $this->SendMail(MailHelper::EMAIL_SYSTEM_NAME, $task['provider_email'], $subject, $getcontent_tmp); } } //echo $getcontent; return NULL; }