Ignore:
Timestamp:
Mar 24, 2015 2:15:02 PM (10 years ago)
Author:
namnd
Message:
 
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  
    137137        }
    138138    }
    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        }
    140304}
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php

    r761 r818  
    3232        $data['month'] = date("m");
    3333        $data['year'] = date("Y");
    34         $data['to_date']=31;
     34        $data['to_date']= 31;
    3535        $data['to_month'] = date("m");
    3636        $data['to_year'] = date("Y");
     
    4444        $data['provinces'] = $result['provinces'];
    4545        $data['packages'] = $result['packages'];
    46 
     46                $data['totalVip'] = $result['totalVip'];
    4747        if ($this->input->is_ajax_request()) {
    4848            return $this->load->view('reportpackage/province', $data);
     
    7070    public function export() {
    7171        $this->load->model('reportmodel');
     72                $data['date']=1;
    7273        $data['month'] = $this->uri->segment(4);
    7374        $data['year'] = $this->uri->segment(5);
     75                $data['to_date']=31;
     76        $data['to_month'] = date("m");
     77        $data['to_year'] = date("Y");
    7478        $data = $this->getdays($data);
    7579        $result = $this->reportmodel->getPackages($data);
    7680        $data['provinces'] = $result['provinces'];
    7781        $data['packages'] = $result['packages'];
     82                $data['totalVip'] = $result['totalVip'];
    7883
    7984        $this->load->library("PHPExcel");
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php

    r771 r818  
    3030
    3131        $this->load->model('reportmodel');
    32         $data['date'] = 1;
     32        $data['date'] = date("d");
    3333        $data['month'] = date("m");
    3434        $data['year'] = date("Y");
    35         $data['to_date'] = 31;
     35        $data['to_date'] = date("d");
    3636        $data['to_month'] = date("m");
    3737        $data['to_year'] = date("Y");
    38         if ($this->input->post('month')) {
     38        if ($this->input->post()) {
     39                        $data['date'] = $this->input->post('date');
    3940            $data['month'] = $this->input->post('month');
    4041            $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               
    4456        if ($this->input->is_ajax_request()) {
    4557            return $this->load->view('reportprovince/province', $data);
     
    115127        echo "</pre>";
    116128    }
     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        }
    117367}
  • 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');
    22
    33class Paidlog_model extends MY_Model
     
    3737                        if ($data['paid_type'] ==0){
    3838                                $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);
    4039                        }else{
    4140                                $sql.=" AND paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     
    4544
    4645        $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                }
    5659        //return $this->db->query($sql)->result_array();
    5760                $re = $this->db->query($sql)->result_array();
  • pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php

    r765 r818  
    4545               
    4646                // 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);
    4950                $tbns = $query->result_array ();
    5051               
    5152                // 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";
    5355                $query = $this->db->query ( $sql );
    5456                $tbts = $query->result_array ();
     
    5658                // tinh thue bao theo ngay
    5759                $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                
    5960                $query = $this->db->query ( $sql );
    6061                $tbng = $query->result_array ();
    61                
    6262                $dem = 1;
     63               
     64                $totalTbng = 0;
     65                $totalTbth = 0;
     66                $totalTbn = 0;
     67                $totalDtng = 0;
     68                $totalDtth = 0;
     69                $totalDtn = 0;
    6370               
    6471                foreach ( $provinces as $index2 => $province ) {
     
    104111                                }
    105112                        }
     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                       
    106122                        $dem ++;
    107123                }
    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;
    110137        }
    111138       
     
    118145                $provinces = lang ( '_PROVINCES_' );
    119146                // 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'] . "'";
    121149                $query = $this->db->query ( $sql );
    122150                $users = $query->result_array ();
     
    128156                        $packages [$index] ['users'] = array ();
    129157                        foreach ( $users as $user ) {
    130                                 if ($user ['p_id'] == $package ['p_id']) {
     158                                if ($user ['p_code'] == $package ['p_code']) {
    131159                                        $packages [$index] ['users'] [] = $user;
    132160                                }
    133161                        }
    134162                }
    135                
    136163                foreach ( $provinces as $index => $province ) {
    137164                        $provinces [$index] = array (
     
    139166                        );
    140167                }
     168               
    141169                $dem = 1;
     170               
    142171                foreach ( $provinces as $index => $province ) {
    143172                        $provinces [$index] ['stt'] = $dem;
     
    154183                                                $provinces [$index] ['total'] = $totaluser;
    155184                                                $provinces [$index] ['packages'] [$package ['p_name']] ['total'] = $total;
     185                                                $provinces [$index] ['packages'] [$package ['p_name']] ['users'] [] = $user;
    156186                                               
    157                                                 $provinces [$index] ['packages'] [$package ['p_name']] ['users'] [] = $user;
    158187                                        }
    159188                                }
     
    161190                        $dem ++;
    162191                }
     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               
    163213                foreach ( $provinces as $index => $province ) {
    164214                        foreach ( $packages as $index2 => $package ) {
     
    172222                $data ['packages'] = $packages;
    173223                $data ['provinces'] = $provinces;
     224                $data['totalVip'] = $totalByVIP;
    174225                return $data;
    175226        }
  • pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php

    r769 r818  
    6969                                                        $sql.=" WHERE province = '".$data['province_code']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
    7070                                                }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']."')";
    7272                                                }
    7373                                        }else{
     
    101101                        }
    102102                }
     103                write_file('./log/test.log', date("d-m-Y: H:i:s"). ": ".$sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage'] , FOPEN_WRITE_CREATE);
    103104                return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
    104105        }
  • pro-violet-viettel/sourcecode/application/modules/admin/views/report/index.php

    r777 r818  
    1 <?php
     1<?php
    22$base_url = base_url();
    33$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));
    55?>
    66<script type="text/javascript">
     
    2626            });
    2727            return false;
    28         })
     28        });
    2929        $('#keyword').keyup(function (event) {
    3030            if (event.keyCode == '13') {
     
    157157        <li>
    158158            <i class="icon-home home-icon"></i>
    159             <a href="#">Trang chá»§</a>
     159            <a href="#">Trang ch</a>
    160160        </li>
    161161
    162162        <li>
    163             <a href="#">Quản lÜ tin nhắn</a>
     163            <a href="#">Quản lý tin nhắn</a>
    164164        </li>
    165165       
     
    169169        <form class="form-search">
    170170            <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 ...">
    172172                <i class="icon-search nav-search-icon"></i>
    173173            </span>
     
    183183    <div class="page-header">
    184184        <h1>
    185             Tin nhắn
     185            Tin nhn
    186186            <small>
    187187                <i class="icon-double-angle-right"></i>
    188                 Mẫu tin nhắn
     188                Mẫu tin nhắn
    189189            </small>
    190190        </h1>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php

    r777 r818  
    33                <div style="padding-bottom:4px" class="table-header">
    44                        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>
    58                </div>
    69
     
    4851                                                <tr role="row">
    4952                                                       
    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>
    5255                                                        <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>
    5356                                                        <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>
     
    6669
    6770                                                        <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>
    6972                                                        </td>
    70                                                         <td class=" "><?php echo $paidlog['cellphone']?></td>
     73                                                        <td class=" "><?php echo $paidlog['username'];?></td>
    7174                                                       
    7275                                                        <td class="hidden-480 "><?php echo number_format($paidlog['amount'],0);?></td>
     
    134137                <div class="tab-content history-tab-content">
    135138                    <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>
    136142                        <div class="table-responsive">
    137143                            <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  
    5555                            </tr>
    5656                        </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>
    5868                        <tbody role="alert" aria-live="polite" aria-relevant="all">
    5969                            <?php
     70                                                        $total = array();
    6071                            foreach ($provinces as $province) {
    6172                                ?>
     
    7586                                </tr>
    7687                            <?php } ?>
     88                                                        <?php //var_dump($total);?>
     89                                                       
    7790                        </tbody>
    7891                    </table>
    79                     <div class="row"><div class="col-sm-6">
     92                    <!--<div class="row"><div class="col-sm-6">-->
    8093
    8194                        </div>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php

    r713 r818  
    99                Báo cáo doanh thu theo tỉnh / thành phố
    1010                <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>
    1213                </div>
    1314            </div>
     
    1718                    <form autocomplete="off" onsubmit="return false;" id="province" >
    1819                        <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>
    2133
    2234                                        <select aria-controls="sample-table-2" size="1" name="month" onchange="filter();">                                     
     
    3446                                        </select>
    3547                                </div>
    36                             </div>
     48                                                        </div>
     49                                                       
    3750
    3851                            <div class="col-sm-6">
     
    4053                            </div>
    4154                        </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>
    4287                          </form>
    4388                    <table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info">
     
    58103
    59104                        <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>
    60115                            <?php
    61116                            foreach ($provinces as $province) {
     
    77132
    78133                                </tr>
     134                                                               
    79135                            <?php } ?>
    80136                        </tbody>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php

    r773 r818  
    171171                                    <td class=" ">
    172172                                        <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>-->
    174174                                    </td>
    175175                                    <td class=" ">
     
    177177                                    </td>
    178178                                    <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>
    180180                                    <td class=" "><?php echo isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : ''; ?></td>
    181181                                    <td><?php echo $user['province']; ?></td>
     
    225225            <div class="modal-header">
    226226                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</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>
    228228            </div>
    229229            <div class="modal-body">
     
    242242                <div class="tab-content history-tab-content">
    243243                    <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>
    244247                        <div class="table-responsive">
    245248                            <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  
    453453                        $data['us_id'] = $us_id;
    454454                        $data['username'] = $username;
     455                        $data['acc_balanced'] = number_format($user['acc_balanced']);
    455456                        $data['perpage'] = 10;
    456457                        $data['current_page'] = $this->uri->segment(6, 1);
  • pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php

    r773 r818  
    8888                                $us_id = $id;
    8989                                $user ['created_time'] = date ( 'Y-m-d H:i:s' );
     90                                $user ['updated_time'] = date ( 'Y-m-d H:i:s' );
    9091                                $user ['us_id'] = $us_id;
    9192                                $user ['p_id'] = $trialpackage['p_id'];
     
    9899                                $this->db->query ( 'UNLOCK TABLES' );
    99100                                $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);
    100102                                $aryPatterns = array ('/:trialdays:/', '/:username:/', '/:password:/');
    101103                                $trialdays = $this->config->item('trial_period');
    102104                                $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                                }
    104111                                $status = 1;
    105112                                $aryPatterns = array('/:username:/');
     
    565572        {
    566573                $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) );
    575579                $row = $query->result_array();
    576580                return $row;
     
    597601                }
    598602        }
     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       
    599619}
  • pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php

    r775 r818  
    228228                                }
    229229                                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                                        /*
    232234                                        if ($case == _SBG_MO_PAY_TO_ACCOUNT_FOR) {
    233235                                                $aryPatterns = array ('/:amount:/', '/:username:/');
    234236                                                $smsReturn = preg_replace($aryPatterns, array($amount, $userName), lang('_SBG_MO_CHARGING_FAIL_NOT_ENOUGH_FOR_MSG'));
    235                                         }
     237                                        }*/
    236238                                        $smsReturn = _SBG_MO_PROCCESS_ERR.'|'.$smsReturn;
    237239                                }
     
    248250                                break;
    249251                        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                                }
    251258                                break;
    252259                        case _SBG_MO_UNSUBSCRIBE_SERVICE:
     
    511518                }
    512519        }
     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        }
    513535}
Note: See TracChangeset for help on using the changeset viewer.