/new88li/core/admin/controller/sale/ctl.salescount.php
PHP | 172 lines | 162 code | 8 blank | 2 comment | 21 complexity | 019ec204c14b7eaa0c0d015233c249ff MD5 | raw file
- <?php
- include_once('objectPage.php');
- class ctl_salescount extends adminPage{
- var $workground ='analytics';
- function index(){
- $sales = &$this->system->loadModel('utility/salescount');
- //$this->pagedata['year']=date("Y");
- //$this->pagedata['month']=date("m");
- $value_year=date("Y")-2000;
- $value_month=date("m");
- if($_GET['search_year']){
- $_GET['search_year']=intval($_GET['search_year']);
- $_GET['search_month']=intval($_GET['search_month']);
- $value_year=$_GET['search_year'];
- $value_month=$_GET['search_month'];
- $month_st=$_GET['search_year'].'-01-01';
- $month_en=$_GET['search_year'].'-12-01';
- $day_st=$_GET['search_year'].'-'.($_GET['search_month']+1).'-01';
- $day_en=date("Y-m-01",strtotime("+1 month",strtotime($day_st)));
- }else{
- $month_st=date("Y-01-01");
- $month_en=date("Y-12-01");
- $day_st=date("Y-m-01");
- $day_en=date("Y-m-01",strtotime("+1 month",strtotime($day_st)));
- }
- $d_year=array();
- for($i=2000;$i<=date("Y");$i++){
- array_push($d_year,$i);
- }
- $d_month=array();
- for($i=1;$i<=12;$i++){
- array_push($d_month,$i);
- }
- $month_search=$sales->mdl_dosearch($month_st,$month_en,"","","month");
- $day_search=$sales->mdl_dosearch($day_st,$day_en,"","","day");
- $this->pagedata['day']=$day_search;
- $this->pagedata['month']=$month_search;
- $this->pagedata['d_year']=$d_year;
- $this->pagedata['d_month']=$d_month;
- $this->pagedata['value_month']=$value_month;
- $this->pagedata['value_year']=$value_year;
- $this->page('sale/count/salescount.html');
- }
- function countall(){
- if($_GET['ordertype'] && $_GET['method']){
- $order['order']=intval($_GET['ordertype']);
- $order['method']=intval($_GET['method']);
- }
- if($_GET['dosearch']){
- $dateFrom=strtotime($_GET['searchfrom']);
- $dateTo=strtotime($_GET['searchto']);
- $search=$_GET['dosearch'];
- $item=$_GET['searchitem'];
- $sales=&$this->system->loadModel('utility/salescount');
- $result=$sales->count_all($dateFrom,$dateTo,$item,$search,$order);
- $this->pagedata['plug']='&dosearch='.$_GET['dosearch'].'&searchitem='.$_GET['searchitem'].'&searchfrom='.$_GET['searchfrom'].'&searchto='.$_GET['searchto'];
- }else {
- $dateFrom=strtotime(date("Y").'-01-01');
- $dateTo=strtotime("+1 year",$dateFrom);
- $sales=&$this->system->loadModel('utility/salescount');
- $result=$sales->count_all($dateFrom,$dateTo,'','',$order);
- }
- if($_GET['genexml']==1){
- $dataio = $this->system->loadModel('system/dataio');
- $io="xls";
- $name=array('????','???','???');
- $dataio->export_begin("xls",$name,'?????(?)',count($result));
- $dataio->export_rows($io,$result);
- $dataio->export_finish('xls');
- exit();
- }
- $this->pagedata['data']=$result;
- $this->pagedata['method']=$_GET['method'];
- $this->page('sale/count/salescountall.html');
- }
- function do_search(){
- $sales = &$this->system->loadModel('utility/salescount');
- $results=$sales->mdl_dosearch($_POST['dateFrom'],$_POST['dateTo'],$_POST['dateCompareFrom'],$_POST['dateCompareTo'],$_POST['ptype']);
- echo $results;
- }
- function membercount(){
- if($_GET['ordertype'] && $_GET['method'] ){
- $order['order']=intval($_GET['ordertype']);
- $order['method']=intval($_GET['method']);
- }
- if($_GET['searchfrom'] && $_GET['searchto']){
- $dateFrom=strtotime($_GET['searchfrom']);
- $dateTo=strtotime($_GET['searchto']);
- $memberinfo=&$this->system->loadModel('utility/salescount');
- $result=$memberinfo->member_count($dateFrom,$dateTo,$order);
- }else{
- $dateFrom=strtotime(date("Y").'-01-01');
- $dateTo=strtotime("+1 year",$dateFrom);
- $memberinfo=&$this->system->loadModel('utility/salescount');
- $result=$memberinfo->member_count($dateFrom,$dateTo,$order);
- }
- if($_GET['genexml']==1){
- $addons = &$this->system->loadModel('system/addons');
- $io= $addons->load('xls','io');
- $name=array(__('???'),__('??'),__('???'),__('???'));
- $io->export_begin($name,__("?????(?)"),count($name));
- $io->export_rows($result);
- $io->export_finish();
- return;
- }
- $this->pagedata['data']=$result;
- $this->pagedata['method']=$_GET['method'];
- $this->page('sale/count/membercount.html');
- }
- function salesguide(){
- if($_GET['searchfrom'] && $_GET['searchto']){
- $dateFrom=strtotime($_GET['searchfrom']);
- $dateTo=strtotime($_GET['searchto']);
- $vcompare=&$this->system->loadModel('utility/salescount');
- $result['ordersales']=$vcompare->average_order_sales($dateFrom,$dateTo);
- $result['ordermember']=$vcompare->have_order_member($dateFrom,$dateTo);
- $result['allmember']=$vcompare->all_member();
- $result['visit']=$vcompare->count_all_visite($dateFrom,$dateTo);
- }else{
- $dateFrom=strtotime(date("Y").'-01-01');
- $dateTo=strtotime("+1 year",$dateFrom);
- $vcompare=&$this->system->loadModel('utility/salescount');
- $result['ordersales']=$vcompare->average_order_sales($dateFrom,$dateTo);
- $result['ordermember']=$vcompare->have_order_member($dateFrom,$dateTo);
- $result['allmember']=$vcompare->all_member();
- $result['visit']=$vcompare->count_all_visite($dateFrom,$dateTo);
- }
- $this->pagedata['data']=$result;
- $this->pagedata['method']=$_GET['method'];
- $this->page('sale/count/salesguide.html');
- }
- function visitsalecompare(){
- if($_GET['ordertype'] && $_GET['method'] ){
- $order['order']=intval($_GET['ordertype']);
- $order['method']=intval($_GET['method']);
- }
- if($_GET['searchfrom'] && $_GET['searchto']){
- $dateFrom=strtotime($_GET['searchfrom']);
- $dateTo=strtotime($_GET['searchto']);
- }else{
- $dateFrom=strtotime(date("Y").'-01-01');
- $dateTo=strtotime("+1 year",$dateFrom);
- }
- $this->pagedata['dateFrom'] = $dateFrom;
- $this->pagedata['dateTo'] = $dateTo;
- $this->pagedata['ship_status'] = 0;
- if($_GET['bn']) $this->pagedata['bn'] = $bn = $_GET['bn'];
- if(!empty($_GET['ship_status'])) $this->pagedata['ship_status'] = $ship_status = $_GET['ship_status'];
- $vcompare=&$this->system->loadModel('utility/salescount');
- $result=$vcompare->visit_sale_compare($dateFrom,$dateTo,$order, $bn, $ship_status);
- if($_GET['genexml']==1){
- $addons = &$this->system->loadModel('system/addons');
- $io= $addons->load('xls','io');
- $name=array(__('????'),__('????'),__('????'));
- $io->export_begin($name,__("????????"),count($name));
- $io->export_rows($result);
- return;
- }
- $this->pagedata['method']=$_GET['method'];
- $this->pagedata['data']=$result;
- $this->page('sale/count/visitsalecompare.html');
- }
- }
- ?>