public function stockGatepassSearch($date_from, $dateto)
 {
     $wh_id = $this->_identity->getWarehouseId();
     if (!empty($date_from) && !empty($dateto)) {
         $where[] = "sm.transactionDate BETWEEN '" . App_Controller_Functions::dateTimeToDbFormat($date_from) . "' AND '" . App_Controller_Functions::dateTimeToDbFormat($dateto) . "'";
     }
     if (!empty($wh_id)) {
         $where[] = "sm.fromWarehouse = '" . $wh_id . "'";
     }
     $where[] = "sm.transactionType = '" . Model_TransactionTypes::TRANSACTION_ISSUE . "'";
     if (is_array($where)) {
         $where_s = implode(" AND ", $where);
     }
     $str_sql = $this->_em->createQueryBuilder()->select("sm.pkId,sm.transactionNumber,sm.transactionDate")->from("StockMaster", "sm")->where($where_s);
     //echo $str_sql->getQuery()->getSql();
     $row = $str_sql->getQuery()->getResult();
     if (!empty($row) && count($row) > 0) {
         return $row;
     } else {
         return false;
     }
 }
 public function update()
 {
     $warehouse_data = $this->_em->getRepository("HfDataMaster")->find($this->form_values['pk_id']);
     $warehouse_data->setReceivedBalance($this->form_values['received_balance']);
     $warehouse_data->setClosingBalance($this->form_values['closing_balance']);
     $warehouse_data->setModifiedDate(new \DateTime(App_Controller_Functions::dateTimeToDbFormat(date("d/m/Y"))));
     $user = $this->_em->getRepository('Users')->find($this->_user_id);
     $warehouse_data->setModifiedBy($user);
     $this->_em->persist($warehouse_data);
     $this->_em->flush();
     return true;
 }
Example #3
0
 public function stockGatepassSearch()
 {
     //$wh_id = $this->_identity->getWarehouseId();
     $where = "";
     if (!empty($this->form_values['vehicle_type_id'])) {
         $where[] = "gpv.vehicleType= '" . $this->form_values['vehicle_type_id'] . "'";
     }
     if (!empty($this->form_values['item_pack_size_id'])) {
         $where[] = "ip.pkId = '" . $this->form_values['item_pack_size_id'] . "'";
     }
     if (!empty($this->form_values['stock_batch_id'])) {
         $where[] = "sd.stockBatchWarehouse = '" . $this->form_values['stock_batch_id'] . "'";
     }
     if (!empty($this->form_values['date_from']) && !empty($this->form_values['date_to'])) {
         $where[] = "DATE_FORMAT(gpm.transactionDate,'%Y-%m-%d') BETWEEN '" . App_Controller_Functions::dateTimeToDbFormat($this->form_values['date_from']) . "' AND '" . App_Controller_Functions::dateTimeToDbFormat($this->form_values['date_to']) . "'";
     }
     $str_sqlee = $this->_em->createQueryBuilder()->select(" gpm.number as gpmnumber,gpm.transactionDate," . " gpv.number as gpnumber," . " sb.number," . "ip.itemName")->from("GatepassDetail", "gpd")->join("gpd.gatepassMaster", "gpm")->join("gpm.gatepassVehicle", "gpv")->join("gpd.stockDetail", "sd")->join("sd.stockBatchWarehouse", "sbw")->join("sbw.stockBatch", "sb")->join('sb.packInfo', 'pi')->join('pi.stakeholderItemPackSize', 'sip')->join("sip.itemPackSize", 'ip');
     if (is_array($where)) {
         $where_s = implode(" AND ", $where);
         $str_sqlee->where($where_s);
     }
     //->orderBy("s.transactionNumber", "ASC");
     //echo $str_sqlee->getQuery()->getSql();//exit;
     $result12 = $str_sqlee->getQuery()->getResult();
     //print_r($result12);exit;
     return $result12;
 }