function getNumOfCus(&$bean, $event, $arguments) { global $db; //$id = $_POST['grouplists87eduplists_ida']; // if( $id != ""){ // $sql = "SELECT // f.last_name // FROM grouplists_fits_c gf // INNER JOIN fits f // ON f.id = gf.grouplists4843itsfits_idb // WHERE gf.deleted = 0 // AND f.deleted = 0 // AND grouplistsd262uplists_ida = '".$id."' // UNION ALL SELECT f.last_name FROM grouplists_accounts_c ga INNER JOIN accounts a ON ga.grouplistsa472ccounts_idb = a.id // INNER JOIN accounts_fits_c af ON a.id = af.accounts_fd483ccounts_ida INNER JOIN fits f ON f.id = af.accounts_f7035itsfits_idb // WHERE ga.deleted = 0 AND a.deleted = 0 AND f.deleted = 0 AND af.deleted = 0 AND ga.grouplists228auplists_ida ='".$id."'" ; // $result = $db->query($sql); // $bean->countofcus= $db->getRowCount($result); // } // fix bug 1266 $made_tour = new GroupProgram(); $made_tour->retrieve($bean->id); $group_list = new GroupLists(); $group_list->retrieve($made_tour->grouplists87eduplists_ida); $bean->countofcus = $group_list->num_of_cus; }
} require_once 'modules/GroupPrograms/GroupProgram.php'; require_once 'modules/GroupPrograms/Forms.php'; require_once 'modules/Releases/Release.php'; global $db; global $app_strings; global $mod_strings; global $mod_strings; global $current_user; global $sugar_version, $sugar_config; $focus = new GroupProgram(); $seedRelease = new Release(); $json = getJSONobj(); $ss = new Sugar_Smarty(); if (isset($_REQUEST['record'])) { $focus->retrieve($_REQUEST['record']); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $focus->id = ""; $focus->number = ""; } // BUILD MODULE TITLE LINE echo "\n<p>\n"; echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true); echo "\n</p>\n"; global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; require_once $theme_path . 'layout_utils.php'; $GLOBALS['log']->info("GroupProgram edit view"); if (isset($_REQUEST['return_module'])) {
function display() { global $sugar_config; global $mod_strings; global $curent_language; $focus = new RoomLists(); // 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"]) : ''; $template = file_get_contents('modules/RoomLists/tpls/RoomLists1.htm'); $focus->retrieve($record); $template = str_replace('{SITE_URL}', $sugar_config['site_url'], $template); if ($focus->department == 'ib' || $focus->department == 'ob') { $template = str_replace('{LBL_TITLE}', $mod_strings['LBL_TITLE'], $template); $template = str_replace('{LBL_TOUR}', $mod_strings['LBL_TOUR'], $template); $template = str_replace('{LBL_HOTEL_NAME}', $mod_strings['LBL_HOTEL_NAME'], $template); $template = str_replace('{LBL_ROOM_NAME}', $mod_strings['LBL_ROOM_NAME'], $template); $template = str_replace('{LBL_NUMBER}', $mod_strings['LBL_NUMBER'], $template); $template = str_replace('{LBL_CUS_NAME}', $mod_strings['LBL_CUS_NAME'], $template); $template = str_replace('{LBL_CUS_GENDER}', $mod_strings['LBL_GENDER'], $template); $template = str_replace('{LBL_PHONE}', $mod_strings['LBL_PHONE'], $template); $template = str_replace('{LBL_ROOM_TYPE}', $mod_strings['LBL_ROOM_TYPE'], $template); $template = str_replace('{LBL_ROOM_CLASS}', $mod_strings['LBL_ROOM_CLASS'], $template); $template = str_replace('{LBL_ROOM_REMARK}', $mod_strings['LBL_ROOM_REMARK'], $template); $template = str_replace('{LBL_ROOM_NOTE}', $mod_strings['LBL_ROOM_NOTE'], $template); $template = str_replace('{LBL_TOTAL}', $mod_strings['LBL_TOTAL'], $template); } if ($focus->department == 'dos') { $template = str_replace('{LBL_TITLE}', 'Danh sách phòng ' . $focus->made_tour, $template); $template = str_replace('{LBL_TOUR}', 'Tên tour', $template); $template = str_replace('{LBL_HOTEL_NAME}', 'Khách sạn', $template); $template = str_replace('{LBL_ROOM_NAME}', 'SỐ PHÒNG', $template); $template = str_replace('{LBL_NUMBER}', 'STT', $template); $template = str_replace('{LBL_CUS_NAME}', 'HỌ VÀ TÊN', $template); $template = str_replace('{LBL_CUS_GENDER}', 'GIỚI TÍNH', $template); $template = str_replace('{LBL_PHONE}', 'SỐ ĐT', $template); $template = str_replace('{LBL_ROOM_TYPE}', 'LOẠI PHÒNG', $template); $template = str_replace('{LBL_TOTAL}', 'TỔNG CỘNG', $template); } $template = str_replace('{TOUR_NAME}', $focus->made_tour, $template); $template = str_replace('{HOTEL_NAME}', $focus->tenks, $template); $made_tour_id = $focus->made_tour_id; $groupprogram = new GroupProgram(); $groupprogram->retrieve($made_tour_id); $start_date = $groupprogram->start_date_group; $end_date = $groupprogram->end_date_group; $tour_code = $groupprogram->tour_code; $group_name = $groupprogram->grouplists_pprograms_name; $inbound = " <td width=104 valign=top style='width:77.7pt;border:solid windowtext 1.0pt;\r\n border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:\r\n solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'>" . $mod_strings['LBL_ROOM_CLASS'] . "</p>\r\n </td>\r\n \r\n <td width=106 valign=top style='width:79.5pt;border:solid windowtext 1.0pt;\r\n border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:\r\n solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'>" . $mod_strings['LBL_ROOM_REMARK'] . "</p>\r\n </td>"; $dos = " <td width=102 valign=top style='width:76.8pt;border:solid windowtext 1.0pt;\r\n border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:\r\n solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'>GHI CHÚ</p>\r\n </td> "; if ($focus->department == 'dos') { $name_label = 'HỌ VÀ TÊN'; } if ($focus->department == 'ob') { $template = str_replace('{INBOUND}', '', $template); $template = str_replace('{DOS}', '', $template); $head = "<p class=MsoNormal><b style='mso-bidi-font-weight:normal'>From :" . $start_date . " To : " . $end_date . "<o:p></o:p></b></p>"; $template = str_replace('{OUTBOUND_HEAD}', $head, $template); $cus_mun = $mod_strings['LBL_PAX']; } if ($focus->department == 'ib' || $focus->department == 'dos') { $cus_name_label = "<td width=210 valign=top style='width:157.5pt;border:solid windowtext 1.0pt;\r\n border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:\r\n solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><span class=SpellE>" . $name_label . "</span></p>\r\n </td>"; } if ($focus->department == 'ob') { $cus_name_label = "<td width=210 valign=top style='width:157.5pt;border:solid windowtext 1.0pt;\r\n border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:\r\n solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><span class=SpellE>" . $mod_strings['LBL_FIRST_NAME'] . "</span></p>\r\n </td>\r\n \r\n <td width=210 valign=top style='width:157.5pt;border:solid windowtext 1.0pt;\r\n border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:\r\n solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><span class=SpellE>" . $mod_strings['LBL_LAST_NAME'] . "</span></p>\r\n </td>\r\n \r\n "; } $template = str_replace('{CUS_NAME}', $cus_name_label, $template); $html = ""; $temp = base64_decode($focus->content); $noidung = json_decode($temp); $stt = 1; $total_room = 0; if (count($noidung) > 0) { foreach ($noidung as $val) { $total_room++; $room_name = $val->room_name; $room_type = translate('roomlist_room_type_dom', '', $val->room_type); $room_class = $val->room_class; $room_remark = $val->room_remark; $room_number = $val->room_number; $room_note = $val->room_note; $list_cus = $val->list_cus; $count = count($list_cus); $html .= "<tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes'>"; $html .= "<td width=104 rowspan=" . $count . " valign=top style='width:78.35pt;border:solid windowtext 1.0pt;\r\n border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;\r\n padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $room_name . "</o:p></p>\r\n </td>"; $html .= "<td width=104 rowspan=" . $count . " valign=top style='width:77.7pt;border-top:none;\r\n border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $room_type . "</o:p></p>\r\n </td>"; if ($focus->department == 'ib') { $html .= "<td width=104 rowspan=" . $count . " valign=top style='width:77.7pt;border-top:none;\r\n border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $room_class . "</o:p></p>\r\n </td>"; //"<td width=128 style='width:95.75pt;border:solid windowtext 1.0pt;border-top: $html .= "<td width=106 rowspan=" . $count . " valign=top style='width:79.5pt;border-top:none;\r\n border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $room_remark . "</o:p></p>\r\n </td>"; } if ($focus->department == 'dos') { $html .= "<td width=102 rowspan=" . $count . " valign=top style='width:76.8pt;border-top:none;\r\n border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $room_note . "</o:p></p>\r\n </td>"; } $cus_val = $list_cus[0]; $temp = explode('_', $cus_val); $html .= "<td width=41 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $stt . "</o:p></p>\r\n </td>"; if ($focus->department == 'ib' || $focus->department == 'dos') { $cus_name = $temp[1] . ' ' . $temp['2']; $html .= "<td width=147 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $cus_name . "</o:p></p>\r\n </td>"; } if ($focus->department == 'ob') { $first_name = $temp[1]; $last_name = $temp['2']; $html .= "<td width=147 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $first_name . "</o:p></p>\r\n </td>"; $html .= "<td width=147 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $last_name . "</o:p></p>\r\n </td>"; } $stt++; for ($i = 1; $i < count($list_cus); $i++) { $cus_val = $list_cus[$i]; $temp = explode('_', $cus_val); $cus_name = $temp[0]; $cus_gender = $temp[1]; $cus_phone = $temp[2]; $html .= "<tr style='mso-yfti-irow:2;height:4.5pt'>"; $html .= "<td width=41 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $stt . "</o:p></p>"; $html .= "</td>"; if ($focus->department == 'ib' || $focus->department == 'dos') { $cus_name = $temp[1] . ' ' . $temp['2']; $html .= "<td width=147 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $cus_name . "</o:p></p>\r\n </td>"; } if ($focus->department == 'ob') { $first_name = $temp[1]; $last_name = $temp['2']; $html .= "<td width=147 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $first_name . "</o:p></p>\r\n </td>"; $html .= "<td width=147 valign=top style='width:72.05pt;border-top:none;border-left:\r\n none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;\r\n mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;\r\n mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;height:4.5pt'>\r\n <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:\r\n normal'><o:p>" . $last_name . "</o:p></p>\r\n </td>"; } $html .= "</tr> "; $html .= "</tr>"; $stt++; } } } $total = $stt - 1; if ($focus->department == 'dos') { $name_label = 'HỌ VÀ TÊN'; $template = str_replace('{INBOUND}', '', $template); $template = str_replace('{DOS}', $dos, $template); $head = "<p class=MsoNormal> Tên đoàn : " . $group_name . " <br/>\r\n Tour Code: " . $tour_code . " \r\n <br/>Ngày khởi hành : " . $start_date . " Ngày kết thúc : " . $end_date . "\r\n <br/> Số Lượng : " . $total . " Khách\r\n </p>"; $template = str_replace('{OUTBOUND_HEAD}', $head, $template); $cus_mun = 'Khách'; $template = str_replace('{TOTAL}', '', $template); } if ($focus->department == 'ob') { $template = str_replace('{TOTAL}', $mod_strings['LBL_TOTAL'] . " : " . $total . ' ' . $cus_mun, $template); } if ($focus->department == 'ib') { $template = str_replace('{INBOUND}', $inbound, $template); $template = str_replace('{DOS}', '', $template); $name_label = $mod_strings['LBL_CUS_NAME']; $cus_mun = $mod_strings['LBL_PAX']; $head = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\r\n <tr>\r\n <td> Tour code: </td> <td>" . $tour_code . "</td>\r\n <td> Party name </td> <td>" . $focus->party_name . " </td>\r\n </tr>\r\n <tr>\r\n <td> Arival : </td> <td> " . $start_date . " </td>\r\n <td> Departure : </td> <td>" . $end_date . "</td>\r\n </tr>\r\n <tr>\r\n <td> Number of pax : </td> <td>" . $total . "</td>\r\n <td>Tour Guide: </td><td>" . $focus->tour_guide . "</td>\r\n </tr>\r\n </table> "; $template = str_replace('{OUTBOUND_HEAD}', $head, $template); $template = str_replace('{TOTAL}', 'Total room: ' . $total_room, $template); } $template = str_replace('{DATA_DETAIL}', $html, $template); $size = strlen($template); $filename = "Danh Sach Phong.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(); }
require_once 'modules/AOS_PDF_Templates/templateParser.php'; require_once 'modules/AOS_PDF_Templates/sendEmail.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; global $mod_strings; $module_type = $_REQUEST['module']; $module = new ContractLiquidate(); $module_type_file = strtoupper(ltrim(rtrim($module_type, 's'), '')); $module_type_low = strtolower($module_type); $module->retrieve($_REQUEST['contractid']); //Lay thong tin cua hop dong goc $contract = new Contract(); $contract->retrieve($module->contract_id); //End //Lay thong tin cua made tour $madetour = new GroupProgram(); $madetour->retrieve($contract->groupprogr4251rograms_ida); //End //Lay thong tin cua tour $tour = new Tour(); $tour->retrieve($madetour->tour_id); //End $task = $_REQUEST['task']; $doc = new clsMsDocGenerator(); $contractliquidatevalue = array(); $sql = "SELECT * FROM contractliquidatevalues WHERE contract_liquidate_id ='" . $module->id . "'and deleted = 0"; $res = $module->db->query($sql); while ($row = $module->db->fetchByAssoc($res)) { $contractliquidatevalue[$row['id']] = $row['contract_liquidate_id']; } $contractliquidateincre = array(); $sql1 = "SELECT * FROM contractliquidateincre WHERE contract_liquidate_id ='" . $module->id . "' AND deleted = 0";
<?php if (isset($_REQUEST['id']) && isset($_REQUEST['dachuyengiao'])) { $id = $_REQUEST['id']; // service ID $dachuyengiao = $_REQUEST['dachuyengiao']; // service ID $result = array(); if ($id != '' && $dachuyengiao == 0) { $madetour = new GroupProgram(); $madetour->retrieve($id); $task = new Task(); $task->assigned_user_id = $madetour->operator_id; $task->name = 'Xác nhận Thực Hiện Tour'; $task->description = 'Xác nhận với bộ phận Sales rằng đã nhận chuyển giao Thực Hiện Tour, chọn completed để xác nhận !'; $task->parent_id = $madetour->id; $task->parent_type = 'GroupPrograms'; $task->priority = 'High'; $task->parent_name = $madetour->name; $result['result'] = $task->save(); $result['task_id'] = $task->id; } elseif ($id != '' && $dachuyengiao == 1) { $dachuyengiao_task = $_REQUEST['dachuyengiao_task']; $task = new Task(); $task->retrieve($dachuyengiao_task); $task->status = 'Completed'; $result['result'] = $task->save(); } if ($result['result']) { $result['result'] = 1; } else {
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } require_once 'modules/GroupPrograms/GroupProgram.php'; require_once 'include/formbase.php'; require_once 'modules/GroupsProgramsLine/GroupsProgramsLine.php'; require_once 'modules/Guide/Guide.php'; require_once 'modules/TeamLeader/TeamLeader.php'; require_once 'modules/PickUpCars/PickUpCars.php'; require_once 'modules/SightSeeingCars/SightSeeingCars.php'; include "config.php"; global $sugar_config; $focus = new GroupProgram(); $focus->retrieve($_POST['record']); if (!$focus->ACLAccess('Save')) { ACLController::displayNoAccess(true); sugar_cleanup(true); } if (!empty($_POST['assigned_user_id']) && $focus->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) { $check_notify = TRUE; } else { $check_notify = FALSE; } foreach ($focus->column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value; } }
function display() { global $sugar_config, $mod_strings, $app_strings; $focus = new RestaurantBookings(); $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"]) : ''; $template = file_get_contents('modules/RestaurantBookings/tpls/export.tpl'); /* Delete by Hieu Nguyen 270712 //$sql = "select * from tours where id ='".$record."' and deleted = 0"; $sql = " SELECT srv.res_address , srv.code , srv.attn_res_name , srv.attn_res_phone , srv.res_tel , srv.res_fax , srv.company , srv.attn_name , srv.attn_phone , srv.attn_id , srv.attn_email , srv.attn_tel , srv.attn_fax , srv.nationlity , srv.notes , srv.confirm , srv.date , srv.deparment , srv.date_time , srv.operating_date , srv.quantity_pax , srv.guide , srv.guide_id , srv.guide_phone ,res.name ,res.code as res_code ,grp.groupprogram_code FROM restaurantbookings srv LEFT JOIN restaurantsrantbookings_c ressvr ON srv.id = ressvr.restaurantd663ookings_idb LEFT JOIN restaurants res ON ressvr.restaurant437baurants_ida = res.id LEFT JOIN groupprograrantbookings_c grpsrv ON srv.id = grpsrv.groupprogre72bookings_idb LEFT JOIN groupprograms grp ON grpsrv.groupprogr880erograms_ida =grp.id WHERE srv.deleted = 0 AND ressvr.deleted = 0 AND res.deleted = 0 AND grpsrv.deleted = 0 AND grp.deleted =0 AND srv.id = '".$record."'"; $result = $db->query($sql); $row = $db->fetchByAssoc($result); */ $template = str_replace("{LBL_TO}", $mod_strings['LBL_TO'], $template); $template = str_replace("{LBL_RES_ADDRESS}", $mod_strings['LBL_RES_ADDRESS'], $template); $template = str_replace("{LBL_ATTN_RES_NAME}", $mod_strings['LBL_ATTN_RES_NAME'], $template); $template = str_replace("{LBL_RES_TEL}", $mod_strings['LBL_RES_TEL'], $template); $template = str_replace("{LBL_RES_FAX}", $mod_strings['LBL_RES_FAX'], $template); $template = str_replace("{LBL_FROM}", $mod_strings['LBL_FROM'], $template); $template = str_replace("{LBL_ATTN_NAME}", $mod_strings['LBL_ATTN_NAME'], $template); $template = str_replace("{LBL_EMAIL}", $mod_strings['LBL_EMAIL'], $template); $template = str_replace("{LBL_TEL}", $mod_strings['LBL_TEL'], $template); $template = str_replace("{LBL_TITLE}", $mod_strings['LBL_TITLE'], $template); $template = str_replace("{LBL_OPERATING_DATE}", $mod_strings['LBL_OPERATING_DATE'], $template); $template = str_replace("{LBL_MADE_TOUR}", $mod_strings['LBL_MADE_TOUR'], $template); $template = str_replace("{LBL_NATIONLITY}", $mod_strings['LBL_NATIONLITY'], $template); $template = str_replace("{LBL_QUANTITY_PAX}", $mod_strings['LBL_QUANTITY_PAX'], $template); $template = str_replace("{LBL_GUIDE}", $mod_strings['LBL_GUIDE'], $template); $template = str_replace("{LBL_TIME}", $mod_strings['LBL_TIME'], $template); $template = str_replace("{LBL_QUANTITY}", $mod_strings['LBL_QUANTITY'], $template); $template = str_replace("{LBL_UNIT_PRICE}", $mod_strings['LBL_UNIT_PRICE'], $template); $template = str_replace("{LBL_MENU}", $mod_strings['LBL_MENU'], $template); $template = str_replace("{LBL_NOTES}", $mod_strings['LBL_NOTES'], $template); $template = str_replace("{LBL_CONFIRM_SERVICE}", $mod_strings['LBL_CONFIRM_SERVICE'], $template); $template = str_replace("{LBL_DATE}", $mod_strings['LBL_DATE'], $template); $template = str_replace("{LBL_CONFIRM_CARNIVAL}", $mod_strings['LBL_CONFIRM_CARNIVAL'], $template); //////////// $template = str_replace("{SITE_URL}", $sugar_config['site_url'], $template); $template = str_replace("{RES}", $this->bean->restaurantstbookings_name, $template); $template = str_replace("{ADDRESS}", $this->bean->res_address, $template); $template = str_replace("{ATTN_RES_NAME}", $this->bean->attn_res_name, $template); $template = str_replace("{ATTN_RES_PHONE}", $this->bean->attn_res_phone, $template); $template = str_replace("{RES_TEL}", $this->bean->res_tel, $template); $template = str_replace("{RES_FAX}", $this->bean->res_fax, $template); $template = str_replace("{FROM}", $this->bean->company, $template); //$template = str_replace("{ATTN_NAME}", $this->bean->attn_name,$template ); $template = str_replace("{ATTN_NAME}", $this->bean->assigned_user_name, $template); $template = str_replace("{ATTN_PHONE}", $this->bean->attn_phone, $template); $template = str_replace("{ATTN_EMAIL}", $this->bean->attn_email, $template); $template = str_replace("{TEL}", $this->bean->attn_tel, $template); $template = str_replace("{FAX}", $this->bean->attn_fax, $template); $template = str_replace("{DATE_TIME}", $this->bean->date_time, $template); $template = str_replace("{OPERATING_DATE}", $this->bean->operating_date, $template); $template = str_replace("{QUANTITY_PAX}", $this->bean->quantity_pax, $template); $template = str_replace("{GUIDE}", $this->bean->guide, $template); $template = str_replace("{GUIDE_PHONE}", $this->bean->guide_phone, $template); // Lay ra code cua MadeTour $made_tour = new GroupProgram(); $made_tour->retrieve($this->bean->groupprogr880erograms_ida); $template = str_replace("{MADETOUR}", $made_tour->groupprogram_code, $template); // fix bug 1487 if (!empty($this->bean->nationlity)) { $template = str_replace("{NATIONLITY}", translate('countries_dom', '', $this->bean->nationlity), $template); } else { $template = str_replace("{NATIONLITY}", '', $template); } $template = str_replace("{BOOKINGLINE}", $focus->get_servicebooking_detailview($record), $template); $template = str_replace("{NOTES}", html_entity_decode(nl2br($this->bean->notes)), $template); if ($this->bean->confirm == 0) { $template = str_replace("{CONFIRM}", 'No', $template); } else { $template = str_replace("{CONFIRM}", 'Yes', $template); } $template = str_replace("{DATE}", $this->bean->date, $template); $template = str_replace("{DEPARMENT}", $this->bean->deparment, $template); $size = strlen($template); $filename = "Restaurant_Booking_" . strtoupper($this->bean->code) . "_To_" . mb_strtoupper($this->bean->restaurantstbookings_name, 'UTF-8') . ".doc"; // fix issue 1485 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(); }