示例#1
0
文件: order.php 项目: OmondiKevin/ADT
 public function getBeginningBalance($param = array(), $month = 0)
 {
     $balance = 0;
     //we are checking for the physical count of theis drug month before reporting period
     $param['period_begin'] = date('Y-m-d', strtotime($param['period_begin'] . "-1 month"));
     $balance = Cdrr_Item::getLastPhysicalStock($param['period_begin'], $param['drug_id'], $param['facility_id']);
     if (!$balance && $month < 3) {
         $month++;
         $param['period_begin'] = date('Y-m-d', strtotime($param['period_begin'] . "-1 month"));
         $balance = $this->getBeginningBalance($param, $month);
     }
     if ($balance == null) {
         $balance = 0;
     }
     return $balance;
 }