/** * Lists all models. */ public function actionIndex() { parent::actionIndex(); $purchasingorg = new Purchasingorg('search'); $purchasingorg->unsetAttributes(); // clear any default values if (isset($_GET['Purchasingorg'])) { $purchasingorg->attributes = $_GET['Purchasingorg']; } $paymentmethod = new Paymentmethod('search'); $paymentmethod->unsetAttributes(); // clear any default values if (isset($_GET['Paymentmethod'])) { $paymentmethod->attributes = $_GET['Paymentmethod']; } $purchasinggroup = new Purchasinggroup('search'); $purchasinggroup->unsetAttributes(); // clear any default values if (isset($_GET['Purchasinggroup'])) { $purchasinggroup->attributes = $_GET['Purchasinggroup']; } $supplier = new Supplier('search'); $supplier->unsetAttributes(); // clear any default values if (isset($_GET['Supplier'])) { $supplier->attributes = $_GET['Supplier']; } $podetail = new Podetail('search'); $podetail->unsetAttributes(); // clear any default values if (isset($_GET['Podetail'])) { $podetail->attributes = $_GET['Podetail']; } $product = new Prmaterial('search'); $product->unsetAttributes(); // clear any default values if (isset($_GET['Prmaterial'])) { $product->attributes = $_GET['Prmaterial']; } $unitofmeasure = new Unitofmeasure('search'); $unitofmeasure->unsetAttributes(); // clear any default values if (isset($_GET['Unitofmeasure'])) { $unitofmeasure->attributes = $_GET['Unitofmeasure']; } $currency = new Currency('search'); $currency->unsetAttributes(); // clear any default values if (isset($_GET['Currency'])) { $currency->attributes = $_GET['Currency']; } $sloc = new Sloc('search'); $sloc->unsetAttributes(); // clear any default values if (isset($_GET['Sloc'])) { $sloc->attributes = $_GET['Sloc']; } $tax = new Tax('search'); $tax->unsetAttributes(); // clear any default values if (isset($_GET['Tax'])) { $tax->attributes = $_GET['Tax']; } $model = new Poheader('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Poheader'])) { $model->attributes = $_GET['Poheader']; } if (isset($_GET['pageSize'])) { Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']); unset($_GET['pageSize']); // would interfere with pager and repetitive page size change } $this->render('index', array('model' => $model, 'purchasingorg' => $purchasingorg, 'purchasinggroup' => $purchasinggroup, 'paymentmethod' => $paymentmethod, 'supplier' => $supplier, 'podetail' => $podetail, 'product' => $product, 'unitofmeasure' => $unitofmeasure, 'currency' => $currency, 'sloc' => $sloc, 'tax' => $tax, 'podetail' => $podetail)); }
public function loadModeldetail($id) { $model = Prmaterial::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
$this->widget('ToolbarButton', array('DialogID' => 'createdialog1', 'DialogGrid' => 'detaildatagrid', 'isSave' => true, 'UrlSave' => 'poheader/writedetail', 'isCancel' => true, 'UrlCancel' => 'poheader/cancelwritedetail')); echo $form->hiddenField($model, 'podetailid'); echo $form->hiddenField($model, 'poheaderid'); ?> <table> <tr> <td> <div class="row"> <?php echo $form->labelEx($model, 'prdetailid'); echo $form->hiddenField($model, 'prdetailid'); ?> <input type="text" name="product_name" id="prno" style="width: 250px" readonly> <?php $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'prmaterial_dialog', 'options' => array('title' => Yii::t('app', 'Purchase Request'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true))); $prmaterial = new Prmaterial('search'); $prmaterial->unsetAttributes(); // clear any default values if (isset($_GET['Prmaterial'])) { $prmaterial->attributes = $_GET['Prmaterial']; } $this->widget('zii.widgets.grid.CGridView', array('id' => 'prmaterial-grid', 'dataProvider' => $prmaterial->searchwfqtystatus(), 'filter' => $prmaterial, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+", array("name" => "send_absschedule", "id" => "send_absschedule", "onClick" => "$(\\"#prmaterial_dialog\\").dialog(\\"close\\"); $(\\"#Podetail_productid\\").val(\\"$data->productid\\"); $(\\"#Podetail_prdetailid\\").val(\\"$data->prmaterialid\\"); generatedata(); "))'), array('name' => 'prmaterialid', 'visible' => false, 'value' => '$data->prmaterialid'), array('name' => 'prheaderid', 'header' => 'PR Date', 'value' => '($data->prheader!==null)?$data->prheader->prdate:""'), array('name' => 'prheaderid', 'value' => '($data->prheader!==null)?$data->prheader->prno:""'), array('name' => 'productid', 'header' => 'Product Name', 'value' => '($data->product!==null)?$data->product->productname:""'), array('name' => 'qty', 'type' => 'raw', 'value' => 'Yii::app()->numberFormatter->format(Yii::app()->params["defaultnumberqty"],$data->qty - $data->poqty)'), array('name' => 'unitofmeasureid', 'header' => 'UOM Code', 'value' => '($data->unitofmeasure!==null)?$data->unitofmeasure->uomcode:""'), array('name' => 'requestedbyid', 'header' => 'Requested By Code', 'value' => '($data->requestedby!==null)?$data->requestedby->description:""')))); $this->endWidget('zii.widgets.jui.CJuiDialog'); echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("prmaterial-grid");$("#prmaterial_dialog").dialog("open"); return false;'));
public function actionGeneratedetail() { if (isset($_POST['productid']) & isset($_POST['supplierid']) & isset($_POST['prmaterialid'])) { $sodetail = Prmaterial::model()->findbysql('select * from prmaterial a inner join prheader b on b.prheaderid = a.prheaderid where prmaterialid = ' . $_POST['prmaterialid'] . ' and productid = ' . $_POST['productid'] . ' and qty > giqty ' . ' and b.prno is not null'); $pirdetail = Purchinforec::model()->findbyattributes(array('addressbookid' => $_POST['supplierid'], 'productid' => $_POST['productid'])); echo CJSON::encode(array('status' => 'success', 'gidetailid' => $sodetail->prmaterialid, 'prno' => $sodetail->prheader !== null ? $sodetail->prheader->prno : "", 'productid' => $sodetail->productid, 'productname' => $sodetail->product !== null ? $sodetail->product->productname : "", 'giqty' => $sodetail->qty - $sodetail->giqty, 'unitofmeasureid' => $sodetail->unitofmeasureid, 'uomcode' => $sodetail->unitofmeasure !== null ? $sodetail->unitofmeasure->uomcode : "", 'slocid' => $sodetail->prheader->slocid, 'itemtext' => $sodetail->itemtext)); Yii::app()->end(); } }