Esempio n. 1
0
<?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 '&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 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'),
Esempio n. 2
0
<?php

/* @var $customer_addresses array of LbCustomerAddress models */
$canDeleteAddress = BasicPermission::model()->checkModules(LbCustomerAddress::model()->getEntityType(), 'delete');
$canEditAddress = BasicPermission::model()->checkModules(LbCustomerAddress::model()->getEntityType(), 'edit');
$i = 0;
foreach ($customer_addresses as $address) {
    $i++;
    echo "\r\n                <div style='overflow:hidden; border-top: 1px solid #EEEEEE;margin-top: 5px;'>\r\n                    <div style='float:left'>\r\n                        <h4><span style='padding: 0 8px;background:#EEEEEE;border-radius:50%;'>{$i}</span> {$address->lb_customer_address_line_1}</h4>\r\n                    </div>\r\n                    <div style='float:right;margin-top:5px;'>\r\n                        <a href='#' onclick=\"onclickSlideToggle(" . $address->lb_record_primary_key . "); return false;\">\r\n                            <i class='icon-info-sign'></i>\r\n                            " . Yii::t('lang', 'Detail information') . "\r\n                        </a>";
    if ($canDeleteAddress) {
        echo "<a href='#' onclick='ajaxDeleteAddress(" . $address->lb_record_primary_key . "); return false;'>\r\n                            <i class='icon-trash'></i>\r\n                            " . Yii::t('lang', 'Delete') . "\r\n                        </a>";
    }
    echo "</div>\r\n                </div>\r\n                <div id='error_delete_address_" . $address->lb_record_primary_key . "' class='alert alert-block alert-error' style='display:none;'></div>\r\n            ";
    echo "<div id='detail_customer_address_" . $address->lb_record_primary_key . "' style='display:none;'>";
    $this->widget('editable.EditableDetailView', array('data' => $address, 'url' => $address->getActionURL('ajaxUpdateField'), 'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken), 'attributes' => array(array('name' => 'lb_customer_address_line_1', 'editable' => array('type' => 'text', 'inputclass' => 'input-large', 'emptytext' => 'Click to Update', 'validate' => 'function(value) {
                                                            if(!value) return "Address Line 1 is required."
                                                            }')), 'lb_customer_address_line_2', 'lb_customer_address_city', 'lb_customer_address_state', array('name' => 'lb_customer_address_country', 'editable' => array('type' => 'select', 'source' => LBApplicationUI::countriesDropdownData(), 'placement' => 'right')), 'lb_customer_address_postal_code', 'lb_customer_address_website_url', 'lb_customer_address_phone_1', 'lb_customer_address_phone_2', 'lb_customer_address_fax', 'lb_customer_address_email', 'lb_customer_address_note', array('name' => 'lb_customer_address_is_active', 'editable' => array('type' => 'select', 'source' => LbCustomerAddress::$dropdownActive, 'placement' => 'right')))));
    echo "</div>";
}
// end for
?>
<script>
    function onclickSlideToggle(id)
    {
        $("#detail_customer_address_"+id).slideToggle();
        $("#error_delete_address_"+id).css("display","none");
    }
    function ajaxDeleteAddress(id)
    {
        
        $.ajax({
Esempio n. 3
0
	return false;
});
$('.search-form form').submit(function(){
	$('#lb-invoice-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");**/
$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');
//$test = LbQuotation::model()->searchQuotationByName($_REQUEST['name'],10,$canListQuotation);
//echo '<pre>';
//print_r($test);
if (!$canView) {
    echo "Have no permission to see this record";
    return;
}
// 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</button>';
}
Esempio n. 4
0
$customer_canAdd = BasicPermission::model()->checkModules('lbCustomer', 'add');
$customer_canView = BasicPermission::model()->checkModules('lbCustomer', 'view');
//Permission Invoice
$invoice_canAdd = BasicPermission::model()->checkModules('lbInvoice', 'add');
$invoice_canView = BasicPermission::model()->checkModules('lbInvoice', 'view');
//Permission Expenses
$expenses_canView = BasicPermission::model()->checkModules('lbExpenses', 'view');
$expenses_canAdd = BasicPermission::model()->checkModules('lbExpenses', 'add');
//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;
Esempio n. 5
0
 public function checkModules($module_name, $per_value, $created_by = false)
 {
     $user_id = Yii::app()->user->id;
     $canAdd = BasicPermission::model()->checkPerModule($module_name, 'add');
     $canEditOwn = BasicPermission::model()->checkPerModule($module_name, 'update own');
     $canEditAll = BasicPermission::model()->checkPerModule($module_name, 'update all');
     $canDeleteOwn = BasicPermission::model()->checkPerModule($module_name, 'delete own');
     $canDeleteAll = BasicPermission::model()->checkPerModule($module_name, 'delete all');
     $canViewOwn = BasicPermission::model()->checkPerModule($module_name, 'view own');
     $canViewAll = BasicPermission::model()->checkPerModule($module_name, 'view all');
     $canListOwn = BasicPermission::model()->checkPerModule($module_name, 'list own');
     $canListAll = BasicPermission::model()->checkPerModule($module_name, 'list all');
     $ownSub = AccountSubscription::model()->checkIsSubscriptionOwner(LBApplication::getCurrentlySelectedSubscription());
     $result = false;
     if ($ownSub) {
         $result = true;
         if ($per_value == "list") {
             $result = FALSE;
         }
     } else {
         if ($per_value == "add") {
             $result = $canAdd;
         } else {
             if ($per_value == "update") {
                 if ($canEditAll) {
                     $result = true;
                 } elseif ($canEditOwn && $user_id == $created_by) {
                     $result = true;
                 }
             } else {
                 if ($per_value == "delete") {
                     if ($canDeleteAll) {
                         $result = true;
                     } elseif ($canDeleteOwn && $user_id == $created_by) {
                         $result = true;
                     }
                 } else {
                     if ($per_value == "view") {
                         if ($canViewAll) {
                             $result = true;
                         } elseif ($canViewOwn && $user_id == $created_by) {
                             $result = true;
                         }
                     } else {
                         if ($per_value == "list") {
                             $result = -1;
                             if ($canListAll) {
                                 $result = false;
                             } else {
                                 if ($canListOwn) {
                                     $result = Yii::app()->user->id;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $result;
 }
Esempio n. 6
0
<?php

$m = $this->module->id;
$canList = BasicPermission::model()->checkModules($m, 'list');
$canAdd = BasicPermission::model()->checkModules($m, 'add');
?>

<?php 
echo '<div id="lb-container-header">';
echo '<div class="lb-header-right" ><h3>' . Yii::t('lang', 'Quotation') . '</h3></div>';
echo '<div style="margin-top: 15px;margin-right:10px;">';
LBApplicationUI::backButton(LbInvoice::model()->getActionURLNormalized("dashboard"));
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>";
?>
Esempio n. 7
0
<?php

/* @var $this LbInvoiceController */
/* @var $model LbInvoice */
/* @var $form CActiveForm */
/* @var $invoiceItemModel LbInvoiceItem */
/* @var $invoiceDiscountModel LbInvoiceItem */
/* @var $invoiceTaxModel LbInvoiceItem */
/* @var $invoiceTotal LbInvoiceTotal */
$m = $this->module->id;
$credit_by = LbCoreEntity::model()->getCoreEntity($m, $model->lb_record_primary_key)->lb_created_by;
$canEdit = BasicPermission::model()->checkModules($m, 'update', $credit_by);
$canDelete = BasicPermission::model()->checkModules($m, 'delete', $credit_by);
$canViewProcess = BasicPermission::model()->checkModules('process_checklist', 'view', $credit_by);
//$canEditAll = BasicPermission::model()->checkModules($m, 'update all');
//$canDeletOwn = BasicPermission::model()->checkModules($m, 'delete own');
//$canDeleteAll = BasicPermission::model()->checkModules($m, 'delete all');
$currency_name = LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol;
$lb_thousand_separator = LbGenera::model()->getGeneraSubscription()->lb_thousand_separator;
$lb_decimal_symbol = LbGenera::model()->getGeneraSubscription()->lb_decimal_symbol;
/********************************************************************************
 * ============================= LINE ITEMS SECTION =============================
 *******************************************************************************/
echo '<div id="container-invoice-line-items-section" style="margin-top: 30px">';
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'lb-invoice-items-form', 'enableAjaxValidation' => false, 'type' => 'horizontal'));
/**
LineItem Grid's $data is LbInvoiceItem
Each line item's fields (description, quantity, unit price and total) 
are marked by the line item's primary key.
*/
$grid_id = 'invoice-line-items-grid-' . $model->lb_record_primary_key;
Esempio n. 8
0
<?php

$m = $this->module->id;
$credit_by = LbCoreEntity::model()->getCoreEntity($m, $model->lb_record_primary_key)->lb_created_by;
$canAdd = BasicPermission::model()->checkModules($m, 'add');
$canView = BasicPermission::model()->checkModules($m, 'view', $credit_by);
$canList = BasicPermission::model()->checkModules($m, 'list', $credit_by);
$canDelete = BasicPermission::model()->checkModules($m, 'delete', $credit_by);
$canEdit = BasicPermission::model()->checkModules($m, 'update', $credit_by);
$deleteTemplate = false;
if ($canDelete) {
    $deleteTemplate = "{delete}";
}
$currency_name = LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol;
?>
<div style="margin-top: 30px">
    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'lb-quotation-items-form', 'enableAjaxValidation' => false, 'type' => 'horizontal'));
?>
    <?php 
$grid_id = 'quotation-line-item-grid-' . $model->lb_record_primary_key;
?>
    <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => $grid_id, 'dataProvider' => $quotationItemModel->getquotationItems($model->lb_record_primary_key), 'htmlOptions' => array('style' => 'padding-top:50px'), 'template' => "{items}\n{summary}", 'columns' => array(array('header' => '#', 'type' => 'raw', 'value' => '1', 'htmlOptions' => array('width' => '10'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => $deleteTemplate, 'deleteButtonUrl' => '"' . $this->createUrl("deleteBlankItem") . '" .
                                                "?id={$data->lb_record_primary_key}"', 'afterDelete' => 'function(link,success,response){
                                var responseJSON = jQuery.parseJSON(response);
                                refreshTotal(responseJSON.lb_quotation_subtotal,responseJSON.lb_quotation_total_after_total);
                                refreshTaxGrid();
                            } ', 'htmlOptions' => array('width' => '10'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Item'), 'type' => 'raw', 'value' => 'CHtml::activeTextArea($data,"lb_quotation_item_description",
                                              array("style"=>"width: 350px; border-top: none; border-left: none; border-right: none; box-shadow: none;",
                                                    "name"=>"lb_quotation_item_description_{$data->lb_record_primary_key}",
Esempio n. 9
0
<?php

/* @var $expenses_invoice array of LbExpensesInvoice models */
$canAddInvoice = BasicPermission::model()->checkModules('lbInvoice', 'add');
$canAddDelete = BasicPermission::model()->checkModules('lbCustomer', 'delete');
if ($canAddInvoice) {
    echo '<div class="btn-toolbar">';
    //  LBApplicationUI::newButton(Yii::t('lang','New Invoice'), array('url'=>$this->createUrl('addInvoice')));
    $this->widget('bootstrap.widgets.TbButton', array('label' => 'New Invoice', 'url' => LbInvoice::model()->getCreateURLNormalized(array('group' => strtolower(LbInvoice::LB_INVOICE_GROUP_INVOICE), 'expenses_id' => $expenses_id))));
    $this->widget('bootstrap.widgets.TbButton', array('label' => 'Assign Invoice', 'htmlOptions' => array('onclick' => 'assignInvoice();')));
    echo '</div>';
}
$i = 0;
foreach ($expenses_invoice as $ex_invoice) {
    $invoice = LbInvoice::model()->findByPk($ex_invoice->lb_invoice_id);
    $i++;
    echo "\n                <div style='overflow:hidden; border-top: 1px solid #EEEEEE;margin-top: 5px;'>\n                    <div style='float:left'>\n                        <h4><span style='padding: 0 8px;background:#EEEEEE;border-radius:50%;'>{$i}</span> " . LBApplication::workspaceLink($invoice->lb_invoice_no, $invoice->customer ? $invoice->getViewURL($invoice->customer->lb_customer_name) : $invoice->getViewURL("No customer")) . "</h4>\n                    </div>";
    if ($canAddDelete) {
        echo "<div style='float:right;margin-top:5px;'>\n                            <a href='#' onclick='ajaxDeleteInvoiceExpenses(" . $invoice->lb_record_primary_key . "); return false;'>\n                                <i class='icon-trash'></i>\n                                Delete\n                            </a>\n                        </div>";
    }
    echo "</div>\n                <div id='error_delete_expense_invoice_" . $invoice->lb_record_primary_key . "' class='alert alert-block alert-error' style='display:none;'></div>\n            ";
}
// end for
//form assign invoice
$this->beginWidget('bootstrap.widgets.TbModal', array('id' => 'modal-invoice-assign-form'));
echo '<div class="modal-header" style="max-width:700px;">';
echo '<a class="close" data-dismiss="modal">&times;</a>';
echo '<h4>Assign Invoice</h4>';
echo '</div>';
echo '<div class="modal-body" style="max-height:500px" id="modal-view-invoice-body-' . $expenses_id . '">';
echo '</div>';
Esempio n. 10
0
 public function actionAssingPermissionAccount()
 {
     $result = false;
     $permissionBasic = BasicPermission::model()->findAll();
     if (isset($_POST['modules_id']) && isset($_POST['account_id'])) {
         if (AccountBasicPermission::model()->checkModuleAssignAccount($_POST['account_id'], $_POST['modules_id']) == true) {
             echo '{"status":"exist","msg":"Module already exists."}';
             return;
         } else {
             foreach ($permissionBasic as $permissionBasicItem) {
                 $basisPermissionAccount = new AccountBasicPermission();
                 $basisPermissionAccount->account_id = $_POST['account_id'];
                 $basisPermissionAccount->module_id = $_POST['modules_id'];
                 $basisPermissionAccount->basic_permission_id = $permissionBasicItem->basic_permission_id;
                 $basisPermissionAccount->basic_permission_status = 0;
                 if ($basisPermissionAccount->save()) {
                     $result = true;
                 }
             }
         }
     }
     if ($result) {
         echo '{"status":"success"}';
     } else {
         echo '{"status":"fail"}';
     }
 }
Esempio n. 11
0
<?php

/* @var $this LbContractsController */
/* @var $model LbContracts */
$m = $this->module->id;
$canView = BasicPermission::model()->checkModules($m, 'view');
$canEdit = BasicPermission::model()->checkModules($m, 'edit');
$canAddInvoice = BasicPermission::model()->checkModules('lbInvoice', 'add');
if (!$canView) {
    echo "Have no permission to see this record";
    return;
}
//$this->breadcrumbs=array(
//	'Lb Contracts'=>array('index'),
//	$model->lb_record_primary_key,
//);
//$this->menu=array(
//	array('label'=>'List LbContracts', 'url'=>array('index')),
//	array('label'=>'Create LbContracts', 'url'=>array('create')),
//	array('label'=>'Update LbContracts', 'url'=>array('update', 'id'=>$model->lb_record_primary_key)),
//	array('label'=>'Delete LbContracts', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->lb_record_primary_key),'confirm'=>'Are you sure you want to delete this item?')),
//	array('label'=>'Manage LbContracts', 'url'=>array('admin')),
//);
//
echo '<div id="lb-container-header">';
echo '<div class="lb-header-right" ><h3>Contracts</h3></div>';
echo '<div class="lb-header-left">';
LBApplicationUI::backButton(LbContracts::model()->getActionURLNormalized("dashboard"));
echo '&nbsp;';
$this->widget('bootstrap.widgets.TbButtonGroup', array('type' => '', 'buttons' => array(array('label' => '<i class="icon-plus"></i> ' . Yii::t('lang', 'New Contract'), 'url' => $this->createUrl('create'))), 'encodeLabel' => false));
echo '</div>';
Esempio n. 12
0
<?php

/* @var $this LbInvoiceController */
/* @var $model LbInvoice */
/* @var $form CActiveForm */
/* @var $invoiceItemModel LbInvoiceItem */
/* @var $invoiceDiscountModel LbInvoiceItem */
/* @var $invoiceTaxModel LbInvoiceItem */
/* @var $invoiceTotal LbInvoiceTotal */
$m = 'LbVendorInvoice';
$credit_by = LbCoreEntity::model()->getCoreEntity($m, $model->lb_record_primary_key);
$canEdit = BasicPermission::model()->checkModules($m, 'update', $credit_by);
$canDelete = BasicPermission::model()->checkModules($m, 'delete', $credit_by);
$canEdit = true;
$canDelete = true;
//$canViewProcess = BasicPermission::model()->checkModules('process_checklist', 'view',$credit_by);
//$canEditAll = BasicPermission::model()->checkModules($m, 'update all');
//$canDeletOwn = BasicPermission::model()->checkModules($m, 'delete own');
//$canDeleteAll = BasicPermission::model()->checkModules($m, 'delete all');
//LbVendorItem::model()->addLineItemVendor($model->lb_record_primary_key, 'LINE');
$currency_name = LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol;
/********************************************************************************
 * ============================= LINE ITEMS SECTION =============================
 *******************************************************************************/
echo '<div id="container-invoice-line-items-section" style="margin-top: 30px">';
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'lb-invoice-items-form', 'enableAjaxValidation' => false, 'type' => 'horizontal'));
/**
LineItem Grid's $data is LbInvoiceItem
Each line item's fields (description, quantity, unit price and total) 
are marked by the line item's primary key.
*/
Esempio n. 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 . '","' . 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')))));
Esempio n. 14
0
<?php

/* @var $this LbInvoiceController */
/* @var $model LbInvoice */
$m = $this->module->id;
$canAdd = BasicPermission::model()->checkModules($m, 'add');
$canList = BasicPermission::model()->checkModules($m, 'list');
$canQuotationAdd = BasicPermission::model()->checkModules('LbQuotation', 'add');
$canPaymentAdd = BasicPermission::model()->checkModules('LbPayment', 'add');
/**
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.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>';
Esempio n. 15
0
<?php

/* @var $this LbCustomerController */
/* @var $model LbCustomer */
/* @var $customer_addresses array of LbCustomerAddress models */
/* @var $customer_contacts ARRAY of LbCustomerContact models */
$m = $this->module->id;
$canAdd = BasicPermission::model()->checkModules($m, 'add');
$canView = BasicPermission::model()->checkModules($m, 'view');
$canAddInvoice = BasicPermission::model()->checkModules(LbInvoice::model()->getEntityType(), 'add');
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:-11px;"><h3>' . Yii::t('lang', 'Customers') . '</h3></div>';
echo '<div class="lb-header-left">';
LBApplicationUI::backButton($model->getHomeURLNormalized());
echo '&nbsp;';
// new
if ($canAdd || $canAddInvoice) {
    LBApplicationUI::newButtonGroup(Yii::t('lang', 'New'), array('buttons' => array(array('items' => array(array('label' => Yii::t('lang', 'New Address'), 'url' => LbCustomerAddress::model()->getCreateURLNormalized(array('customer_id' => $model->lb_record_primary_key)), 'visible' => $canAdd), array('label' => Yii::t('lang', 'New Contact'), 'url' => LbCustomerContact::model()->getCreateURLNormalized(array('customer_id' => $model->lb_record_primary_key)), 'visible' => $canAdd), array('label' => Yii::t('lang', 'New Invoice'), 'url' => '#', 'visible' => $canAddInvoice), '---', array('label' => Yii::t('lang', 'New Customer'), 'url' => $model->getCreateURLNormalized(), 'visible' => $canAdd))))));
}
echo '</div>';
echo '</div>';
?>

<div style="width:30%;margin-top:19px;margin-bottom:11px;"><span style="font-size: 16px;"><b><?php 
echo $model->lb_customer_name;
?>
</b></span></div>
Esempio n. 16
0
<?php

$m = $this->module->id;
$canList = BasicPermission::model()->checkModules($m, 'list', Yii::app()->user->id);
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-invoice-Outstanding-grid', 'type' => 'striped', 'dataProvider' => LbInvoice::model()->searchInvoiceByName($_REQUEST['name'], 10, $canList), 'columns' => array(array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{delete}', 'afterDelete' => 'function(link,success,data){ ' . 'if(data){ responseJSON = jQuery.parseJSON(data);' . '     alert(responseJSON.error); }' . '}', 'htmlOptions' => array('width' => '20')), array('type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_invoice_no,
                                        $data->customer ? $data->getViewURL($data->customer->lb_customer_name) : $data->getViewURL("No customer")) . "<br/>".
                                        LBApplicationUI::getStatusBadge($data->lb_invoice_status_code)', 'htmlOptions' => array('width' => '130')), array('type' => 'raw', 'value' => '$data->customer ? $data->customer->lb_customer_name."<br><span style=\'color:#666;\'>". $data->lb_invoice_subject."</span>" : "No customer"
                                    ."<br><span style=\'color:#666;\'>". $data->lb_invoice_subject."</span>"', 'htmlOptions' => array('width' => '')), array('type' => 'raw', 'value' => 'date("d M Y",strtotime($data->lb_invoice_due_date))', 'htmlOptions' => array('width' => '100')), array('type' => 'raw', 'value' => 'LbInvoice::model()->getStatusAmount($data->lb_invoice_status_code,$data->total_invoice ? $data->total_invoice->lb_invoice_total_outstanding : "0.00")', 'htmlOptions' => array('width' => '120', 'style' => 'text-align:right')))));
Esempio n. 17
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$model = new LbPvExpenses();
$m = $this->module->id;
$canAdd = BasicPermission::model()->checkModules($m, 'add');
$canList = BasicPermission::model()->checkModules($m, 'list');
$id = 0;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
}
//echo '<pre>';
//print_r(LbExpenses::model()->getExpensesByPk(4));
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'payment_invoice_grid', 'type' => 'bordered', 'dataProvider' => $model->listPV($id), 'columns' => array(array('class' => 'CButtonColumn', 'template' => '{delete}', 'deleteButtonUrl' => 'CHtml::normalizeUrl(array("/lbExpenses/default/deletePVExpenses", "id"=>$data->lb_record_primary_key))', 'htmlOptions' => array('width' => '30'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Date'), 'name' => 'lb_customer_id', 'type' => 'raw', 'id' => '$data->lb_record_primary_key', 'value' => 'CHtml::textField("date_ex_{LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)[lb_expenses_date]}",LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_expenses_date"] ? date("d M, Y", strtotime(LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_expenses_date"])) : "",array(
                                                                                                "style"=>"width: 110px;text-align: left; padding-right: 0px;
                                                                                                 border: none;box-shadow: none;background:#ffffff;",
                                                                                                 "disabled"=>"disabled",
                                                                                                 "id"=>"date_ex_{$data->lb_record_primary_key}",
                                            ))', 'htmlOptions' => array('width' => '120'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Expenses No'), 'type' => 'raw', 'value' => 'CHtml::textField("ex_no_{LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)[lb_expenses_no]}",LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_expenses_no"],array(
                                                                                                "style"=>"width: 110px;text-align: left; padding-right: 0px;
                                                                                                 border: none;box-shadow: none;background:#ffffff;",
                                                                                                 "disabled"=>"disabled",
                                                                                                 "id"=>"ex_no_{$data->lb_record_primary_key}",
                                            ))', 'htmlOptions' => array('width' => '180'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Category'), 'type' => 'raw', 'value' => 'CHtml::textField("ex_category_{LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)[lb_expenses_no]}",(count(UserList::model()->getItem(LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_category_id"])))>0 ?(UserList::model()->getItem(LbExpenses::model()->getExpensesByPk($data->lb_expenses_id)["lb_category_id"])->system_list_item_name): "",array(
                                                                                                "style"=>"text-align: left; padding-right: 0px;
                                                                                                 border: none;box-shadow: none;background:#ffffff;",
                                                                                                 "disabled"=>"disabled",
Esempio n. 18
0
 public function actionAssingPermissionRoles()
 {
     $result = false;
     $permissionBasic = BasicPermission::model()->findAll();
     if (isset($_POST['modules_id']) && isset($_POST['role_id'])) {
         if (RolesBasicPermission::model()->checkModuleAssignRole($_POST['role_id'], $_POST['modules_id']) == true) {
             echo '{"status":"exist","msg":"module nay da ton tai."}';
             return;
         } else {
             foreach ($permissionBasic as $permissionBasicItem) {
                 $basisPermissionRole = new RolesBasicPermission();
                 $basisPermissionRole->role_id = $_POST['role_id'];
                 $basisPermissionRole->module_id = $_POST['modules_id'];
                 $basisPermissionRole->basic_permission_id = $permissionBasicItem->basic_permission_id;
                 $basisPermissionRole->basic_permission_status = 0;
                 if ($basisPermissionRole->save()) {
                     $result = true;
                 }
             }
         }
     }
     if ($result) {
         echo '{"status":"success"}';
     } else {
         echo '{"status":"fail"}';
     }
 }