Example #1
0
 public function refreshReceiveTotal($receive_id)
 {
     $total = 0;
     if ($receive_id) {
         $data = $this->fetchAll("receive_id = " . $receive_id);
         if ($data->count() > 0) {
             $items = $data->toArray();
             foreach ($items as $item) {
                 $total += $item['total'];
             }
         }
     }
     $receive = new Erp_Model_Stock_Receive();
     $receive->update(array('total' => $total), "id = " . $receive_id);
 }