<?php $m = $this->module->id; $canView = BasicPermission::model()->checkModules($m, 'view'); if (!$canView) { echo "Have no permission to see this record"; return; } echo '<div id="lb-container-header">'; echo '<div class="lb-header-right" style="margin-left:-12px;" ><h4>Bills</h4></div>'; echo '<div class="lb-header-left">'; echo ' '; $this->widget('bootstrap.widgets.TbButtonGroup', array('type' => '', 'buttons' => array(array('label' => '<i class="icon-plus"></i> ' . Yii::t('lang', 'New'), 'items' => array(array('label' => Yii::t('lang', 'New Vendor'), 'url' => LbVendor::model()->getActionModuleURL('vendor', 'create')), array('label' => Yii::t('lang', 'New Vendor invoice'), 'url' => LbVendor::model()->getActionModuleURL('supplier', 'createSupplier')), array('label' => Yii::t('lang', 'New Payment Voucher'), 'url' => LbVendor::model()->getActionModuleURL('vendor', 'addPayment'))))), 'encodeLabel' => false)); echo '</div>'; echo '</div><br>'; //vendor //echo '<div>'; // echo '<div class="panel-header-title" style="margin-top: 40px;"> // <div class="panel-header-title-left"> // <h4>Vendor</h4> // </div> // </div>'; //$this->Widget('bootstrap.widgets.TbGridView',array( // 'id'=>'lb_expenses_gridview', // 'dataProvider'=> LbVendor::model()->getVendor(false,5), // 'type'=>'striped bordered condensed', // //'template' => "{items}", // 'columns'=>array( // // array( // 'header'=>Yii::t('lang','Date'),
public function actionVendorpdf($id) { $html2pdf = Yii::app()->ePdf->HTML2PDF(); $model = LbVendor::model()->findByPk($id); //$html2pdf->AddFont(13); $html2pdf->WriteHTML($this->renderPartial('vendor_pdf', array('model' => $model), true)); $html2pdf->WriteHTML($this->renderPartial('_pdf_footer', array(), true)); $html2pdf->Output($model->lb_vendor_no . '.pdf', 'PO'); }
if ($file_name_arr[0] == $subcription && $file_name_arr[1] == $company) { echo "<img src='" . $path . $file . "' style='max-height:120px' />"; } } $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => $this->createUrl('uploadLogo', array('id' => $model->lb_record_primary_key, 'sub_cription' => $subcription, 'company_id' => $company)), 'allowedExtensions' => array("jpeg", "jpg", "gif", "png"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 1 * 1024, 'multiple' => true, 'onComplete' => "js:function(id, fileName, responseJSON){\n \$('#uploadFile .qq-upload-list').html('');\n //\$('#logo_wrapper img').attr('src','" . $path . "'+fileName);\n window,location.reload(true);\n }"))); echo '</div>'; //echo '<h3 id="po-number-container">'.$model->getDisplayPOStatus($model->lb_vendor_status).'</h3>'; echo '<div id="invoice-basic-info-container" style="float: left;width:36%;">'; echo '<h3 id="po-number-container">'; $this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vd_invoice_no', 'url' => LbVendor::model()->getActionURLNormalized('AjaxUpdateFieldVD'), 'placement' => 'right')); echo '</h3><br />'; //date echo Yii::t('lang', 'Date') . ': '; $this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vd_invoice_date', 'url' => LbVendor::model()->getActionURLNormalized('ajaxUpdateFieldInvoice'), 'placement' => 'right')); echo ' '; echo Yii::t('lang', 'Due Date') . ': '; $this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vd_invoice_due_date', 'url' => LbVendor::model()->getActionURLNormalized('ajaxUpdateFieldInvoice'), 'placement' => 'right')); echo '<br>'; echo '<div>'; echo Yii::t('lang', 'Status') . ': '; echo '<span id="lb_invocie_status">'; echo $model->getDisplayInvoiceStatus($model->lb_vd_invoice_status); echo '</span>'; echo '</div>'; echo '</div>'; echo '<div class="pull-right" style="text-align: right; margin-right: 25px;width:60%">'; $modelCustomer = LbCustomer::model()->find('lb_record_primary_key=' . $model->lb_vd_invoice_company_id); echo '<h3>' . $modelCustomer->lb_customer_name . '</h3><br/>'; echo 'Registration No: ' . $modelCustomer->lb_customer_registration . '. '; echo $modelCustomer->lb_customer_website_url != NULL ? 'Website: ' . $modelCustomer->lb_customer_website_url . '<br>' : ''; echo '</div>';
$("#modal-new-tax-form-body-"+<?php echo $model->lb_record_primary_key; ?> ).html(getLoadingIconHTML(false)); $("#modal-new-tax-form-body-"+<?php echo $model->lb_record_primary_key; ?> ).load("<?php echo $model->getActionURLNormalized('createTax', array('form_type' => 'ajax', 'ajax' => 1, 'invoice_id' => $model->lb_record_primary_key)); ?> "); $("#btn-add-new-tax").click(); } else { // submit selected tax to server $.post("<?php echo LbVendor::model()->getActionURLNormalized('ajaxGetTax', array('id' => $model->lb_record_primary_key)); ?> ", {line_item_pk: line_item_pk, tax_id: tax_id}, function(response) { if (response != null) { var responseJSON = jQuery.parseJSON(response); // refill tax value $("#lb_invoice_item_value_"+line_item_pk).val(responseJSON.lb_tax_value); // recalculate totals on client-side calculateInvoiceTotals(<?php echo $model->lb_record_primary_key; ?>
public function actioncreatePo() { $model = new LbVendor(); // get basic info to assign to this record $ownCompany = LbCustomer::model()->getOwnCompany(); $ownCompanyAddress = null; $customerCompany = new LbCustomer(); $customerCompany->lb_customer_name = 'Click to choose customer'; // get own company address if ($ownCompany->lb_record_primary_key) { // auto assign owner company $model->lb_vendor_company_id = $ownCompany->lb_record_primary_key; $own_company_addresses = LbCustomerAddress::model()->getActiveAddresses($ownCompany->lb_record_primary_key, $ownCompany::LB_QUERY_RETURN_TYPE_MODELS_ARRAY); if (count($own_company_addresses)) { $ownCompanyAddress = $own_company_addresses[0]; // auto assign owner company's address $model->lb_vendor_company_address_id = $ownCompanyAddress->lb_record_primary_key; } } if ($model->save()) { $id = $_GET['id']; $invoiceVendor = LbVendorInvoice::model()->findByPk($id); $invoiceVendor->lb_vendor_id = $model->lb_record_primary_key; $invoiceVendor->save(); $this->redirect(array('view', 'id' => $model->lb_record_primary_key)); } }
//Permission Quotation $quotation_canAdd = BasicPermission::model()->checkModules('lbQuotation', 'add'); $quotation_canView = BasicPermission::model()->checkModules('lbQuotation', 'view'); //Permission Bills $bill_canAdd = BasicPermission::model()->checkModules('lbVendor', 'add'); $bill_canView = BasicPermission::model()->checkModules('lbVendor', 'view'); //Permission Report $report_canView = BasicPermission::model()->checkModules('lbReport', 'view'); $home_img = CHtml::image(Yii::app()->request->baseUrl . '/images/logo_home.png', '', array('height' => 30, 'width' => 30, 'style' => "margin-top:-5px")); ?> <div class="container" id="page"> <div id="lb-top-menu"> <?php $ownCompany = LbCustomer::model()->getOwnCompany(); $this->widget('bootstrap.widgets.TbNavbar', array('brand' => false, 'brandUrl' => isset(Yii::app()->user) ? LbInvoice::model()->getActionURL('dashboard') : Yii::app()->createUrl('site/login'), 'items' => array(array('class' => 'bootstrap.widgets.TbMenu', 'items' => array()), array('class' => 'bootstrap.widgets.TbMenu', 'encodeLabel' => false, 'htmlOptions' => array('class' => 'pull-left'), 'items' => array(array('label' => $home_img, 'url' => LbInvoice::model()->getActionURL('dashboard')), array('label' => Yii::t('lang', 'Customers'), 'url' => LbCustomer::model()->getAdminURL(), 'visible' => !Yii::app()->user->isGuest && Modules::model()->checkHiddenModule('lbCustomer'), 'items' => array(array('label' => Yii::t('lang', '<i class="icon-plus"></i> New Customer'), 'url' => LbCustomer::model()->getCreateURL(), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $customer_canAdd), '---', array('label' => Yii::t('lang', 'All Customers'), 'url' => LbCustomer::model()->getAdminURL(), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $customer_canView), array('label' => Yii::t('lang', 'Contracts'), 'url' => LbContracts::model()->getActionURL('dashboard'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $customer_canView), array('label' => Yii::t('lang', 'My Company'), 'url' => LbCustomer::model()->getActionURLNormalized('view', array('id' => $ownCompany->lb_record_primary_key)), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $customer_canView))), array('label' => Yii::t('lang', 'Income'), 'url' => LbInvoice::model()->getActionURL('dashboard'), 'visible' => !Yii::app()->user->isGuest && Modules::model()->checkHiddenModule('lbInvoice'), 'items' => array(array('label' => Yii::t('lang', '<i class="icon-plus"></i> New Invoice'), 'url' => LbInvoice::model()->getCreateURLNormalized(array('group' => strtolower(LbInvoice::LB_INVOICE_GROUP_INVOICE))), 'visible' => $invoice_canAdd), array('label' => Yii::t('lang', '<i class="icon-plus"></i> New Quotation'), 'url' => LbQuotation::model()->getCreateURLNormalized(), 'visible' => $quotation_canAdd), array('label' => Yii::t('lang', '<i class="icon-plus"></i> Enter Payment'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'url' => LbPayment::model()->getCreateURLNormalized(), 'visible' => $quotation_canAdd), '---', array('label' => Yii::t('lang', 'Outstanding Invoices and Quotations'), 'linkOptions' => array('href' => LbInvoice::model()->getActionURL('dashboard'), 'data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'url' => LbInvoice::model()->getActionURL('dashboard'), 'visible' => $invoice_canView), array('label' => Yii::t('lang', 'All Invoices'), 'linkOptions' => array('href' => LbInvoice::model()->getActionURL('admin'), 'data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'url' => LbInvoice::model()->getActionURL('admin'), 'visible' => $invoice_canView), array('label' => Yii::t('lang', 'All Quotations'), 'linkOptions' => array('href' => LbQuotation::model()->getActionURL('admin'), 'data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'url' => LbQuotation::model()->getActionURL('admin'), 'visible' => $quotation_canView))), array('label' => Yii::t('lang', 'Expenses'), 'items' => array(array('label' => Yii::t('lang', 'All Expenses'), 'linkOptions' => array('href' => LbExpenses::model()->getActionURL('expenses'), 'data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'url' => LbExpenses::model()->getActionURL('expenses'), 'visible' => $expenses_canView), array('label' => Yii::t('lang', 'All Payment voucher'), 'linkOptions' => array('href' => LbExpenses::model()->getActionURL('paymentVoucher'), 'data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'url' => LbExpenses::model()->getActionURL('paymentVoucher'), 'visible' => $expenses_canView))), array('label' => Yii::t('lang', 'Bills'), 'url' => LbVendor::model()->getActionURL('dashboard'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => !Yii::app()->user->isGuest && Modules::model()->checkHiddenModule('lbVendor'), 'items' => array(array('label' => Yii::t('lang', 'Outstanding'), 'url' => LbVendor::model()->getActionURL('dashboard'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $bill_canView), array('label' => Yii::t('lang', 'Make Payment'), 'url' => LbVendor::model()->getActionModuleURL('vendor', 'addPayment'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $bill_canAdd))), array('label' => Yii::t('lang', 'Payroll'), 'url' => LbEmployee::model()->getActionURL('dashboard'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => !Yii::app()->user->isGuest && Modules::model()->checkHiddenModule('lbVendor'), 'items' => array(array('label' => Yii::t('lang', 'All Employees'), 'url' => LbEmployee::model()->getActionURL('dashboard'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $bill_canView), array('label' => Yii::t('lang', 'Make Payment'), 'url' => LbEmployee::model()->getActionURL('EnterPayment'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $bill_canAdd), array('label' => Yii::t('lang', 'All Payment'), 'url' => LbEmployee::model()->getActionURL('ListPayment'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $bill_canView))), array('label' => Yii::t('lang', 'Report'), 'url' => array('/lbReport/default/index'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => !Yii::app()->user->isGuest && Modules::model()->checkHiddenModule('lbReport'), 'items' => array(array('label' => Yii::t('lang', 'All'), 'url' => array('/lbReport/default/index?tab=all'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Aging Report'), 'url' => array('/lbReport/default/index?tab=aging_report'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Cash Receipt'), 'url' => array('/lbReport/default/index?tab=cash_receipt'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Invoice Journal'), 'url' => array('/lbReport/default/index?tab=invoice_journal'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'GST Report'), 'url' => array('/lbReport/default/index?tab=gst_report'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Sales Report'), 'url' => array('/lbReport/default/index?tab=sales_report'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Customer Statement'), 'url' => array('/lbReport/default/index?tab=customer_statement'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Employee Report'), 'url' => array('/lbReport/default/index?tab=employee_report'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView), array('label' => Yii::t('lang', 'Payment Report'), 'url' => array('/lbReport/default/index?tab=payment_report'), 'linkOptions' => array('data-workspace' => '1', 'id' => uniqid(), 'live' => false), 'visible' => $report_canView)))))), 'htmlOptions' => array('class' => 'navbar'))); ?> </div> <div id="lb-top-shortcuts"> <?php $onwSubcriptAccount = AccountSubscription::model()->getSubscriptionOwnerID(LBApplication::getCurrentlySelectedSubscription()); $onwSubcrip = false; if ($onwSubcriptAccount == Yii::app()->user->id) { $onwSubcrip = true; } $linx_app_menu_subscription_items = array(); $selected_subscription_label = 'Subscription'; if (!Yii::app()->user->isGuest) { $linx_app_account_subscriptions = AccountSubscription::model()->findSubscriptions(Yii::app()->user->id); foreach ($linx_app_account_subscriptions as $sub_id => $subscription) {
/** * json data source for x-editable dropdown to get ADDRESSES */ public function actionDropdownJSON() { $allow_add = isset($_GET['allow_add']) ? $_GET['allow_add'] : NO; $customer_id = isset($_GET['customer_id']) ? $_GET['customer_id'] : 0; $invoice_id = isset($_GET['invoice_id']) ? $_GET['invoice_id'] : 0; $quotation_id = isset($_GET['quotation_id']) ? $_GET['quotation_id'] : 0; $vendor_id = isset($_GET['vendor_id']) ? $_GET['vendor_id'] : 0; $lb_vendor_invoice_id = isset($_GET['lb_vendor_invoice_id']) ? $_GET['lb_vendor_invoice_id'] : 0; // override customer id if invoice id is provided if ($invoice_id) { $invoice = LbInvoice::model()->findByPk($invoice_id); $customer_id = $invoice->lb_invoice_customer_id; } if ($vendor_id) { $vendor = LbVendor::model()->findByPk($vendor_id); $customer_id = $vendor->lb_vendor_supplier_id; } if ($lb_vendor_invoice_id) { $vendor_invoice = LbVendorInvoice::model()->findByPk($lb_vendor_invoice_id); $customer_id = $vendor_invoice->lb_vd_invoice_supplier_id; } // override customer id if quotation id is provided if ($quotation_id) { $quotation = LbQuotation::model()->findByPk($quotation_id); $customer_id = $quotation->lb_quotation_customer_id; } // get results; $results = LbCustomerAddress::model()->getAddresses($customer_id, LbCustomerAddress::LB_QUERY_RETURN_TYPE_DROPDOWN_ARRAY); // prepend new address link if allow add new if ($allow_add && $allow_add != 2) { $results = array('0' => 'Choose address', '-1' => '-- Add new address --') + $results; } if ($vendor_id || $lb_vendor_invoice_id) { $results = array('0' => 'Choose address') + $results; } // we want to preserve order $ordered_results = array(); foreach ($results as $key => $text) { $ordered_results[] = array('value' => $key, 'text' => $text); } LBApplication::renderPartial($this, '//layouts/plain_ajax_content', array('content' => CJSON::encode($ordered_results))); }
$canAdd = BasicPermission::model()->checkModules('lbPayment', 'add'); $customer_arr = LbCustomer::model()->getCompanies($sort = 'lb_customer_name ASC', LbCustomer::LB_QUERY_RETURN_TYPE_DROPDOWN_ARRAY); $option_customer = array(0 => 'Choose Supplier') + $customer_arr; ?> <style> .accordion-heading{ background: #F5F5F5; } </style> <?php // echo $model->lb_record_primary_key; echo '<div id="lb-container-header">'; echo '<div class="lb-header-right" ><h3>Bills</h3></div>'; echo '<div class="lb-header-left">'; LBApplicationUI::backButton(LbVendor::model()->getActionURLNormalized('dashboard')); echo ' '; echo '</div>'; echo '</div><br>'; ?> <h3>Payment</h3> <div style="overflow: hidden;"> <div class="accordion" id="accordion2"> <?php if ($canAdd) { ?> <div class="accordion-group"> <div class="accordion-heading" id="new_payment"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#form_new_payment"> <i></i> <span style="color: #6E8900;font-size: 20px; font-weight: bold"><?php
"name"=>"lb_vendor_tax_total{$data->lb_record_primary_key}", "data_invoice_id"=>"{$data->lb_vendor_id}", "line_item_pk"=>"{$data->lb_record_primary_key}", "line_item_field"=>"item-total", "disabled"=>"true")) . CHtml::activeHiddenField($data,"lb_vendor_tax_total", array("style"=>"width: 50px; text-align: right", "class"=>"lbinvoice-tax", "name"=>"lb_vendor_tax_total{$data->lb_record_primary_key}", "data_invoice_id"=>"{$data->lb_vendor_id}", "line_item_pk"=>"{$data->lb_record_primary_key}", "line_item_field"=>"item-value")) ', 'htmlOptions' => array('style' => 'width: 148px; border-top: none; padding-top: 0px', 'align' => 'right'))))); // end tax grid // hidden tax submit button echo CHtml::ajaxSubmitButton('Save Taxes', LbVendor::model()->getActionURLNormalized('ajaxUpdateTaxes', array('id' => $model->lb_record_primary_key, 'type' => LbVendorTax::LB_VENDOR_ITEM_TYPE_TAX)), array('id' => 'ajax-submit-form-taxes-' . uniqid(), 'beforeSend' => 'function(data){ // code... } ', 'success' => 'function(data, status, obj) { if(lbinvoice_new_tax_added) { lbinvoice_new_tax_added = false; refreshTaxesGrid(); } refreshTotals(); disableSaveButton(' . $model->lb_record_primary_key . '); }'), array('live' => false, 'style' => 'display: none;', 'class' => 'submit-btn-taxes-form')); $this->endWidget(); // END TAX FORM echo '</div>'; // end invoice taxes /// TOTAL
// echo CHtml::dropDownList('lb_category_id', '', array(''=>'All')+CHtml::listData($category_arr, 'system_list_item_id', 'system_list_item_name'), array('style'=>'width:150px;'));echo ' '; ?> <?php $category_arr = SystemList::model()->getItemsForListCode('expenses_category'); // echo dropDownListRow($model, 'lb_category_id', CHtml::listData($category_arr, 'system_list_item_id', 'system_list_item_name')); ?> <div id="container-invoice-customer-subject"> <h4><?php echo Yii::t('lang', 'Subject'); ?> :</h4> <?php $this->widget('editable.EditableField', array('type' => 'textarea', 'inputclass' => 'input-large-textarea', 'emptytext' => 'Enter invoice subject', 'model' => $model, 'attribute' => 'lb_vendor_subject', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'htmlOptions' => array('style' => 'text-decoration: none; border-bottom: none; color: #777'), 'options' => array())); $lb_invoice_customer_id = $model->lb_record_primary_key; $manage = LbVendor::model()->findByPk($lb_invoice_customer_id); ?> </div> <script language="javascript"> var lb_invoice_customer_id = "<?php echo $lb_invoice_customer_id; ?> "; var lb_invoice_status = "<?php echo $manage->lb_vendor_status; ?> "; // var lbInvoice_choose_customer = false; var lbInvoice_status_draft = false; if(lb_invoice_customer_id!="")
} $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => $this->createUrl('uploadLogo', array('id' => $model->lb_record_primary_key, 'sub_cription' => $subcription, 'company_id' => $company)), 'allowedExtensions' => array("jpeg", "jpg", "gif", "png"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 1 * 1024, 'multiple' => true, 'onComplete' => "js:function(id, fileName, responseJSON){\n \$('#uploadFile .qq-upload-list').html('');\n //\$('#logo_wrapper img').attr('src','" . $path . "'+fileName);\n window,location.reload(true);\n }"))); echo '</div>'; //echo '<h3 id="po-number-container">'.$model->getDisplayPOStatus($model->lb_vendor_status).'</h3>'; echo '<div id="invoice-basic-info-container" style="float: left;width:36%;">'; echo '<h3 id="po-number-container">' . $model->lb_vendor_no . '</h3><br />'; //date echo Yii::t('lang', 'PO Date') . ': '; $this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vendor_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right')); echo ' '; echo Yii::t('lang', 'Due Date') . ': '; $this->widget('editable.EditableField', array('type' => 'text', 'model' => $model, 'attribute' => 'lb_vendor_due_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right')); echo '<br>'; echo '<div>'; echo Yii::t('lang', 'Status') . ': '; $this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_vendor_status', 'htmlOptions' => array('id' => 'lb_invocie_status'), 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => Editable::source(array(LbVendor::LB_PO_STATUS_CODE_DRAFT => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_DRAFT), LbVendor::LB_PO_STATUS_CODE_APPROVED => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_APPROVED), LbVendor::LB_PO_STATUS_CODE_SEND => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_SEND), LbVendor::LB_PO_STATUS_CODE_ACCEPTED => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_ACCEPTED), LbVendor::LB_PO_STATUS_CODE_REJECTED => LbVendor::model()->getDisplayPOStatus(LbVendor::LB_PO_STATUS_CODE_REJECTED))), 'placement' => 'right', 'validate' => 'js: function(value) { if(quotation_status_draft) return "Please confirm quotation."; else if(value=="' . LbVendor::LB_PO_STATUS_CODE_DRAFT . '") return "You\'re not allowed to update the status of this quotation back to Draft"; }', 'success' => 'js: function(response, newValue) { if(newValue == "' . LbVendor::LB_PO_STATUS_CODE_ACCEPTED . '") { quotaiton_status_accepted = true; } else { quotaiton_status_accepted = false; } $("#lb_invocie_status").html(newValue); }'));