- Tạo đối tượng template ,lấy dữ liệu template từ thuộc tính(thông qua một 
   dropdow_template) teamplate của module.
 - Lấy dữ liệu của template này đưa vào một biến text.
 - Chuyển dữ liệu từ module và biến text này vào hàm 'templateParser::parse_template', hàm
   này trả ra một biến text đã được điền dữ liệu.
 - Sau đó xuất ra file word với nội dung là đoạn text này và các formmat cần thiết.
 
*******************************************************************/
require_once 'modules/AOS_PDF_Templates/clsMsDocGenerator.php';
require_once 'modules/AOS_PDF_Templates/PDF_Lib/mpdf.php';
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
Ejemplo n.º 2
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once 'modules/ContractLiquidate/ContractLiquidate.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 ContractLiquidate();
$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/";
Ejemplo n.º 3
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once 'modules/ContractLiquidate/ContractLiquidate.php';
require_once 'include/formbase.php';
require_once 'modules/ContractLiquidateValues/ContractLiquidateValues.php';
require_once 'modules/ContractLiquidateIncre/ContractLiquidateIncre.php';
require_once 'modules/ContractLiquidateDecre/ContractLiquidateDecre.php';
include "config.php";
global $sugar_config;
$focus = new ContractLiquidate();
$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];
        switch ($field) {
            case 'template_ddown_c':
                $value = implode("^,^", $_POST[$field]);
                break;
            default:
Ejemplo n.º 4
0
 function display()
 {
     global $sugar_config, $mod_strings, $app_strings;
     $focus = new ContractLiquidate();
     $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"]) : '';
     $focus->retrieve($record);
     $template = file_get_contents('modules/ContractLiquidate/tpls/export.tpl');
     //$sql = "select * from tours where id ='".$record."' and deleted = 0";
     $contract = new Contract();
     $contract->retrieve($focus->contract_id);
     $template = str_replace("{DAY}", $focus->day, $template);
     $template = str_replace("{MONTH}", $focus->month, $template);
     $template = str_replace("{YEAR}", $focus->year, $template);
     $template = str_replace("{position_a}", translate('position_dom', '', $contract->position_a), $template);
     $template = str_replace("{position_b}", translate('position_dom', '', $contract->position_b), $template);
     $template = str_replace("{address_a}", $contract->address_a, $template);
     $template = str_replace("{phone_a}", $contract->phone_a, $template);
     $template = str_replace("{fax_a}", $contract->fax_a, $template);
     $template = str_replace("{mst_bena}", $contract->mst_bena, $template);
     $template = str_replace("{BENB}", $contract->parent_name, $template);
     $template = str_replace("{address_b}", $contract->address_b, $template);
     $template = str_replace("{phone_b}", $contract->phone_b, $template);
     $template = str_replace("{fax_b}", $contract->fax_b, $template);
     $template = str_replace("{mst_benb}", $contract->mst_benb, $template);
     $template = str_replace("{TONGCONG_CONTRACT_KEHOACH}", format_number($focus->tongcong_contract_kehoach), $template);
     $template = str_replace("{TONGCONG_CONTRACT_THUCTE}", format_number($focus->tongcong_contract_thucte), $template);
     $template = str_replace("{TONGCONG_TANG_KEHOACH}", format_number($focus->tongcong_tang_kehoach), $template);
     $template = str_replace("{TONGCONG_TANG_THUCTE}", format_number($focus->tongcong_tang_thucte), $template);
     $template = str_replace("{TONGCONG_GIAM_KEHOACH}", format_number($focus->tongcong_giam_kehoach), $template);
     $template = str_replace("{TONGCONG_GIAM_THUCTE}", format_number($focus->tongcong_giam_thucte), $template);
     $template = str_replace("{TONGTIEN_KEHOACH}", format_number($focus->tongtien_kehoach), $template);
     $template = str_replace("{TONGTIEN_THUCTE}", format_number($focus->tongtien_thucte), $template);
     $template = str_replace("{TIENTHANHTOAN}", format_number($focus->tienthanhtoan), $template);
     $template = str_replace("{TIENCONLAI}", format_number($focus->tienconlai), $template);
     $template = str_replace("{TIENTRALAI}", format_number($focus->tientralai), $template);
     $template = str_replace("{GIATRIHOPDONG}", $focus->giatrihopdong_detail(), $template);
     $template = str_replace("{PHATSINHTANG}", $focus->phatsinhtang_detail(), $template);
     $template = str_replace("{PHATSINHGIAM}", $focus->phatsinhgiam_detail(), $template);
     $template = str_replace("{BANGCHU}", $focus->bangchu, $template);
     $template = str_replace("{DAIDIENBENA}", $contract->daidienbena, $template);
     $template = str_replace("{DAIDIENBENB}", $contract->daidienbenb, $template);
     $template = str_replace("{LBL_TITLE_THANH_LY}", $mod_strings['LBL_TITLE_THANH_LY'], $template);
     $template = str_replace("{LBL_BEN_A}", $mod_strings['LBL_BEN_A'], $template);
     $template = str_replace("{LBL_COM_NAME}", $mod_strings['LBL_COM_NAME'], $template);
     $template = str_replace("{LBL_BEN_A_NAME}", $mod_strings['LBL_BEN_A_NAME'], $template);
     $template = str_replace("{LBL_POSITION}", $mod_strings['LBL_POSITION'], $template);
     $template = str_replace("{LBL_ADDRESS}", $mod_strings['LBL_ADDRESS'], $template);
     $template = str_replace("{LBL_PHONE}", $mod_strings['LBL_PHONE'], $template);
     $template = str_replace("{LBL_FAX}", $mod_strings['LBL_FAX'], $template);
     $template = str_replace("{LBL_TAX}", $mod_strings['LBL_TAX'], $template);
     $template = str_replace("{LBL_BEN_B}", $mod_strings['LBL_BEN_B'], $template);
     $template = str_replace("{LBL_BEN_B_NAME}", $mod_strings['LBL_BEN_B_NAME'], $template);
     $template = str_replace("{LBL_NOIDUNG_THANH_LY}", $mod_strings['LBL_NOIDUNG_THANH_LY'], $template);
     $template = str_replace("{LBL_NOIDUNG}", $mod_strings['LBL_NOIDUNG'], $template);
     $template = str_replace("{LBL_KEHOACH}", $mod_strings['LBL_KEHOACH'], $template);
     $template = str_replace("{LBL_THUCTE}", $mod_strings['LBL_THUCTE'], $template);
     $template = str_replace("{LBL_DONGIA}", $mod_strings['LBL_DONGIA'], $template);
     $template = str_replace("{LBL_SL}", $mod_strings['LBL_SL'], $template);
     $template = str_replace("{LBL_THANHTIEN}", $mod_strings['LBL_THANHTIEN'], $template);
     $template = str_replace("{LBL_TONGGIATRIHD}", $mod_strings['LBL_TONGGIATRIHD'], $template);
     $template = str_replace("{LBL_TONGCONG}", $mod_strings['LBL_TONGCONG'], $template);
     $template = str_replace("{LBL_CHIPHIPHATSINHTANG}", $mod_strings['LBL_CHIPHIPHATSINHTANG'], $template);
     $template = str_replace("{LBL_CHIPHIPHATSINHGIAM}", $mod_strings['LBL_CHIPHIPHATSINHGIAM'], $template);
     $template = str_replace("{LBL_TONGTRIGIATOUR}", $mod_strings['LBL_TONGTRIGIATOUR'], $template);
     $template = str_replace("{LBL_BENBTHANHTOANBENA}", $mod_strings['LBL_BENBTHANHTOANBENA'], $template);
     $template = str_replace("{LBL_BENBNOBENA}", $mod_strings['LBL_BENBNOBENA'], $template);
     $template = str_replace("{LBL_BENANOBENB}", $mod_strings['LBL_BENANOBENB'], $template);
     $template = str_replace("{LBL_BANGCHU}", $mod_strings['LBL_BANGCHU'], $template);
     $template = str_replace("{LBL_THONGTINCHUNG}", $mod_strings['LBL_THONGTINCHUNG'], $template);
     $template = str_replace("{LBL_DAIDIENBENA}", $mod_strings['LBL_DAIDIENBENA'], $template);
     $template = str_replace("{LBL_DAIDIENBENB}", $mod_strings['LBL_DAIDIENBENB'], $template);
     $size = strlen($template);
     $filename = $focus->number . ".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();
 }