public function make() { $values = array(Zurmo::t('CustomField', 'Labor'), Zurmo::t('CustomField', 'Equipment'), Zurmo::t('CustomField', 'Material'), Zurmo::t('CustomField', 'Subcontractor'), Zurmo::t('CustomField', 'Other'), Zurmo::t('CustomField', 'Assembly')); static::makeCustomFieldDataByValuesAndDefault('CostOfGoodsTypes', $values); $values = array(Zurmo::t('CustomField', 'All'), Zurmo::t('CustomField', 'Labor'), Zurmo::t('CustomField', 'Equipment'), Zurmo::t('CustomField', 'Material'), Zurmo::t('CustomField', 'Subcontractor'), Zurmo::t('CustomField', 'Other')); static::makeCustomFieldDataByValuesAndDefault('CostOfGoodsTypesAssembly', $values, $values[0]); $unitofMeasuresDropdownOptions = array(); foreach (Unitofmeasure::getAll('name') as $uom) { $unitofMeasuresDropdownOptions[] = Zurmo::t('CustomField', $uom->name); } static::makeCustomFieldDataByValuesAndDefault('UnitOfMeasureTypes', $unitofMeasuresDropdownOptions); $categoriesDropdownOptions = array(); foreach (Category::getAll('name') as $categroy) { $categoriesDropdownOptions[] = Zurmo::t('CustomField', $categroy->name); } static::makeCustomFieldDataByValuesAndDefault('CategoryTypes', $categoriesDropdownOptions); $assemblyDetailvalues = Costbook::getAllAssemblyDetails(); $assemblyDetailDropdownOptions = array(); foreach ($assemblyDetailvalues as $assemblyDetail) { if ($assemblyDetail['assemblydetail'] != NULL) { $tmpAssemblyoptions = explode(";", $assemblyDetail['assemblydetail']); foreach ($tmpAssemblyoptions as $assemblyOption) { $assemblyDetailDropdownOptions[] = Zurmo::t('CustomField', $assemblyOption); } } } static::makeCustomFieldDataByValuesAndDefault('AssemblyDetailSearchTypes', $assemblyDetailDropdownOptions); }
/** * Lists all models. */ public function actionIndex() { parent::actionIndex(); $deliveryadvicedetail = new Deliveryadvicedetail('search'); $deliveryadvicedetail->unsetAttributes(); // clear any default values if (isset($_GET['Deliveryadvicedetail'])) { $deliveryadvicedetail->attributes = $_GET['Deliveryadvicedetail']; } $product = new Product('search'); $product->unsetAttributes(); // clear any default values if (isset($_GET['Product'])) { $product->attributes = $_GET['Product']; } $unitofmeasure = new Unitofmeasure('search'); $unitofmeasure->unsetAttributes(); // clear any default values if (isset($_GET['Unitofmeasure'])) { $unitofmeasure->attributes = $_GET['Unitofmeasure']; } $sloc = new Sloc('search'); $sloc->unsetAttributes(); // clear any default values if (isset($_GET['Sloc'])) { $sloc->attributes = $_GET['Sloc']; } $requestedby = new Requestedby('search'); $requestedby->unsetAttributes(); // clear any default values if (isset($_GET['Requestedby'])) { $requestedby->attributes = $_GET['Requestedby']; } $model = new Deliveryadvice('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Deliveryadvice'])) { $model->attributes = $_GET['Deliveryadvice']; } 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, 'deliveryadvicedetail' => $deliveryadvicedetail, 'product' => $product, 'unitofmeasure' => $unitofmeasure, 'sloc' => $sloc, 'requestedby' => $requestedby)); }
public static function isUnitofmeasureInUseById($unitofmeasureId) { $unitofmeasures = Unitofmeasure::getById($unitofmeasureId); $rows = ZurmoRedBean::getAll('SELECT * FROM customfield WHERE id IN (SELECT unitofmeasure_customfield_id FROM costbook) AND VALUE="' . $unitofmeasures->name . '"'); if (count($rows) > 0) { return true; } else { return false; } }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Material Stock Overview List'; $pdf->AddPage('L'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Material Name', 'Sloc', 'Qty', 'UOM', 'Prod Trans Type', 'Ref Source'); $model = new Productstock('search'); $dataprovider = $model->search(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(10, 15, 70, 30, 30, 30, 40, 30); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['productstockid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, Product::model()->findbypk($datas['productid'])->productname, 'LR', 0, 'L', $fill); $pdf->Cell($w[3], 6, Sloc::model()->findbypk($datas['slocid'])->sloccode, 'LR', 0, 'L', $fill); $pdf->Cell($w[4], 6, $datas['qty'], 'LR', 0, 'L', $fill); $pdf->Cell($w[5], 6, Unitofmeasure::model()->findbypk($datas['unitofmeasureid'])->uomcode, 'LR', 0, 'L', $fill); $pdf->Cell($w[6], 6, Prodtranstype::model()->findbypk($datas['prodtranstypeid'])->description, 'LR', 0, 'L', $fill); $pdf->Cell($w[7], 6, $datas['refsource'], 'LR', 0, 'L', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('productstock.pdf', 'D'); }
/** * 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)); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Unitofmeasure::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> </div> </td> <td> <div class="row"> <?php echo $form->labelEx($model, 'unitofmeasureid'); echo $form->hiddenField($model, 'unitofmeasureid'); ?> <input type="text" name="uomcode" id="uomcode" title="Account name" readonly value="<?php echo Unitofmeasure::model()->findByPk($model->unitofmeasureid) !== null ? Unitofmeasure::model()->findByPk($model->unitofmeasureid)->uomcode : ''; ?> "> <?php $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'uom_dialog', 'options' => array('title' => Yii::t('app', 'Unit of Measure'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true))); $unitofmeasure = new Unitofmeasure('searchwfstatus'); $unitofmeasure->unsetAttributes(); // clear any default values if (isset($_GET['Unitofmeasure'])) { $unitofmeasure->attributes = $_GET['Unitofmeasure']; } $this->widget('zii.widgets.grid.CGridView', array('id' => 'uom-grid', 'dataProvider' => $unitofmeasure->Searchwstatus(), 'filter' => $unitofmeasure, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+", array("name" => "send_absschedule", "id" => "send_absschedule", "onClick" => "$(\\"#uom_dialog\\").dialog(\\"close\\");$(\\"#uomcode\\").val(\\"$data->uomcode\\"); $(\\"#Deliveryadvicedetail_unitofmeasureid\\").val(\\"$data->unitofmeasureid\\"); "))'), array('name' => 'unitofmeasureid', 'visible' => false, 'value' => '$data->unitofmeasureid', 'htmlOptions' => array('width' => '1%')), 'uomcode'))); $this->endWidget('zii.widgets.jui.CJuiDialog'); echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("uom-grid");$("#uom_dialog").dialog("open"); return false;')); ?> <?php
public function actionDelete($id) { if (!Unitofmeasure::isUnitofmeasureInUseById(intval($id))) { $unitofmeasures = Unitofmeasure::GetById(intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($unitofmeasures); $unitofmeasures->delete(); } else { Yii::app()->user->setFlash('notification', Zurmo::t('ZurmoModule', 'Not possible to delete. Unit Of Measure is already in use')); } $this->redirect(array($this->getId() . '/index')); }