/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Unitbarang::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, 'QTY' => $this->QTY, 'SIZE' => $this->SIZE, 'WEIGHT' => $this->WEIGHT, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'KD_UNIT', $this->KD_UNIT])->andFilterWhere(['like', 'NM_UNIT', $this->NM_UNIT])->andFilterWhere(['like', 'COLOR', $this->COLOR])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'CREATED_AT', $this->CREATED_AT])->andFilterWhere(['like', 'UPDATED_AT', $this->UPDATED_AT]); return $dataProvider; }
use kartik\helpers\Html; use kartik\grid\GridView; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use kartik\widgets\Select2; use kartik\widgets\DepDrop; use yii\helpers\Url; use kartik\builder\Form; use kartik\widgets\TouchSpin; use yii\web\JsExpression; use yii\data\ActiveDataProvider; use lukisongroup\master\models\Barangumum; use lukisongroup\esm\models\Barang; use lukisongroup\master\models\Kategori; use lukisongroup\master\models\Unitbarang; $brgUnit = ArrayHelper::map(Unitbarang::find()->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT'); $brgKtg = ArrayHelper::map(Kategori::find()->orderBy('NM_KATEGORI')->all(), 'KD_KATEGORI', 'NM_KATEGORI'); $brgUmum = ArrayHelper::map(Barangumum::find()->orderBy('NM_BARANG')->all(), 'KD_BARANG', 'NM_BARANG'); /* $this->registerJs(" $.fn.modal.Constructor.prototype.enforceFocus = function() {}; ",$this::POS_HEAD); */ ?> <?php $form = ActiveForm::begin(['id' => 'roInput', 'enableClientValidation' => true, 'method' => 'post', 'action' => ['/purchasing/request-order/simpanfirst']]); ?> <?php //= $form->errorSummary($model); ?>
<dd>: <?php if (count($dept) != 0) { echo $dept->DEP_NM; } else { echo 'Dept Set'; } ?> </dd> </dl> </div> <!-- Table Grid List RO Detail !--> <div> <?php echo GridView::widget(['id' => 'ro-process', 'dataProvider' => $dataProvider, 'headerRowOptions' => ['style' => 'background-color:rgba(126, 189, 188, 0.3); align:center'], 'filterRowOptions' => ['style' => 'background-color:rgba(126, 189, 188, 0.3); align:center'], 'beforeHeader' => [['columns' => [['content' => '', 'options' => ['colspan' => 2, 'class' => 'text-center info']], ['content' => 'Quantity', 'options' => ['colspan' => 3, 'class' => 'text-center info', 'style' => ['width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['content' => 'Remark', 'options' => ['colspan' => 2, 'class' => 'text-center info', 'style' => ['width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]]]]], 'columns' => [['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'hAlign' => 'center', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['label' => 'Items', 'attribute' => 'NM_BARANG', 'mergeHeader' => true, 'format' => 'raw', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['width' => '200px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'RQTY', 'label' => 'R.Qty', 'vAlign' => 'middle', 'hAlign' => 'center', 'mergeHeader' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '40px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['width' => '40px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'SQTY', 'label' => 'S.Qty', 'mergeHeader' => true, 'vAlign' => 'middle', 'hAlign' => 'center', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '40px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['width' => '40px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'UNIT', 'mergeHeader' => true, 'label' => 'Unit', 'vAlign' => 'middle', 'hAlign' => 'right', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']], 'value' => function ($model) { $model = Unitbarang::find()->where('KD_UNIT="' . $model->UNIT . '"')->one(); if (count($model) != 0) { $UnitNm = $model->NM_UNIT; } else { $UnitNm = 'Not Set'; } return $UnitNm; }], ['attribute' => 'NOTE', 'label' => 'Noted', 'hAlign' => 'left', 'mergeHeader' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['width' => '200px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'STATUS', 'options' => ['id' => 'test-ro'], 'label' => '#', 'hAlign' => 'center', 'vAlign' => 'middle', 'mergeHeader' => true, 'contentOptions' => ['style' => 'width: 100px'], 'format' => 'html', 'value' => function ($model, $key, $index, $widget) { return statusProcessRo($model); }, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(126, 189, 188, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'ro-process']], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => false]); ?> </div> <div> <?php $tgl1 = explode(' ', $roHeader->CREATED_AT);
public function actionCreate($kdpo) { $searchModel = new RequestorderSearch(); $dataProviderRo = $searchModel->cariHeaderRO_SendPO(Yii::$app->request->queryParams); $searchModel = new SalesorderSearch(); $dataProviderSo = $searchModel->cariHeaderSO_SendPO(Yii::$app->request->queryParams); $poHeader = Purchaseorder::find()->where(['KD_PO' => $kdpo])->one(); $supplier = $poHeader->suplier; $bill = $poHeader->bill; $ship = $poHeader->ship; $employee = $poHeader->employe; $poDetail = Purchasedetail::find()->where(['KD_PO' => $kdpo])->andWhere('STATUS <> 3')->all(); $poDetailProvider = new ArrayDataProvider(['key' => 'ID', 'allModels' => $poDetail, 'pagination' => ['pageSize' => 20]]); /* * Edit PO Quantity | Validation max Jumlah RO/SA * @author ptrnov <*****@*****.**> * @since 1.2 */ if (Yii::$app->request->post('hasEditable')) { $id = Yii::$app->request->post('editableKey'); Yii::$app->response->format = Response::FORMAT_JSON; $model = Purchasedetail::findOne($id); $currentQty = $model->QTY; $currentKdPo = $model->KD_PO; $currentKdRo = $model->KD_RO; $currentKdBrg = $model->KD_BARANG; /* $iendPoQtyValidation = new SendPoQtyValidation(); $iendPoQtyValidation->findOne($id); */ $out = Json::encode(['output' => '', 'message' => '']); $post = []; $posted = current($_POST['Purchasedetail']); $post['Purchasedetail'] = $posted; /* $posted = current($_POST['SendPoQtyValidation']); $post['SendPoQtyValidation'] = $posted; */ if ($model->load($post)) { $output = ''; /* * Split PO Plus dan PO Normal * PO Plus=POA.* * PO Plus=POB.* * @author ptrnov [piter@lukison] * @since 1.2 */ $kdPo = explode('.', $currentKdPo); if ($kdPo[0] != 'POA') { if (isset($posted['QTY'])) { /* * QTY RO-PO VALIDATION * QTY PO tidak boleh lebih dari SQTY Request Order */ /*Find SQTY RoDetail*/ $roDetail = Rodetail::find()->where(['KD_RO' => $currentKdRo, 'KD_BARANG' => $currentKdBrg])->one(); //if(!$roDetail){ $roQty = $roDetail->SQTY != 0 ? $roDetail->SQTY : 0; //}else{$roQty=0;} /*Sum QTY PoDetail */ $pqtyTaken = "SELECT SUM(QTY) as QTY FROM p0002 WHERE KD_RO='" . $roDetail->KD_RO . "' AND KD_BARANG='" . $roDetail->KD_BARANG . "' GROUP BY KD_BARANG"; //$pqtyTaken= 'SELECT SUM(QTY) as QTY FROM p0002 WHERE KD_RO="RO.2015.12.000001" AND KD_BARANG="BRGU.LG.03.06.E07.0001"'; $poDetailQtySum = Purchasedetail::findBySql($pqtyTaken)->one(); $poQty = $poDetailQtySum->QTY != 0 ? $poDetailQtySum->QTY : 0; /* Calculate SQTY RO - QTY PO + Current QTY | minus current record QTY */ $ttlPQTY = $roQty - $poQty + $currentQty; if ($posted['QTY'] <= $ttlPQTY) { $model->save(); $output = Yii::$app->formatter->asDecimal($model->QTY, 0); } else { return ['output' => '', 'message' => 'Request Order QTY Limited, Greater than RO QTY ! please insert free Qty, Check Request Order']; } } if (isset($posted['HARGA'])) { $model->save(); $output = Yii::$app->formatter->asDecimal($model->HARGA, 2); } if (isset($posted['UNIT'])) { $modelUnit = Unitbarang::find()->where('KD_UNIT="' . $posted['UNIT'] . '"')->one(); $model->NM_UNIT = $modelUnit->NM_UNIT; $model->UNIT_QTY = $modelUnit->QTY; $model->UNIT_WIGHT = $modelUnit->WEIGHT; $model->save(); $output = $model->UNIT; } /* if (isset($posted['NOTE'])) { // $output = Yii::$app->formatter->asDecimal($model->EMP_NM, 2); $output = $model->NOTE; } */ } elseif ($kdPo[0] != 'PO') { /* PO Plus=POB.*/ if (isset($posted['QTY'])) { $model->save(); $output = Yii::$app->formatter->asDecimal($model->QTY, 0); } if (isset($posted['HARGA'])) { $model->save(); $output = Yii::$app->formatter->asDecimal($model->HARGA, 2); } if (isset($posted['UNIT'])) { $model->save(); $output = $model->UNIT; } } $out = Json::encode(['output' => $output, 'message' => '']); } // return ajax json encoded response and exit echo $out; return; } return $this->render('create', ['searchModel' => $searchModel, 'dataProviderRo' => $dataProviderRo, 'dataProviderSo' => $dataProviderSo, 'poDetailProvider' => $poDetailProvider, 'poHeader' => $poHeader, 'supplier' => $supplier, 'bill' => $bill, 'ship' => $ship, 'employee' => $employee]); }
/** * Deletes an existing Unitbarang model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { // $this->findModel($id)->delete(); $data = Unitbarang::find()->where(['ID' => $id])->one(); $data->STATUS = 3; $data->save(); return $this->redirect(['index']); }
} }], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(247, 245, 64, 0.6)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(247, 245, 64, 0.6)']]], ['attribute' => 'STATUS', 'options' => ['id' => 'test-ro'], 'label' => 'Status', 'hAlign' => 'center', 'vAlign' => 'middle', 'mergeHeader' => true, 'contentOptions' => ['style' => 'width: 100px'], 'format' => 'html', 'value' => function ($model, $key, $index, $widget) { return statusProcessRo($model); }, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '50px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(247, 245, 64, 0.6)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '50px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(247, 245, 64, 0.6)']]], ['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'hAlign' => 'center', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-right' => '0px']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'KD_COSTCENTER', 'label' => 'Cost.Center', 'vAlign' => 'middle', 'mergeHeader' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']], 'editableOptions' => ['header' => 'Cost Center', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'md', 'options' => ['data' => ArrayHelper::map(Costcenter::find()->all(), 'KD_COSTCENTER', 'NM_COSTCENTER'), 'pluginOptions' => ['allowClear' => true, 'class' => 'pull-top dropup']], 'displayValueConfig' => ArrayHelper::map(Costcenter::find()->all(), 'KD_COSTCENTER', 'KD_COSTCENTER')]], ['attribute' => 'KD_BARANG', 'label' => 'SKU', 'hAlign' => 'left', 'vAlign' => 'middle', 'mergeHeader' => true, 'format' => 'raw', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']]], ['label' => 'Items Name', 'attribute' => 'NM_BARANG', 'hAlign' => 'center', 'vAlign' => 'middle', 'mergeHeader' => true, 'format' => 'raw', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '200px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'QTY', 'label' => 'Qty', 'vAlign' => 'middle', 'hAlign' => 'center', 'mergeHeader' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '60px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']], 'editableOptions' => ['header' => 'Update Quantity', 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'size' => 'sm', 'options' => ['pluginOptions' => ['min' => 0, 'max' => 50000]]]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'UNIT', 'mergeHeader' => true, 'label' => 'UoM', 'vAlign' => 'middle', 'hAlign' => 'right', 'readonly' => function ($model, $key, $index, $widget) use($poHeader) { //return (102=$model->STATUS || 0<> $headerStatus); // Allow Status Process = 0; return 102 == $poHeader->STATUS; // Allow Status Process = 0; }, 'value' => function ($model) { $model = Unitbarang::find()->where('KD_UNIT="' . $model->UNIT . '"')->one(); if (count($model) != 0) { $UnitNm = $model->NM_UNIT; } else { $UnitNm = 'Not Set'; } return $UnitNm; }, 'editableOptions' => ['header' => 'Update Unit', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'md', 'options' => ['data' => ArrayHelper::map(Unitbarang::find()->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT'), 'pluginOptions' => ['allowClear' => true, 'class' => 'pull-top dropup']], 'displayValueConfig' => ArrayHelper::map(Unitbarang::find()->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT')], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']], 'pageSummary' => function ($summary, $data, $widget) { return '<div>Sub Total :</div> <div>Discount :</div> <div>TAX :</div> <div>Delevery.Cost :</div> <div><b>GRAND TOTAL :</b></div>'; }, 'pageSummaryOptions' => ['style' => ['font-family' => 'tahoma', 'font-size' => '8pt', 'text-align' => 'right', 'border-left' => '0px', 'border-right' => '0px']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'HARGA', 'value' => function ($model) { return round($model->HARGA * $model->UNIT_QTY, 0, PHP_ROUND_HALF_UP); }, 'mergeHeader' => true, 'label' => 'Price', 'vAlign' => 'middle', 'hAlign' => 'right', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '100px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'editableOptions' => ['header' => 'Update Price', 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'size' => 'sm', 'options' => ['pluginOptions' => ['min' => 0, 'max' => 10000000000]]], 'format' => ['decimal', 2], 'pageSummary' => function ($summary, $data, $widget) use($poHeader) { $discountModal = $poHeader->DISCOUNT != 0 ? $poHeader->DISCOUNT : '0.00'; $pajakModal = $poHeader->PAJAK != 0 ? $poHeader->PAJAK : '0.00'; return '<div>IDR</div > <div> ' . Html::a($discountModal, Url::toRoute(['/purchasing/purchase-order/discount-view', 'kdpo' => $poHeader->KD_PO]), ['id' => 'discount', 'data-toggle' => 'modal', 'data-target' => '#frm-discount']) . ' %</div > <div>
echo GridView::widget(['id' => 'ro-process', 'dataProvider' => $dataProvider, 'filterModel' => '', 'filterRowOptions' => ['style' => 'background-color:rgba(0, 95, 218, 0.3); align:center'], 'beforeHeader' => [['columns' => [['content' => '', 'options' => ['colspan' => 2, 'class' => 'text-center info']], ['content' => 'Quantity', 'options' => ['colspan' => 3, 'class' => 'text-center info']], ['content' => 'Remark', 'options' => ['colspan' => 2, 'class' => 'text-center info']]]]], 'columns' => [['class' => 'kartik\\grid\\SerialColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'width' => '10px', 'header' => 'No.', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]], ['label' => 'Items', 'attribute' => 'NM_BARANG', 'hAlign' => 'left', 'vAlign' => 'middle', 'mergeHeader' => true, 'format' => 'raw', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '200px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'RQTY', 'label' => 'Qty.Request', 'vAlign' => 'middle', 'hAlign' => 'center', 'mergeHeader' => true, 'readonly' => function ($model, $key, $index, $widget) use($headerStatus) { //return (101 == $model->STATUS || 10 == $model->STATUS || 3 == $model->STATUS || 4 == $model->STATUS);// or 101 == $roHeader->STATUS); return 0 != $model->STATUS || 0 != $headerStatus; // Allow Status Process = 0); }, 'editableOptions' => ['header' => 'Update Quantity', 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'size' => 'sm', 'options' => ['pluginOptions' => ['min' => 0, 'max' => 50000]]], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '60px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'SQTY', 'label' => 'Qty.Submit', 'mergeHeader' => true, 'vAlign' => 'middle', 'hAlign' => 'center', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '60px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '60px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'UNIT', 'label' => 'Unit', 'hAlign' => 'left', 'vAlign' => 'middle', 'mergeHeader' => true, 'readonly' => function ($model, $key, $index, $widget) use($headerStatus) { return 0 != $model->STATUS || 0 != $headerStatus; // Allow Status Process = 0; }, 'value' => function ($model) { $model = Unitbarang::find()->where('KD_UNIT="' . $model->UNIT . '"')->one(); if (count($model) != 0) { $UnitNm = $model->NM_UNIT; } else { $UnitNm = 'Not Set'; } return $UnitNm; }, 'editableOptions' => ['header' => 'Update Quantity', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'md', 'options' => ['data' => ArrayHelper::map(Unitbarang::find()->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT'), 'pluginOptions' => ['min' => 0, 'max' => 50000, 'allowClear' => true]], 'displayValueConfig' => ArrayHelper::map(Unitbarang::find()->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT')], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '120px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '120px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'NOTE', 'label' => 'Notes', 'hAlign' => 'left', 'mergeHeader' => true, 'readonly' => function ($model, $key, $index, $widget) use($headerStatus) { return 0 != $model->STATUS || 0 != $headerStatus; // Allow Status Process = 0; }, 'editableOptions' => ['header' => 'Update Quantity', 'inputType' => \kartik\editable\Editable::INPUT_TEXTAREA, 'size' => 'md', 'options' => ['pluginOptions' => ['min' => 0, 'max' => 50000]]], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '200px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '200px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'STATUS', 'label' => 'Status', 'hAlign' => 'center', 'vAlign' => 'middle', 'mergeHeader' => true, 'contentOptions' => ['style' => 'width: 100px'], 'format' => 'html', 'value' => function ($model, $key, $index, $widget) { return statusProcessRo($model); }, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(0, 15, 118, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '8pt']]]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'ro-process']], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => false]); ?> </div> </div> <!-- Signature !--> <div class="col-md-11"> <?php $tgl1 = explode(' ', $roHeader->CREATED_AT); $awl1 = explode('-', $tgl1[0]); $blnAwl1 = date("F", mktime(0, 0, 0, $awl1[1], 1));
echo $form->field($roDetail, 'NOTE')->textarea(array('rows' => 2, 'cols' => 5))->label('Informasi'); ?> <div class="form-group"> <?php echo Html::submitButton($roDetail->isNewRecord ? 'Add' : 'Update', ['class' => $roDetail->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> <?php echo GridView::widget(['id' => 'ro-form', 'dataProvider' => $dataProvider, 'columns' => [['attribute' => 'KD_RO'], ['label' => 'Tanggal Pembuatan', 'attribute' => 'CREATED_AT'], ['label' => 'Nama Barang', 'attribute' => 'NM_BARANG'], ['label' => 'Qty', 'attribute' => 'RQTY'], ['attribute' => 'UNIT', 'mergeHeader' => true, 'value' => function ($model, $key, $index, $widget) { $masterUnit = Unitbarang::find()->where(['KD_UNIT' => $model->UNIT])->one(); if (count($masterUnit) != 0) { return $masterUnit->NM_UNIT; } else { return "Not Set"; } }], ['header' => 'Action', 'class' => 'yii\\grid\\ActionColumn', 'template' => '{tambah} {link} {edit} {delete} {cetak}', 'buttons' => ['delete' => function ($url, $model) { if ($model->STATUS == 0) { return Html::a('', ['hapusro', 'id' => $model->KD_RO], ['class' => 'fa fa-trash-o fa-lg', 'title' => 'Hapus RO', 'data-confirm' => 'Anda yakin ingin menghapus RO ini?']); } }]]], 'export' => false, 'toggleData' => false, 'panel' => ['type' => 'success']]); ?> </div>
use yii\helpers\Html; use kartik\form\ActiveForm; use yii\helpers\ArrayHelper; use kartik\widgets\Select2; use kartik\widgets\FileInput; use kartik\widgets\DepDrop; use yii\helpers\Url; use lukisongroup\master\models\Tipebarang; use lukisongroup\master\models\Kategori; use lukisongroup\master\models\Unitbarang; use lukisongroup\master\models\Suplier; use lukisongroup\hrd\models\Corp; $drop = ArrayHelper::map(Corp::find()->where('CORP_STS=1 AND CORP_ID="GSN"')->all(), 'CORP_ID', 'CORP_NM'); $droptype = ArrayHelper::map(Tipebarang::find()->where('STATUS<>3 and PARENT=1')->all(), 'KD_TYPE', 'NM_TYPE'); $dropkat = ArrayHelper::map(Kategori::find()->where('STATUS<>3 and PARENT=1')->all(), 'KD_KATEGORI', 'NM_KATEGORI'); $dropunit = ArrayHelper::map(Unitbarang::find()->all(), 'KD_UNIT', 'NM_UNIT'); $dropsup = ArrayHelper::map(Suplier::find()->all(), 'KD_SUPPLIER', 'NM_SUPPLIER'); ?> <div class="barang-form"> <?php $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'method' => 'post', 'id' => 'form-prodak-id', 'enableClientValidation' => true, 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'PARENT')->hiddenInput(['value' => 1, 'maxlength' => true])->label(false); ?> <?php echo $form->field($model, 'KD_CORP')->dropDownList($drop, ['id' => 'barang-kd_corp', 'readonly' => true])->label('Perusahaan'); echo $form->field($model, 'KD_TYPE')->widget(DepDrop::classname(), ['type' => DepDrop::TYPE_SELECT2, 'data' => $droptype, 'options' => ['id' => 'barang-kd_type'], 'pluginOptions' => ['depends' => ['barang-kd_corp'], 'url' => Url::to(['/dashboard/gsn-product/prodak-corp-type']), 'initialize' => true]]); echo $form->field($model, 'KD_KATEGORI')->widget(DepDrop::classname(), ['type' => DepDrop::TYPE_SELECT2, 'data' => $dropkat, 'options' => ['id' => 'barang-kd_kategori'], 'pluginOptions' => ['depends' => ['barang-kd_corp', 'barang-kd_type'], 'url' => Url::to(['/dashboard/gsn-product/prodak-type-kat']), 'initialize' => true]]);
public function ary_unit() { return ArrayHelper::map(Unitbarang::find()->all(), 'NM_UNIT', 'NM_UNIT'); }
<?php $drop = ArrayHelper::map(Tipebarang::find()->where(['STATUS' => 1])->all(), 'KD_TYPE', 'NM_TYPE'); ?> <?php echo $form->field($model, 'KD_TYPE')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Type Barang'); ?> <?php $drop = ArrayHelper::map(Kategori::find()->where(['STATUS' => 1])->all(), 'KD_KATEGORI', 'NM_KATEGORI'); ?> <?php echo $form->field($model, 'KD_KATEGORI')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Kategori'); ?> <?php $drop = ArrayHelper::map(Unitbarang::find()->all(), 'ID', 'NM_UNIT'); ?> <?php echo $form->field($model, 'KD_UNIT')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --']); ?> <?php /* $drop = ArrayHelper::map(Distributor::find()->all(), 'KD_DISTRIBUTOR', 'NM_DISTRIBUTOR'); */ ?> <?php /* $form->field($model, 'KD_DISTRIBUTOR')->dropDownList($drop,['prompt'=>' -- Pilih Salah Satu --']) */ ?> <?php echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]); ?>