Пример #1
0
 /**
  * Calculate total gross sales between  2 dates
  * 
  * @param (date) $dateFrom - format: 'YYYY-mm-dd';
  * @param (date) $dateTo - format: 'YYYY-mm-dd';
  * @param int $shopId
  * @return int - total gross sales between  2 dates
  */
 public static function calculateTotalWeekGrossSales($dateFrom, $dateTo, $shopId)
 {
     $model = new Default_Model_DailySales();
     $selectAll = $model->getMapper()->getDbTable()->select()->from(array('ds' => 'daily_sales'), array('id' => 'SUM(ds.grossSales)'))->where('ds.date >= ?', $dateFrom)->where('ds.date <= ?', $dateTo)->where('ds.idShop = ?', $shopId);
     $model->fetchRow($selectAll);
     return $model->getId();
 }
Пример #2
0
 /**
  * 
  * @return number of reports that have not been audited
  */
 public function getTotalNoAudit()
 {
     $model = new Default_Model_DailySales();
     $select = $model->getMapper()->getDbTable()->select()->from(array('d' => 'daily_sales'), array('id' => 'COUNT(d.id)'))->where('audited = ?', 0)->setIntegrityCheck(false);
     $model->fetchRow($select);
     return $model->getId();
 }