public function get_aryBarang()
 {
     $sql = Barang::find()->where('KD_CORP="ESM" AND PARENT= 1 AND STATUS<>3')->all();
     return ArrayHelper::map($sql, function ($sql, $defaultValue) {
         return $sql->KD_BARANG . ',' . $sql->NM_BARANG;
     }, 'NM_BARANG');
 }
 /**
  * Lists all Barangalias models.
  * @return mixed
  */
 public function actionProduct()
 {
     $out = [];
     if (isset($_POST['depdrop_parents'])) {
         $parents = $_POST['depdrop_parents'];
         if ($parents != null) {
             $id = $parents[0];
             $model = Barang::find()->asArray()->where(['PARENT' => $id])->andwhere('STATUS <> 3')->all();
             // print_r($model);
             // die();
             //$out = self::getSubCatList($cat_id);
             // the getSubCatList function will query the database based on the
             // cat_id and return an array like below:
             // [
             //    ['id'=>'<sub-cat-id-1>', 'name'=>'<sub-cat-name1>'],
             //    ['id'=>'<sub-cat_id_2>', 'name'=>'<sub-cat-name2>']
             // ]
             foreach ($model as $key => $value) {
                 $out[] = ['id' => $value['KD_BARANG'], 'name' => $value['NM_BARANG']];
             }
             echo json_encode(['output' => $out, 'selected' => '']);
             return;
         }
     }
     echo Json::encode(['output' => '', 'selected' => '']);
 }
Esempio n. 3
0
 /**
  * Check PO PLUS| kD_PO kD_BARANG =0 | Jika Ada, update Harga/QTY 
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function findcheck($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $cntDetailPo = Purchasedetail::find()->where('STATUS<>3 AND KD_PO="' . $this->kD_PO . '" AND KD_BARANG="' . $this->kD_BARANG . '"')->count();
         if ($cntDetailPo) {
             $this->addError($attribute, 'SKU Alrady Exist,Please Update Quantity or Price');
         } else {
             $brg = Barang::find()->where(['KD_BARANG' => $this->kD_BARANG])->one();
             //$roDetail = Rodetail::find()->where(['KD_RO'=>$kD_RO,'KD_BARANG'=>$this->kD_BARANG])->all();
             $brgUnit = $brg->unitb;
             $this->nM_BARANG = $brg->NM_BARANG;
             $this->hARGA = $brg->PARENT == 1 ? $brg->HARGA_PABRIK : $brg->HARGA_SPL;
             $this->nM_UNIT = $brgUnit->NM_UNIT;
             $this->qTY_UNIT = $brgUnit->QTY;
             $this->wEIGHT_UNIT = $brgUnit->WEIGHT;
         }
     }
 }
Esempio n. 4
0
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\Tipebarang;
use lukisongroup\master\models\Kategori;
use lukisongroup\master\models\Unitbarang;
use lukisongroup\master\models\Barang;
use lukisongroup\hrd\models\Corp;
$userCorp = ArrayHelper::map(Corp::find()->where('CORP_STS<>3')->all(), 'CORP_ID', 'CORP_NM');
$brgUnit = ArrayHelper::map(Unitbarang::find()->where('STATUS<>3')->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT');
$brgType = ArrayHelper::map(Tipebarang::find()->where('PARENT=1 AND STATUS<>3')->orderBy('NM_TYPE')->all(), 'KD_TYPE', 'NM_TYPE');
$brgKtg = ArrayHelper::map(Kategori::find()->where('PARENT=1 AND STATUS<>3')->orderBy('NM_KATEGORI')->all(), 'KD_KATEGORI', 'NM_KATEGORI');
$brgProdak = ArrayHelper::map(Barang::find()->where('PARENT=1 AND STATUS<>3')->orderBy('NM_BARANG')->all(), 'KD_BARANG', 'NM_BARANG');
?>


    <?php 
$form = ActiveForm::begin(['id' => 'roInput', 'enableClientValidation' => true, 'method' => 'post', 'action' => ['/purchasing/request-order/simpanfirst']]);
?>
	<?php 
//= $form->errorSummary($model);
?>
	
    <?php 
echo $form->field($roDetail, 'CREATED_AT', ['template' => "{input}"])->hiddenInput(['value' => date('Y-m-d H:i:s'), 'readonly' => true]);
?>

    <?php 
 public function actionCreatepo()
 {
     $post = Yii::$app->request->post();
     $coall = count($post['hargaBarang']);
     $kdpo = $post['kdpo'];
     for ($i = 0; $i < $coall; $i++) {
         $kdBrg = $post['kdBarang'][$i];
         $harga = $post['hargaBarang'][$i];
         $ckBrg = explode('.', $kdBrg);
         if ($ckBrg[0] == 'BRG') {
             $nmBrg = Barang::find('NM_BARANG')->where(['KD_BARANG' => $kdBrg])->one();
             $nmBrg->HARGA = $harga;
             $nmBrg->save();
         } else {
             if ($ckBrg[0] == 'BRGU') {
                 $nmBrg = Barang::find('NM_BARANG')->where(['KD_BARANG' => $kdBrg])->one();
                 $nmBrg->HARGA = $harga;
                 $nmBrg->save();
             }
         }
         $detpo = Purchasedetail::find('ID')->where(['KD_BARANG' => $kdBrg, 'KD_PO' => $kdpo])->one();
         $cons = \Yii::$app->db_esm;
         $command = $cons->createCommand();
         $command->update('p0002', ['HARGA' => $harga], "ID='{$detpo->ID}'")->execute();
     }
     $po = Purchaseorder::find()->where(['KD_PO' => $kdpo])->one();
     $po->STATUS = '101';
     $po->PAJAK = $post['pajak'];
     $po->DISC = $post['disc'];
     $po->NOTE = $post['note'];
     $po->ETA = $post['eta'];
     $po->ETD = $post['etd'];
     $po->SHIPPING = $post['shipping'];
     $po->BILLING = $post['billing'];
     $po->DELIVERY_COST = $post['delvCost'];
     $po->save();
     return $this->redirect([' ']);
 }
Esempio n. 6
0
//print_r($aryProviderDataStock);
//print_r($aryProviderHeaderStock);
/*
 * === STOCK =======================
 * @author ptrnov [ptr.nov@gmail.com]
 * @since 1.2
 * ===================================
 */
