public function getssUser($sscode) { $uDenpyo = new Udenpyo(); $tm08Sagyosya = $uDenpyo->getTm08Sagyosya(['M08_SS_CD' => $sscode]); $ssUser = []; if (count($tm08Sagyosya)) { foreach ($tm08Sagyosya as $tmp) { $ssUser[$tmp['M08_JYUG_CD']] = $tmp['M08_NAME_SEI'] . $tmp['M08_NAME_MEI']; } } return $ssUser; }
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; }