Changeset 818 for pro-violet-viettel/sourcecode/application/modules
- Timestamp:
- Mar 24, 2015 2:15:02 PM (10 years ago)
- Location:
- pro-violet-viettel/sourcecode/application/modules
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php
r777 r818 137 137 } 138 138 } 139 139 140 public function export(){ 141 $this->load->model('paidlog_model'); 142 $data ['paid_types'] = array ( 143 0 => "Tất cả", 144 1 => "SMS", 145 2 => "Card", 146 ); 147 $data ['paid_type'] = 0; 148 if ($this->input->post ( 'paid_type' )) { 149 $data ['paid_type'] = ( int ) $this->input->post ( 'paid_type' ); 150 } 151 152 $data['daterange_start'] = ""; 153 $data['daterange_end'] = ""; 154 if ($this->input->post('daterange')){ 155 $daterange = explode(" - ", $this->input->post('daterange')); 156 $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0])); 157 $data['daterange_end'] = date('Y-m-d 23:59:59', strtotime($daterange[1])); 158 } 159 $data['total'] = $this->paidlog_model->countPaidlog($data); 160 $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs']; 161 $data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount']; 162 163 foreach ($data['paidlogs'] as $index => $paidlog) { 164 $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']); 165 } 166 167 168 $this->load->library("PHPExcel"); 169 $sheet = $this->phpexcel->getActiveSheet(); 170 171 $sheet->setTitle("bao cao tong hop "); 172 $sheet->getColumnDimension('A')->setWidth(20); 173 $sheet->getColumnDimension('B')->setWidth(25); 174 $sheet->getColumnDimension('C')->setWidth(15); 175 $sheet->getColumnDimension('D')->setWidth(15); 176 $sheet->getColumnDimension('E')->setWidth(25); 177 178 179 180 $sheet->setCellValue('B1', "TẬP ÄOÃN VIá»N THÃNG QUÃN Äá»I"); 181 $style = array( 182 'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 183 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 184 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 185 'wrap' => true ) 186 ); 187 $sheet->mergeCells('B1:E1'); 188 $sheet->getStyle('B1')->applyFromArray($style); 189 190 $sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL"); 191 $style = array( 192 'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 193 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 194 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 195 'wrap' => true ) 196 ); 197 $sheet->mergeCells('B2:E2'); 198 $sheet->getStyle('B2')->applyFromArray($style); 199 200 201 $sheet->setCellValue('A4', "BÃO CÃO DOANH THU Tá»NG HỢP"); 202 203 $style = array( 204 'font' => array('size' => 11, 'name' =>'Cambria'), 205 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT, 206 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 207 'wrap' => true ), 208 'borders' => array( 209 'allborders' => array( 210 'style' => \PHPExcel_Style_Border::BORDER_THIN 211 ) 212 ) 213 ); 214 $sheet->setCellValue('B6', "Từ ngà y: ". $data['daterange_start']); 215 $sheet->setCellValue('C6', "Äến ngà y: ". $data['daterange_end']); 216 $sheet->setCellValue('B7', "Ngà y kết xuất: ".date("d")."/".date("m")."/".date("Y")); 217 $sheet->setCellValue('C7', "Nhân viên kết xuất: "); 218 219 $sheet->getStyle('B6')->applyFromArray($style); 220 $sheet->getStyle('C6')->applyFromArray($style); 221 $sheet->getStyle('B7')->applyFromArray($style); 222 $sheet->getStyle('C7')->applyFromArray($style); 223 224 225 $style = array( 226 'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'), 227 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 228 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 229 'wrap' => true ) 230 ); 231 $sheet->mergeCells('A4:E4'); 232 $sheet->getStyle('A4')->applyFromArray($style); 233 234 $sheet->setCellValue('A9', 'Sá» Äiá»n thoại'); 235 $style = array( 236 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 237 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 238 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 239 'wrap' => true), 240 'borders' => array( 241 'allborders' => array( 242 'style' => \PHPExcel_Style_Border::BORDER_THIN 243 ) 244 ) 245 ); 246 247 $sheet->setCellValue('B9', 'Há» tên'); 248 $sheet->setCellValue('C9', "Sá» tiá»n (VNÄ)"); 249 $sheet->setCellValue('D9', "SMS/Card"); 250 $sheet->setCellValue('E9', "Ngà y"); 251 252 $sheet->getStyle('A9:E9')->applyFromArray($style); 253 254 $sheet->setCellValue('A10', "Tá»ng"); 255 $sheet->mergeCells('A10:B10'); 256 $sheet->getStyle('A10:B10')->applyFromArray($style); 257 258 $style = array( 259 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 260 'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 261 'borders' => array( 262 'allborders' => array( 263 'style' => \PHPExcel_Style_Border::BORDER_THIN 264 ) 265 ) 266 ); 267 268 $sheet->setCellValue('C10', $data['total_amount']); 269 $sheet->getStyle('C10:E10')->applyFromArray($style); 270 271 $style = array( 272 'font' => array('size' => 11, 'name' =>'Cambria'), 273 'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 274 'borders' => array( 275 'allborders' => array( 276 'style' => \PHPExcel_Style_Border::BORDER_THIN 277 ) 278 ) 279 ); 280 281 $dem=0; 282 foreach ($data['paidlogs'] as $index => $paidlog) { 283 $type = ""; 284 // $sheet->setCellValue('A' . ($dem + 11), $paidlog['cellphone']); 285 if ($paidlog['paid_type'] == 1) { 286 $type = "SMS"; 287 }else { 288 $type = "Card"; 289 } 290 $sheet->setCellValueExplicit('A' . ($dem + 11), $paidlog['cellphone'], PHPExcel_Cell_DataType::TYPE_STRING); 291 292 $sheet->setCellValue('B' . ($dem + 11), $paidlog['username']); 293 $sheet->setCellValue('C' . ($dem + 11), $paidlog['amount']); 294 $sheet->setCellValue('D' . ($dem + 11), $type); 295 $sheet->setCellValue('E' . ($dem + 11), $paidlog['paid_time']); 296 $sheet->getStyle('A'. ($dem + 11).':E'.($dem + 11))->applyFromArray($style); 297 $dem++; 298 } 299 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 300 header('Content-Type: application/vnd.ms-excel'); 301 header('Content-Disposition: attachment; filename="bao_cao_tong_hop_'.date('d-m-Y').'.xls"'); 302 $writer->save('php://output'); 303 } 140 304 } -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php
r761 r818 32 32 $data['month'] = date("m"); 33 33 $data['year'] = date("Y"); 34 $data['to_date']= 31;34 $data['to_date']= 31; 35 35 $data['to_month'] = date("m"); 36 36 $data['to_year'] = date("Y"); … … 44 44 $data['provinces'] = $result['provinces']; 45 45 $data['packages'] = $result['packages']; 46 46 $data['totalVip'] = $result['totalVip']; 47 47 if ($this->input->is_ajax_request()) { 48 48 return $this->load->view('reportpackage/province', $data); … … 70 70 public function export() { 71 71 $this->load->model('reportmodel'); 72 $data['date']=1; 72 73 $data['month'] = $this->uri->segment(4); 73 74 $data['year'] = $this->uri->segment(5); 75 $data['to_date']=31; 76 $data['to_month'] = date("m"); 77 $data['to_year'] = date("Y"); 74 78 $data = $this->getdays($data); 75 79 $result = $this->reportmodel->getPackages($data); 76 80 $data['provinces'] = $result['provinces']; 77 81 $data['packages'] = $result['packages']; 82 $data['totalVip'] = $result['totalVip']; 78 83 79 84 $this->load->library("PHPExcel"); -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php
r771 r818 30 30 31 31 $this->load->model('reportmodel'); 32 $data['date'] = 1;32 $data['date'] = date("d"); 33 33 $data['month'] = date("m"); 34 34 $data['year'] = date("Y"); 35 $data['to_date'] = 31;35 $data['to_date'] = date("d"); 36 36 $data['to_month'] = date("m"); 37 37 $data['to_year'] = date("Y"); 38 if ($this->input->post('month')) { 38 if ($this->input->post()) { 39 $data['date'] = $this->input->post('date'); 39 40 $data['month'] = $this->input->post('month'); 40 41 $data['year'] = $this->input->post('year'); 41 } 42 $data['provinces'] = $this->reportmodel->getProvinces($data); 43 42 $data['to_date'] = $this->input->post('to_date'); 43 $data['to_month'] = $this->input->post('to_month'); 44 $data['to_year'] = $this->input->post('to_year'); 45 } 46 $result = $this->reportmodel->getProvinces($data); 47 $data['provinces'] = $result['provinces']; 48 $data['totalTbng'] = $result['totalTbng']; 49 $data['totalTbth'] = $result['totalTbth']; 50 $data['totalTbn'] = $result['totalTbn']; 51 52 $data['totalDtng'] = $result['totalDtng']; 53 $data['totalDtth'] = $result['totalDtth']; 54 $data['totalDtn'] = $result['totalDtn']; 55 44 56 if ($this->input->is_ajax_request()) { 45 57 return $this->load->view('reportprovince/province', $data); … … 115 127 echo "</pre>"; 116 128 } 129 130 public function exportProvince(){ 131 $this->load->model('reportmodel'); 132 $data['date'] = date("d"); 133 $data['month'] = $this->uri->segment(4); 134 $data['year'] = $this->uri->segment(5); 135 $data['to_date'] = date("d"); 136 $data['to_month'] = date("m"); 137 $data['to_year'] = date("Y"); 138 if ($this->input->post()) { 139 $data['date'] = $this->input->post('date'); 140 $data['month'] = $this->input->post('month'); 141 $data['year'] = $this->input->post('year'); 142 $data['to_date'] = $this->input->post('to_date'); 143 $data['to_month'] = $this->input->post('to_month'); 144 $data['to_year'] = $this->input->post('to_year'); 145 } 146 147 $result = $this->reportmodel->getProvinces($data); 148 $data['provinces'] = $result['provinces']; 149 150 $data['totalTbng'] = $result['totalTbng']; 151 $data['totalTbth'] = $result['totalTbth']; 152 $data['totalTbn'] = $result['totalTbn']; 153 154 $data['totalDtng'] = $result['totalDtng']; 155 $data['totalDtth'] = $result['totalDtth']; 156 $data['totalDtn'] = $result['totalDtn']; 157 158 $this->load->library("PHPExcel"); 159 $sheet = $this->phpexcel->getActiveSheet(); 160 161 $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']); 162 $sheet->getColumnDimension('A')->setWidth(10); 163 $sheet->getColumnDimension('B')->setWidth(25); 164 $sheet->getColumnDimension('C')->setWidth(25); 165 $sheet->getColumnDimension('D')->setWidth(15); 166 $sheet->getColumnDimension('E')->setWidth(15); 167 $sheet->getColumnDimension('F')->setWidth(15); 168 $sheet->getColumnDimension('G')->setWidth(15); 169 $sheet->getColumnDimension('H')->setWidth(15); 170 $sheet->getColumnDimension('I')->setWidth(15); 171 $sheet->getColumnDimension('J')->setWidth(15); 172 173 174 $sheet->setCellValue('B1', "TẬP ÄOÃN VIá»N THÃNG QUÃN Äá»I"); 175 $style = array( 176 'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 177 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 178 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 179 'wrap' => true ) 180 ); 181 $sheet->mergeCells('B1:I1'); 182 $sheet->getStyle('B1')->applyFromArray($style); 183 184 $sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL"); 185 $style = array( 186 'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 187 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 188 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 189 'wrap' => true ) 190 ); 191 $sheet->mergeCells('B2:I2'); 192 $sheet->getStyle('B2')->applyFromArray($style); 193 194 195 $sheet->setCellValue('A4', "BÃO CÃO Tá»NG HỢP PHÃT TRIá»N THUà BAO Và DOANH THU Dá»CH VỀ SBG THEO Tá»NH"); 196 197 $style = array( 198 'font' => array('size' => 11, 'name' =>'Cambria'), 199 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT, 200 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 201 'wrap' => true ), 202 'borders' => array( 203 'allborders' => array( 204 'style' => \PHPExcel_Style_Border::BORDER_THIN 205 ) 206 ) 207 ); 208 209 $sheet->setCellValue('B6', "Từ ngà y: ".$data['date']."/".$data['month']."/".$data['year']); 210 $sheet->setCellValue('C6', "Äến ngà y: ".$data['to_date']."/".$data['to_month']."/".$data['to_year']); 211 $sheet->setCellValue('B7', "Ngà y kết xuất: ".date("d")."/".date("m")."/".date("Y")); 212 $sheet->setCellValue('C7', "Nhân viên kết xuất: "); 213 214 $sheet->getStyle('B6')->applyFromArray($style); 215 $sheet->getStyle('C6')->applyFromArray($style); 216 $sheet->getStyle('B7')->applyFromArray($style); 217 $sheet->getStyle('C7')->applyFromArray($style); 218 219 220 $style = array( 221 'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'), 222 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 223 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 224 'wrap' => true ) 225 ); 226 $sheet->mergeCells('A4:I4'); 227 $sheet->getStyle('A4')->applyFromArray($style); 228 229 $sheet->setCellValue('A9', 'STT'); 230 $style = array( 231 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 232 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 233 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 234 'wrap' => true), 235 'borders' => array( 236 'allborders' => array( 237 'style' => \PHPExcel_Style_Border::BORDER_THIN 238 ) 239 ) 240 ); 241 $sheet->mergeCells('A9:A10'); 242 $sheet->getStyle('A9')->applyFromArray($style); 243 244 $sheet->setCellValue('B9', 'Mã Tá»nh/Thà nh Phá»'); 245 $sheet->mergeCells('B9:B10'); 246 $sheet->getStyle('B9:B10')->applyFromArray($style); 247 248 $sheet->setCellValue('C9', "Tá»nh/Thà nh phá»"); 249 $sheet->mergeCells('C9:C10'); 250 $sheet->getStyle('C9:C10')->applyFromArray($style); 251 252 $sheet->setCellValue('D9', "THUà BAO"); 253 $sheet->mergeCells('D9:F9'); 254 $sheet->getStyle('D9:F9')->applyFromArray($style); 255 256 $sheet->setCellValue('G9', "DOANH THU"); 257 $sheet->mergeCells('G9:I9'); 258 $sheet->getStyle('G9:I9')->applyFromArray($style); 259 260 $sheet->setCellValue('A11', "Tá»ng"); 261 $sheet->mergeCells('A11:C11'); 262 $sheet->getStyle('A11:C11')->applyFromArray($style); 263 264 $style = array( 265 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 266 'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 267 'borders' => array( 268 'allborders' => array( 269 'style' => \PHPExcel_Style_Border::BORDER_THIN 270 ) 271 ) 272 ); 273 274 $sheet->setCellValue('D11', $data['totalTbng']); 275 $sheet->setCellValue('E11', $data['totalTbth']); 276 $sheet->setCellValue('F11', $data['totalTbn']); 277 $sheet->setCellValue('G11', $data['totalDtng']); 278 $sheet->setCellValue('H11', $data['totalDtth']); 279 $sheet->setCellValue('I11', $data['totalDtn']); 280 281 $sheet->getStyle('D11')->applyFromArray($style); 282 $sheet->getStyle('E11')->applyFromArray($style); 283 $sheet->getStyle('F11')->applyFromArray($style); 284 $sheet->getStyle('G11')->applyFromArray($style); 285 $sheet->getStyle('H11')->applyFromArray($style); 286 $sheet->getStyle('I11')->applyFromArray($style); 287 288 $styleSTT = array( 289 'font' => array('size' => 11, 'name' =>'Cambria'), 290 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 291 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 292 'borders' => array( 293 'allborders' => array( 294 'style' => \PHPExcel_Style_Border::BORDER_THIN 295 ) 296 ) 297 ); 298 299 $style = array( 300 'font' => array('size' => 11, 'name' =>'Cambria'), 301 'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 302 'borders' => array( 303 'allborders' => array( 304 'style' => \PHPExcel_Style_Border::BORDER_THIN 305 ) 306 ) 307 ); 308 309 $sheet->setCellValue('D10', "Thá»±c hiá»n Ngà y"); 310 $sheet->getStyle('D10')->applyFromArray($style); 311 $sheet->setCellValue('E10', "LÅ©y kế Tháng"); 312 $sheet->getStyle('E10')->applyFromArray($style); 313 $sheet->setCellValue('F10', "LÅ©y kế NÄm"); 314 $sheet->getStyle('F10')->applyFromArray($style); 315 $sheet->setCellValue('G10', "Thá»±c hiá»n Ngà y"); 316 $sheet->getStyle('G10')->applyFromArray($style); 317 $sheet->setCellValue('H10', "LÅ©y kế Tháng"); 318 $sheet->getStyle('H10')->applyFromArray($style); 319 $sheet->setCellValue('I10', "LÅ©y kế NÄm"); 320 $sheet->getStyle('I10')->applyFromArray($style); 321 322 /* 323 $sheet->setCellValue('A1', "Báo cáo thuê bao theo tá»nh"); 324 $sheet->setCellValue('A2', "Tháng: " . $data['month'] . " - " . $data['year']); 325 //$sheet->setCellValue('C2', "Ngà y: ".date('d')." - ".date('m')." - ". date('Y').""); 326 $sheet->setCellValue('A4', "STT"); 327 $sheet->setCellValue('B4', "Ngà y"); 328 $sheet->setCellValue('C4', "Mã Tá»nh/Thà nh Phá»"); 329 $sheet->setCellValue('D4', "Tá»nh/Thà nh phá»"); 330 $sheet->setCellValue('E4', "TB Ngà y"); 331 $sheet->setCellValue('F4', "LÅ©y kế TB tháng"); 332 $sheet->setCellValue('G4', "Tá»ng TB Ngà y"); 333 $sheet->setCellValue('H4', "DT Ngà y"); 334 $sheet->setCellValue('I4', "LÅ©y kế DT tháng"); 335 $sheet->setCellValue('J4', "Tá»ng DT nÄm"); 336 */ 337 $dem=0; 338 foreach ($data['provinces'] as $index => $provinces) { 339 $sheet->setCellValue('A' . ($dem + 12), $provinces['stt']); 340 $sheet->setCellValue('B' . ($dem + 12), $index); 341 $sheet->setCellValue('C' . ($dem + 12), $provinces['province']); 342 $sheet->setCellValue('D' . ($dem + 12), $provinces['tbng']); 343 $sheet->setCellValue('E' . ($dem + 12), $provinces['tbt']); 344 $sheet->setCellValue('F' . ($dem + 12), $provinces['tbn']); 345 $sheet->setCellValue('G' . ($dem + 12), $provinces['dtng']); 346 $sheet->setCellValue('H' . ($dem + 12), $provinces['dtt']); 347 $sheet->setCellValue('I' . ($dem + 12), $provinces['dtn']); 348 349 $sheet->getStyle('A'. ($dem + 12))->applyFromArray($styleSTT); 350 $sheet->getStyle('B'. ($dem + 12))->applyFromArray($style); 351 $sheet->getStyle('C'. ($dem + 12))->applyFromArray($style); 352 $sheet->getStyle('D'. ($dem + 12))->applyFromArray($style); 353 $sheet->getStyle('E'. ($dem + 12))->applyFromArray($style); 354 $sheet->getStyle('F'. ($dem + 12))->applyFromArray($style); 355 $sheet->getStyle('G'. ($dem + 12))->applyFromArray($style); 356 $sheet->getStyle('H'. ($dem + 12))->applyFromArray($style); 357 $sheet->getStyle('I'. ($dem + 12))->applyFromArray($style); 358 359 $dem++; 360 } 361 362 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 363 header('Content-Type: application/vnd.ms-excel'); 364 header('Content-Disposition: attachment; filename="thue_bao_va_doanh_thu_theo_tinh_' .$data["date"]. $data['month'] . $data['year']."_".$data["to_date"]. $data['to_month']. $data['to_year'] . '.xls"'); 365 $writer->save('php://output'); 366 } 117 367 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php
r777 r818 1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 2 2 3 3 class Paidlog_model extends MY_Model … … 37 37 if ($data['paid_type'] ==0){ 38 38 $sql.=" WHERE paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'"; 39 //write_file('./log/sql.log', date("m/d/Y H:i:s")." ".$sql."\n", FOPEN_WRITE_CREATE);40 39 }else{ 41 40 $sql.=" AND paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'"; … … 45 44 46 45 $order = ""; 47 if ($data['sorting_order'] != "sorting") { 48 if ($data['sorting_field'] != "money") { 49 $sort = "DESC"; 50 if ($data['sorting_order'] == "sorting_asc") 51 $sort = "ASC"; 52 $order = "ORDER BY " . $data['sorting_field'] . " " . $sort; 53 } 54 } 55 $sql=$sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " "; 46 if ($data['sorting_order']){ 47 if ($data['sorting_order'] != "sorting") { 48 if ($data['sorting_field'] != "money") { 49 $sort = "DESC"; 50 if ($data['sorting_order'] == "sorting_asc") 51 $sort = "ASC"; 52 $order = "ORDER BY " . $data['sorting_field'] . " " . $sort; 53 } 54 } 55 } 56 if ($data['start']){ 57 $sql=$sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " "; 58 } 56 59 //return $this->db->query($sql)->result_array(); 57 60 $re = $this->db->query($sql)->result_array(); -
pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php
r765 r818 45 45 46 46 // Tinh thue bao theo tinh theo nam 47 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01' GROUP BY tbluser.province"; 48 $query = $this->db->query ( $sql ); 47 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01 23:59:59' GROUP BY tbluser.province"; 48 $query = $this->db->query ( $sql ); 49 write_file('./log/test.log', date('d-m-Y H:i:s').": ".$sql."\n", FOPEN_WRITE_CREATE); 49 50 $tbns = $query->result_array (); 50 51 51 52 // tinh thue bao theo thang 52 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND $to GROUP BY tbluser.province"; 53 //$sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND $to GROUP BY tbluser.province"; 54 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . '01 00:00:00' . "' AND created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59' GROUP BY tbluser.province"; 53 55 $query = $this->db->query ( $sql ); 54 56 $tbts = $query->result_array (); … … 56 58 // tinh thue bao theo ngay 57 59 $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"; 58 59 60 $query = $this->db->query ( $sql ); 60 61 $tbng = $query->result_array (); 61 62 62 $dem = 1; 63 64 $totalTbng = 0; 65 $totalTbth = 0; 66 $totalTbn = 0; 67 $totalDtng = 0; 68 $totalDtth = 0; 69 $totalDtn = 0; 63 70 64 71 foreach ( $provinces as $index2 => $province ) { … … 104 111 } 105 112 } 113 114 $totalTbng = $totalTbng + $provinces [$index2] ['tbng']; 115 $totalTbth = $totalTbth + $provinces [$index2] ['tbt']; 116 $totalTbn = $totalTbn + $provinces [$index2] ['tbn']; 117 118 $totalDtng = $totalDtng + $provinces [$index2] ['dtng']; 119 $totalDtth = $totalDtth + $provinces [$index2] ['dtt']; 120 $totalDtn = $totalDtn + $provinces [$index2] ['dtn']; 121 106 122 $dem ++; 107 123 } 108 109 return $provinces; 124 125 $data['provinces'] = $provinces; 126 127 $data['totalTbng'] = $totalTbng; 128 $data['totalTbth'] = $totalTbth; 129 $data['totalTbn'] = $totalTbn; 130 131 $data['totalDtng'] = $totalDtng; 132 $data['totalDtth'] = $totalDtth; 133 $data['totalDtn'] = $totalDtn; 134 135 //return $provinces; 136 return $data; 110 137 } 111 138 … … 118 145 $provinces = lang ( '_PROVINCES_' ); 119 146 // tinh thue bao theo thang 120 $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 "; 147 //$sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblservicepackage.p_period > 0 "; 148 $sql = "SELECT * FROM tbluser LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "'"; 121 149 $query = $this->db->query ( $sql ); 122 150 $users = $query->result_array (); … … 128 156 $packages [$index] ['users'] = array (); 129 157 foreach ( $users as $user ) { 130 if ($user ['p_ id'] == $package ['p_id']) {158 if ($user ['p_code'] == $package ['p_code']) { 131 159 $packages [$index] ['users'] [] = $user; 132 160 } 133 161 } 134 162 } 135 136 163 foreach ( $provinces as $index => $province ) { 137 164 $provinces [$index] = array ( … … 139 166 ); 140 167 } 168 141 169 $dem = 1; 170 142 171 foreach ( $provinces as $index => $province ) { 143 172 $provinces [$index] ['stt'] = $dem; … … 154 183 $provinces [$index] ['total'] = $totaluser; 155 184 $provinces [$index] ['packages'] [$package ['p_name']] ['total'] = $total; 185 $provinces [$index] ['packages'] [$package ['p_name']] ['users'] [] = $user; 156 186 157 $provinces [$index] ['packages'] [$package ['p_name']] ['users'] [] = $user;158 187 } 159 188 } … … 161 190 $dem ++; 162 191 } 192 193 $totalByVIP = array(); 194 195 foreach ($packages as $index => $package){ 196 $totalByVIP[$package ['p_name']] = 0; 197 foreach ( $provinces as $index=>$province){ 198 foreach ($province['packages'] as $index2 => $p){ 199 if ($index2 == $package['p_name']) 200 $totalByVIP[$package ['p_name']] = $totalByVIP[$package ['p_name']] + $p['total']; 201 } 202 } 203 } 204 205 $totalVip = 0; 206 207 foreach ($totalByVIP as $vipName=>$total){ 208 $totalVip = $totalVip + $total; 209 } 210 211 $totalByVIP['total'] = $totalVip; 212 163 213 foreach ( $provinces as $index => $province ) { 164 214 foreach ( $packages as $index2 => $package ) { … … 172 222 $data ['packages'] = $packages; 173 223 $data ['provinces'] = $provinces; 224 $data['totalVip'] = $totalByVIP; 174 225 return $data; 175 226 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php
r769 r818 69 69 $sql.=" WHERE province = '".$data['province_code']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'"; 70 70 }else{ 71 $sql.=" AND(created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";71 $sql.=" WHERE (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')"; 72 72 } 73 73 }else{ … … 101 101 } 102 102 } 103 write_file('./log/test.log', date("d-m-Y: H:i:s"). ": ".$sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage'] , FOPEN_WRITE_CREATE); 103 104 return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array(); 104 105 } -
pro-violet-viettel/sourcecode/application/modules/admin/views/report/index.php
r777 r818 1 <?php1 <?php 2 2 $base_url = base_url(); 3 3 $this->load->view('layout/admin/header', array('base_url' => $base_url)); 4 $this->load->view('layout/admin/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class 4 $this->load->view('layout/admin/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class)); 5 5 ?> 6 6 <script type="text/javascript"> … … 26 26 }); 27 27 return false; 28 }) 28 }); 29 29 $('#keyword').keyup(function (event) { 30 30 if (event.keyCode == '13') { … … 157 157 <li> 158 158 <i class="icon-home home-icon"></i> 159 <a href="#">Trang ch á»§</a>159 <a href="#">Trang chủ</a> 160 160 </li> 161 161 162 162 <li> 163 <a href="#">Qu ản lÜ tin nhắn</a>163 <a href="#">Quản lý tin nhắn</a> 164 164 </li> 165 165 … … 169 169 <form class="form-search"> 170 170 <span class="input-icon"> 171 <input type="text" autocomplete="off" id="nav-search-input" class="nav-search-input" placeholder="T ìm kiếm ...">171 <input type="text" autocomplete="off" id="nav-search-input" class="nav-search-input" placeholder="Tìm kiếm ..."> 172 172 <i class="icon-search nav-search-icon"></i> 173 173 </span> … … 183 183 <div class="page-header"> 184 184 <h1> 185 Tin nh ắn185 Tin nhắn 186 186 <small> 187 187 <i class="icon-double-angle-right"></i> 188 M ẫu tin nhắn188 Mẫu tin nhắn 189 189 </small> 190 190 </h1> -
pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php
r777 r818 3 3 <div style="padding-bottom:4px" class="table-header"> 4 4 Doanh thu 5 <div class="pull-right" style="margin:5px;"> 6 <a style="color:#fff" href="<?php echo base_url();?>admin/report/export">Xuất ra Excel</a> 7 </div> 5 8 </div> 6 9 … … 48 51 <tr role="row"> 49 52 50 <th class="<?php if ($sorting_field == 'fullname') {echo $sorting_order;} else {echo "";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending"> Họ tên</th>51 <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 283px;" aria-label="Họ tên: activate to sort column ascending"> Số điện thoại</th>53 <th class="<?php if ($sorting_field == 'fullname') {echo $sorting_order;} else {echo "";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">Số điện thoại</th> 54 <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 283px;" aria-label="Họ tên: activate to sort column ascending">Họ tên</th> 52 55 <th class="<?php if ($sorting_field == 'amount') {echo $sorting_order;} else {echo "sorting";}?>" id="amount" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">Số tiền</th> 53 56 <th class="<?php if ($sorting_field == 'paid_type') {echo $sorting_order;} else {echo "sorting";}?>" id="paid_type" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">SMS/Card</th> … … 66 69 67 70 <td class=" "> 68 <a onclick="getUserHistory(<?php echo $paidlog['us_id']; ?>, 1);" data-toggle="modal"><?php echo $paidlog[' username'];?></a>71 <a onclick="getUserHistory(<?php echo $paidlog['us_id']; ?>, 1);" data-toggle="modal"><?php echo $paidlog['cellphone']?></a> 69 72 </td> 70 <td class=" "><?php echo $paidlog[' cellphone']?></td>73 <td class=" "><?php echo $paidlog['username'];?></td> 71 74 72 75 <td class="hidden-480 "><?php echo number_format($paidlog['amount'],0);?></td> … … 134 137 <div class="tab-content history-tab-content"> 135 138 <div class="tab-pane in active" id="regis"> 139 <div class="col-sm-12"> 140 <h5>Tài khoản SBG Online: <b><span class="blue"><span id="topup-money"><?php echo number_format($acc_balanced, 0); ?></span> VNĐ <span></b></h5> 141 </div> 136 142 <div class="table-responsive"> 137 143 <table id="sample-table-1" class="table table-striped table-bordered table-hover"> -
pro-violet-viettel/sourcecode/application/modules/admin/views/reportpackage/province.php
r713 r818 55 55 </tr> 56 56 </thead> 57 57 <tr> 58 <td colspan=2 align="center" style="font-weight:bold;">Tá»ng</td> 59 <?php $d = 0; ?> 60 <?php foreach ($totalVip as $vipName => $total): ?> 61 <?php $d++;?> 62 <td style="font-weight:bold;"><?php echo $total; ?></td> 63 <?php if($d<count($totalVip)): ?> 64 <td></td> 65 <?php endif;?> 66 <?php endforeach; ?> 67 </tr> 58 68 <tbody role="alert" aria-live="polite" aria-relevant="all"> 59 69 <?php 70 $total = array(); 60 71 foreach ($provinces as $province) { 61 72 ?> … … 75 86 </tr> 76 87 <?php } ?> 88 <?php //var_dump($total);?> 89 77 90 </tbody> 78 91 </table> 79 < div class="row"><div class="col-sm-6">92 <!--<div class="row"><div class="col-sm-6">--> 80 93 81 94 </div> -
pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php
r713 r818 9 9 Báo cáo doanh thu theo tá»nh / thà nh phá» 10 10 <div class="pull-right" style="margin:5px;"> 11 <a style="color:#fff" href="<?php echo base_url();?>admin/reportprovince/export/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a> 11 <!--<a style="color:#fff" href="<?php echo base_url();?>admin/reportprovince/export/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a>--> 12 <a style="color:#fff" href="<?php echo base_url();?>admin/reportprovince/exportProvince/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a> 12 13 </div> 13 14 </div> … … 17 18 <form autocomplete="off" onsubmit="return false;" id="province" > 18 19 <div class="row"> 19 <div class="col-sm-6"> 20 <div class="" style="display: inline-block"><label>Tháng 20 <div class="col-sm-1"> 21 <div class="" style="display: inline-block"><label><strong>Từ: </strong></label></div> 22 </div> 23 <div class="col-sm-6"> 24 <div class="" style="display: inline-block"><label>Ngà y</label> 25 26 <select aria-controls="sample-table-2" size="1" name="date" onchange="filter();"> 27 <?php for ($i=1;$i<=31;$i++) { ?> 28 <option value="<?php echo $i;?>" <?php if($date==$i) { ?> selected <?php }?>><?php echo $i;?></option> 29 <?php }?> 30 </select> 31 </div> 32 <div class="" style="display: inline-block"><label>Tháng</label> 21 33 22 34 <select aria-controls="sample-table-2" size="1" name="month" onchange="filter();"> … … 34 46 </select> 35 47 </div> 36 </div> 48 </div> 49 37 50 38 51 <div class="col-sm-6"> … … 40 53 </div> 41 54 </div> 55 56 <div class="row"> 57 <div class="col-sm-1"> 58 <div class="" style="display: inline-block"><label><strong>Äến: </strong></label></div> 59 </div> 60 <div class="col-sm-6"> 61 <div class="" style="display: inline-block"><label>Ngà y</label> 62 63 <select aria-controls="sample-table-2" size="1" name="to_date" onchange="filter();"> 64 <?php for ($i=1;$i<=31;$i++) { ?> 65 <option value="<?php echo $i;?>" <?php if($to_date==$i) { ?> selected <?php }?>><?php echo $i;?></option> 66 <?php }?> 67 </select> 68 </div> 69 <div class="" style="display: inline-block"><label>Tháng</label> 70 71 <select aria-controls="sample-table-2" size="1" name="to_month" onchange="filter();"> 72 <?php for ($i=1;$i<=12;$i++) { ?> 73 <option value="<?php echo $i;?>" <?php if($to_month==$i) { ?> selected <?php }?>><?php echo $i;?></option> 74 <?php }?> 75 </select> 76 </div> 77 <div class="" style="display: inline-block"><label>NÄm 78 79 <select aria-controls="sample-table-2" size="1" name="to_year" onchange="filter();"> 80 <?php for ($i=2014;$i<=date("Y");$i++) { ?> 81 <option value="<?php echo $i;?>" <?php if($to_year==$i) { ?> selected <?php }?>><?php echo $i;?></option> 82 <?php }?> 83 </select> 84 </div> 85 </div> 86 </div> 42 87 </form> 43 88 <table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info"> … … 58 103 59 104 <tbody role="alert" aria-live="polite" aria-relevant="all"> 105 <tr> 106 <td colspan=2 align="center" style="font-weight:bold;">Tá»ng</td> 107 <td style="font-weight:bold;"><?php echo $totalTbng; ?></td> 108 <td style="font-weight:bold;"><?php echo $totalTbth; ?></td> 109 <td style="font-weight:bold;"><?php echo $totalTbn; ?></td> 110 <td style="font-weight:bold;"><?php echo $totalDtng; ?></td> 111 <td style="font-weight:bold;"><?php echo $totalDtng; ?></td> 112 <td style="font-weight:bold;"><?php echo $totalDtn; ?></td> 113 114 </tr> 60 115 <?php 61 116 foreach ($provinces as $province) { … … 77 132 78 133 </tr> 134 79 135 <?php } ?> 80 136 </tbody> -
pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php
r773 r818 171 171 <td class=" "> 172 172 <a onclick="getUserHistory(<?php echo $user['us_id']; ?>, 1);" data-toggle="modal"><?php echo $user['username']; ?></a> 173 <!--<a href="#user-history" data-toggle="modal"><?php echo @$user['username']; ?></a>-->173 <!--<a href="#user-history" data-toggle="modal"><?php echo $user['username']; ?></a>--> 174 174 </td> 175 175 <td class=" "> … … 177 177 </td> 178 178 <td class="hidden-480 "><?php echo number_format($user['acc_balanced'], 0); ?></td> 179 <td class=" "><?php echo $user['created_time']; ?></td>179 <td class=" "><?php echo date('d/m/Y', strtotime($user['created_time'])); ?></td> 180 180 <td class=" "><?php echo isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : ''; ?></td> 181 181 <td><?php echo $user['province']; ?></td> … … 225 225 <div class="modal-header"> 226 226 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> 227 <h4 class="modal-title"> Lá»ch sá»</h4>227 <h4 class="modal-title">ThÃŽng tin ngưá»i dùng</h4> 228 228 </div> 229 229 <div class="modal-body"> … … 242 242 <div class="tab-content history-tab-content"> 243 243 <div class="tab-pane in active" id="regis"> 244 <div class="col-sm-12"> 245 <h5>Tà i khoản SBG Online: <b><span class="blue"><span id="topup-money"><?php echo number_format($acc_balanced, 0); ?></span> VNÄ <span></b></h5> 246 </div> 244 247 <div class="table-responsive"> 245 248 <table id="sample-table-1" class="table table-striped table-bordered table-hover"> -
pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
r773 r818 453 453 $data['us_id'] = $us_id; 454 454 $data['username'] = $username; 455 $data['acc_balanced'] = number_format($user['acc_balanced']); 455 456 $data['perpage'] = 10; 456 457 $data['current_page'] = $this->uri->segment(6, 1); -
pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
r773 r818 88 88 $us_id = $id; 89 89 $user ['created_time'] = date ( 'Y-m-d H:i:s' ); 90 $user ['updated_time'] = date ( 'Y-m-d H:i:s' ); 90 91 $user ['us_id'] = $us_id; 91 92 $user ['p_id'] = $trialpackage['p_id']; … … 98 99 $this->db->query ( 'UNLOCK TABLES' ); 99 100 $this->db->insert ( 'tbluser', $user ); 101 //write_file('./log/test.log', date("H:i:s m-d-Y").": ". var_export($user, TRUE)."\n" , FOPEN_WRITE_CREATE); 100 102 $aryPatterns = array ('/:trialdays:/', '/:username:/', '/:password:/'); 101 103 $trialdays = $this->config->item('trial_period'); 102 104 $trialdays = strlen($trialdays) < 2 ? '0'. $trialdays : $trialdays; 103 $sms = preg_replace($aryPatterns, array($trialdays. ' ngay', $username, $password), lang('_SBG_MO_USER_REGISTER_SUCCESS_MSG')); 105 if ($this->isViettel($username)){ 106 $sms = preg_replace($aryPatterns, array($trialdays. ' ngay', $username, $password), lang('_SBG_MO_USER_VIETTEL_REGISTER_SUCCESS_MSG')); 107 }else{ 108 $aryPatterns = array ('/:username:/', '/:password:/'); 109 $sms = preg_replace($aryPatterns, array($username, $password), lang('_SBG_MO_USER_NOT_VIETTEL_REGISTER_SUCCESS_MSG')); 110 } 104 111 $status = 1; 105 112 $aryPatterns = array('/:username:/'); … … 565 572 { 566 573 $username = $data['username']; 567 $us_id = $data['us_id']; 568 $this->db->query ( 'UNLOCK TABLES' ); 569 //$sql="SELECT tblregisterpackagelog.source,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage'].""; 570 $sql="SELECT tblregisterpackagelog.source,0 as amount,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,'Nạp tiền' as name,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage'].""; 571 $query = $this->db->query ( $sql, array ( 572 "$username", 573 $us_id 574 ) ); 574 $us_id = $data['us_id']; 575 $this->db->query ( 'UNLOCK TABLES' ); 576 //$sql="SELECT tblregisterpackagelog.source,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage'].""; 577 $sql="SELECT tblregisterpackagelog.source,0 as amount,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,'Nạp tiền' as name,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage'].""; 578 $query = $this->db->query ( $sql, array ("$username", $us_id) ); 575 579 $row = $query->result_array(); 576 580 return $row; … … 597 601 } 598 602 } 603 604 public function isViettel($number) { 605 $prefixViettel = array ( 606 '96', '97', '98', 607 '096', '097', '098', '162', '163', '164', '165', '166', '167', '168', '169', 608 '8496', '8497', '8498', '0162', '0163', '0164', '0165', '0166', '0167', '0168', '0169', 609 '84162', '84163', '84164', '84165', '84166', '84167', '84168', '84169' 610 ); 611 foreach ( $prefixViettel as $value ) { 612 if (strpos ( $number, $value ) === 0) { 613 return 1; 614 } 615 } 616 return 0; 617 } 618 599 619 } -
pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
r775 r818 228 228 } 229 229 else if ($result == _SBG_CHARGING_FAIL_NOT_ENOUGH) { 230 $aryPatterns = array ('/:amount:/'); 231 $smsReturn = preg_replace($aryPatterns, array($amount), lang('_SBG_MO_CHARGING_FAIL_NOT_ENOUGH_MSG')); 230 //$aryPatterns = array ('/:amount:/'); 231 $aryPatterns = array ('/:sentNumber:/'); 232 $smsReturn = preg_replace($aryPatterns, array($sentNumber), lang('_SBG_MO_CHARGING_FAIL_NOT_ENOUGH_MSG')); 233 /* 232 234 if ($case == _SBG_MO_PAY_TO_ACCOUNT_FOR) { 233 235 $aryPatterns = array ('/:amount:/', '/:username:/'); 234 236 $smsReturn = preg_replace($aryPatterns, array($amount, $userName), lang('_SBG_MO_CHARGING_FAIL_NOT_ENOUGH_FOR_MSG')); 235 } 237 }*/ 236 238 $smsReturn = _SBG_MO_PROCCESS_ERR.'|'.$smsReturn; 237 239 } … … 248 250 break; 249 251 case _SBG_MO_SUPPOR_SERVICE: 250 $smsReturn = '1|'.lang('_SBG_MO_SUPPORT_MSG'); 252 //$smsReturn = '1|'.lang('_SBG_MO_SUPPORT_MSG'); 253 if ($this->isViettel($sentNumber)){ 254 $smsReturn = '1|'.lang('_SBG_MO_SUPPORT_VIETTEL_MSG'); 255 }else{ 256 $smsReturn = '1|'.lang('_SBG_MO_SUPPORT_NOT_VIETTEL_MSG'); 257 } 251 258 break; 252 259 case _SBG_MO_UNSUBSCRIBE_SERVICE: … … 511 518 } 512 519 } 520 521 public function isViettel($number) { 522 $prefixViettel = array ( 523 '96', '97', '98', 524 '096', '097', '098', '162', '163', '164', '165', '166', '167', '168', '169', 525 '8496', '8497', '8498', '0162', '0163', '0164', '0165', '0166', '0167', '0168', '0169', 526 '84162', '84163', '84164', '84165', '84166', '84167', '84168', '84169' 527 ); 528 foreach ( $prefixViettel as $value ) { 529 if (strpos ( $number, $value ) === 0) { 530 return 1; 531 } 532 } 533 return 0; 534 } 513 535 }
Note: See TracChangeset
for help on using the changeset viewer.