示例#1
0
 /**
  * @inheritdoc
  */
 public function beforeAction()
 {
     $current_route = $this->getModules()[0]->requestedRoute;
     if (!Yii::$app->request->isAjax && !in_array($current_route, Yii::$app->params['route_keep_cookie'])) {
         utilities::deleteCookie('cus_info');
         //Delete coolkie cus_info
     }
     $session = \Yii::$app->session;
     if (!$session->get('login_info')) {
         $this->redirect(BaseUrl::base(true) . '/login');
         return false;
     }
     if ($login_info = $session->get('login_info') and $login_info['expired'] < time()) {
         $session->remove('login_info');
         unset($session['login_info']);
     }
     if (!$session->get('login_info')) {
         $this->redirect(BaseUrl::base(true) . '/timeout');
         return false;
     }
     if ($loginInfo = $session->get('login_info')) {
         $login_info['expired'] = time() + Yii::$app->params['timeOutLogin'];
         $session->set('login_info', $login_info);
     }
     return true;
 }
示例#2
0
 /**
  *Login admin
  * @author: Dang Bui
  */
 public function actionLoginadmin()
 {
     if ($user_info = Yii::$app->request->post()) {
         $id = $user_info['ssid'];
         $pass = $user_info['password'];
         if (!file_exists(getcwd() . '/data/adminuser.json')) {
             $user = Yii::$app->params['admin_user'];
             utilities::createFolder('data/');
             $fh = fopen(getcwd() . '/data/adminuser.json', 'w+');
             $content = json_encode($user);
             fwrite($fh, $content);
         } else {
             $user = json_decode(file_get_contents(getcwd() . '/data/adminuser.json'), true);
         }
         foreach ($user as $k => $v) {
             if ($id == $v['ssid'] && $pass == $v['password']) {
                 Yii::$app->session->set('login_admin_info', ['status' => 'login_success', 'id' => $id, 'pass' => $pass, 'expired' => time() + Yii::$app->params['timeOutLogin']]);
                 $this->redirect(BaseUrl::base(true) . '/operator/punc');
             }
         }
         Yii::$app->session->setFlash('error', 'ログインIDが正しくありません');
     }
     $this->layout = '@backend/views/layouts/login';
     return $this->render('login_admin');
 }
示例#3
0
 /**
  * @param array $info_warranty
  * @param array $info_car
  * @param array $info_bill
  * @param array $info_ss
  * @param $denpyoNo
  * @param null $savetype
  * @param null $watermark
  * @return bool|string
  * @throws \Exception
  */
 public function exportBill($info_warranty = [], $info_car = [], $info_bill = [], $info_ss = [], $denpyoNo = null, $savetype = null, $watermark = null)
 {
     $data = ['info_warranty' => $info_warranty, 'info_car' => $info_car, 'info_bill' => $info_bill, 'info_ss' => $info_ss];
     $stringTarget = Pdfbill::widget($data);
     $pdf = new \mPDF('ja', 'A4', 0, 'DejaVuSansCondensed', '4', '4', '5', '5', '4', '4');
     $pdf->WriteHTML($stringTarget);
     if ($watermark) {
         $pdf->SetWatermarkImage('../web/img/confidentiality.png', 0.6);
         $pdf->showWatermarkImage = true;
     }
     utilities::createFolder('data/pdf');
     //Create folder data/pdf
     if ($savetype == 'save') {
         if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
             return false;
         }
         $pdf->Output('data/pdf/' . $denpyoNo . '.pdf', 'F');
         if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
             return true;
         }
     } else {
         utilities::createFolder('data/tmp');
         $name = 'draft-' . md5(uniqid(mt_rand(), true)) . '.pdf';
         $filename = "data/tmp/{$name}";
         $pdf->Output($filename, 'F');
         return $filename;
     }
 }
