find(); $inquiryInfo = Inquiry::where('id', $reportInfo['quot_id'])->find(); $inquiryDetailInfo = Property_cert_info::where('quot_id', $reportInfo['quot_id'])->select(); $reportDetailInfoIndex = ReportDetail::where('property_cert_info_id', $inquiryDetailInfo[0]['id'])->find(); $valuerInfo = Db::name('valuer')->field('name,mobile,certificate_number,mark,certificate')->whereIn('id', [$reportInfo['appraiser_id'], $reportInfo['appraiser2_id']])->select(); //注册房地产估价师 $valuerName = ''; $valuerimg = []; if (!empty($valuerInfo)) { $i = 1; foreach ($valuerInfo as &$value1) { $valuerName .= $value1['name'] . ':' . $value1['certificate_number'] . '
'; $value1['nod'] = $i++; if (!empty($value1['certificate'])) { $valuerimg[] = $value1['certificate']; } } } $year = substr($reportInfo['report_no'], 0, 4); $report_no = explode('-', $reportInfo['report_no']); $numberings = substr($reportInfo['report_no'], 4, 10); $suffix = substr($reportInfo['report_no'], 14); $item_name = []; foreach ($inquiryDetailInfo as $key => $value) { $item_name[] = $value['property_full_name'];//项目名称 $reportDetailInfo = ReportDetail::where('property_cert_info_id', $value['id'])->find(); //估 价 结 果 明 细 表 $data = []; $data['full_estate_name'] = $value['property_full_name']; $data['size'] = $value['size']; $data['unit_price'] = number_format($reportDetailInfo['eva_unit_price']); $data['total_price'] = number_format($reportDetailInfo['eva_total_value']); $appraiserData[] = $data; //估价对象位置示意图 if (!empty($reportDetailInfo['loc_img_ids'])) { $location_imgs_ids[] = $reportDetailInfo['loc_img_ids']; } //根据首套物业所在城市,获取报告code if (empty($code)) { if ($value['city'] == '北京') { $code = 'B'; } elseif ($value['city'] == '武汉') { $code = 'C'; } else { $code = 'A'; } } } //第一页 $info['report_no'] = '深国中评字['.$year.$code.']第'.$numberings.'号'.$suffix;//估价报告编号 $info['client_name'] = $inquiryInfo['client_name'];//委托人 $usage_name = getDictionaryName('HOUSE_USAGE', $inquiryDetailInfo[0]['usage']); // $info['item_name'] = implode('、', $item_name);//估价项目名称 $info['item_name'] = $reportDetailInfoIndex['land_location'] . $inquiryDetailInfo[0]['property_full_name'] . '一套' . $usage_name . '用途';//估价项目名称(首页) $info['employee_name'] = $valuerName;//注册房地产估价师 $info['report_qrcode'] = $reportInfo['report_qrcode'];//防伪二维码 //第二页 $info['cost_date'] = !empty($reportInfo['valuation_time']) ? date('Y年m月d日', strtotime($reportInfo['valuation_time'])) : '';//价值时点 $info['gross_value_str'] = convertAmountToCn($reportInfo['eva_total_value'], $type = 1);//市场价值 $info['gross_value'] = number_format($reportInfo['eva_total_value']);//市场价值 $appraisal_time = !empty($reportInfo['appraisal_time']) ? explode('-', $reportInfo['appraisal_time']) : ''; $info['finish_date_cn'] = !empty($appraisal_time) ? numToWordone($appraisal_time[0]) .'年'. numToWordone(intval($appraisal_time[1])) .'月'. numToWordone(intval($appraisal_time[2])) . '日' : '';//二〇二〇年五月九日 // 简易报告有效期 $info['simple_valid'] = date('Y-m-d', strtotime("$appraisal_time +3 months")); $info['appraiserData'] = $appraiserData;//估 价 结 果 明 细 表 $owner_name = $this->array_column($inquiryDetailInfo, 'owner_name'); $info['owner_name'] = implode('、', array_unique($owner_name)); //第三页 $attachmnet = new Attachment(); //物业位置图 $loc_img_ids = []; if (!empty($location_imgs_ids)) { foreach ($location_imgs_ids as $lk => $lv) { $locationIds = explode(',', $lv); $loc_img_ids[] = ['name' => numToWordone($lk + 1), 'info' => $attachmnet->getUrls($locationIds)]; } } $info['location_imgs'] = $loc_img_ids; //估价师证件 $valuer_img = []; if (!empty($valuerimg)) { $valuer_img = $attachmnet->getUrls($valuerimg); } $info['valuer_img'] = $valuer_img; $company_img = [ array('url' => Env::get('uploadFile.host_url') . DS . 'image' . DS .'business_license1.png'), array('url' => Env::get('uploadFile.host_url') . DS . 'image' . DS .'business_license3.jpg') ]; $info['company_img'] = $company_img; return $info; } //多位数组获取列数据 public function array_column($rows, $column_key, $index_key = null) { $data = []; foreach ($rows as $row) { if (empty($index_key)) { $data[] = $row[$column_key]; } else { $data[$row[$index_key]] = $row[$column_key]; } } return $data; } }