<?php $this->widget('bootstrap.widgets.BootGridView', array('id' => 'u-order-detail-grid', 'dataProvider' => bPorderDetail::model()->search($model->id), 'template' => '{items}{pager}', 'itemsCssClass' => 'table table-striped table-bordered', 'columns' => array(array('header' => 'Item.', 'value' => '$data->item_id'), 'description', 'qty', 'uom', array('value' => '$data->amountf()', 'name' => 'amount', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;')), array('header' => 'Total', 'value' => '$data->totalf()', 'name' => 'amount', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;'))))); ?> <br /> <b> Total: <?php echo $model->sum_pof(); ?> </b> <hr /> <h2>Payment History</h2> <?php $this->widget('bootstrap.widgets.BootGridView', array('id' => 't-account-balance-grid', 'dataProvider' => bPorderPayment::model()->search($model->id), 'template' => '{items}{pager}', 'itemsCssClass' => 'table table-striped table-bordered', 'columns' => array('payment_date', array('header' => 'No Ref', 'value' => '$data->payment_ref'), array('header' => 'Payment Source', 'value' => '$data->payment_source->account_concat()'), array('header' => 'Payment Type', 'value' => '$data->payment_type_id'), array('header' => 'Effective Date', 'value' => '$data->effective_date'), array('name' => 'amount', 'value' => '$data->amountf()', 'htmlOptions' => array('style' => 'text-align: right; padding-right: 5px;'))))); ?> <?php //--------------------- begin new code -------------------------- // add the (closed) dialog for the iframe $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'cru-dialog', 'options' => array('title' => 'View Detail', 'autoOpen' => false, 'modal' => true, 'width' => '70%', 'height' => '400'))); ?> <iframe id="cru-frame" width="100%" height="100%"></iframe> <?php $this->endWidget(); //--------------------- end new code -------------------------- ?>
public function newPayment($id) { $model = new bPorderPayment(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['bPorderPayment'])) { $model->attributes = $_POST['bPorderPayment']; $model->parent_id = $id; if ($model->save()) { //Create System_ref $_ref = "AP-" . str_pad($model->id, 5, "0", STR_PAD_LEFT); bPorderPayment::model()->updateByPk((int) $model->id, array('payment_ref' => $_ref)); $modelPO = $this->loadModel($id); if ($modelPO->payment >= $modelPO->sum_po) { bPorder::model()->updateByPk((int) $modelPO->id, array('payment_state_id' => 2)); } $this->redirect(array('view', 'id' => $id)); } } return $model; }