foreach ($aryProviderHeaderStock as $key => $value) {
    $colorb = 'rgba(255, 255, 142, 0.2)';
    if ($key == 'CUST_NM') {
        $lbl = "Customer Name";
        $align = "left";
        $pageSummary = 'Sub Total';
    } else {
        $kd = explode('_', $key);
        //echo $kd[1];
        $nmBrg = Barang::find()->where("KD_BARANG='" . $kd[1] . "'")->one();
        $lblR = $nmBrg['NM_BARANG'];
        $lbl = str_replace('MAXI', '', $lblR);
        $align = "center";
        $pageSummary = true;
    }
    /* Attribute Dinamik */
    $attDinamikSTCK[] = ['attribute' => $key, 'label' => $lbl, 'hAlign' => 'right', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(97, 211, 96, 0.3)']], 'contentOptions' => ['style' => ['text-align' => $align, 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => $colorb]], 'pageSummaryFunc' => GridView::F_SUM, 'pageSummary' => $pageSummary, 'pageSummaryOptions' => ['style' => ['text-align' => 'center', 'width' => '30px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']]];
}
$gvStockSummary = GridView::widget(['id' => 'gv-summary-stock', 'dataProvider' => $aryProviderDataStock, 'showPageSummary' => true, 'columns' => $attDinamikSTCK, 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-summary-stock']], 'summary' => false, 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true]);
?>
	<div style="font-family:tahoma, arial, sans-serif;font-size:9pt;text-align:center;color:red"><b>REVIEW - STOCK</b></div>
	<?php 
echo $gvStockSummary;
 private function aryBrgID()
 {
     $dataCust = ArrayHelper::map(Barang::find()->where(['KD_CORP' => 'ESM', 'KD_TYPE' => '01', 'KD_KATEGORi' => '01'])->orderBy('NM_BARANG')->asArray()->all(), 'KD_BARANG', 'NM_BARANG');
     return $dataCust;
 }
 /**
  * actionBrgkat() select2 barang mendapatkan unit barang
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function actionBrgunit()
 {
     $out = [];
     if (isset($_POST['depdrop_parents'])) {
         $ids = $_POST['depdrop_parents'];
         $kat_id = empty($ids[0]) ? null : $ids[0];
         $brg_id = empty($ids[1]) ? null : $ids[1];
         if ($brg_id != null) {
             $brgu = new Barang();
             $model = Barang::find()->where("KD_BARANG='" . $brg_id . "'")->one();
             $brgUnit = $model->unit;
             //foreach ($brgUnit as $value) {
             //$out[] = ['id'=>$value['UNIT'],'name'=> $value['NM_UNIT']];
             $out[] = ['id' => $brgUnit->KD_UNIT, 'name' => $brgUnit->NM_UNIT];
             //$out[] = ['id'=>'E07','name'=> $value->NM_UNIT];
             // }
             echo json_encode(['output' => $out, 'selected' => '']);
             return;
         }
     }
     echo Json::encode(['output' => '', 'selected' => '']);
 }
 /**
  * Deletes an existing Barang 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();
     $model = Barang::find()->where(['ID' => $id])->one();
     $model->STATUS = 3;
     $model->UPDATED_BY = Yii::$app->user->identity->username;
     $model->save();
     return $this->redirect(['index']);
 }
Esempio n. 10
0
use yii\helpers\Url;
use kartik\builder\Form;
use kartik\widgets\TouchSpin;
use yii\web\JsExpression;
use yii\data\ActiveDataProvider;
use lukisongroup\purchasing\models\ro\RodetailSearch;
use lukisongroup\master\models\Tipebarang;
use lukisongroup\master\models\Barang;
use lukisongroup\master\models\Kategori;
use lukisongroup\master\models\Unitbarang;
use lukisongroup\hrd\models\Corp;
$userCorp = ArrayHelper::map(Corp::find()->all(), 'CORP_ID', 'CORP_NM');
$brgType = ArrayHelper::map(Tipebarang::find()->where(['PARENT' => 0])->orderBy('NM_TYPE')->all(), 'KD_TYPE', 'NM_TYPE');
$brgUnit = ArrayHelper::map(Unitbarang::find()->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT');
$brgKtg = ArrayHelper::map(Kategori::find()->where(['PARENT' => 0, 'STATUS' => 1])->orderBy('NM_KATEGORI')->all(), 'KD_KATEGORI', 'NM_KATEGORI');
$brgUmum = ArrayHelper::map(Barang::find()->where(['PARENT' => 0, 'STATUS' => 1])->orderBy('NM_BARANG')->all(), 'KD_BARANG', 'NM_BARANG');
?>
	<?php 
/*
 * DESCRIPTION FORM AddItem
 * Form Add Items Hanya ada pada Form Edit | ACTION addItem
 * Items Barang tidak bisa di input Duplicated. | Unix by KD_RO dan KD_BARANG
 * @author ptrnov  <*****@*****.**>
 * @since 1.1
 */
?>

	<div  style="padding-top:20">
		<!-- Render create form -->
			<?php 
/* echo $this->render('_form', [
 public function actionBarangPrice()
 {
     if (Yii::$app->request->post('hasEditable')) {
         $idx = Yii::$app->request->post('editableKey');
         Yii::$app->response->format = Response::FORMAT_JSON;
         $modelPrice = Barang::findOne($idx);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Barang']);
         $post['Barang'] = $posted;
         if ($modelPrice->load($post)) {
             $output = '';
             $modelPrice->save();
             /* HARGA PABRIK */
             if (isset($posted['HARGA_PABRIK'])) {
                 $output = Yii::$app->formatter->asDecimal($modelPrice->HARGA_PABRIK, 0);
             }
             /* HARGA LG */
             if (isset($posted['HARGA_LG'])) {
                 $output = Yii::$app->formatter->asDecimal($modelPrice->HARGA_LG, 2);
             }
             /* HARGA SUPPLIER */
             if (isset($posted['HARGA_DIST'])) {
                 $output = $modelPrice->HARGA_DIST;
             }
             /* HARGA SALES LG */
             if (isset($posted['HARGA_SALES'])) {
                 $output = $modelPrice->HARGA_SALES;
             }
             $out = Json::encode(['output' => $output, 'message' => '']);
         }
         // return ajax json encoded response and exit
         echo $out;
         return;
     }
     $searchModel = new BarangSearch();
     $dataProvider = $searchModel->searchBarang(Yii::$app->request->queryParams);
     $model = new Barang();
     $querys = Barang::find()->from('dbc002.b0001 AS db1')->leftJoin('dbc002.b1001 AS db2', 'db1.KD_BARANG = db2.KD_TYPE')->where(['NM_TYPE' => 'FDSFDG'])->all();
     return $this->render('price', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'querys' => $querys]);
 }
