Exemplo n.º 1
0
 public function actionCreate($kdpo)
 {
     $model = new Purchaseorder();
     $qq = Purchaseorder::find()->where(['KD_PO' => $kdpo])->count();
     if ($qq == 0) {
         return $this->redirect([' ']);
     }
     if ($kdpo == '') {
         return $this->redirect([' ']);
     }
     if ($kdpo == null) {
         return $this->redirect([' ']);
     }
     $que = Requestorder::find()->where('STATUS <> 3 and STATUS <> 0')->all();
     $searchModel = new RequestorderSearch();
     $dataProvider = $searchModel->cari(Yii::$app->request->queryParams);
     $podet = Purchasedetail::find()->where(['KD_PO' => $kdpo])->all();
     $quer = Purchaseorder::find()->where(['KD_PO' => $kdpo])->one();
     return $this->render('create', ['model' => $model, 'que' => $que, 'quer' => $quer, 'podet' => $podet, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Exemplo n.º 2
0
<style type="text/css">
    td {vertical-align: top; padding: 2px;}
</style>

<div class="purchaseorder-view" style="margin:0px 20px;">
<br/><br/>

    <?php 
echo Html::a('<i class="fa fa-print fa-fw"></i> PDF', ['cetakpdf', 'kdpo' => $model->KD_PO], ['target' => '_blank', 'class' => 'btn btn-warning']);
?>


    <?php 
$sup = Suplier::find()->where(['KD_SUPPLIER' => $model->KD_SUPPLIER])->one();
$pod = Purchasedetail::find()->where(['KD_PO' => $model->KD_PO])->all();
?>

    <center>
        <h3 style="margin:0px;"><u>Purchase Order</u></h3>
        <h4 style="margin:0px;">No. <?php 
echo $model->KD_PO;
?>
</h4>
    </center>

    <br/>
    <div class="row">
      <div class="col-xs-12 col-sm-6 col-md-6">

            <b><?php 
Exemplo n.º 3
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([' ']);
 }