Exemplo n.º 1
0
 public function getKey_KdBrg($corp_id)
 {
     $ck = Barangumum::find(['max(KD_BARANG) as KD_BARANG'])->where(['KD_CORP' => $corp_id])->one();
     $kd = explode('.', $ck['KD_BARANG']);
     //$nkd_test=$kd[2]+1;
     if (count($ck) == 0) {
         $nkd = 1;
     } else {
         $nkd = $kd[2] + 1;
     }
     $digit = str_pad($nkd, 6, "0", STR_PAD_LEFT);
     $KD_BRG = 'BRG.' . $corp_id . '.' . $digit;
     return $KD_BRG;
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Barangumum::find()->where('b1000.STATUS <> 3');
     $query->joinWith(['type' => function ($q) {
         $q->where('b1001.NM_TYPE LIKE "%' . $this->nmtype . '%"');
     }]);
     $query->joinWith(['kategori' => function ($q) {
         $q->where('b1002.NM_KATEGORI LIKE "%' . $this->nmktegori . '%"');
     }]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ['KD_BARANG', 'NM_BARANG', 'nmtype' => ['asc' => ['b1001.NM_TYPE' => SORT_ASC], 'desc' => ['b1001.NM_TYPE' => SORT_DESC], 'label' => 'Type'], 'nmktegori' => ['asc' => ['b1002.NM_KATEGORI' => SORT_ASC], 'desc' => ['b1002.NM_KATEGORI' => SORT_DESC], 'label' => 'Type']]]);
     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.
          */
         $query->joinWith(['type']);
         $query->joinWith(['kategori']);
         return $dataProvider;
     }
     /*
             $query->andFilterWhere([
                 'ID' => $this->ID,
                 'HPP' => $this->HPP,
                 'HARGA' => $this->HARGA,
                 'STATUS' => $this->STATUS,
                 'CREATED_AT' => $this->CREATED_AT,
                 'UPDATED_AT' => $this->UPDATED_AT,
             ]);
             $query->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])
                 ->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])
                 ->andFilterWhere(['like', 'KD_TYPE', $this->KD_TYPE])
                 ->andFilterWhere(['like', 'KD_KATEGORI', $this->KD_TYPE])
                 ->andFilterWhere(['like', 'KD_UNIT', $this->KD_UNIT])
                 ->andFilterWhere(['like', 'KD_SUPPLIER', $this->KD_SUPPLIER])
                 ->andFilterWhere(['like', 'KD_DISTRIBUTOR', $this->KD_DISTRIBUTOR])
                 ->andFilterWhere(['like', 'BARCODE', $this->BARCODE])
                 ->andFilterWhere(['like', 'IMAGE', $this->IMAGE])
                 ->andFilterWhere(['like', 'NOTE', $this->NOTE])
                 ->andFilterWhere(['like', 'KD_CORP', $this->KD_CORP])
                 ->andFilterWhere(['like', 'KD_CAB', $this->KD_CAB])
                 ->andFilterWhere(['like', 'KD_DEP', $this->KD_DEP])
                 ->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])
                 ->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY])
                 ->andFilterWhere(['like', 'DATA_ALL', $this->DATA_ALL]);
     */
     return $dataProvider;
 }
 public function actionSimpan($id)
 {
     $rodetail = new Rodetail();
     $hsl = Yii::$app->request->post();
     $created = $hsl['Rodetail']['CREATED_AT'];
     $nmBarang = $hsl['Rodetail']['NM_BARANG'];
     $kdRo = $hsl['Rodetail']['KD_RO'];
     $kdBarang = $hsl['Rodetail']['KD_BARANG'];
     $qty = $hsl['Rodetail']['QTY'];
     $note = $hsl['Rodetail']['NOTE'];
     $ck = Rodetail::find()->where(['KD_BARANG' => $kdBarang, 'KD_RO' => $kdRo])->andWhere('STATUS <> 3')->one();
     if (count($ck) == 1) {
         \Yii::$app->getSession()->setFlash('error', '<br/><br/><p class="bg-danger" style="padding:15px"><b>Barang Sudah di Masukkan</b></p>');
         return $this->redirect(['buatro', 'id' => $id]);
     } else {
         $kdBrg = $hsl['Rodetail']['KD_BARANG'];
         $ckBrg = explode('.', $kdBrg);
         if ($ckBrg[0] == 'BRG') {
             $kdUnit = Barang::find('KD_UNIT')->where(['KD_BARANG' => $kdBrg])->one();
         } else {
             if ($ckBrg[0] == 'BRGU') {
                 $kdUnit = Barangumum::find('KD_UNIT')->where(['KD_BARANG' => $kdBrg])->one();
             }
         }
         $rodetail->UNIT = $kdUnit->KD_UNIT;
         $rodetail->CREATED_AT = $created;
         $rodetail->NM_BARANG = $nmBarang;
         $rodetail->KD_RO = $kdRo;
         $rodetail->KD_BARANG = $kdBarang;
         $rodetail->QTY = $qty;
         $rodetail->NOTE = $note;
         $rodetail->save();
         \Yii::$app->getSession()->setFlash('error', '<br/><br/><p class="bg-success" style="padding:15px"><b>Barang berhasil di Masukkan</b></p>');
         return $this->redirect(['buatro', 'id' => $id]);
     }
 }
