Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.79 KB | None | 0 0
  1.         if(count($alerts) > 0) {
  2.             $this->view->alerts = $alerts;
  3.             return $this->view->render('alert-box.phtml');
  4.         }
  5.         return false;
  6.     }
  7.     /**
  8.      * Count orders waiting for verification
  9.      * @return int
  10.      */
  11.     protected function _unverifiedCount()
  12.     {
  13.         $list = Report_Model_OrderList::build();
  14.         $list
  15.             ->whereStatusIn(array(Order::STATUS_PENDING_APPROVAL))
  16.             ->isUnverified();
  17.         switch( $this->_user->Role->slug ) {
  18.             case FirstAmerican_Roles::AFFILIATE_SUPPORT: $list->isExternal(); break;
  19.             case FirstAmerican_Roles::AFFILIATE_MANAGER: $list->forCompany( $this->_user->company_id );
  20.             case FirstAmerican_Roles::CUSTOMER_SUPPORT:  $list->isInternal();
  21.         }
  22.         return $list->getQuery()->count();
  23.     }
  24.     /**
  25.      * Count orders waiting for doctor assignment
  26.      * @return int
  27.      */
  28.     protected function _pendingCount()
  29.     {
  30.         $pending = Doctrine_Query::create()
  31.             ->select('ord.id, da.id')
  32.             ->from('Order ord INDEXBY ord.id, ord.PlacedBy usr')
  33.             ->where('ord.verified = ?',1)
  34.             ->addWhere('ord.current_status_id = ?',OrderStatusList::PENDING_APPROVAL)
  35.             ->addWhere('ord.id NOT IN (SELECT da2.order_id FROM DoctorApproval da2 WHERE da2.status IN ("pending", "approved"))');
  36.         if( $this->_user->Role->slug == FirstAmerican_Roles::AFFILIATE_SUPPORT )
  37.             $pending->addWhere('usr.Company.internal = ?', 0);
  38.         if( in_array( $this->_user->Role->slug, array(
  39.             FirstAmerican_Roles::CUSTOMER_SUPPORT,
  40.             FirstAmerican_Roles::AFFILIATE_MANAGER
  41.         ) ) )
  42.             $pending->addWhere('usr.company_id = ?', $this->_user->company_id);
  43.         return $pending->count();
  44.     }
  45.     /**
  46.      * Count companies waiting for verification
  47.      * @return int
  48.      */
  49.     protected function _companiesCount()
  50.     {
  51.         $companies = Doctrine_Query::create()
  52.             ->select('c.id, em.id')
  53.             ->from('Company c, c.Email em')
  54.             ->where('c.verified = ?',0)
  55.             ->addWhere('em.verified = ?', 1);
  56.         return $companies->count();
  57.     }
  58.     /**
  59.      * Count orders waiting for doctor approval
  60.      * @return int
  61.      */
  62.     protected function _approvalCount()
  63.     {
  64.         $approvals = Doctrine_Query::create()
  65.             ->select('da.id')
  66.             ->from('DoctorApproval da')
  67.             ->where('da.user_id = ?',$this->_user->id)
  68.             ->addWhere('da.status = ?','pending');
  69.         return $approvals->count();
  70.     }
  71.    
  72.    
  73.     //QUERY CHAD GAVE ME
  74.     //SELECT COUNT(app_order_system.ord.order_id) as total
  75.       //      FROM app_order_system.app_order ord
  76.        //     LEFT JOIN app_order_system.app_order_shipping ship ON ship.order_id = ord.id
  77.        //     LEFT JOIN app_order_system.app_shipping_status_list shipsta ON shipsta.id = ship.current_status_id
  78.         //    where ship.current_status_id = 2 and ship.type = 'package' and ship.shipped_by = 'usps'
  79.        //     group by ship.current_status_id order by ord.order_id;
  80.     protected function _intransitCount()   
  81.     {
  82.         return $intransit->count();
  83.  }
  84. }
  85. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement