/**
  * 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)));
 }
示例#2
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'lb-quotation-Outstanding-grid') {
         $model = LbQuotation::model()->findByPk($id);
         $error = array();
         if ($model->lb_quotation_status == LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT) {
             $model->delete();
             // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
             if (!isset($_GET['ajax'])) {
                 $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('dashboard'));
             }
         } else {
             $error['error'] = "The quotation may be allowed to remove the I_DRAFT status";
             LBApplication::renderPlain($this, array('content' => CJSON::encode($error)));
         }
     } else {
         $model = LbInvoice::model()->findByPk($id);
         $error = array();
         if ($model->lb_invoice_status_code == LbInvoice::LB_INVOICE_STATUS_CODE_DRAFT) {
             $this->loadModel($id)->delete();
             // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
             if (!isset($_GET['ajax'])) {
                 $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('dashboard'));
             }
         } else {
             $error['error'] = "The invoice may be allowed to remove the I_DRAFT status";
             LBApplication::renderPlain($this, array('content' => CJSON::encode($error)));
         }
     }
 }
 public function actionAjaxCopyQuotation($id)
 {
     //Add thong tin quotation
     $quo_new = new LbQuotation();
     $quotation = LbQuotation::model()->findByPk($id);
     $quo_new->lb_quotation_no = LbQuotation::model()->formatQuotationNextNumFormatted(0);
     $quo_new->lb_quotation_date = date('Y-m-d');
     $quo_new->lb_quotation_due_date = date('Y-m-d');
     $quo_new->lb_quotation_status = LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT;
     $quo_new->lb_company_id = $quotation->lb_company_id;
     $quo_new->lb_company_address_id = $quotation->lb_company_address_id;
     $quo_new->lb_quotation_customer_id = $quotation->lb_quotation_customer_id;
     $quo_new->lb_quotation_customer_address_id = $quotation->lb_quotation_customer_address_id;
     $quo_new->lb_quotation_attention_id = $quotation->lb_quotation_attention_id;
     $quo_new->lb_quotation_internal_note = $quotation->lb_quotation_internal_note;
     $quo_new->lb_quotation_subject = $quotation->lb_quotation_subject;
     $quo_new->lb_quotation_note = $quotation->lb_quotation_note;
     $quo_new->lb_quotation_encode = LbQuotation::model()->setBase64_decodeQuotation();
     if ($quo_new->save()) {
         // Add thong tin tax
         $quotation_tax_arr = LbQuotationTax::model()->getTaxQuotation($quotation->lb_record_primary_key);
         foreach ($quotation_tax_arr->data as $tax_item) {
             $quo_tax_new = new LbQuotationTax();
             $quo_tax_new->lb_quotation_id = $quo_new->lb_record_primary_key;
             $quo_tax_new->lb_quotation_tax_id = $tax_item->lb_quotation_tax_id;
             $quo_tax_new->lb_quotation_tax_value = $tax_item->lb_quotation_tax_value;
             $quo_tax_new->lb_quotation_tax_total = $tax_item->lb_quotation_tax_total;
             $quo_tax_new->save();
         }
         //END
         //Add thong tin discount
         $quotation_discount_arr = LbQuotationDiscount::model()->getQuotationDiscounts($quotation->lb_record_primary_key);
         foreach ($quotation_discount_arr->data as $discount_item) {
             $quo_discount_new = new LbQuotationDiscount();
             $quo_discount_new->lb_quotation_id = $quo_new->lb_record_primary_key;
             $quo_discount_new->lb_quotation_discount_description = $discount_item->lb_quotation_discount_description;
             $quo_discount_new->lb_quotation_discount_total = $discount_item->lb_quotation_discount_total;
             $quo_discount_new->lb_quotation_discount_value = $discount_item->lb_quotation_discount_value;
             $quo_discount_new->save();
         }
         //END
         //Add Thong tin total
         $quotation_total = LbQuotationTotal::model()->getQuotationTotal($quotation->lb_record_primary_key);
         $quo_total_new = new LbQuotationTotal();
         $quo_total_new->lb_quotation_id = $quo_new->lb_record_primary_key;
         $quo_total_new->lb_quotation_subtotal = $quotation_total->lb_quotation_subtotal;
         $quo_total_new->lb_quotation_total_after_discount = $quotation_total->lb_quotation_total_after_discount;
         $quo_total_new->lb_quotation_total_after_tax = $quotation_total->lb_quotation_total_after_tax;
         $quo_total_new->lb_quotation_total_after_total = $quotation_total->lb_quotation_total_after_total;
         $quo_total_new->save();
         //Add thong tin item
         $quotation_item_arr = LbQuotationItem::model()->getquotationItems($quo_new->lb_record_primary_key);
         foreach ($quotation_item_arr->data as $item) {
             $quo_item_new = new LbQuotationItem();
             $quo_item_new->lb_quotation_id = $quo_new->lb_record_primary_key;
             $quo_item_new->lb_quotation_item_price = $item->lb_quotation_item_price;
             $quo_item_new->lb_quotation_item_description = $item->lb_quotation_item_description;
             $quo_item_new->lb_quotation_item_quantity = $item->lb_quotation_item_quantity;
             $quo_item_new->lb_quotation_item_total = $item->lb_quotation_item_total;
             $quo_item_new->save();
         }
         //END
     }
 }
示例#4
0
        }
    }
    
    function onChangeAddressDropdown(e, quotation_id)
    {
        var target = e.target;
        //console.log($(target).val());
        if ($(target).val() == -1)
        {
            lbAppUILoadModal(quotation_id, 'New Address','<?php 
echo LbQuotation::model()->getActionURLNormalized("ajaxQuickCreateAddress", array("ajax" => 1, "id" => $model->lb_record_primary_key));
?>
');
        }
    }

    function onChangeAttentionDropdown(e, quotation_id)
    {
        var target = e.target;
        //console.log($(target).val());
        if ($(target).val() == -1)
        {
            lbAppUILoadModal(quotation_id, 'New Contact','<?php 
echo LbQuotation::model()->getActionURLNormalized("ajaxQuickCreateContact", array("ajax" => 1, "id" => $model->lb_record_primary_key));
?>
');
        }
    }

</script>
示例#5
0
echo '</div>';
//            echo 'Quotation Status: '.CHtml::dropDownList('status_quo_id', '',
//    LbQuotation::model()->ArrayStatusQuotation(), array('empty' => 'All','onchange'=>'search_quotation();return false;','style'=>'width:100px;'));
//
echo '</div>';
echo '<div id="lb_menu_right" class="lb_submenu_right">';
?>
         <a href="<?php 
echo $model->getCreateURLNormalized(array('group' => strtolower(LbInvoice::LB_INVOICE_GROUP_INVOICE)));
?>
"><i class="icon-plus"></i> <?php 
echo Yii::t('lang', 'New Invoice');
?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <a href="<?php 
echo LbQuotation::model()->getCreateURLNormalized();
?>
"><i class="icon-plus"></i> <?php 
echo Yii::t('lang', 'New Quotation');
?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <a href="<?php 
echo Yii::app()->createAbsoluteUrl('lbPayment/default/create');
?>
"><img width="16" src="<?php 
echo Yii::app()->baseUrl . '/images/icons/dolar.png';
?>
" /> <?php 
echo Yii::t('lang', 'New Payment');
?>
</a>
示例#6
0
    {
        if(value!=-1)
        {
            $(".submit-btn-taxes-form").click();
            enableSaveQuotation(<?php 
echo $model->lb_record_primary_key;
?>
);
        }
        else
       {
            lbAppUILoadModal(<?php 
echo $model->lb_record_primary_key;
?>
, 'New Tax','<?php 
echo LbQuotation::model()->getActionURLNormalized("ajaxQuickCreateTax", array("ajax" => 1, 'form_type' => 'ajax', "id" => $model->lb_record_primary_key));
?>
');
       }
        
    }
    
    function bindLineItemsForChanges(grid_id)
    {
            $('#' + grid_id +' .lbquotation-line-items').each(function() {
                    var elem = $(this);
                    console.log('binding...'+$(this));

                    // Save current value of element
                    elem.data('oldVal', elem.val());
示例#7
0
 public function countQuotationByStatus($status)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'lb_quotation_status IN ' . $status;
     $q = LbQuotation::model()->findAll($criteria);
     return count($q);
 }
示例#8
0
 * Time: 2:59 PM
 * To change this template use File | Settings | File Templates.
 */
