Esempio n. 1
0
 public function getdata($sku, $c_id)
 {
     $response = array();
     $companyproducts = EeCompanyProduct::find()->joinWith(array('c' => function ($q) {
         $q->from('ee_company ec');
     }))->joinWith(array('product'))->where('sku = :abc AND ec.c_id = :cid', array(':abc' => $sku, ':cid' => $c_id))->limit(10)->all();
     if ($companyproducts) {
         $bills = EeCompanyBillDetails::find()->joinWith(array('companyBill' => function ($q) {
             $q->from('ee_company_bills');
         }))->joinWith('eeReturnHistories')->where('merchant_c_id = :cid AND product_id = :pi AND inventory_status_id IN (1,6)', array(':cid' => $companyproducts[0]->c_id, ':pi' => $companyproducts[0]['product_id']))->all();
         if ($bills) {
             $response['Available_Inventory'] = count($bills);
             $response['Company'] = $companyproducts[0]->c['companyname'];
             $response['Product Model'] = $companyproducts[0]->product['model_no'];
             $response['Product Description'] = $companyproducts[0]->product['description'];
             $response['Product MRP'] = $companyproducts[0]->product['mrp'];
             $response['Bill Id'] = $bills;
             $response['CP'] = $companyproducts[0];
             $response['Product'] = $companyproducts[0]->product;
         } else {
             $response['Available_Inventory'] = 0;
             $response['Company'] = $companyproducts[0]->c['companyname'];
             $response['Product Model'] = $companyproducts[0]->product['model_no'];
             $response['Product Description'] = $companyproducts[0]->product['description'];
             $response['Product MRP'] = $companyproducts[0]->product['mrp'];
             $response['CP'] = $companyproducts[0];
             $response['Product'] = $companyproducts[0]->product;
         }
     } else {
         $response['Error'] = 'No product found';
     }
     return $response;
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEeCompanyBillDetails()
 {
     return $this->hasMany(EeCompanyBillDetails::className(), ['brand_id' => 'brand_id']);
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBillItem()
 {
     return $this->hasOne(EeCompanyBillDetails::className(), ['id' => 'bill_item_id']);
 }
Esempio n. 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEeCompanyBillDetails()
 {
     return $this->hasMany(EeCompanyBillDetails::className(), ['inventory_status_id' => 'id']);
 }
Esempio n. 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEeCompanyBillDetails()
 {
     return $this->hasMany(EeCompanyBillDetails::className(), ['marketplaces_order_id' => 'id']);
 }