Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Sot2::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID' => $this->ID, 'TGL' => $this->TGL, 'UNIT_QTY' => $this->UNIT_QTY, 'UNIT_BERAT' => $this->UNIT_BERAT, 'SO_TYPE' => $this->SO_TYPE, 'SO_QTY' => $this->SO_QTY, 'HARGA_PABRIK' => $this->HARGA_PABRIK, 'HARGA_DIS' => $this->HARGA_DIS, 'HARGA_SALES' => $this->HARGA_SALES, 'HARGA_LG' => $this->HARGA_LG]);
     $query->andFilterWhere(['like', 'CUST_KD_ALIAS', $this->CUST_KD_ALIAS])->andFilterWhere(['like', 'KD_DIS', $this->KD_DIS])->andFilterWhere(['like', 'USER_ID', $this->USER_ID])->andFilterWhere(['like', 'KD_BARANG_ALIAS', $this->KD_BARANG_ALIAS])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'UNIT_BARANG', $this->UNIT_BARANG])->andFilterWhere(['like', 'NOTED', $this->NOTED]);
     return $dataProvider;
 }
Пример #2
0
 public function actionSendFix()
 {
     $username = Yii::$app->user->identity->username;
     $data_view = Yii::$app->db_esm->createCommand("\n\t\t\t#CALL ESM_SALES_IMPORT_TEMP_view('STOCK','" . $username . "')\n\t\t\tSELECT ID,TGL,ITEM_ID_ALIAS,ITEM_NM,QTY_PCS,HARGA_PCS,QTY_UNIT,DIS_REF,DIS_REF_NM,SO_TYPE,POS,USER_ID\n\t\t\tFROM so_t2_tmp_file\t\t\t\n\t\t\tWHERE USER_ID='" . $username . "' AND SO_TYPE=1\n\t\t")->queryAll();
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     if (Yii::$app->request->isAjax && $data_view) {
         $viewDataProvider = new ArrayDataProvider(['key' => 'ID', 'allModels' => $data_view, 'pagination' => ['pageSize' => 1000]]);
         $dataImport = $viewDataProvider->allModels;
         // print_r($viewDataProvider->allModels);
         // die();
         //Validation column
         $sttValidationColumn = 0;
         $sttValidationDataReady = 0;
         foreach ($dataImport as $key => $value) {
             if ($value['TGL'] == 'NotSet' or $value['ITEM_ID_ALIAS'] == 'NotSet' or $value['ITEM_NM'] == 'NotSet' or $value['QTY_PCS'] == 'NotSet' or $value['DIS_REF'] == 'NotSet' or $value['HARGA_PCS'] == '') {
                 $sttValidationColumn = 1;
             }
             $countDataSot2 = Sot2::find()->where(['SO_TYPE' => 1, 'TGL' => $value['TGL'], 'KD_BARANG_ALIAS' => $value['ITEM_ID_ALIAS']])->count();
             if ($countDataSot2 != 0) {
                 $sttValidationDataReady = $countDataSot2;
             }
         }
         //print_r($sttValidationColumn);
         //die();
         if ($sttValidationColumn != 1) {
             if ($sttValidationDataReady == 0) {
                 foreach ($dataImport as $key => $value) {
                     //$cmd->reset();
                     $tgl = date_format(date_create($value['TGL']), "Y-m-d");
                     $cust_kd = $value['CUST_KD_ALIAS'];
                     $item_kd = $value['ITEM_ID_ALIAS'];
                     $item_qty = $value['QTY_PCS'];
                     $item_price = $value['HARGA_PCS'];
                     $dis_id = $value['DIS_REF'];
                     $import_live = Yii::$app->db_esm->createCommand("CALL ESM_SALES_IMPORT_LIVE_create(\n\t\t\t\t\t\t\t\t\t\t\t\t'STOCKG_GUDANG','" . $tgl . "','" . $cust_kd . "','" . $item_kd . "','" . $item_qty . "','" . $item_price . "','WEB_IMPORT','" . $dis_id . "','" . $username . "'\n\t\t\t\t\t\t\t\t\t\t\t)");
                     $import_live->execute();
                 }
                 $rslt = 'sukses';
             } else {
                 $rslt = 'datasudahada';
             }
         } else {
             $rslt = 'validasi';
         }
         //return true;
     } else {
         //return $this->redirect(['index']);
         //return false;
         $rslt = 'nodata';
     }
     //return $this->redirect(['index']);
     return $rslt;
 }
 /**
  * Finds the Sot2 model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Sot2 the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Sot2::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
    return '<li>' . Html::a('<span class="fa fa-search-plus fa-dm"></span>' . Yii::t('app', 'Image Start'), ['/master/schedule-detail/img1', 'id' => $model->ID], ['id' => 'img1-id', 'data-toggle' => "modal", 'data-target' => "#img1-visit"]) . '</li>' . PHP_EOL;
}, 'view2' => function ($url, $model, $key) {
    return '<li>' . Html::a('<span class="fa fa-search-plus fa-dm"></span>' . Yii::t('app', 'Image End'), ['/master/schedule-detail/img2', 'id' => $model->ID], ['id' => 'img2-id', 'data-toggle' => "modal", 'data-target' => "#img2-visit"]) . '</li>' . PHP_EOL;
}], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(74, 206, 231, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'height' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]];
/*GRIDVIEW EXPAND*/
$attDinamik[] = ['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '50px', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    $dataInventory = Yii::$app->db_esm->createCommand("CALL ERP_CUSTOMER_VISIT_inventory('" . $model->TGL . "','" . $model->CUST_ID . "','" . $model->USER_ID . "')")->queryAll();
    $inventoryProvider = new ArrayDataProvider(['allModels' => $dataInventory, 'pagination' => ['pageSize' => 50]]);
    /*INFO*/
    $modelInfo = $model;
    /*INVENTORY*/
    //Sot2Search
    //$modelInvntory =Sot2::find()->where('TGL="'.$model->TGL.'" AND CUST_KD="'.$model->CUST_ID.'" AND USER_ID="'.$model->USER_ID.'"')->All();
    $modelInvntory = Sot2::find()->where('TGL="' . $model->TGL . '" AND USER_ID="' . $model->USER_ID . '"')->All();
    //$modelInvntory =Sot2::find()->where('USER_ID="'.$model->USER_ID.'"')->all();
    //$modelImage =CustomerVisitImage::find()->where('ID="'.$model->ID.'"')->One();
    $aryDataProvider = new ArrayDataProvider(['key' => 'ID', 'allModels' => $modelInvntory]);
    /*IMAGE VISIT*/
    $searchModel = new CustomerVisitImageSearch(['ID_DETAIL' => '' . $model->ID . '']);
    $dataProviderImage = $searchModel->search(Yii::$app->request->queryParams);
    return Yii::$app->controller->renderPartial('indexExpand', ['cust_id' => $model->ID, 'modelInfo' => $modelInfo, 'dataProviderInventory' => $aryDataProvider, 'searchModelImage' => $searchModel, 'inventoryProvider' => $inventoryProvider, 'dataProviderImage' => $dataProviderImage]);
}, 'headerOptions' => ['class' => 'kartik-sheet-style'], 'expandOneOnly' => false, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(74, 206, 231, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'height' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]];
/*GRIDVIEW ARRAY ROWS*/
foreach ($gvHeadColomn as $key => $value[]) {
    $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filterType' => $value[$key]['filterType'], 'filter' => $value[$key]['filter'], 'filterOptions' => ['style' => 'background-color:rgba(' . $value[$key]['filterwarna'] . '); align:center'], 'hAlign' => 'right', 'vAlign' => 'middle', 'noWrap' => true, 'group' => $value[$key]['GRP'], 'format' => $value[$key]['FORMAT'], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => $value[$key]['FIELD'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(' . $value[$key]['warna'] . ')']], 'contentOptions' => ['style' => ['text-align' => $value[$key]['align'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]];
}
/*STATUS RADIUS*/
$attDinamik[] = ['attribute' => 'sttKoordinat', 'label' => 'STATUS', 'filter' => $SttFilter, 'filterOptions' => ['style' => 'background-color:rgba(249, 215, 100, 1); align:center'], 'hAlign' => 'right', 'vAlign' => 'middle', 'value' => function ($model) {
    return statusRadius($model);