/* @var $this DefaultController */
/* @var $model LbTax */
/* @var $invoiceModel LbQuotation */
/* @var $form CActiveForm */
/* @var $submission_details array("type"=>"ajax|default", "ajaxCallback"=>"callbackscript...")*/
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'lb-tax-form', 'enableAjaxValidation' => false, 'type' => 'horizontal'));
echo '<p class="note">Fields with <span class="required">*</span> are required.</p>';
echo '<div id="tax_error"></div>';
echo $form->textFieldRow($model, 'lb_tax_name');
echo $form->textFieldRow($model, 'lb_tax_value');
echo $form->checkBoxRow($model, 'lb_tax_is_default');
if (isset($submission_details) && $submission_details["type"] == 'ajax') {
    LBApplicationUI::submitButton('Save', array('url' => LbQuotation::model()->getActionURLNormalized('ajaxQuickCreateTax', array('ajax' => 1, 'form_type' => 'ajax', 'auto_add' => '1', "id" => $quotationModel->lb_record_primary_key)), 'buttonType' => 'ajaxSubmit', 'ajaxOptions' => array('id' => 'ajax-submit-form-new-tax-' . uniqid(), 'beforeSend' => 'function(data){
				if ($("#LbTax_lb_tax_name").val() == "" ||
				    $("#LbTax_lb_tax_value").val() == "")
				{
				    $("#tax_error").html("<div class=\'alert alert-block alert-error\'>Please fill in the required fields.</div>");
                                    return false;
				}

				return true;
			} ', 'success' => 'function(data, status, obj) {
                var responseJSON = jQuery.parseJSON(data);
                if(responseJSON.error!=undefined)
                    $("#tax_error").html("<div class=\'alert alert-block alert-error\'>"+responseJSON.error+"</div>");
                else
                {
                    
示例#9
0
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#lb-invoice-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");**/
echo '<div id="lb-container-header">';
echo '<div class="lb-header-right" style="margin-left:-11px;"><h4>Invoices</h4></div>';
echo '<div class="lb-header-left">';
LBApplicationUI::backButton(LbInvoice::model()->getActionURLNormalized("dashboard"));
echo '&nbsp;';
$this->widget('bootstrap.widgets.TbButtonGroup', array('type' => '', 'buttons' => array(array('label' => '<i class="icon-plus"></i> New', 'items' => array(array('label' => 'New Invoice', 'url' => LbInvoice::model()->getCreateURLNormalized(array('group' => strtolower(LbInvoice::LB_INVOICE_GROUP_INVOICE)))), array('label' => 'New Quotation', 'url' => LbQuotation::model()->getCreateURLNormalized())))), 'encodeLabel' => false));
echo '</div>';
echo '</div>';
echo '<br>';
// Buttons
//echo '<div class="btn-toolbar">';
//if($canAdd)
//    LBApplicationUI::newButton(Yii::t('lang','New Invoice'), array(
//            'url'=>$model->getCreateURLNormalized(array('group'=>strtolower(LbInvoice::LB_INVOICE_GROUP_INVOICE))),
//    ));
//if($canQuotationAdd)
//    LBApplicationUI::newButton(Yii::t('lang','New Quotation'));
//if($canPaymentAdd)
//    LBApplicationUI::newButton(Yii::t('lang','New Payment'),array('url'=> Yii::app()->createAbsoluteUrl('lbPayment/default/create')));
//echo '</div><br>';
// END BUTTON ADD
示例#10
0
//                                {
//                                    lbInvoice_status_draft = false;
//                                    $("#invoice-header-container .ribbon-green").html(newValue);
//                                }',
//		'placement' => 'right',
//));
echo '<span style="margin-left:79px;">';
echo Yii::t('lang', 'Created By');
echo ':  ';
echo $create_by . '</span>';
echo '</div>';
if (isset($model->lb_quotation_id) && $model->lb_quotation_id != 0) {
    $modelQuo = LbQuotation::model()->findByPk($model->lb_quotation_id);
    echo '<div>';
    echo Yii::t('lang', 'Quotation') . ': ';
    echo LBApplication::workspaceLink($modelQuo->lb_quotation_no, $modelQuo->customer ? LbQuotation::model()->getViewParamModuleURL($modelQuo->customer->lb_customer_name, null, $modelQuo->lb_record_primary_key, "lbQuotation") : LbQuotation::model()->getViewParamModuleURL("No customer", null, $modelQuo->lb_record_primary_key, "lbQuotation"));
    echo '</div>';
}
echo '</div>';
// company info
echo '<div class="pull-right" style="text-align: right; margin-right: 25px;width:60%">';
echo '<h3>' . (isset($model->owner) ? $model->owner->lb_customer_name : '') . '</h3><br/>';
if (isset($model->owner) && $model->owner->lb_customer_registration) {
    echo 'Registration No: ' . $model->owner->lb_customer_registration . '.&nbsp;';
}
if (isset($model->owner)) {
    echo $model->owner->lb_customer_website_url != NULL ? 'Website: ' . $model->owner->lb_customer_website_url . '<br>' : '';
}
$country_arr = LBApplicationUI::countriesDropdownData();
// supplier address and info
echo '<div id="container-supplier-contact" style="float: right; max-width: 600px;">';
示例#11
0
echo '&nbsp;';
$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 Invoice'), 'url' => LbInvoice::model()->getCreateURLNormalized(array('group' => strtolower(LbInvoice::LB_INVOICE_GROUP_INVOICE))), 'visib'), array('label' => Yii::t('lang', 'New Quotation'), 'url' => LbQuotation::model()->getCreateURLNormalized())))), 'encodeLabel' => false));
echo '</div>';
echo '</div>';
echo '<br>';
// SEARCH
echo '<div style="text-align:right;width:100%">';
echo 'Status: ' . CHtml::dropDownList('status_quo_id', $status_id, LbQuotation::model()->ArrayStatusQuotation(), array('empty' => 'All', 'onchange' => 'search_quotation();return false;'));
echo '</div>';
// END SEARCH
echo '<div id="quotation_more_grid">';
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-quotation-grid', 'dataProvider' => $model->search($canList, $status_id), 'template' => "{items}\n{pager}\n{summary}", 'filter' => $model, 'columns' => array(array('name' => 'lb_quotation_no', 'type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_quotation_no,
                            $data->customer ? $data->getViewURL($data->customer->lb_customer_name) : $data->getViewURL("No customer"))', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('width' => '100'), 'filter' => CHtml::activeTextField($model, 'lb_quotation_no', array('class' => 'input-mini'))), array('name' => 'lb_quotation_customer_id', 'type' => 'raw', 'value' => '($data->customer ?
					LBApplication::workspaceLink( $data->customer->lb_customer_name, $data->getViewURL($data->customer->lb_customer_name) )
					:LBApplication::workspaceLink("No customer", $data->getViewURL("No customer") )
				)."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>"', 'htmlOptions' => array('width' => '250'), 'headerHtmlOptions' => array('width' => '300'), 'filter' => CHtml::listData(LbQuotation::model()->with('customer')->findAll(), 'lb_quotation_customer_id', 'customer.lb_customer_name')), array('name' => 'lb_quotation_date', 'value' => '$data->lb_quotation_date', 'headerHtmlOptions' => array('width' => '80'), 'filter' => CHtml::activeTextField($model, 'lb_quotation_date', array('class' => 'input-mini'))), array('name' => 'lb_quotation_due_date', 'value' => '$data->lb_quotation_due_date', 'headerHtmlOptions' => array('width' => '100'), 'filter' => CHtml::activeTextField($model, 'lb_quotation_due_date', array('class' => 'input-mini'))), array('header' => Yii::t('lang', 'Amount'), 'type' => 'raw', 'value' => '$data->quotationTotal ? LbInvoice::CURRENCY_SYMBOL.$data->quotationTotal->lb_quotation_total_after_total : "{LbInvoice::CURRENCY_SYMBOL}0,00"', 'htmlOptions' => array('width' => '90', 'style' => 'text-align:right'), 'headerHtmlOptions' => array('width' => '90', 'style' => 'text-align:right')), array('name' => 'lb_quotation_status', 'type' => 'raw', 'value' => 'lbQuotation::model()->getDisplayQuotationStatus($data->lb_quotation_status)', 'htmlOptions' => array('width' => '100'), 'filter' => false), array('header' => 'Create By', 'type' => 'raw', 'value' => '(AccountProfile::model()->getFullName(LbCoreEntity::model()->getCoreEntity(LbQuotation::model()->module_name,$data->lb_record_primary_key)->lb_created_by)) ? AccountProfile::model()->getFullName(LbCoreEntity::model()->getCoreEntity(LbQuotation::model()->module_name,$data->lb_record_primary_key)->lb_created_by) : ""'))));
echo "</div>";
?>

<script type="text/javascript">
    function search_quotation()
    {
        var status_id = $('#status_quo_id').val();
        open('<?php 
echo LbQuotation::model()->getAdminURLNormalized();
?>
?status_id='+status_id,'_self');
    }
</script>

示例#12
0
 function getMoveIQuotationNum($quotation_number, $move_type = false)
 {
     $criteria = new CDbCriteria();
     $criteria->join = 'LEFT JOIN lb_customers a ON a.lb_record_primary_key = t.lb_quotation_customer_id';
     if ($move_type == "next") {
         $criteria->condition = 'lb_quotation_no > "' . $quotation_number . ' " AND lb_quotation_no <> "Draft"';
         $criteria->order = 'lb_quotation_no ASC';
     } elseif ($move_type == "previous") {
         $criteria->condition = 'lb_quotation_no < "' . $quotation_number . ' " AND lb_quotation_no <> "Draft"';
         $criteria->order = 'lb_quotation_no DESC';
     } elseif ($move_type == 'last') {
         $criteria->condition = 'lb_quotation_no > "' . $quotation_number . ' " AND lb_quotation_no <> "Draft"';
         $criteria->order = 'lb_quotation_no DESC';
     } elseif ($move_type == 'first') {
         $criteria->condition = 'lb_quotation_no < "' . $quotation_number . ' " AND lb_quotation_no <> "Draft"';
         $criteria->order = 'lb_quotation_no ASC';
     }
     $model = LbQuotation::model()->find($criteria);
     $data = array();
     if (count($model) > 0) {
         $data[0] = $model->lb_record_primary_key;
         if ($model->customer) {
             $data[1] = $model->customer->lb_customer_name;
         } else {
             $data[1] = "No customer";
         }
     }
     return $data;
     //$model = LbInvoice::model()->find('lb_record_primary_key >'.intval($invoice_id).' ORDER BY lb_record_primary_key');
 }
示例#13
0
 <?php 
$m = $this->module->id;
$canListQuotation = BasicPermission::model()->checkModules('lbQuotation', 'list');
$status = '("' . LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT . '","' . LbQuotation::LB_QUOTATION_STATUS_CODE_SENT . '")';
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-quotation-Outstanding-grid', 'type' => 'striped bordered condensed', 'dataProvider' => LbQuotation::model()->searchQuotationByName($_REQUEST['name'], 10, $canListQuotation), 'columns' => array(array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{delete}', 'afterDelete' => 'function(link,success,data){ ' . ' $( "#update-dialog" )..dialog("close");' . '$(this).dialog("close");' . 'alert(success)}'), array('header' => Yii::t('lang', 'Quotation No'), 'type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_quotation_no,
                                    $data->customer ? $data->getViewParamModuleURL($data->customer->lb_customer_name,null,$data->lb_record_primary_key,"lbQuotation")
                                    : $data->getViewParamModuleURL("No customer",null,$data->lb_record_primary_key,"lbQuotation"))', 'htmlOptions' => array('width' => '130')), array('header' => Yii::t('lang', 'Customer'), 'type' => 'raw', 'value' => '$data->customer ? $data->customer->lb_customer_name."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>" : "Customer No"
                                ."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>"', 'htmlOptions' => array('width' => '380')), array('header' => Yii::t('lang', 'Due Date'), 'type' => 'raw', 'value' => '$data->lb_quotation_due_date', 'htmlOptions' => array('width' => '100')), array('header' => Yii::t('lang', 'Amount'), 'type' => 'raw', 'value' => '$data->quotationTotal ? LbInvoice::CURRENCY_SYMBOL.$data->quotationTotal->lb_quotation_total_after_total : "{LbInvoice::CURRENCY_SYMBOL}0,00"', 'htmlOptions' => array('width' => '120', 'style' => 'text-align:right')), array('header' => Yii::t('lang', 'Status'), 'type' => 'raw', 'value' => 'LbQuotation::model()->getDisplayQuotationStatus($data->lb_quotation_status)', 'htmlOptions' => array('width' => '100', 'style' => 'text-align:center'), 'headerHtmlOptions' => array('style' => 'text-align:center')), array('header' => Yii::t('lang', 'Created By'), 'type' => 'raw', 'value' => 'AccountProfile::model()->getFullName(LbCoreEntity::model()->getCoreEntity(LbQuotation::model()->module_name,$data->lb_record_primary_key)->lb_created_by)'))));
示例#14
0
}
$m = $this->module->id;
$canAdd = BasicPermission::model()->checkModules($m, 'add');
$canList = BasicPermission::model()->checkModules($m, 'list');
$canView = BasicPermission::model()->checkModules($m, 'view');
$canAddQuotation = BasicPermission::model()->checkModules('lbQuotation', 'add');
$canListQuotation = BasicPermission::model()->checkModules('lbQuotation', 'list');
$canAddPayment = BasicPermission::model()->checkModules('lbPayment', 'add');
if (!$canView) {
    echo "Have no permission to see this record";
    return;
}
$status = '("' . LbInvoice::LB_INVOICE_STATUS_CODE_DRAFT . '","' . LbInvoice::LB_INVOICE_STATUS_CODE_OPEN . '","' . LbInvoice::LB_INVOICE_STATUS_CODE_OVERDUE . '")';
$count_invoice = LbInvoice::model()->getInvoiceByStatus($status);
$count_invoice = $count_invoice->totalItemCount;
$count_quotation = LbQuotation::model()->getQuotationByStatus('("' . LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT . '","' . LbQuotation::LB_QUOTATION_STATUS_CODE_SENT . '","' . LbQuotation::LB_QUOTATION_STATUS_CODE_APPROVED . '")');
$count_quotation = $count_quotation->totalItemCount;
// Buttons
echo '<div id="lb-container-header">';
echo '<div class="lb-header-right" style="margin-left: -10px"><h4>' . Yii::t("lang", "Invoice Dashboard") . '</h4></div>';
echo '<div class="lb-header-left">';
echo '<div class="btn-toolbar" style="margin-top:2px;">';
if ($canAdd) {
    echo '<button id="btn_invoice" class = "btn" onclick="view_oustanding_invoice()">Outstanding Invoice<span class="notification-badge">' . $count_invoice . '</span></button>';
}
if ($canAddQuotation) {
    echo '<button id="btn_quotation" class = "btn" onclick="view_oustanding_quotation()">Outstanding Quotation<span class="notification-badge">' . $count_quotation . '</span></button>';
}
if ($canAddPayment) {
    echo '<button id="btn_graph" class = "btn" onclick="view_chart()">Chart</button>';
}
示例#15
0
 <?php 
$m = $this->module->id;
$canListQuotation = BasicPermission::model()->checkModules('lbQuotation', 'list');
$status = '("' . LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT . '","' . LbQuotation::LB_QUOTATION_STATUS_CODE_SENT . '","' . LbQuotation::LB_QUOTATION_STATUS_CODE_APPROVED . '")';
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-quotation-Outstanding-grid', 'type' => 'striped bordered condensed', 'dataProvider' => LbQuotation::model()->searchQuotationByName($_REQUEST['name'], 10, $canListQuotation), 'columns' => array(array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{delete}', 'afterDelete' => 'function(link,success,data){ ' . 'if(data){ responseJSON = jQuery.parseJSON(data);' . '     alert(responseJSON.error); }' . '}'), array('type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_quotation_no,
                                    $data->customer ? $data->getViewParamModuleURL($data->customer->lb_customer_name,null,$data->lb_record_primary_key,"lbQuotation")
                                    : $data->getViewParamModuleURL("No customer",null,$data->lb_record_primary_key,"lbQuotation"))', 'htmlOptions' => array('width' => '130')), array('type' => 'raw', 'value' => '$data->customer ? $data->customer->lb_customer_name."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>" : "Customer No"
                                ."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>"', 'htmlOptions' => array('width' => '380')), array('type' => 'raw', 'value' => 'date("d M Y", strtotime($data->lb_quotation_due_date))', 'htmlOptions' => array('width' => '100')), array('type' => 'raw', 'value' => 'LbQuotation::model()->getStatusAmount($data->lb_quotation_status,$data->quotationTotal ? $data->quotationTotal->lb_quotation_total_after_total : "0.00")', 'htmlOptions' => array('width' => '100', 'style' => 'text-align:right')), array('type' => 'raw', 'value' => 'LbQuotation::model()->getDisplayQuotationStatus($data->lb_quotation_status)', 'htmlOptions' => array('width' => '100', 'style' => 'text-align:center'), 'headerHtmlOptions' => array('style' => 'text-align:center')))));
        </div>
    </div>
     <div>
    <div id ="show_quotation">
   
        <?php 
$status = '("' . LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT . '","' . LbQuotation::LB_QUOTATION_STATUS_CODE_SENT . '")';
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-quotation-Outstanding-grid', 'type' => 'striped bordered condensed', 'dataProvider' => $quotationModel->getQuotationByStatus($status, 10, $canListQuotation), 'columns' => array(array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{delete}', 'afterDelete' => 'function(link,success,data){ ' . 'if(data){ responseJSON = jQuery.parseJSON(data);' . '     alert(responseJSON.error); }' . '}'), array('header' => Yii::t('lang', 'Quotation No'), 'type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_quotation_no,
                                    $data->customer ? $data->getViewParamModuleURL($data->customer->lb_customer_name,null,$data->lb_record_primary_key,"lbQuotation")
                                    : $data->getViewParamModuleURL("No customer",null,$data->lb_record_primary_key,"lbQuotation"))', 'htmlOptions' => array('width' => '130')), array('header' => Yii::t('lang', 'Customer'), 'type' => 'raw', 'value' => '$data->customer ? $data->customer->lb_customer_name."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>" : "Customer No"
                                ."<br><span style=\'color:#666;\'>". $data->lb_quotation_subject."</span>"', 'htmlOptions' => array('width' => '380')), array('header' => Yii::t('lang', 'Due Date'), 'type' => 'raw', 'value' => '$data->lb_quotation_due_date', 'htmlOptions' => array('width' => '100')), array('header' => Yii::t('lang', 'Amount'), 'type' => 'raw', 'value' => '$data->quotationTotal ? LbInvoice::CURRENCY_SYMBOL.$data->quotationTotal->lb_quotation_total_after_total : "{LbInvoice::CURRENCY_SYMBOL}0,00"', 'htmlOptions' => array('width' => '120', 'style' => 'text-align:right')), array('header' => Yii::t('lang', 'Status'), 'type' => 'raw', 'value' => 'LbQuotation::model()->getDisplayQuotationStatus($data->lb_quotation_status)', 'htmlOptions' => array('width' => '100', 'style' => 'text-align:center'), 'headerHtmlOptions' => array('style' => 'text-align:center')), array('header' => Yii::t('lang', 'Created By'), 'type' => 'raw', 'value' => 'AccountProfile::model()->getFullName(LbCoreEntity::model()->getCoreEntity(LbQuotation::model()->module_name,$data->lb_record_primary_key)->lb_created_by)'))));
?>
    </div>
    <div>
        <a class="more" href="<?php 
echo LbQuotation::model()->getActionURLNormalized('admin');
?>
"><?php 
echo Yii::t('lang', 'see more quotations');
?>
</a>
    </div>
</div>
 <script lang="javascript">
    
    function search_quotation(name)
    {
        name = replaceAll(name," ", "%");
         $('#show_quotation').load('<?php 
echo $this->createUrl('/lbInvoice/default/_search_quotation');
?>
示例#17
0
echo '</div>';
// Quotation number, date and due
echo '<div id="quotation-basic-info-container" style="float: left;width:36%;">';
echo '<h3 id="quotation-number-container">';
echo $model->lb_quotation_no;
// SHALL NOT ALLOW UPDATING OF INVOICE NO
echo '</h3><br/>';
echo Yii::t('lang', 'Quotation Date') . ': ';
$this->widget('editable.EditableField', array('type' => 'date', 'model' => $model, 'attribute' => 'lb_quotation_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'format' => 'yyyy-mm-dd', 'viewformat' => 'dd/mm/yyyy'));
echo '&nbsp;&nbsp;';
echo Yii::t('lang', 'Due Date') . ': ';
$this->widget('editable.EditableField', array('type' => 'date', 'model' => $model, 'attribute' => 'lb_quotation_due_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'format' => 'yyyy-mm-dd', 'viewformat' => 'dd/mm/yyyy'));
echo '<br>';
echo '<div id="quotation_status">';
echo Yii::t('lang', 'Status') . ': ';
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_status', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => Editable::source(array(LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_DRAFT), LbQuotation::LB_QUOTATION_STATUS_CODE_APPROVED => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_APPROVED), LbQuotation::LB_QUOTATION_STATUS_CODE_SENT => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_SENT), LbQuotation::LB_QUOTATION_STATUS_CODE_ACCEPTED => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_ACCEPTED), LbQuotation::LB_QUOTATION_STATUS_CODE_REJECTED => LbQuotation::model()->getDisplayQuotationStatus(LbQuotation::LB_QUOTATION_STATUS_CODE_REJECTED))), 'placement' => 'right', 'validate' => 'js: function(value) {
                        if(quotation_status_draft) 
                            return "Please confirm quotation.";
                        else if(value=="' . LbQuotation::LB_QUOTATION_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 == "' . LbQuotation::LB_QUOTATION_STATUS_CODE_ACCEPTED . '")
        {
            quotaiton_status_accepted = true;
        }
        else
        {
            quotaiton_status_accepted = false;
        }
        $("#quotation_status_container").html(newValue);
    }'));
示例#18
0
//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) {
示例#19
0
')
    {
        quotation_status_draft = true;
    }
    function onclickFromEmailQuotation(quotation_id)
    {
        lbAppUILoadModal(quotation_id,'Send Email','<?php 
echo LbQuotation::model()->getActionURLNormalized("formSendEmail", array("ajax" => 1, "id" => $model->lb_record_primary_key));
?>
');
    }
    
    function onclickFormGetPublicPDF(quotation_id)
    {
        lbAppUILoadModal(quotation_id,'Share PDF','<?php 
echo LbQuotation::model()->getActionURLNormalized("formSharePDFQuotation", array("ajax" => 1, "id" => $model->lb_record_primary_key));
?>
');
        $('#modal-holder-'+quotation_id+' .modal-body').css('max-height','900px;');
    }
    
    function onclickCopyQuotationToInvoice()
    {
        $.ajax({
            'url':'<?php 
echo $this->createURL("ajaxCreateInvoice", array('id' => $model->lb_record_primary_key));
?>
',
            'beforeSend':function(data){
                            var countInv = <?php 
echo $countInv;