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); }
public function saveCsv($postData) { if (file_exists(getcwd() . '/data/pdf/' . $postData['D03_DEN_NO'] . '.pdf')) { return true; } $totalTaisa = 0; $totalSuryo = 0; for ($i = 1; $i < 11; ++$i) { if ((int) $postData['D05_COM_CD' . $i] && in_array((int) $postData['D05_COM_CD' . $i], range(42000, 42999))) { $totalSuryo += $postData['D05_SURYO' . $i]; $totalTaisa = $totalTaisa + 1; } } if ($totalTaisa) { $postData['D05_SURYO'] = $totalSuryo; return \backend\components\csv::writecsv($postData); } return \backend\components\csv::deletecsv($postData); }