- Timestamp:
- Feb 11, 2015 4:08:09 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php
r760 r761 16 16 17 17 function getProvinces($input) { 18 $ext=""; 19 if (isset($input['to_month'])) 20 { 21 $ext="AND tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-01 23:59:59'"; 22 } 18 19 $from="tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-" . $input['date'] . " 00:00:00'"; 20 $to="tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-" . $input['to_date'] . " 23:59:59'"; 21 23 22 $provinces = lang('_PROVINCES_'); 24 23 // Tinh doanh thu theo tinh theo nam … … 26 25 $query = $this->db->query($sql); 27 26 $dtns = $query->result_array(); 27 28 28 // tinh doanh thu theo thang 29 $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-01' $extGROUP BY tbluser.province";29 $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE $from AND $to GROUP BY tbluser.province"; 30 30 $query = $this->db->query($sql); 31 31 $dtts = $query->result_array(); 32 32 33 // tinh doanh thu trong ngay hien tai 33 $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time > '" . date('Y') . "-" . date('m') . "-".date('d')." 00:00:00' AND tblpaidlog.paid_time <'" . date('Y') . "-" . date('m') . "-".date('d')." 23:59:59' GROUP BY tbluser.province";34 34 if (isset($input['to_month'])) 35 35 { … … 45 45 46 46 // tinh thue bao theo thang 47 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01' $extGROUP BY tbluser.province";47 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND $to GROUP BY tbluser.province"; 48 48 $query = $this->db->query($sql); 49 49 $tbts = $query->result_array(); 50 50 51 51 // tinh thue bao theo ngay 52 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . date('Y') . "-" . date('m') . "-".date('d')." 00:00:00' AND tbluser.created_time < '" . date('Y') . "-" . date('m') . "-".date('d')." 23:59:59' GROUP BY tbluser.province"; 53 if (isset($input['to_month'])) 54 { 55 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND tbluser.created_time < '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59' GROUP BY tbluser.province"; 56 } 52 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND tbluser.created_time < '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59' GROUP BY tbluser.province"; 53 57 54 $query = $this->db->query($sql); 58 55 $tbng = $query->result_array(); … … 104 101 $provinces = lang('_PROVINCES_'); 105 102 // tinh thue bao theo thang 106 $sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "- 01' AND tbluser.created_time <'" . $input['year'] . "-" . $input['month'] . "-31' AND tblservicepackage.p_period > 0 ";103 $sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-" . $input['date'] . "' AND tbluser.created_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-" . $input['to_date'] . "' AND tblservicepackage.p_period > 0 "; 107 104 $query = $this->db->query($sql); 108 105 $users = $query->result_array(); … … 160 157 } 161 158 public function exportProvince($input) 162 { 159 { 160 //$input['date']=1; 163 161 //$input['month']=1; 164 162 //$input['year']=2014; … … 183 181 public function exportPackage($input) 184 182 { 183 // $input['date']=1; 185 184 //$input['month']=1; 186 //$input['year']=2014; 185 // $input['year']=2014; 186 // $input['to_month']=1; 187 // $input['to_year']=2015; 188 // $input['to_date']=15; 187 189 if (isset($input['month'])) 188 190 {
Note: See TracChangeset
for help on using the changeset viewer.