border:1px solid #B2B2B2 !important; } } </style> <div class="ttl"> <center> <?php echo Html::img('@web/upload/lukison.png', ['class' => 'pnjg']); ?> </center> <br/> <?php $sup = Suplier::find()->where(['KD_SUPPLIER' => $model->KD_SUPPLIER])->one(); $pod = Purchasedetail::find()->where(['KD_PO' => $model->KD_PO])->all(); ?> <div style="font-size:12pt;"> <center> <h3 style="margin:0px;"><u>Purchase Order</u></h3> <h4 style="margin:0px;">No. <?php echo $model->KD_PO; ?> </h4> </center> </div> <br/><br/><br/> </div> <div class="purchaseorder-view" style="margin:0px 20px;">
use lukisongroup\master\models\Suplier; use lukisongroup\master\models\Barangumum; use lukisongroup\master\models\Nmperusahaan; use lukisongroup\purchasing\models\Purchasedetail; use lukisongroup\esm\models\Barang; /* @var $this yii\web\View */ /* @var $poHeader lukisongroup\poHeaders\esm\po\Purchaseorder */ $this->title = 'Detail PO'; $this->params['breadcrumbs'][] = ['label' => 'Purchaseorders', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $y = 4; ?> <?php $sup = Suplier::find()->where(['KD_SUPPLIER' => $poHeader->KD_SUPPLIER])->one(); $pod = Purchasedetail::find()->where(['KD_PO' => $poHeader->KD_PO])->all(); $ship = Nmperusahaan::find()->where(['ID' => $poHeader->SHIPPING])->one(); $bill = Nmperusahaan::find()->where(['ID' => $poHeader->BILLING])->one(); /* $x=10; function ax(){ return '10'; } */ /* function formulaAmount($summary, $data, $widget){ //$calculate = dataCell($model, $key, $index); //$p = compact('model', 'key', 'index'); return '<div>'.$summary * $this->model().',</div> <div>'.min($data).'</div> <div>'.$summary.'</div> <div>100,0</div> <div><b>10000,0</b></div>';
} return $UnitNm; }, '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']]], ['attribute' => 'HARGA', 'label' => 'Price', 'vAlign' => 'middle', 'hAlign' => 'center', 'mergeHeader' => true, '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']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']]], ['class' => 'kartik\\grid\\CheckboxColumn', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '20px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['readonly' => true, 'style' => ['text-align' => 'center', 'width' => '20px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']], 'checkboxOptions' => ['is' => 'ck-gv', 'class' => 'simple', 'style' => ['text-align' => 'left', 'width' => '20px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']], 'rowSelectedClass' => GridView::TYPE_WARNING, 'checkboxOptions' => function ($model, $key, $index, $column) use($kdpo) { $poDetail = Purchasedetail::find()->where(['KD_PO' => $kdpo, 'KD_RO' => $model->KD_RO, 'KD_BARANG' => $model->KD_BARANG])->one(); if ($poDetail) { return ['checked' => $model->TMP_CK, 'hidden' => true]; } else { /*FORMULA*/ $pqtyTaken = "SELECT SUM(QTY) as QTY FROM p0002 WHERE KD_RO='" . $model->KD_RO . "' AND KD_BARANG='" . $model->KD_BARANG . "' GROUP BY KD_BARANG"; $countQtyTaken = Purchasedetail::findBySql($pqtyTaken)->one(); if ($countQtyTaken) { $qtyInPo = $countQtyTaken->QTY != '' ? $countQtyTaken->QTY : 0; } else { $qtyInPo = 0; } //$qtyInPo=$countQtyTaken!=''? $countQtyTaken->QTY :0; $actualQty = $model->SQTY - $qtyInPo; if ($actualQty > 0) { return ['checked' => $model->TMP_CK]; } else { return ['checked' => $model->TMP_CK, 'hidden' => true]; } } }]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => true, 'id' => 'gv-ropo']], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => false]); ?>
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([' ']); }
echo GridView::widget(['id' => 'gv-ropo', 'dataProvider' => $roDetailProvider, 'columns' => [['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']]], ['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' => ['is' => 'kd-brg', 'style' => ['width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']]], ['label' => 'Items Name', 'attribute' => 'NM_BARANG', 'hAlign' => 'left', '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' => ['width' => '200px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-left' => '0px', 'border-right' => '0px']]], ['attribute' => 'SQTY', 'label' => 'SQty', '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']]], ['attribute' => 'UNIT', 'mergeHeader' => true, 'label' => 'UoM', 'vAlign' => 'middle', 'hAlign' => 'right', '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; }, '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\\CheckboxColumn', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['readonly' => true, 'style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']], 'checkboxOptions' => ['is' => 'ck-gv', 'class' => 'simple', 'style' => ['text-align' => 'left', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']], 'rowSelectedClass' => GridView::TYPE_WARNING, 'checkboxOptions' => function ($model, $key, $index, $column) { $poDetail = Purchasedetail::find()->where(['KD_RO' => $model->KD_RO, 'KD_BARANG' => $model->KD_BARANG])->one(); if ($poDetail) { return ['checked' => $model->TMP_CK, 'hidden' => true]; } else { return ['checked' => $model->TMP_CK]; } }]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => true, 'id' => 'gv-ropo']], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => false]); ?> <!-- <input type="hidden" name="kdpo" value="<?php echo $kdpo; ?> " />