public function actionDelpo($idpo, $kdpo)
 {
     $podet = Podetail::find()->where(['KD_PO' => $kdpo, 'ID' => $idpo])->one();
     $po = Purchasedetail::find()->where(['KD_PO' => $kdpo, 'ID' => $podet->ID_DET_PO])->one();
     $sisa = $po->QTY - $podet->QTY;
     if ($sisa == '0') {
         \Yii::$app->db_esm->createCommand()->update('p0002', ['QTY' => $sisa, 'STATUS' => '3'], "ID='{$po->ID}'")->execute();
     } else {
         \Yii::$app->db_esm->createCommand()->update('p0002', ['QTY' => $sisa], "ID='{$po->ID}'")->execute();
     }
     $podet->STATUS = '3';
     $podet->save();
     return $this->redirect(['create', 'kdpo' => $kdpo]);
 }
Exemple #2
0
					<?php 
    $form = ActiveForm::begin(['method' => 'post', 'action' => ['purchasing/purchase-order/spo?kdpo=' . $kdpo], 'id' => 'detpo' . $a]);
    ?>
        		<table class="table table-hover">
					<thead style="background-color:#FF8533;">
						<tr>
							<th>Kode RO</th>
							<th>Devisi</th>
							<th>Quantity</th>
							<th></th>
						</tr>
					</thead>

					<tbody>
						<?php 
    $pod = Podetail::find()->where(['ID_DET_PO' => $rows->ID])->andWhere('STATUS <> 3')->all();
    $b = 0;
    foreach ($pod as $pods => $pode) {
        $b = $b + 1;
        $ro_dep = Requestorder::find('KD_DEP')->where(['KD_RO' => $pode->KD_RO])->one();
        ?>
						<tr>
							<td><?php 
        echo $pode->KD_RO;
        ?>
</td>
							<td><?php 
        //echo $ro_dep->KD_DEP;
        ?>
</td>
							<td id="<?php