Exemplo n.º 4
0
            <td class="head">Total Harga</td>
        </tr>


        <tbody>
        <?php 
$total = 0;
$a = 0;
foreach ($pod as $key => $val) {
    $a = $a + 1;
    $ckBrg = explode('.', $val->KD_BARANG);
    if ($ckBrg[0] == 'BRG') {
        $nmBrg = Barang::find('NM_BARANG')->where(['KD_BARANG' => $val->KD_BARANG])->one();
    } else {
        if ($ckBrg[0] == 'BRGU') {
            $nmBrg = Barangumum::find('NM_BARANG')->where(['KD_BARANG' => $val->KD_BARANG])->one();
        }
    }
    $ckUnit = preg_replace("/[^A-Z\\']/", '', $val->UNIT);
    if ($ckUnit == 'U') {
        $brg = lukisongroup\models\master\Unitbarang::find('NM_UNIT')->where(['KD_UNIT' => $val->UNIT])->one();
    } else {
        $brg = lukisongroup\models\esm\Unitbarang::find('NM_UNIT')->where(['KD_UNIT' => $val->UNIT])->one();
    }
    ?>

            <tr>
                <td><?php 
    echo $a;
    ?>
</td>
Exemplo n.º 5
0
    ?>

			<?php 
    if ($a == 1) {
        echo "</form>";
    }
    ?>
			<tr style="cursor:pointer;">

			<?php 
    $ckBrg = explode('.', $rows->KD_BARANG);
    if ($ckBrg[0] == 'BRG') {
        $nmBrg = Barang::find('NM_BARANG', 'HARGA')->where(['KD_BARANG' => $rows->KD_BARANG])->one();
    } else {
        if ($ckBrg[0] == 'BRGU') {
            $nmBrg = Barangumum::find('NM_BARANG', 'HARGA')->where(['KD_BARANG' => $rows->KD_BARANG])->one();
        }
    }
    $ckUnit = preg_replace("/[^A-Z\\']/", '', $rows->UNIT);
    if ($ckUnit == 'U') {
        $brg = lukisongroup\models\master\Unitbarang::find('NM_UNIT')->where(['KD_UNIT' => $rows->UNIT])->one();
    } else {
        $brg = lukisongroup\models\esm\Unitbarang::find('NM_UNIT')->where(['KD_UNIT' => $rows->UNIT])->one();
    }
    ?>

				<td class=" accordion-toggle" data-toggle="collapse" data-target="#demo<?php 
    echo $a;
    ?>
"><?php 
    echo $a;
Exemplo n.º 6
0
 /**
  * Finds the Barangumum model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @param string $kd_barang
  * @return Barangumum the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($ID, $KD_BARANG)
 {
     if (($model = Barangumum::findOne(['ID' => $ID, 'KD_BARANG' => $KD_BARANG])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 7
0
 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 = Barangumum::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([' ']);
 }
Exemplo n.º 8
0
" readonly >
		</div>
	</div>

	<div class="form-group">
		<div class="col-sm-12">
			<br/>
		</div>
	</div>

 </form>
 
 
<?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['esm/requestorder/simpan?id=' . $id]]);
$brg = ArrayHelper::map(Barangumum::find()->all(), 'KD_BARANG', 'NM_BARANG');
$unit = ArrayHelper::map(Unitbarang::find()->all(), 'KD_UNIT', 'NM_UNIT');
echo $form->field($rodetail, 'CREATED_AT')->hiddenInput(['value' => date('Y-m-d H:i:s')])->label(false);
?>
	
<?php 
echo $form->field($rodetail, 'NM_BARANG')->hiddenInput(['value' => ''])->label(false);
?>
	

<?php 
echo $form->field($rodetail, 'KD_RO')->textInput(['value' => $id, 'readonly' => true])->label('Kode Request Order');
?>

<div class="row">
  <div class="col-xs-3"><?php