Esempio n. 12
0
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\master\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');
$brgAll = ArrayHelper::map(Barang::find()->orderBy('NM_BARANG')->all(), 'KD_BARANG', 'NM_BARANG');
/* $this->registerJs("
        $.fn.modal.Constructor.prototype.enforceFocus = function() {};			
    ",$this::POS_HEAD);
 */
$aryParent = [['PARENT' => 0, 'PAREN_NM' => 'UMUM'], ['PARENT' => 1, 'PAREN_NM' => 'PRODAK']];
$valParent = ArrayHelper::map($aryParent, 'PARENT', 'PAREN_NM');
?>


    <?php 
$form = ActiveForm::begin(['id' => 'poplus-Input', 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'method' => 'post', 'action' => ['/purchasing/purchase-order/poplus-additem-save']]);
?>
	<?php 
//= $form->errorSummary($model);
?>
Esempio n. 13
0
 /**
  * BARANG PRODUCTION || Lukisongroup
  * PARENT = 1 [PRODUK]
  * @author ptrnov [piter@lukison.com]
  */
 public function searchBarangLG($params)
 {
     $query = Barang::find()->where('b0001.STATUS <> 3')->andWhere('b0001.PARENT=1 AND KD_CORP="LG"')->groupBy(['KD_BARANG', 'KD_CORP', 'KD_TYPE', 'KD_KATEGORI']);
     $query->joinWith(['unitb' => function ($q) {
         $q->where('ub0001.NM_UNIT LIKE "%' . $this->unitbrg . '%"');
     }]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 20]]);
     $dataProvider->setSort(['attributes' => ['KD_BARANG', 'NM_BARANG', 'unitbrg' => ['asc' => ['ub0001.NM_UNIT' => SORT_ASC], 'desc' => ['ub0001.NM_UNIT' => SORT_DESC], 'label' => 'Unit Barang'], 'tipebrg' => ['asc' => ['dbc002.b1001.NM_TYPE' => SORT_ASC], 'desc' => ['dbc002.b1001.NM_TYPE' => SORT_DESC], 'label' => 'Tipe Barang'], 'nmkategori' => ['asc' => ['b1002.NM_KATEGORI' => SORT_ASC], 'desc' => ['b1002.NM_KATEGORI' => SORT_DESC], 'label' => 'Kategori']]]);
     if (!($this->load($params) && $this->validate())) {
         /**
          * The following line will allow eager loading with country data
          * to enable sorting by country on initial loading of the grid.
          */
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'b0001.STATUS', $this->STATUS])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'b0001.KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'b0001.KD_TYPE', $this->tipebrg])->andFilterWhere(['like', 'b0001.KD_KATEGORI', $this->nmkategori]);
     return $dataProvider;
 }
 /**
  * actionBrgkat() select2 Kategori mendapatkan barang
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function actionCariBrg()
 {
     $out = [];
     if (isset($_POST['depdrop_parents'])) {
         $parents = $_POST['depdrop_parents'];
         if ($parents != null) {
             $kat_id = $parents[0];
             $model = Barang::find()->asArray()->where(['KD_KATEGORI' => $kat_id])->all();
             foreach ($model as $key => $value) {
                 $out[] = ['id' => $value['KD_BARANG'], 'name' => $value['NM_BARANG']];
             }
             echo json_encode(['output' => $out, 'selected' => '']);
             return;
         }
     }
     echo Json::encode(['output' => '', 'selected' => '']);
 }
Esempio n. 15
0
use lukisongroup\master\models\Kategori;
use lukisongroup\master\models\Unitbarang;
use lukisongroup\hrd\models\Corp;
use kartik\money\MaskMoney;
use yii\helpers\Url;
// $userCorp = ArrayHelper::map(Corp::find()->where('CORP_STS<>3')->all(), 'CORP_ID', 'CORP_NM');
$brgUnit = ArrayHelper::map(Unitbarang::find()->where('STATUS<>3')->orderBy('NM_UNIT')->all(), 'KD_UNIT', 'NM_UNIT');
// $brgType = ArrayHelper::map(Tipebarang::find()->where('PARENT=0 AND STATUS<>3')->orderBy('NM_TYPE')->all(), 'KD_TYPE', 'NM_TYPE');
// $brgKtg  = ArrayHelper::map(Kategori::find()->where('PARENT=0 AND STATUS<>3')->orderBy('NM_KATEGORI')->all(), 'KD_KATEGORI', 'NM_KATEGORI');
// $brgUmum = ArrayHelper::map(Barang::find()->where('PARENT=0 AND STATUS<>3')->orderBy('NM_BARANG')->all(), 'KD_BARANG', 'NM_BARANG');
/* $this->registerJs("
        $.fn.modal.Constructor.prototype.enforceFocus = function() {};
    ",$this::POS_HEAD);
 */
$corp = Yii::$app->getUserOpt->Profile_user()->emp->EMP_CORP_ID;
$data = ArrayHelper::map(Barang::find()->where(['KD_CORP' => $corp])->all(), 'KD_BARANG', 'NM_BARANG');
?>


    <?php 
$form = ActiveForm::begin(['id' => $roDetail->formName(), 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'method' => 'post', 'action' => ['/purchasing/request-order/simpanfirst'], 'validationUrl' => Url::toRoute('/purchasing/request-order/valid')]);
?>
	<?php 
//= $form->errorSummary($model);
?>

    <!-- $form->field($roDetail, 'CREATED_AT',['template' => "{input}"])->hiddenInput(['value'=>date('Y-m-d H:i:s'),'readonly' => true]) ?> -->

    <?php 
echo $form->field($roDetail, 'NEW')->radioList(['1' => 'New ', '2' => ' Search'], ['item' => function ($index, $label, $name, $checked, $value) {
    $return = '<label class="modal-radio">';