LỊCH VẠN NIÊN
alert("'.$msg.'");'; echo $alert; } function close(){ $close = ''; echo $close; } function redir($url){ $redir = ''; echo $redir; exit(); } function refresh($timeout,$url){ echo ''; exit(); } function taxation($amount,$id_country){ global $DB,$DP,$referer_id; $total_tax_amount=0; $rs_show = $DB->SQLexec("SELECT z.* FROM {$DP}tax_rate_zone AS z INNER JOIN {$DP}tax_rate AS t ON t.tax_rate_id=z.tax_rate_id WHERE z.country_id='".$id_country."' AND t.reseller_id='".$referer_id."'"); while($row_show = mysql_fetch_array($rs_show)){ // show list rate_value here $rs_tax = $DB->SQLexec("SELECT * FROM {$DP}tax_rate WHERE tax_rate_id='".$row_show[tax_rate_id]."'"); while($row_tax = mysql_fetch_array($rs_tax)){ $tax_amount=$amount*$row_tax['tax_rate_value']/100; $total_tax_amount=$total_tax_amount+$tax_amount; } } return $total_tax_amount; } //==================== //== GetResellerTax will return tax amount of the reseller==== //== $total is total of amount== //== $referer_id is the id of reseller. //===================== function GetResellerTax($total,$referer_id){ global $DB,$DP; if($referer_id!=0&&$referer_id!=""){ $sql="SELECT * FROM {$DP}members WHERE member_id='".$referer_id."'"; $rs=mysql_query($sql); if(mysql_num_rows($rs)>0){ $row=mysql_fetch_array($rs); $vat_percent=$row['vat_percent']; } else{ $vat_percent=0; } } else{ $vat_percent=0; } return $total*$vat_percent/100; } function user_auth(){ global $conn,$DP,$_SESSION; $return_url=str_replace('=','-',$_SERVER['QUERY_STRING']); $return_url=str_replace('&','|',$return_url); if($_SESSION[ses_user_id] == ''){ $this->redir("index4.php?act=login"); } } function loggedin(){ global $conn,$DP,$_SESSION; if($_SESSION[ses_user_id] != ''){ $this->redir("?mod=user&act=account"); } } function simple_execsql($sql){ $rs = mysql_query($sql) or $this->redir('?mod=home'); return $rs; } function simple_recordset($sql){ if($sql){ $rs = mysql_query($sql) or $this->redir('?mod=home'); $row = mysql_fetch_array($rs); return $row; } } function select_country($select_id,$event){ global $conn,$DP; $sql = "SELECT * FROM {$DP}country"; $rs = mysql_query($sql); $ren = ''; return $ren; } function check_reg_permit($table,$field,$key,$plus){ global $DP; $rs = mysql_query("SELECT {$field} FROM {$DP}{$table} WHERE {$field}='{$key}' {$plus}"); @$num = mysql_num_rows($rs); return $num; } function rent_day($control_form_name,$event){ $rent = ''; return $rent; } function rent_month($control_form_name,$event){ $month = array( "January"=>"1", "February"=>"2", "March"=>"3", "April"=>"4", "May"=>"5", "June"=>"6", "July"=>"7", "August"=>"8", "September"=>"9", "October"=>"10", "November"=>"11", "December"=>"12"); $rent = ''; return $rent; } function rent_year($control_form_name,$event,$from,$to){ $rent = ''; return $rent; } function cutString($str,$maxlen){ if(strlen($str)>$maxlen){ $newstr=substr($str,0,$maxlen); while(' '!=substr($newstr,-1,1)){ $maxlen--; $newstr=substr($newstr,0,$maxlen); } return $newstr."..."; }else return $str; } function cutWord($str,$num_word){ $end_of_word = array(" ",",",".","!","..."); $str = trim($str); $count = 0; $i = 0; $cut_pos = 0; while($i with a
$string = preg_replace('/(?)\n/', "
\n", $string); return $string; } function __random($min = null, $max = null){ static $seeded; if(!$seeded){ mt_srand((double)microtime()*1000000); $seeded = true; } if(isset($min) && isset($max)){ if ($min >= $max) { return $min; } else { return mt_rand($min, $max); } }else{ return mt_rand(); } } function format_date_time($strdate){ $_month = array( "Jan"=>"1", "Feb"=>"2", "Mar"=>"3", "Apr"=>"4", "May"=>"5", "Jun"=>"6", "Jul"=>"7", "Aug"=>"8", "Sep"=>"9", "Oct"=>"10", "Nov"=>"11", "Dec"=>"12"); if(strlen($strdate) == 10 || strlen($strdate) == 19){ $day = substr($strdate,8,2); $month = substr($strdate,5,2); $year = substr($strdate,0,4); if(strlen($strdate) == 19) $time = substr($strdate,11,8); foreach($_month as $text_month=>$index_month){ if($index_month == $month){ $month = $text_month; } } $strdate = "{$month} {$day}, ".$year." ".$time; } return $strdate; } function button_ren($value,$onclick){ $button = '
'.$value.'
'; return $button; } function checkActive($referer_id){ global $DP,$rootPath; //-- $sql = "SELECT status, is_active FROM {$DP}members WHERE member_id = '".$referer_id."'"; $rs = mysql_query($sql); //-- if(mysql_num_rows($rs) > 0){ $row = mysql_fetch_array(mysql_query($sql)); if($row['status'] == '1' && $row['is_active'] == 'A'){ return true; } else{ return false; } } elseif(mysql_num_rows($rs) == 0){ return false; } //-- if(file_exists($rootPath."bltemplates/layout_".$referer_id."/layout.html")){ return true; }else{ return false; } } } ?>