示例#4
0
 /**
  * list order
  * @return string
  */
 public function actionIndex()
 {
     $all = new utilities();
     $branch = $all->getAllBranch();
     $data['all_ss'] = $branch['all_ss'];
     $obj = new Sdptd03denpyo();
     $obj_job = new Sdptm01sagyo();
     $filters = Yii::$app->request->get();
     $query_string = empty($filters) ? '' : '?' . http_build_query($filters);
     Yii::$app->session->set('url_list_workslip', BaseUrl::base() . '/list-workslip' . $query_string);
     if (empty($filters)) {
         $filters['start_time'] = date('Ymd');
         $filters['end_time'] = date('Ymd');
     }
     $data['filters'] = $filters;
     /*
      * Get login info
      * */
     $login_info = Yii::$app->session->get('login_info');
     if (isset($login_info['M50_SS_CD']) && $login_info['M50_SS_CD'] != '') {
         $data['filters']['m50_ss_cd'] = $login_info['M50_SS_CD'];
     }
     $count = $obj->countDataSearch($data['filters']);
     $data['pagination'] = new Pagination(['totalCount' => $count, 'defaultPageSize' => Yii::$app->params['defaultPageSize']]);
     $data['page'] = $filters = Yii::$app->request->get('page');
     $data['filters']['limit'] = $data['pagination']->limit;
     $data['filters']['offset'] = $data['pagination']->offset;
     $data['list'] = $obj->getDataSearch($data['filters']);
     if (empty($data['list'])) {
         Yii::$app->session->setFlash('empty', '入力条件に該当する作業伝票が存在しません');
     }
     $data['job'] = [];
     $all_job = $obj_job->getData();
     foreach ($all_job as $k => $v) {
         $data['job'][''] = '';
         $data['job'][$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
     }
     $data['status'] = Yii::$app->params['status'];
     Yii::$app->params['titlePage'] = '作業伝票一覧';
     Yii::$app->view->title = '情報検索';
     return $this->render('index', $data);
 }
示例#5
0
 /**
  * action import
  * @return \yii\web\Response
  */
 public function actionImport()
 {
     $request = Yii::$app->request;
     if ($request->isPost && isset($_FILES['commodity'])) {
         $obj = new Sdptm05com();
         if (substr($_FILES['commodity']['name'], -4) == '.csv') {
             $file = utilities::convertUtf8($_FILES['commodity']['tmp_name']);
             $result = $obj->saveImport($file);
             $error = $result['error'];
         } else {
             $error[] = 'CSVのフォーマットが正しくありません';
         }
         if (empty($error) && $result['insert']) {
             Yii::$app->session->setFlash('success', 'success');
         } else {
             Yii::$app->session->setFlash('error', $error);
         }
         return $this->redirect(BaseUrl::base(true) . '/update-commodity');
     }
 }
示例#6
0
 public function actionIndex()
 {
     $data['post'] = \Yii::$app->request->post();
     if (isset($data['post']['D01_SS_CD'])) {
         $branch = utilities::getAllBranch();
         $ss = $branch['all_ss'];
         $address = $branch['ss_address'];
         $tel = $branch['ss_tel'];
         $obj_job = new Sdptm01sagyo();
         $job[''] = '';
         $all_job = $obj_job->getData();
         foreach ($all_job as $k => $v) {
             $job[$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
         }
         $data['ss'] = isset($ss[$data['post']['D01_SS_CD']]) ? $ss[$data['post']['D01_SS_CD']] : '';
         $data['address'] = isset($address[$data['post']['D01_SS_CD']]) ? $address[$data['post']['D01_SS_CD']] : '';
         $data['tel'] = isset($tel[$data['post']['D01_SS_CD']]) ? $tel[$data['post']['D01_SS_CD']] : '';
         foreach ($data['post']['LIST_NAME'] as $k => $v) {
             $data['post']['M05_COM_NAMEN' . $k] = $v;
         }
         $data['job'] = $job;
         $data['status'] = \Yii::$app->params['status'];
         $tanto = explode('[]', $data['post']['D03_TANTO_MEI_D03_TANTO_SEI']);
         if (!empty($tanto[0]) && !empty($tanto[1])) {
             $data['post']['tanto'] = $tanto[0] . $tanto[1];
         }
         $kakunin = explode('[]', $data['post']['D03_KAKUNIN_MEI_D03_KAKUNIN_SEI']);
         if (!empty($kakunin[0]) && !empty($kakunin[1])) {
             $data['post']['kakunin'] = $kakunin[0] . $kakunin[1];
         }
         $data['post']['ss_user'] = $this->getssUser($data['post']['D01_SS_CD']);
         $data['ss_user'] = $data['post']['M08_NAME_MEI_M08_NAME_SEI'] ? $data['post']['ss_user'][$data['post']['M08_NAME_MEI_M08_NAME_SEI']] : '';
         $this->layout = '@app/views/layouts/print';
         \Yii::$app->view->title = '作業確認書';
         \Yii::$app->params['titlePage'] = '作業確認書';
         return $this->render('index', $data);
     }
     return $this->redirect(BaseUrl::base(true) . '/regist-workslip');
 }
示例#7
0
 /**
  * create, edit staff
  * @return string|Response
  */
 public function actionStaff()
 {
     $request = Yii::$app->request;
     $data['api'] = utilities::getAllBranch();
     $data['all_branch'] = ['' => ''] + $data['api']['all_branch'];
     $login_info = Yii::$app->session->get('login_info');
     $data['default_value'] = ['M08_HAN_CD' => $data['api']['all_ss_branch'][$login_info['M50_SS_CD']], 'M08_SS_CD' => $login_info['M50_SS_CD']];
     if ($request->get('branch') && $request->get('ss') && $request->get('cd')) {
         $primary = ['M08_HAN_CD' => $request->get('branch'), 'M08_SS_CD' => $request->get('ss'), 'M08_JYUG_CD' => $request->get('cd')];
         $data['model'] = Sdptm08sagyosya::findOne($primary);
         if (!$data['model']) {
             return $this->redirect(BaseUrl::base() . '/list-staff');
         }
         $data['action'] = 'edit';
         $all_ss = $this->processGetss($data['model']->M08_HAN_CD, $data['api']);
         Yii::$app->session->set('url_edit_staff', BaseUrl::base(true) . '/edit-staff?branch=' . $primary['M08_HAN_CD'] . '&ss=' . $primary['M08_SS_CD']) . '&cd=' . $primary['M08_JYUG_CD'];
         Yii::$app->view->title = '作業者編集';
     } else {
         $primary = null;
         $data['model'] = new Sdptm08sagyosya();
         $data['action'] = 'create';
         $all_ss = $this->processGetss($data['default_value']['M08_HAN_CD'], $data['api']);
         Yii::$app->view->title = '作業者登録';
     }
     $data['all_ss'] = ['' => ''] + $all_ss;
     if ($request->isPost) {
         $data['model']->setData($request->post('Sdptm08sagyosya'), $primary);
         if ($data['model']->saveData()) {
             Yii::$app->session->setFlash('success', 'success');
             $key = $data['model']->getPrimaryKeyAfterSave();
             return $this->redirect(BaseUrl::base() . '/edit-staff?branch=' . $key['M08_HAN_CD'] . '&ss=' . $key['M08_SS_CD'] . '&cd=' . $key['M08_JYUG_CD']);
         }
         Yii::$app->session->setFlash('error', 'error');
     }
     Yii::$app->params['titlePage'] = 'メンテナンス';
     return $this->render('staff', $data);
 }
示例#8
0
 public function actionIndex()
 {
     if ($data = \Yii::$app->request->post()) {
         $tmp_folder = 'data/tmp/';
         utilities::createFolder($tmp_folder);
         //Create folder data/zip
         $start_date = $data['start_year'] . $data['start_month'] . $data['start_day'];
         $end_date = $data['end_year'] . $data['end_month'] . $data['end_day'];
         if ($data['type-download'] == 'csv') {
             $folder_source = 'data/csv/';
             $isStatus = $this->exportCsv($start_date, $end_date, $folder_source, $tmp_folder);
             if ($isStatus) {
                 die;
             }
         } elseif ($data['type-download'] == 'pdf') {
             $folder_source = 'data/pdf/';
             $isStatus = $this->exportPdf($start_date, $end_date, $folder_source, $tmp_folder);
         } else {
             \Yii::$app->params['titlePage'] = 'パンク保証データダウンロード';
             \Yii::$app->view->title = 'パンク保証データダウンロード';
             $this->layout = '@backend/views/layouts/blank';
             return $this->render('index');
         }
         if (!$isStatus) {
             Yii::$app->session->setFlash('error', 'ファイルがありません');
         } else {
             Yii::$app->session->setFlash('success', 'PDFファイルを作りました。');
         }
     }
     //Get date time in select box
     $yesterday = date("Y-m-d", strtotime("- 1 day"));
     $year_now = date('Y');
     $year = date('Y', strtotime($yesterday));
     $day = date('d', strtotime($yesterday));
     $month = date('m', strtotime($yesterday));
     $select_date = ['year_now' => [$year_now - 2 => $year_now - 2, $year_now - 1 => $year_now - 1, $year_now => $year_now], 'year' => $year, 'day' => $day, 'month' => $month];
     \Yii::$app->params['titlePage'] = 'パンク保証データダウンロード';
     \Yii::$app->view->title = 'パンク保証データダウンロード';
     $this->layout = '@backend/views/layouts/blank';
     return $this->render('index', ['select_date' => $select_date]);
 }
示例#9
0
 /**
  *complete change member car
  * @author: Dang Bui
  */
 public function actionComplete()
 {
     if (!($data = \Yii::$app->request->post())) {
         return $this->redirect(BaseUrl::base(true) . '/usappy-number-change');
     }
     $memberKaiinName = $data['memberKaiinName'];
     $infoCard = json_decode($data['infoCard'], true);
     $oldCardNumber = $data['oldCardNumber'];
     $newCardNumber = $data['newCardNumber'];
     $kaiinCd = $data['kaiinCd'];
     $api = new api();
     $status = $api->updateCardNumber($kaiinCd, $infoCard);
     if ($status) {
         \Yii::$app->session->setFlash('info', '下記の内容でUsappyカード番号を変更しました。');
     } else {
         \Yii::$app->session->setFlash('info', 'Error Update Card Number');
     }
     utilities::deleteCookie('cus_info');
     //Delete coolkie cus_info
     $form['data'] = ['memberKaiinName' => $memberKaiinName, 'oldCardNumber' => $oldCardNumber, 'newCardNumber' => $newCardNumber];
     \Yii::$app->view->title = 'Usappyカード変更';
     \Yii::$app->params['titlePage'] = 'Usappyカード変更';
     return $this->render('complete', $form);
 }
示例#10
0
 public function actionPreview()
 {
     $branch = utilities::getAllBranch();
     $ss = $branch['all_ss'];
     $address = $branch['ss_address'];
     $tel = $branch['ss_tel'];
     $api = new api();
     $data = [];
     $filter['detail_no'] = Yii::$app->request->get('den_no');
     $cus = new Sdptd01customer();
     $obj = new Sdptd03denpyo();
     $obj_job = new Sdptm01sagyo();
     $car = new Sdptd02car();
     $job[''] = '';
     $all_job = $obj_job->getData();
     foreach ($all_job as $k => $v) {
         $job[$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
     }
     $detail = $obj->getDataSearch($filter);
     if (empty($detail)) {
         $this->redirect(BaseUrl::base(true) . '/list-workslip');
     }
     $data['detail'] = $detail[0];
     $data['detail']['D02_SYAKEN_CYCLE'] = $this->getCar(['D02_CUST_NO' => $data['detail']['D03_CUST_NO'], 'D02_CAR_NO' => $data['detail']['D03_CAR_NO']]);
     //getCustomer_API
     $cus_info = $cus->findOne($data['detail']['D03_CUST_NO']);
     $data['detail']['D01_UKE_TAN_NAMEN'] = $cus_info['D01_UKE_TAN_NAMEN'];
     if (isset($cus_info['D01_KAIIN_CD'])) {
         $info = $api->getMemberInfo($cus_info['D01_KAIIN_CD']);
         $data['detail']['D01_CUST_NAMEN'] = $info['member_kaiinName'];
         $data['detail']['D01_CUST_NAMEK'] = $info['member_kaiinKana'];
     }
     //getCar_API
     if ($cus_info['D01_KAIIN_CD'] != '') {
         $car_api = $api->getInfoListCar($cus_info['D01_KAIIN_CD']);
         foreach ($car_api['car_carSeq'] as $k => $v) {
             if ($v == $data['detail']['D03_CAR_SEQ']) {
                 $data['detail']['D02_SYAKEN_CYCLE'] = $car_api['car_syakenCycle'][$k];
             }
         }
     }
     $data['ss'] = isset($ss[$data['detail']['D03_SS_CD']]) ? $ss[$data['detail']['D03_SS_CD']] : '';
     $data['address'] = isset($address[$data['detail']['D03_SS_CD']]) ? $address[$data['detail']['D03_SS_CD']] : '';
     $data['tel'] = isset($tel[$data['detail']['D03_SS_CD']]) ? $tel[$data['detail']['D03_SS_CD']] : '';
     $data['detail']['sagyo'] = $this->getSagyo($data['detail']['D03_DEN_NO']);
     $data['detail']['product'] = $this->getProduct($data['detail']['D03_DEN_NO']);
     $data['job'] = $job;
     $data['status'] = Yii::$app->params['status'];
     $data['csv'] = csv::readcsv(['D03_DEN_NO' => $filter['detail_no']]);
     $data['confirm'] = confirm::readconfirm(['D03_DEN_NO' => $filter['detail_no']]);
     $this->layout = '@app/views/layouts/print';
     Yii::$app->view->title = '作業確認書';
     Yii::$app->params['titlePage'] = '作業確認書';
     return $this->render('preview', $data);
 }
示例#11
0
 /**
  * @inheritdoc
  * check other
  * @author: dangbc6591
  */
 public function actionCheckother()
 {
     $flag = false;
     utilities::deleteCookie('cus_info');
     //Delete coolkie cus_info
     $member_info = [];
     $url_redirect = Yii::$app->request->post('url_redirect');
     $type_redirect = Yii::$app->request->post('type_redirect');
     $member_info['type_redirect'] = 3;
     $cookie = new Cookie(['name' => 'cus_info', 'value' => $member_info]);
     \Yii::$app->getResponse()->getCookies()->add($cookie);
     if (!empty($member_info)) {
         $flag = true;
     }
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     return $flag;
 }