public function actionUpdate() { $pictures = array(); $lid = Yii::app()->request->getParam('lid'); Until::isUpdateValid(array($lid), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 $criteria = new CDbCriteria(); $criteria->with = 'productImg'; $criteria->addCondition('t.lid=:lid and t.dpid=:dpid and t.delete_flag=0 '); $criteria->order = ' t.lid desc '; $criteria->params[':lid'] = $lid; $criteria->params[':dpid'] = $this->companyId; $model = Product::model()->find($criteria); if (Yii::app()->request->isPostRequest) { $postData = Yii::app()->request->getPost('productImg'); if (ProductPicture::saveImg($this->companyId, $lid, $postData)) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('productImg/index', 'companyId' => $this->companyId)); } } if (!empty($model->productImg)) { foreach ($model->productImg as $pic) { array_push($pictures, $pic->pic_path); } } $this->render('updateProductImg', array('model' => $model, 'pictures' => $pictures)); }
function exeUpdate() { if (isset($_POST['intro_submit'])) { $id = Request::post('id'); $content = Request::post('content'); $this->model->updateIntro($id, $content); } Until::redirectTo('intro'); }
public function actionDelete() { $ids = Yii::app()->request->getPost('companyIds'); Until::isUpdateValid(array(0), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 if (!empty($ids)) { Yii::app()->db->createCommand('update nb_company set delete_flag=1,update_at="' . date('Y-m-d H:i:s', time()) . '" where dpid in (' . implode(',', $ids) . ')')->execute(); } $this->redirect(array('company/index', 'companyId' => $this->companyId)); }
function exeDelete() { if ((int) Request::get('id') > 0) { $this->model->remove((int) Request::get('id')); } if (Request::post('check') != null) { $delete = Request::post('check'); foreach ($delete as $value) { $this->model->remove((int) $value); } } Until::redirectTo('feedback'); }
public function actionDelete() { //$ids = $_POST['type_id'] ; $ids = Yii::app()->request->getPost('type_id'); Until::isUpdateValid($ids, $companyId, $this); //0,表示企业任何时候都在云端更新。 //var_dump(implode(',' , $ids),$this->companyId);exit; //$sql='update nb_site_type set delete_flag=1 where lid in ('.implode(',' , $ids).') and dpid = :companyId'; //$command=Yii::app()->db->createCommand($sql); //$command->bindValue(":ids" , implode(',' , $ids)); //$command->bindValue(":dpid" , $this->companyId); //var_dump($command);exit; if (!empty($ids)) { Yii::app()->db->createCommand('update nb_site_persons set delete_flag=1 where lid in (' . implode(',', $ids) . ') and dpid = :companyId')->execute(array(':companyId' => $this->companyId)); } $this->redirect(array('sitePersons/index', 'companyId' => $this->companyId)); }
public function actionUpdate() { $id = Yii::app()->request->getParam('id'); $model = Department::model()->findByPk($id); if (Yii::app()->request->isPostRequest) { Until::isUpdateValid(array($id), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 $model->attributes = Yii::app()->request->getPost('Department'); $model->update_at = date('Y-m-d H:i:s', time()); if ($model->save()) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('department/index', 'companyId' => $this->companyId)); } } $printers = $this->getPrinterList(); $this->render('update', array('model' => $model, 'printers' => $printers)); }
public function beforeAction($action) { parent::beforeAction($action); $controllerId = Yii::app()->controller->getId(); $action = Yii::app()->controller->getAction()->getId(); //$companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId',"0000000000")); if (Yii::app()->user->isGuest) { if ($controllerId != 'login' && $action != 'upload') { $this->redirect(Yii::app()->params['admin_return_url']); } } elseif (Yii::app()->user->role > User::WAITER && $controllerId != 'login') { $this->redirect(Yii::app()->params['admin_return_url']); } else { $this->companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId', "0000000000")); } Until::isOperateValid($controllerId, $action, $this->companyId, $this); return true; }
function exeDetail() { $id = (int) Request::get('service'); $data = array(); $data['service'] = $this->model->selectOne($id); if (empty($data['service'])) { Until::redirectTo('services'); } if ($id > 0) { Document::setTitle($data['service']['feature']); $art = $this->loadArticle(); $data['article'] = $art->selectAll(0, 20, '`service_id`="' . $data['service']['id'] . '"'); $data['detail'] = BASE_URL . '/article/Article?article='; $this->view->render('detail', $data); } else { Until::redirectTo('services'); } }
public function actionDelete() { $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId')); $ids = Yii::app()->request->getPost('ids'); Until::isUpdateValid($ids, $companyId, $this); //0,表示企业任何时候都在云端更新。 if (!empty($ids)) { foreach ($ids as $id) { $model = Site::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId)); if ($model) { $model->saveAttributes(array('delete_flag' => 1, 'update_at' => date('Y-m-d H:i:s', time()))); } } $this->redirect(array('site/index', 'companyId' => $companyId)); } else { Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目')); $this->redirect(array('site/index', 'companyId' => $companyId)); } }
public function actionDelete() { $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId')); $ids = Yii::app()->request->getPost('ids'); Until::isUpdateValid($ids, $this->companyId, $this); if (!empty($ids)) { foreach ($ids as $id) { $model = CompanyWifi::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId)); if ($model) { $model->update_at = date('Y-m-d H:i:s'); $model->delete(); } } $this->redirect(array('companyWifi/index', 'companyId' => $companyId)); } else { Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目')); $this->redirect(array('companyWifi/index', 'companyId' => $companyId)); } }
public function actionDelete() { $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId')); $ids = Yii::app()->request->getPost('ids'); Until::isUpdateValid($ids, $companyId, $this); //0,表示企业任何时候都在云端更新。 if (!empty($ids)) { foreach ($ids as $id) { $model = PaymentMethod::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId)); if ($model) { $model->delete(); } } $this->redirect(array('payMethod/index', 'companyId' => $companyId)); } else { Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目')); $this->redirect(array('payMethod/index', 'companyId' => $companyId)); } }
public function checkLogin() { if (Session::get('user') == null) { if (Router::$controller != 'login') { Until::redirectTo('login'); } else { $this->index(); } } else { if (Router::$controller == 'login' && Router::$action == 'logout') { $this->index(); return true; } if (Session::get('user')['user_type'] == 7) { $this->index(); return true; } else { $this->checkRole(Session::get('user')['id']); } } }
public function actionUpdate() { $printerway = array(); $lid = Yii::app()->request->getParam('lid'); $model = Product::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId)); Until::isUpdateValid(array($lid), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 if (Yii::app()->request->isPostRequest) { $postData = Yii::app()->request->getPost('ProductPrinterway'); //$model->printer_way_id = $postData; if (ProductPrinterway::saveProductPrinterway($this->companyId, $lid, $postData)) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('productPrinter/index', 'companyId' => $this->companyId)); } } $printerWays = PrinterWay::getPrinterWay($this->companyId); $productPrinterway = ProductPrinterway::getProductPrinterWay($lid, $this->companyId); foreach ($productPrinterway as $ppw) { array_push($printerway, $ppw['printer_way_id']); } $this->render('updateProductPrinter', array('model' => $model, 'printerWays' => $printerWays, 'printerway' => $printerway)); }
function exeInsert() { if (Request::post('submit') != null) { $fullname = Request::post('fullname'); $email = Request::post('email'); $content = Request::post('content'); $captcha = Request::post('captcha'); $error = ''; if ($fullname == null) { $error .= 'Bạn chưa nhập họ tên. <br />'; } if ($email == null) { $error .= 'Bạn chưa nhập email.<br />'; } elseif (Validate::email($email) != true) { $error .= 'Email của bạn không đúng.<br />'; } if (strlen($content) < 50) { $error .= 'Nội dung phải lớn hơn 50 ký tự.<br />'; } if ($captcha != Session::get('captcha')) { $error .= 'Bạn nhập mã bảo vệ không đúng. <br />'; } if ($error == '') { $this->model->add($fullname, $email, $content); $data['error'] = $data['content'] = $data['email'] = $data['fullname'] = ''; $data['success'] = '<p class="success">Cảm ơn bạn đã gửi ý kiến.</p>'; Session::set('feedback', $data); } else { $data = $_POST; $data['error'] = '<p class="error">' . $error . '</p>'; $data['success'] = ''; Session::set('feedback', $data); } } Until::redirectTo('feedback'); }
function exeAdd() { $id = (int) Session::get('user')['id']; if ($id > 0) { $error = ''; if (!empty($_FILES)) { $upload = new Upload('file'); $upload->setFileExtension('jpg|jepg|png|gif'); $upload->setUploadDir('public/uploads/members/'); $upload->setFileSize(2048); $e = $upload->getError(); if (!empty($e)) { foreach ($e as $value) { $error .= $value . '<br />'; } } if ($error != '') { $message = '<div class="album" status="true"><p class="red">' . $error . '</p></div>'; } else { $imageName = Convert::makeLink($_FILES['file']['name']); $imageLink = $upload->uploads($imageName); $id = $this->model->add(Session::get('user')['username'], $imageName, $imageLink); $message = '<div class="album" imageId="' . $id . '"> <img src="' . BASE_URL . '/' . $imageLink . '" alt="' . $imageName . '" class="imgage" /> <span class="img-delete" imageId="' . $id . '" title="Xoá ảnh này">X</span> <p>Ngày đăng: ' . date('d-m-Y H:i', time()) . '</p> </div>'; } } else { $message = '<div class="album" status="true"><p class="red">Bạn chưa chọn file</p></div>'; } echo $message; } else { Until::redirectTo(); } }
function exeDelete() { if ((int) Request::get('id') > 0) { $data = $this->model->selectOne((int) Request::get('id')); if (!empty($data)) { $ordinal = $data['ordinal']; $condition = '`ordinal` > ' . $ordinal . ' AND `parent_id` = ' . Request::post('parent_id'); $this->model->ordinalUpdate($condition, true); $this->model->remove((int) Request::get('id')); } } Until::redirectTo('services'); }
public function actionCharge() { $model = new MemberRecharge(); $model->dpid = $this->companyId; //Until::validOperate($model->dpid, $this); if (Yii::app()->request->isPostRequest) { $model->attributes = Yii::app()->request->getPost('MemberRecharge'); $rfid = Yii::app()->request->getPost('rfid'); $transaction = Yii::app()->db->beginTransaction(); try { $member = MemberCard::model()->find('rfid=:rfid and selfcode=:selfcode and dpid=:dpid', array(':rfid' => $rfid, ':selfcode' => $model->member_card_id, ':dpid' => $this->companyId)); Until::validOperate($member->lid, $this); //var_dump($member);exit; $member->all_money = $member->all_money + $model->reality_money + $model->give_money; $se = new Sequence("member_recharge"); $model->lid = $se->nextval(); $model->update_at = date('Y-m-d H:i:s', time()); $model->create_at = date('Y-m-d H:i:s', time()); $model->delete_flag = '0'; if ($model->save() && $member->update()) { $transaction->commit(); Yii::app()->user->setFlash('success', yii::t('app', '充值成功')); } else { $transaction->rollback(); Yii::app()->user->setFlash('error', yii::t('app', '充值失败')); } } catch (Exception $e) { Yii::app()->user->setFlash('error', yii::t('app', '充值失败')); $transaction->rollback(); } $this->redirect(array('member/index', 'companyId' => $this->companyId)); } $this->renderPartial('charge', array('model' => $model)); }
function exeUpdate() { if (Request::post('submit') == null) { Until::redirectTo('acl'); } else { $id = Request::post('id'); $module = Request::post('module'); $action = Request::post('action'); $description = Request::post('description'); if ($module == null || $action == null || $description == null) { Session::set('acl', $_POST); Until::redirectTo('acl/edit?id=' . $id); } else { $this->model->edit($id, $module, $action, $description); Until::redirectTo('acl'); } } }
function exeDetail() { $id = (int) Request::get('message'); if ($id > 0) { Document::setJs(array('message')); Document::setTitle('Tin nhắn'); $this->read($id); $data = $this->model->selectOne($id); if (empty($data)) { Until::redirectTo('message'); } $data['reply'] = BASE_URL . '/message/reply?message='; $data['imageReply'] = BASE_URL . '/public/css/images/email-reply-icon.png'; $data['delete'] = BASE_URL . '/message/delete?message='; $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png'; $this->view->render('detail', $data); } else { Until::redirectTo('message'); } }
function exeDelete() { $id = (int) Request::get('id'); if ($id > 0) { $this->model->remove($id); } Until::redirectTo('recharge'); }
function exeChangeAvatar() { $id = (int) Session::get('user')['id']; if ($id > 0) { $error = ''; if (!empty($_FILES)) { $upload = new Upload('file'); $upload->setFileExtension('jpg|jepg|png|gif'); $upload->setUploadDir('public/uploads/avatar/'); $upload->setFileSize(1024); $e = $upload->getError(); if (!empty($e)) { foreach ($e as $value) { $error .= $value . '<br />'; } } if ($error != '') { $message = '<p class="red">' . $error . '</p>'; } else { $imageName = Convert::makeLink($_FILES['file']['name']); $imageLink = $upload->uploads($imageName); $this->model->changeAvatar(Session::get('user')['id'], $imageLink); if (Session::get('user')['avatar'] != 'public/uploads/members/member-1.png' || Session::get('user')['avatar'] != 'public/uploads/members/member-1.png') { if (file_exists(Session::get('user')['avatar'])) { unlink(Session::get('user')['avatar']); } } $data = Session::get('user'); $data['avatar'] = $imageLink; Session::set('user', $data); $message = '1'; } } else { $message = '<p class="red">Bạn chưa chọn file</p>'; } echo $message; } else { Until::redirectTo(); } }
public function actionRecommend() { $id = Yii::app()->request->getParam('id'); $product = Product::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $this->companyId)); Until::isUpdateValid(array($id), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 if ($product) { $product->saveAttributes(array('is_discount' => $product->is_discount == 0 ? 1 : 0, 'update_at' => date('Y-m-d H:i:s', time()))); //$product->update_at = date('Y-m-d H:i:s',time()); } exit; }
public function newPrescription() { $input = Input::all(); $pres = Prescription::where(DB::raw('DATE(created_at)'), '=', date('Y-m-d'))->where('patient', '=', $input['patient'])->first(); $isSell = 0; if (!Until::isNull($pres)) { if (Input::has('listDelete')) { PrescriptionDetail::whereIn('id', $input['listDelete'])->delete(); } else { if ($input['presSelect'] != $pres->id) { PrescriptionDetail::where('prescription', '=', $pres->id)->delete(); } } $isSell = $pres->is_sell; } else { $pres = new Prescription(); $pres->is_no_drug = false; } $pres->patient = $input['patient']; $pres->disease = $input['disease']; $pres->note = $input['note']; $pres->day = $input['dosage']; $pres->is_free = Until::isNull($input['isFree']) ? 0 : 1; $pres->is_repres = Until::isNull($input['isRe']) ? 1 : 0; $pres->is_sell = $isSell; $pres->save(); foreach ($input['drugs'] as $drug) { $detail = new PrescriptionDetail(); if (!Until::isNull($drug['idDetail'])) { $detail = PrescriptionDetail::where('id', '=', $drug['idDetail'])->first(); } $detail->prescription = $pres->id; $detail->drug = $drug['drugId']; $detail->price = Drug::where('id', '=', $drug['drugId'])->first()->price; switch ($drug['type']) { case 1: $detail->morning = $drug['morning']; $detail->lunch = $drug['lunch']; $detail->afternoon = $drug['afternoon']; $detail->night = $drug['night']; $detail->total = $drug['total']; break; case 3: $detail->special = $drug['dosage']; $detail->total = $drug['fixed']; case 2: case 4: $detail->total = $drug['fixed']; break; } $detail->save(); } return Response::json('true'); }
public function newPrescription() { $input = Input::all(); $pres = Prescription::where(DB::raw('DATE(created_at)'), '=', date('Y-m-d'))->where('patient', '=', $input['patient'])->first(); $flagDetail = true; if (!Until::isNull($pres)) { if (Input::has('listDelete')) { PrescriptionDetail::whereIn('id', explode(",", $input['listDelete']))->delete(); } else { if ($input['presSelect'] != $pres->id) { PrescriptionDetail::where('prescription', '=', $pres->id)->delete(); $flagDetail = false; } } } else { $pres = new Prescription(); $pres->is_no_drug = false; $flagDetail = false; } $pres->patient = $input['patient']; $pres->disease = $input['disease']; $pres->note = $input['note']; $pres->day = $input['dosage']; $pres->is_repres = $input['isRe'] == "false" ? 0 : 1; $pres->save(); $inputDrug = json_decode($input['drugs']); foreach ($inputDrug as $drug) { $detail = new PrescriptionDetail(); if (!Until::isNull($drug->idDetail) && $flagDetail) { $detail = PrescriptionDetail::where('id', '=', $drug->idDetail)->first(); } $detail->prescription = $pres->id; $detail->drug = $drug->drugId; $detail->price = Drug::where('id', '=', $drug->drugId)->first()->price; switch ($drug->type) { case 1: $detail->morning = $drug->morning; $detail->lunch = $drug->lunch; $detail->afternoon = $drug->afternoon; $detail->night = $drug->night; $detail->total = $drug->total; break; case 2: $detail->special = $drug->dosage; case 3: case 4: $detail->total = $drug->fixed; break; } $detail->save(); } $pres = $this->createDataPrint($pres); return Response::json(array('pres' => $pres)); }
function exeLoadType() { $userId = (int) Request::post('userId'); if ($userId > 0) { $data = $this->model->loadType($userId); $type = array('0' => 'Khoá', '2' => 'Thành viên'); if (Session::get('user')['user_type'] == 7) { $type['4'] = 'Mod'; } if (Session::get('user')['user_type'] > $data['user_type']) { echo '<form name="editType" method="post"><p>'; echo '<p>Nhóm thành viên</p>'; foreach ($type as $key => $value) { if ($key == $data['user_type']) { echo '<label class="label_radio"><input type="radio" name="editType" value="' . $key . '" checked="checked" />' . $value . '</label>'; } else { echo '<label class="label_radio"><input type="radio" name="editType" value="' . $key . '" />' . $value . '</label>'; } } echo '<input type="hidden" name="id" value="' . $userId . '" />'; echo '</p><p><label class="label_text"></label><input class="input_submit" type="button" name="submitType" value="Thay đổi"></p>'; echo '</form>'; } else { echo '<p class="error">Bạn không có quyền với user này</p>'; } } else { Until::redirectTo(); } }
public function exeService() { if ((int) Request::get('id') > 0) { $service = $this->LoadService(); $sv = $service->SelectOne((int) Request::get('id')); if (empty($sv)) { Until::redirectTo('error'); } else { $data = array(); $data['services'] = $sv['feature']; $id = $sv['id']; $data['id'] = $id; $data['title'] = BASE_URL_ADMIN . '/article/service?id=' . $id; Document::setTitle($sv['feature']); Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery')); $condition = "`service_id`='" . $id . "'"; $keySearch = Request::get('keySearch'); $find = Request::get('find'); $searchTitle = ''; $searchAuthor = ''; if ($find == 'title') { $searchTitle = 'selected="selected"'; } elseif ($find == 'author') { $searchAuthor = 'selected="selected"'; } $link = '?id=' . $id . '&'; $data['searchTitle'] = $searchTitle; $data['searchAuthor'] = $searchAuthor; $data['keySearch'] = $keySearch; if ($keySearch != null) { $link = 'keySearch=' . $keySearch . '&'; if ($searchTitle != '') { $condition .= " AND LOWER(`title`) like '%" . strtolower($keySearch) . "%'"; } else { $condition .= "AND LOWER(`author`) like '%" . strtolower($keySearch) . "%'"; } if ($find == 'author') { $link .= 'find=' . $find . '&'; } } $display = 20; $totalPage = ceil($this->model->total($condition) / $display); if ((int) Request::get('page') > 0) { $page = Request::get('page'); if ($totalPage < $page) { $page = $totalPage; } } else { $page = 1; } $pageLink = new Paging($page, $totalPage); $data['pagination'] = $pageLink->pagination($link); $data['article'] = $this->model->selectAll(($page - 1) * $display, $display, $condition); $data['add'] = BASE_URL_ADMIN . '/article/add?service=' . $id; $data['actionDelete'] = BASE_URL_ADMIN . '/article/delete'; $data['detail'] = BASE_URL_ADMIN . '/article/detail?id='; $data['edit'] = BASE_URL_ADMIN . '/article/edit?id='; $data['imageEdit'] = BASE_URL . '/public/css/images/white_edit.png'; $data['delete'] = BASE_URL_ADMIN . '/article/delete?id='; $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png'; $this->view->render('service', $data); } } else { Until::redirectTo('error'); } }
public function actionUpdateProductTaste() { $tasteArr = array(); $lid = Yii::app()->request->getParam('lid'); Until::isUpdateValid(array($lid), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 $model = Product::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId)); if (Yii::app()->request->isPostRequest) { $postData = Yii::app()->request->getPost('Taste'); if (TasteClass::saveProductTaste($this->companyId, $lid, $postData)) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('taste/productTaste', 'companyId' => $this->companyId)); } } $tastes = TasteClass::getAllOrderTasteGroup($this->companyId, 0); $productTastes = TasteClass::getProductTasteGroup($lid, $this->companyId); foreach ($productTastes as $taste) { array_push($tasteArr, $taste['lid']); } $this->render('updateProductTaste', array('model' => $model, 'tastes' => $tastes, 'productTastes' => $tasteArr)); }
public function actionDelete() { $id = Yii::app()->request->getParam('id'); Until::isUpdateValid(array($id), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 $model = ProductCategory::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $this->companyId)); //var_dump($id, $this->companyId,$model);exit; if ($model) { $model->deleteCategory(); Yii::app()->user->setFlash('success', yii::t('app', '删除成功!')); } $this->redirect(array('productCategory/index', 'companyId' => $this->companyId, 'id' => $model->pid)); }
public function actionCompanyDelete() { $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId')); $ids = Yii::app()->request->getPost('ids'); $userid = Yii::app()->request->getParam('userid', 0); Until::isUpdateValid($ids, $companyId, $this); //0,表示企业任何时候都在云端更新。 if (!empty($ids)) { Yii::app()->db->createCommand('update nb_user_company set delete_flag=1 where lid in (' . implode(',', $ids) . ') and dpid = :companyId')->execute(array(':companyId' => $this->companyId)); $this->redirect(array('user/companyIndex', 'companyId' => $companyId, 'lid' => $userid)); } else { Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目')); $this->redirect(array('user/companyIndex', 'companyId' => $companyId, 'lid' => $userid)); } }
public function actionPrintList() { $orderId = Yii::app()->request->getParam('orderId', 0); //$companyId = Yii::app()->request->getParam('companyId'); $padId = Yii::app()->request->getParam('padId'); $typeId = Yii::app()->request->getParam('typeId'); Until::validOperate($companyId, $this); $order = Order::model()->with('company')->find('t.lid=:id and t.dpid=:dpid', array(':id' => $orderId, ':dpid' => $this->companyId)); $pad = Pad::model()->find(' dpid=:dpid and lid=:lid', array(':dpid' => $order->dpid, 'lid' => $padId)); //前面加 barcode if (!empty($pad)) { $precode = ""; //$precode="1D6B450B".strtoupper(implode('',unpack('H*', 'A'.$order->lid)))."0A".strtoupper(implode('',unpack('H*', 'A'.$order->lid)))."0A"; //Yii::app()->end(json_encode(Helper::printList($order , $padid))); $printserver = "1"; $memo = ""; $ret = Helper::printList($order, $pad, $precode, $printserver, $memo); } else { $ret = array('status' => false, 'dpid' => $order->dpid, 'jobid' => "0", 'type' => 'none', 'msg' => yii::t('app', 'PAD不存在!')); } //exit; $this->renderPartial('printlist', array('orderId' => $orderId, 'ret' => $ret, 'typeId' => $typeId)); }