Beispiel #1
0
 public function actionAddress()
 {
     $request = Yii::$app->request;
     $api = new api();
     if ($request->isAjax) {
         $info = $api->getAddrFromZipcode($request->post('zipcode'));
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         if (count($info) > 1) {
             $info = false;
         }
         return $info;
     }
 }
Beispiel #2
0
 /**
  * test api
  * @author: Dang Bui
  */
 public function actionTestapi()
 {
     $api = new api();
     $memem = $api->getInfoCardTop('4035607000500000');
     $member_info = $api->getMemberInfo($memem['member_kaiinCd']);
     $infocard = $api->getInfoListCard($memem['member_kaiinCd']);
     echo '<pre>';
     var_dump($memem);
     var_dump($member_info);
     var_dump($infocard);
     echo '</pre>';
     die;
 }
Beispiel #3
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);
 }
Beispiel #4
0
 public function savePdf($denpyoNo, $postData, $isView = false)
 {
     $api = new api();
     $uDenpyo = new Udenpyo();
     if ($isView == false) {
         $creat_warranty = false;
         for ($i = 1; $i < 11; ++$i) {
             if (isset($postData['checkClickWarranty']) && $postData['checkClickWarranty'] == 1 && in_array((int) $postData['D05_COM_CD' . $i], range(42000, 42999))) {
                 $creat_warranty = true;
                 break;
             }
         }
         if (!$creat_warranty) {
             return false;
         }
     }
     $denpyo = $uDenpyo->setDefaultDataObj('denpyo');
     if ($denpyoNo) {
         $denpyo = current($uDenpyo->getDenpyo(['D03_DEN_NO' => $denpyoNo]));
     }
     $listSS = $api->getSsName();
     $ssInfo = [];
     foreach ($listSS as $ss) {
         if ($ss['sscode'] == $denpyo['D03_SS_CD'] || $ss['sscode'] == $postData['D03_SS_CD']) {
             $ssInfo = $ss;
             break;
         }
     }
     $info_warranty = ['number' => $postData['M09_WARRANTY_NO'], 'date' => date('Y年m月d日'), 'expired' => date('Y年m月d日', mktime(0, 0, 0, date('m', time()) + 6, date('d', time()), date('Y', time())))];
     $info_car = ['customer_name' => isset($postData['WARRANTY_CUST_NAMEN']) ? $postData['WARRANTY_CUST_NAMEN'] : '', 'car_name' => isset($postData['D03_CAR_NAMEN']) ? $postData['D03_CAR_NAMEN'] : '', 'car_license' => isset($postData['D03_CAR_NO']) ? $postData['D03_CAR_NO'] : '', 'car_riku' => isset($postData['D03_RIKUUN_NAMEN']) ? $postData['D03_RIKUUN_NAMEN'] : '', 'car_type_code' => isset($postData['D03_CAR_ID']) ? $postData['D03_CAR_ID'] : '', 'car_hira' => isset($postData['D03_HIRA']) ? $postData['D03_HIRA'] : ''];
     $info_bill = ['right_front' => ['info_market' => $postData['right_front_manu'], 'product_name' => $postData['right_front_product'], 'size' => $postData['right_front_size'], 'serial' => $postData['right_front_serial']], 'left_front' => ['info_market' => $postData['left_front_manu'], 'product_name' => $postData['left_front_product'], 'size' => $postData['left_front_size'], 'serial' => $postData['left_front_serial']], 'right_behind' => ['info_market' => $postData['right_behind_manu'], 'product_name' => $postData['right_behind_product'], 'size' => $postData['right_behind_size'], 'serial' => $postData['right_behind_serial']], 'left_behind' => ['info_market' => $postData['left_behind_manu'], 'product_name' => $postData['left_behind_product'], 'size' => $postData['left_behind_size'], 'serial' => $postData['left_behind_serial']], 'otherB' => ['info_market' => $postData['other_b_manu'], 'product_name' => $postData['other_b_product'], 'size' => $postData['other_b_size'], 'serial' => $postData['other_b_serial']], 'otherA' => ['info_market' => $postData['other_a_manu'], 'product_name' => $postData['other_a_product'], 'size' => $postData['other_a_size'], 'serial' => $postData['other_a_serial']]];
     $info_ss = ['name' => isset($ssInfo['ss_name']) ? $ssInfo['ss_name'] : 'N/A', 'address' => isset($ssInfo['address']) ? $ssInfo['address'] : 'N/A', 'mobile' => isset($ssInfo['tel']) ? $ssInfo['tel'] : 'N/A'];
     $data = ['info_warranty' => $info_warranty, 'info_car' => $info_car, 'info_bill' => $info_bill, 'info_ss' => $info_ss];
     $pdf_export = new PdfController();
     if ($isView == true) {
         $res = $pdf_export->exportBill($info_warranty, $info_car, $info_bill, $info_ss, $denpyo['D03_DEN_NO'], null, 1);
     } else {
         $res = $pdf_export->exportBill($info_warranty, $info_car, $info_bill, $info_ss, $denpyo['D03_DEN_NO'], 'save', 0);
     }
     return $res;
 }
