function display() { $tour = new Tour(); global $sugar_config; // $ss = new Sugar_Smarty(); $db = DBManagerFactory::getInstance(); // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN; // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : ''; $tour->retrieve($record); $template = file_get_contents('modules/Tours/tpls/exports/template-dos.htm'); $template = str_replace('${SITE_URL}', $sugar_config['site_url'], $template); $template = str_replace('${TOUR_NOTE}', html_entity_decode_utf8($tour->description), $template); $template = str_replace('${CODE}', $tour->tour_code, $template); $template = str_replace('${NAME}', $tour->name, $template); $template = str_replace('${TRANSPORT}', $tour->transport2, $template); $template = str_replace('${START_DATE}', $tour->start_date, $template); $template = str_replace('${DURATION}', $tour->duration, $template); // Hieu fix issue 1438 if ($tour->picture) { $main_picture = ' <!--[if gte vml 1]> <o:wrapblock> <v:shape id="Picture_x0020_11" o:spid="_x0000_s1028" type="#_x0000_t75" alt="" style=\'position:absolute;margin-left:0;margin-top:0;width:470.55pt;height:234pt; z-index:251657216;visibility:visible;mso-wrap-style:square; mso-width-percent:0;mso-height-percent:0;mso-wrap-distance-left:9pt; mso-wrap-distance-top:0;mso-wrap-distance-right:9pt; mso-wrap-distance-bottom:0;mso-position-horizontal:center; mso-position-horizontal-relative:margin;mso-position-vertical:absolute; mso-position-vertical-relative:text;mso-width-percent:0;mso-height-percent:0; mso-width-relative:page;mso-height-relative:page\'> <v:imagedata src="' . $sugar_config['site_url'] . "/modules/images/" . $tour->picture . '" o:title="phan%20thiet%20beach"/> <o:lock v:ext="edit" aspectratio="f"/> <w:wrap type="topAndBottom" anchorx="margin"/> </v:shape><![endif]--><![if !vml]><img width=627 height=312 src="' . $sugar_config['site_url'] . "/modules/images/" . $tour->picture . '" alt="" v:shapes="Picture_x0020_11"><![endif]><!--[if gte vml 1]></o:wrapblock> <![endif]--> '; } else { $main_picture = ''; } $template = str_replace('${PICTURE}', $main_picture, $template); // End issue 1438 $template = str_replace('${TOUR_PROGRAM_LINES}', html_entity_decode_utf8($tour->get_data_to_expor2word()), $template); $size = strlen($template); $filename = "TOUR_PROGRAM_" . $tour->name . ".doc"; ob_end_clean(); header("Cache-Control: private"); header("Content-Type: application/force-download;"); header("Content-Disposition:attachment; filename=\"{$filename}\""); header("Content-length:{$size}"); echo $template; ob_flush(); }
function display() { $focus = new Tour(); $quotes = new Quotes(); global $sugar_config, $mod_strings, $timedate; $ss = new Sugar_Smarty(); $db = DBManagerFactory::getInstance(); // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN; // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : ''; $department = isset($_GET["department"]) ? htmlspecialchars($_GET["department"]) : ''; $template = file_get_contents('modules/Quotes/tpls/export.tpl'); $quotes->retrieve($record); $focus->retrieve($quotes->quotes_toufa8brstours_idb); $content = $quotes->cost_detail; $content = base64_decode($content); $content = json_decode($content); $template = str_replace('{SITE_URL}', $sugar_config['site_url'], $template); if (!empty($focus->picture)) { $img = "<br/><img src='" . $sugar_config['site_url'] . "/modules/images/" . $focus->picture . "' width='600'/><br/><br/>"; } else { $img = ""; } $html = ''; if ($quotes->department == 'dos') { $html .= '<table cellpadding="0" cellspacing="0" border="0" class="content1" align="center">'; $html .= '<tr><td> </td> </tr>'; $html .= '<tr><td align="center"><i>' . $mod_strings['LBL_MOD_STRING_DOS_HEAD'] . '</i></td> </tr>'; $html .= '<tr><td align="center" style="font-size: 24px; color: blue">' . $focus->name . '</td></tr>'; $html .= '<tr><td align="justify">' . $focus->description . ' </tr>'; $html .= '<tr>'; $html .= '<tr><td class="tabDetailViewDL" align="center">' . $img . '</td></tr>'; $html .= '</tr>'; $html .= '</table>'; if (!empty($focus->start_date)) { $start_date = $timedate->to_display($focus->start_date, $timedate->get_date_format($current_user), 'd/m/Y'); // $start_date = date('d/m/Y',strtotime()); } else { $start_date = ''; } $html .= '<table align="center">'; $html .= '<tr>'; $html .= '<td class="tabDetailViewDL" align="left"><p>Thời gian : ' . $focus->duration . ' <br/> Mã tour: ' . $focus->tour_code . ' <br/> Phương tiện : ' . $focus->transport2 . ' <br/> Khởi hành : ' . $start_date . '<br/></p></td>'; $html .= '</tr>'; $html .= '</table><br/>'; $template = str_replace('{HEAD}', $html, $template); $html = ''; $cost_detail = $content->dos_cost_detail; if (count($cost_detail) > 0) { $html .= '<div id="dos" align="center"><table width="100%" class="table_clone" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse">'; $html .= '<thead>'; $html .= '<tr height="15">'; $html .= '<td class="tdborder" rowspan="2" style="text-align:center">' . $mod_strings['LBL_DOS_TICKET_VN'] . '</td>'; $html .= '<td class="tdborder" colspan="2" style="text-align:center">' . $mod_strings['LBL_DOS_TOUR_COST_VN'] . '</td>'; $html .= '<td class="tdborder" colspan="2" style="text-align:center">' . $mod_strings['LBL_DOS_SURCHANGE_VN'] . '</td>'; $html .= '</tr>'; $html .= '<tr height="15">'; $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_FARE_VN'] . '</td>'; $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_FACILITY_COST_VN'] . '</td>'; $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_SINGLE_ROM_VN'] . '</td>'; $html .= '<td class="tdborder" style="text-align:center">' . $mod_strings['LBL_DOS_FOREIGN_VN'] . '</td>'; $html .= '</tr>'; $html .= '</thead>'; $html .= '<tbody>'; if (count($cost_detail) > 0) { foreach ($cost_detail as $val) { $html .= '<tr height="15">'; $html .= '<td class="tdborder" align="center">' . translate('quotes_dos_hotel_standard', '', $val->dos_hotel_standard) . '</td>'; $html .= '<td class="tdborder" align="center">' . number_format($val->ticket_cost, 0, '', '.') . '</td>'; $html .= '<td class="tdborder" align="center">' . number_format($val->facility_cost, 0, '', '.') . '</td>'; $html .= '<td class="tdborder" align="center">' . number_format($val->single_room, 0, '', '.') . '</td>'; $html .= '<td class="tdborder" align="center">' . number_format($val->foreign, 0, '', '.') . '</td>'; $html .= '</tr>'; } } $html .= '</tbody>'; $html .= '</table> </div> '; $template = str_replace('{COST_DETAIL}', $html, $template); } $html = ''; $html .= '<h3 align="center">GIÁ TOUR TRỌN GÓI CHO CÁC DỊCH VỤ:</h3>'; $html .= '<table cellpadding="0" cellspacing="0" border="0" width="100%">'; $html .= '<tr>'; $html .= '<td align="justify"><h2><u><b>I. GIÁ TRÊN BAO GỒM:</b></u></h2></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Vận chuyển:</b></u><br/>' . html_entity_decode(nl2br($quotes->transport)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Khách sạn:</b></u><br/>' . html_entity_decode(nl2br($quotes->hotel)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Hướng dẫn viên</b></u>: <br/> ' . html_entity_decode(nl2br($quotes->guide)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Tham quan</b></u><br/>' . html_entity_decode(nl2br($quotes->room)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Ăn uống</b></u>: ' . html_entity_decode(nl2br($quotes->food)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Bảo hiểm</b></u>: <br/>' . html_entity_decode(nl2br($quotes->insurance)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><u><b>Khăn, nón, nước và quà tặng</b></u>: <br/>' . html_entity_decode(nl2br($quotes->other)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<tr>'; $html .= '<td> </td>'; $html .= '</tr>'; $html .= '<td align="justify"><h2><u><b>II. GIÁ TRÊN KHÔNG BAO GỒM :</b></u></h2></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify">' . html_entity_decode(nl2br($quotes->not_content)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify"><h2><u><b>III.GIÁ TOUR DÀNH CHO TRẺ EM</b></u> :</h2></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify">' . html_entity_decode(nl2br($quotes->child_cost)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="center"><h2>THÔNG TIN HƯỚNG DẪN</h2></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify">' . html_entity_decode(nl2br($quotes->surcharge)) . '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<p align="center"> <br/> <b>CARNIVAL TOURS HÂN HẠNH PHỤC VỤ QUÝ KHÁCH</b> </p>'; $template = str_replace('{DETAIL}', $html, $template); } elseif ($quotes->department == 'ib') { $html .= '<p align="center" style="font-size: 24px;"> </p>'; $html .= '<p align="center" style="font-size: 24px; color: blue">' . $focus->name . '</p>'; $html .= '<table>'; $html .= '<tr><td class="tabDetailViewDL" align="center">' . $img . '</td></tr>'; $html .= '</table>'; $html .= '<table align="center" cellpadding="0" cellspacing="0">'; $html .= '<tr> <td>Duration : </td> <td>' . $focus->duration . '</td></tr>'; $html .= '<tr> <td>Code tour : </td> <td>' . $focus->tour_code . '</td></tr>'; if (!empty($focus->start_date)) { $start_date = $timedate->to_display($focus->start_date, $timedate->get_date_format($current_user), 'd/m/Y'); // $start_date = date('d/m/Y',strtotime()); } else { $start_date = ''; } $html .= '<tr> <td>Start : </td> <td>' . $start_date . '</td></tr>'; $html .= '<tr> <td>Transport : </td> <td>' . $focus->transport2 . '</td></tr>'; // $html .= '<tr> <td>Depart from : </td> <td>'.$focus->.'</td></tr>'; $html .= '</table><br />'; $template = str_replace("{HEAD}", $html, $template); $html = ''; $cost_detail_head = $content->cost_detail_head; $ib_cose_detai = $content->ib_cose_detai; $html .= '<div id="inbound">'; $html .= '<table width="100%" border="1" class="table_clone" cellspacing="0" cellpadding="2" style="border-collapse:collapse">'; $html .= '<thead>'; $html .= '<tr height="15">'; $html .= '<td colspan="7" style="text-align:center" class="tdborder"><strong>' . $mod_strings['LBL_IB_TABLE_TITLE'] . '</strong></td>'; $html .= '</tr>'; $html .= '<tr height="15">'; $html .= '<td class="tdborder"><strong>' . $mod_strings['LBL_IB_GROUP_SIZE'] . '</strong></td>'; $html .= '<td class="tdborder">' . $cost_detail_head->group_site1 . '</td>'; $html .= '<td class="tdborder">' . $cost_detail_head->group_site2 . '</td>'; $html .= '<td class="tdborder">' . $cost_detail_head->group_site3 . '</td>'; $html .= '<td class="tdborder">' . $cost_detail_head->group_site4 . '</td>'; $html .= '<td class="tdborder">' . $cost_detail_head->group_site5 . '</td>'; $html .= '<td class="tdborder">' . $cost_detail_head->group_site6 . '</td>'; $html .= '</tr>'; $html .= '</thead>'; $html .= '<tbody>'; if (count($ib_cose_detai) > 0) { foreach ($ib_cose_detai as $val) { $html .= '<tr height="15">'; $html .= '<td class="tdborder">' . translate('quotes_ib_hotel_standard', '', $val->ib_hotel_standard) . '</td>'; $html .= '<td class="tdborder">' . $val->group_site1_cost . '</td>'; $html .= '<td class="tdborder">' . $val->group_site2_cost . '</td>'; $html .= '<td class="tdborder">' . $val->group_site3_cost . '</td>'; $html .= '<td class="tdborder">' . $val->group_site4_cost . '</td>'; $html .= '<td class="tdborder">' . $val->group_site5_cost . '</td>'; $html .= '<td class="tdborder">' . $val->group_site6_cost . '</td>'; $html .= '</tr>'; } } $html .= '</tbody>'; $html .= '</table>'; $html .= '</div>'; $template = str_replace('{COST_DETAIL}', $html, $template); $html = ''; $html .= '<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse">'; $html .= '<tr bgcolor="#CCCCCC">'; $html .= '<td align="center">' . $mod_strings['LBL_IB_INCLUDE'] . '</td>'; $html .= '<td align="center">' . $mod_strings['LBL_IB_EXCLUDE'] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="justify">' . html_entity_decode_utf8(nl2br($quotes->ib_include)) . '</td>'; $html .= '<td align="justify">' . html_entity_decode_utf8(nl2br($quotes->not_content)) . '</td>'; $html .= '</tr>'; $html .= '<tr bgcolor="#CCCCCC">'; $html .= '<td colspan="2" align="center">' . $mod_strings['LBL_IB_EXPORT_HOTEL'] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan="2" align="justify">' . html_entity_decode_utf8(nl2br($quotes->hotel)) . '</td>'; $html .= '</tr>'; $html .= '<tr bgcolor="#CCCCCC" align="justify">'; $html .= '<td colspan="2" align="center">' . $mod_strings['LBL_IB_EXPORT_SURCHARGE'] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan="2" align="justify">' . html_entity_decode_utf8(nl2br($quotes->surcharge)) . '</td>'; $html .= '</tr>'; $html .= '<tr bgcolor="#CCCCCC">'; $html .= '<td colspan="2" align="center">' . $mod_strings['LBL_IB_EXPORT_CHILD_POLICY'] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan="2" align="justify">' . html_entity_decode_utf8(nl2br($quotes->child_cost)) . '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<p> </p>'; $html .= '<p align="center">CARNIVAL TOURS – WITH YOU ALL THE WAY!</p>'; $template = str_replace('{DETAIL}', $html, $template); } elseif ($quotes->department == 'ob') { $html .= '<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">'; $html .= '<tr><td><br /><br /><br /></td> </tr>'; $html .= '<tr>'; $html .= '<td align="center">Chương trình du lịch</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="center"><p align="center" style="font-size: 24px; color: blue">' . $focus->name . '</p></td>'; $html .= '</tr>'; $html .= '<tr><td class="tabDetailViewDL" align="center">' . $img . '</td></tr>'; $html .= '<tr>'; $html .= '<td>'; $html .= '<table align="center" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse">'; $html .= '<tr>'; $html .= '<td align="left">Thời gian : ' . $focus->duration . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="left">Tour Code : ' . $focus->tour_code . '</td>'; $html .= '</tr>'; $html .= '<tr>'; if (!empty($focus->start_date)) { $start_date = $timedate->to_display($focus->start_date, $timedate->get_date_format($current_user), 'd/m/Y'); // $start_date = date('d/m/Y',strtotime()); } else { $start_date = ''; } $html .= '<td align="left">Khởi hành : ' . $start_date . '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table><br/>'; $html .= '<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">'; $html .= '<tr>'; $html .= '<td> Lịch bay tham khảo </td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td> <br/>' . html_entity_decode_utf8(nl2br($quotes->flight_schedules)) . '</td>'; $html .= '</tr>'; $html .= '</table>'; $template = str_replace("{HEAD}", $html, $template); $html = ''; $ob_cost_detail = $content->ob_cost_detail; $html .= '<table width="100%" border="0" class="table_clone" cellspacing="0" cellpadding="2" style="border-collapse:collapse">'; $html .= '<tr>'; $html .= '<td align="center"><b>Giá: ' . $ob_cost_detail->price . ' ' . translate('currency_dom', '', $ob_cost_detail->currency) . ' + ' . $ob_cost_detail->tax . ' ' . translate('currency_dom', '', $ob_cost_detail->currency) . '(Thuế) = ' . $ob_cost_detail->total_price . ' ' . translate('currency_dom', '', $ob_cost_detail->currency) . ' </b></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td align="center"><b>' . html_entity_decode_utf8(nl2br($ob_cost_detail->price_note)) . '</b></td>'; $html .= '</tr>'; $html .= '</table>'; $template = str_replace('{COST_DETAIL}', $html, $template); $html = ''; $html .= '<table cellspacing="0" cellpadding="0" border="0" style="border-collaspe:collapse" width="100%">'; $html .= '<tr>'; $html .= '<td> <u><b>' . $mod_strings['LBL_OB_INCLUDE_EXPORT'] . '</b></u><br/>' . html_entity_decode_utf8(nl2br($quotes->ib_include)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><br/> <u><b>' . $mod_strings['LBL_OB_EXCLUDE_EXPORT'] . '</b></u><br/>' . html_entity_decode_utf8(nl2br($quotes->not_content)) . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><br/> <u><b>' . $mod_strings['LBL_OB_NOTE_EXPORT'] . '</b></u><br/>' . html_entity_decode_utf8(nl2br($quotes->ob_notes)) . '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<p align="center"><font size="14pt">Carnival Tours Kính Chúc Quý Khách Một Chuyến Du Lịch Vui Vẻ. </p></p>'; $template = str_replace('{DETAIL}', $html, $template); } $template = str_replace("{TOUR_PROGRAM_LINE_DETAIL}", html_entity_decode_utf8($focus->get_data_to_expor2word($focus->id)), $template); $size = strlen($template); $filename = $quotes->name . ".doc"; ob_end_clean(); header("Cache-Control: private"); header("Content-Type: application/force-download;"); header("Content-Disposition:attachment; filename=\"{$filename}\""); header("Content-length:{$size}"); echo $template; ob_flush(); }
$template = str_replace("{START_DATE}", $row['start_date'],$template); $template = str_replace("{END_DATE}", $row['end_date'],$template); $template = str_replace("{VALUE}", $row['contract_value'],$template); $template = str_replace("{CURRENCY}", translate('currency_dom','',$row['currency']),$template); $template = str_replace("{DIVISION}", translate('division_dom','',$row['division']),$template); $template = str_replace("{ASSIGNED_TO}", $row['first_name'].' '.$row['last_name'],$template); $template = str_replace("{OPERATOR}", $row['operator'],$template); $template = str_replace("{DESCRIPTION}", html_entity_decode(nl2br( $row['description'])),$template); $template = str_replace("{TOUR_PROGRAM_LINE_DETAIL}", $tour->get_data_to_expor2word($record),$template);*/ $template = str_replace('${CODE}', $tour->tour_code, $template); $template = str_replace('${NAME}', $tour->name, $template); $template = str_replace('${TRANSPORT}', $tour->transport2, $template); $template = str_replace('${START_DATE}', $tour->start_date, $template); $template = str_replace('${DURATION}', $tour->duration, $template); $template = str_replace('${PICTURE}', $sugar_config['site_url'] . "/modules/images/" . $tour->picture, $template); $template = str_replace('${TOUR_PROGRAM_LINES}', html_entity_decode_utf8($tour->get_data_to_expor2word()), $template); $size = strlen($template); /*$filename = "TOUR_PROGRAM_".$tour->name.".doc"; ob_end_clean(); header("Cache-Control: private"); header("Content-Type: application/force-download;"); header("Content-Disposition:attachment; filename=\"$filename\""); header("Content-length:$size"); echo $template; ob_flush();*/ //added 09-06-2012 $filename = "TOUR_PROGRAM_" . $tour->name; /*$mpdf=new mPDF(); $mpdf->WriteHTML($template); $mpdf->Output($filename, "D");//D=Download; I-Internal - xem trực tiếp file*/