���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/admin.adimi/code/management/customer/ |
<?php use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\IOFactory; $v_customer_id = (isset($CORE->input['customer_id']) && $CORE->input['customer_id']>0) ? $CORE->input['customer_id'] : 0; /*if(intval($v_customer_id)==0){ echo '<script>alert(\'Không tồn tại mã khách hàng!\');</script>'; $print->refresh('?act=management&code=customer'); }*/ $type2 = (isset($CORE->input['type2']) && $CORE->input['type2']!='') ? $CORE->input['type2'] : 'hosting'; $row_customer = $DB->fetch_row($DB->query("SELECT * FROM tb_customer WHERE customer_id='$v_customer_id' ")); $v_customer_baogia_id = (isset($CORE->input['customer_baogia_id']) && $CORE->input['customer_baogia_id']>0) ? $CORE->input['customer_baogia_id'] : 0; $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_customer_baogia WHERE customer_id='$v_customer_id' AND customer_baogia_id='$v_customer_baogia_id' ")); $q_item = $DB->query("SELECT * FROM tb_baogia_item WHERE customer_baogia_id='$v_customer_baogia_id' AND customer_id='$v_customer_id' ORDER BY time_post ASC "); $v_chi_phi = 0; while ($r_item = $DB->fetch_row($q_item)){ $arr_item[]=$r_item['baogia_item_name']; $v_chi_phi += $r_item['baogia_item_price']; } $q_template = $DB->query("SELECT * FROM tb_hopdong_tpl WHERE service_cat='baogia' ORDER BY hopdong_tpl_id DESC"); $txt_template = ''; $txt_checked = 'checked'; while ($r_template=$DB->fetch_row($q_template)){ $txt_template .= '<tr><td> <div class="custom-control custom-radio"> <input class="custom-control-input" type="radio" name="hopdong_tpl_id" value="'.$r_template['hopdong_tpl_id'].'" id="customRadio'.$r_template['hopdong_tpl_id'].'" '.$txt_checked.'> <label for="customRadio'.$r_template['hopdong_tpl_id'].'" class="custom-control-label"></label> </div> </td><td>'.$r_template['hopdong_tpl_name'].'</td><td><a href="'.$r_template['hopdong_tpl_path'].'"><i class="fas fa-file-download"></i></a></td><td><a href="?act=management&code=customer&type=delete_template&type2=hosting&customer_id='.$v_customer_id.'&customer_baogia_id='.$v_customer_baogia_id.'&template_id='.$r_template['hopdong_tpl_id'].'" onclick="return confirm(\'Bạn có chắc muốn xóa?\');">Xóa</a></td></tr>'; $txt_checked = ''; } //in bao gia if(isset($CORE->input['submitbt_print'])) { $f = $CORE->input['f']; $template_id = isset($CORE->input['hopdong_tpl_id']) ? $CORE->input['hopdong_tpl_id'] : 0; $v_customer_id = $f['customer_id']; $v_customer_baogia_id = $f['customer_baogia_id']; $row_customer = $DB->fetch_row($DB->query("SELECT * FROM tb_customer WHERE customer_id='".$f['customer_id']."' ")); $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_customer_baogia WHERE customer_id='$v_customer_id' AND customer_baogia_id='$v_customer_baogia_id' ")); $q_item = $DB->query("SELECT * FROM tb_baogia_item WHERE customer_baogia_id='$v_customer_baogia_id' AND customer_id='$v_customer_id' ORDER BY time_post ASC "); /*$replacements = array( array('item_name' => 'Batman', 'item_value' => 'Gotham City'), array('item_name' => 'Superman', 'item_value' => 'Metropolis'), array('item_name' => 'Superman', 'item_value' => 'Metropolis') );*/ $total = 0; while ($r_item = $DB->fetch_row($q_item)){ if($r_item['baogia_item_price']>0){ $v_price = $fmt->formatCurrency($r_item['baogia_item_price'],'VND'); $total += $r_item['baogia_item_price']; }else{ $v_price = 'Miễn phí'; } $replacements[] = array('item_name'=>$r_item['baogia_item_name'],'item_value'=>$v_price); } //$replacements[] = array('item_name'=>'Tổng giá dịch vụ','item_value'=>$fmt->formatCurrency($total,'VND')); $data['baogia_name'] = $row_check['customer_baogia_name']; $data['congty_nguoinhan'] = $row_check['customer_baogia_congtynguoinhan']; if($row_check['customer_baogia_gender']==1){ $row_check['customer_baogia_gender']='Mr. '; }else{ $row_check['customer_baogia_gender']='Ms. '; } $data['ten_nguoinhan'] = $row_check['customer_baogia_gender'].$row_check['customer_baogia_tennguoinhan']; $data['dienthoai_nguoinhan'] = $row_check['customer_baogia_dienthoainguoinhan']; $data['email_nguoinhan'] = $row_check['customer_baogia_emailnguoinhan']; $data['congty_nguoigui'] = $row_check['customer_baogia_congtynguoigui']; $data['ten_nguoigui'] = $row_check['customer_baogia_tennguoigui']; $data['dienthoai_nguoigui'] = $row_check['customer_baogia_dienthoainguoigui']; $data['email_nguoigui'] = $row_check['customer_baogia_emailnguoigui']; $data['ngay_gui'] = date('d-m-Y',strtotime($row_check['customer_baogia_ngaygui'])); if(!empty($row_check['customer_baogia_hostingghichu'])) { $arr_ghichu = explode('@', $row_check['customer_baogia_hostingghichu']); foreach ($arr_ghichu as $val) { if($val!='') { $list_ghichu[] = array('ghichu_value' => '- '.$arr_baogia_ghichu[$val].'.'); } } } $row_template = $DB->fetch_row($DB->query("SELECT * FROM tb_hopdong_tpl WHERE hopdong_tpl_id='".$template_id."' ")); if(!$row_template){ $print->refresh('?act=management&code=customer&type=print_baogia&type2=hosting&customer_id='.$v_customer_id.'&customer_baogia_id='.$v_customer_baogia_id, 'Bạn chưa chọn template!', 5); } $txt_path = $row_template['hopdong_tpl_path']; $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($txt_path); //$data = array_merge($row_service, $row_service_event, $row_company,$row_hopdong,$row_customer); foreach ($data as $key => $val) { $templateProcessor->setValue($key, $val); } $templateProcessor->cloneBlock('block_name', 0, true, false, $replacements); $templateProcessor->cloneBlock('block_ghichu', 0, true, false, $list_ghichu); $templateProcessor->saveAs('upload/logos/bao-gia-after-replace.docx'); $out = shell_exec('export HOME=/tmp && /usr/bin/libreoffice6.4 --headless -convert-to pdf --outdir /var/www/html/admin.adimi/upload/logos /var/www/html/admin.adimi/upload/logos/bao-gia-after-replace.docx'); //$out = shell_exec('export HOME=/tmp && /usr/bin/libreoffice6.4 --headless -convert-to pdf --outdir /var/www/html/api2.uka.edu.vn/cache /var/www/html/api2.uka.edu.vn/cache/hop-dong-goi-dau-tu-' . base64_encode($data['so_hop_dong']) . '.docx'); //unlink('cache/hop-dong-goi-dau-tu-' . base64_encode($data['so_hop_dong']) . '.docx'); if ($out) { $filename = "upload/logos/bao-gia-after-replace.pdf"; $name = 'bao-gia.pdf'; header("Content-type: application/pdf"); header("Content-Length: " . filesize($filename)); header('Content-Type: application/pdf'); header('Content-Length: '. filesize($filename)); header('Content-disposition: inline; filename="' . $name . '"'); header('Cache-Control: public, must-revalidate, max-age=0'); header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); readfile($filename); exit(); } else { echo 'error, please try later!'; exit(); } } ?>