Beispiel #5
0
 /**
  * @inheritdoc
  * check member usappy info
  * @author: dangbc6591
  */
 public function actionCheckmember()
 {
     utilities::deleteCookie('cus_info');
     //Delete coolkie cus_info
     $api = new api();
     $flag = false;
     $flag1 = false;
     $flag2 = true;
     $flag3 = false;
     $array_source = [];
     //Get data post
     $url_redirect = Yii::$app->request->post('url_redirect');
     $type_redirect = 1;
     //Yii::$app->request->post('type_redirect');
     $member_card = Yii::$app->request->post('card_number', '');
     $member_birthday = Yii::$app->request->post('member_birthday', '');
     $member_kaiinKana = preg_replace(['/\\s/', '/\\s+/'], '', Yii::$app->request->post('member_kaiinKana', ''));
     $member_tel = Yii::$app->request->post('member_tel', '');
     $license_plates = Yii::$app->request->post('license_plates', '');
     if ($member_birthday != '') {
         $array_source['member_birthday'] = $member_birthday;
     }
     if ($member_kaiinKana != '') {
         $array_source['member_kaiinKana'] = $member_kaiinKana;
     }
     if ($member_tel != '') {
         $array_source['member_tel'] = $member_tel;
     }
     if ($license_plates != '') {
         $array_source['license_plates'] = $license_plates;
     }
     $member_info = $api->getInfoCardTop($member_card);
     $member_info['type_redirect'] = $type_redirect;
     if (!isset($member_info['member_kaiinCd'])) {
         $flag = false;
     } else {
         $member_info['member_kaiinKana'] = preg_replace(['/\\s/', '/\\s+/'], '', $member_info['member_kaiinKana']);
         //trim whitespace in kaiinKana
         $flag1 = $this->equalArray($array_source, $member_info);
         if ($license_plates != '') {
             if ($list_info_car = $api->getInfoListCar($member_info['member_kaiinCd'])) {
                 $car_carNo = $list_info_car['car_carNo'];
                 $flag2 = $this->equalNocar($license_plates, $car_carNo);
             } else {
                 $flag2 = false;
             }
         }
         $member_api = $api->getMemberInfo($member_info['member_kaiinCd']);
         $member_info = $member_info + $member_api;
         if (isset($member_info['member_kaiinCd'])) {
             $flag3 = true;
         }
     }
     if ($flag1 == true && $flag2 == true && $flag3 == true) {
         $cookie = new Cookie(['name' => 'cus_info', 'value' => $member_info]);
         Yii::$app->response->cookies->add($cookie);
         $flag = true;
     }
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     return $flag;
 }