public function addReport($stockId, $type, $from = NULL)
 {
     $stock_master = new Model_StockMaster();
     $stock_master->form_values['pk_id'] = $stockId;
     $stock_master->form_values['from'] = $from;
     $result = $stock_master->getItemDetailFromStock();
     if ($result != FALSE) {
         foreach ($result as $stockdata) {
             $tdate = $stockdata['transaction_date'];
             $product = $stockdata['item_id'];
             $month = App_Controller_Functions::dateFormat($tdate, "first day of this month", "m");
             $year = App_Controller_Functions::dateFormat($tdate, "first day of this month", "Y");
             $wh_id = $this->_identity->getWarehouseId();
             if ($month == date("m") && $year == date("Y")) {
                 $item = new Model_ItemPackSizes();
                 $items = $item->getAllItems();
                 foreach ($items as $one) {
                     $this->form_values['report_month'] = $month;
                     $this->form_values['report_year'] = $year;
                     $this->form_values['item_id'] = $one['pkId'];
                     $this->form_values['warehouse_id'] = $wh_id;
                     $this->form_values['created_by'] = $this->_user_id;
                     $this->adjustStockReport();
                 }
             } else {
                 $this->form_values['report_month'] = $month;
                 $this->form_values['report_year'] = $year;
                 $this->form_values['item_id'] = $product;
                 $this->form_values['warehouse_id'] = $wh_id;
                 $this->form_values['created_by'] = $this->_user_id;
                 $this->adjustStockReport();
             }
         }
     }
 }