コード例 #1
0
 function display()
 {
     global $sugar_config, $timedate;
     $focus = new GroupLists();
     $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"]) : '';
     $template = file_get_contents('modules/GroupLists/tpls/Export.tpl');
     $sql = "SELECT\r\n                 g.groupprogram_code\r\n                ,g.tour_name\r\n                ,g.end_date_group\r\n                ,g.start_date_group\r\n                FROM\r\n                  groupprograms g INNER JOIN grouplists_roupprograms_c ggr ON g.id = ggr.grouplistsf242rograms_idb \r\n                  INNER JOIN grouplists gl ON gl.id = ggr.grouplists87eduplists_ida \r\n                WHERE gl.deleted = 0 AND ggr.deleted = 0 AND g.deleted = 0 AND ggr.grouplists87eduplists_ida = '" . $record . "'";
     $result = $db->query($sql);
     $row = $db->fetchByAssoc($result);
     $template = str_replace("{TOURNAME}", mb_strtoupper($row['tour_name'], 'utf-8'), $template);
     $template = str_replace("{SITE_URL}", $sugar_config['site_url'], $template);
     $template = str_replace("{CODE}", $row['groupprogram_code'], $template);
     $template = str_replace("{START_DATE}", $timedate->to_display_date($row['start_date_group'], true), $template);
     $template = str_replace("{END_DATE}", $timedate->to_display_date($row['end_date_group'], true), $template);
     $template = str_replace("{SOLUONG}", $focus->get_count($record), $template);
     $template = str_replace("{TEL}", '', $template);
     $template = str_replace("{FAX}", '', $template);
     //$template = str_replace("{LIST_GIT}", $focus->get_GIT_to_report("('".$record."')"),$template);
     $template = str_replace("{LIST_FIT}", $focus->get_customer_list("('" . $record . "')"), $template);
     $template = str_replace("{DATE}", date('d/m/Y'), $template);
     $size = strlen($template);
     $filename = "DS Doan " . mb_strtoupper($row['tour_name'], 'utf-8') . ".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();
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 function listViewProcess()
 {
     $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
     global $sugar_config;
     global $current_user;
     global $app_strings;
     global $timedate;
     $type = clean_string($_REQUEST['module']);
     $db = DBManagerFactory::getInstance();
     /* $query = $_REQUEST['query'];
        if($query){
            $ret_array = generateSearchWhere($type, $_REQUEST['current_post']);
            $w = $ret_array['where'];
            $where = "IN ( SELECT id from grouplists WHERE ".$w .")";  
        }
        else{
            $where = '';
        } */
     /*$ids = $_REQUEST['uid']; 
                 if($ids) {
                     $ids = explode(',', $ids);
                     $ids = "'" . implode("','", $ids) . "'";
                     $where = "in ($ids)";
                 } 
                 else if (isset($_REQUEST['all']) ){
                         $where = '';//get all
     
                     } else {
                         if(!empty($_REQUEST['current_post'])) {
                             $ret_array = generateSearchWhere($type, $_REQUEST['current_post']);
     
                             $w = $ret_array['where'];
                             $where = "IN ( SELECT id from grouplists WHERE ".$w .")";
     
                         } else {
                             $where = '';
                         }
                 }*/
     $focus = new GroupLists();
     // $query = $focus->create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false, $parentbean=null, $singleSelect = false);
     $query = $focus->{$start_date} = $_REQUEST['start_date'];
     $end_date = $_REQUEST['end_date'];
     $template = file_get_contents('modules/GroupLists/tpls/report.tpl');
     $template = str_replace('{START}', $start_date, $template);
     $template = str_replace('{END}', $end_date, $template);
     $template = str_replace('{LIST_GIT}', $focus->get_GIT_to_report($where), $template);
     $template = str_replace('{LIST_FIT}', $focus->get_FIT_to_report($where), $template);
     $size = strlen($template);
     $filename = "DS KHACH DI TOUR TU " . $start_date . " DEN " . $end_date . ".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();
     //    header("Location: index.php?module=GroupLists&action=index");
     sugar_cleanup(true);
 }
コード例 #4
0
    $where = "({$ids})";
} else {
    if (isset($_REQUEST['all'])) {
        $where = '';
        //get all
    } else {
        if (!empty($_REQUEST['current_post'])) {
            $ret_array = generateSearchWhere($type, $_REQUEST['current_post']);
            $w = $ret_array['where'];
            $where = "( SELECT id from grouplists WHERE " . $w . ")";
        } else {
            $where = '';
        }
    }
}
$focus = new GroupLists();
$start_date = $_REQUEST['start_date'];
$end_date = $_REQUEST['end_date'];
$template = file_get_contents('modules/GroupLists/tpls/report.tpl');
$template = str_replace('{START}', $start_date, $template);
$template = str_replace('{END}', $end_date, $template);
$template = str_replace('{LIST_GIT}', $focus->get_GIT_to_report($where), $template);
$template = str_replace('{LIST_FIT}', $focus->get_FIT_to_report($where), $template);
$size = strlen($template);
$filename = "DS KHACH DI TOUR TU " . $start_date . " DEN " . $end_date . ".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;