public function actionPdf($invoice, $search_date_from, $search_date_to)
 {
     //$customer_id = $_GET['customer_id'];
     $html2pdf = Yii::app()->ePdf->HTML2PDF();
     $model = new LbPayment();
     $lbInvoiceModel = LbInvoice::model()->findByPk($invoice);
     $html2pdf->WriteHTML($this->renderPartial('pdf', array('lbPaymentModel' => $model, 'model' => $lbInvoiceModel, 'invoice_id' => $invoice, 'search_date_from' => $search_date_from, 'search_date_to' => $search_date_to), true));
     $html2pdf->WriteHTML($this->renderPartial('_pdf_footer', array(), true));
     $html2pdf->Output('invoice.pdf', 'I');
 }
Example #2
0
 public function actionCronInvoiceUpdateStatus()
 {
     $current_date = date('Y-m-d');
     $modelAll = LbInvoice::model()->findAll();
     foreach ($modelAll as $data) {
         if (strtotime($current_date) > strtotime($data->lb_invoice_due_date) && $data->lb_invoice_status_code == LbInvoice::LB_INVOICE_STATUS_CODE_OPEN) {
             $model = LbInvoice::model()->findByPk($data->lb_record_primary_key);
             $model->lb_invoice_status_code = LbInvoice::LB_INVOICE_STATUS_CODE_OVERDUE;
             $model->save();
         }
     }
 }
Example #3
0
 public static function getStatusBadge($status_code)
 {
     $badge_css = '';
     if ($status_code == LbInvoice::LB_INVOICE_STATUS_CODE_DRAFT) {
         $badge_css = '';
     }
     if ($status_code == LbInvoice::LB_INVOICE_STATUS_CODE_OPEN) {
         $badge_css = 'badge-success';
     }
     if ($status_code == LbInvoice::LB_INVOICE_STATUS_CODE_OVERDUE) {
         $badge_css = 'badge-warning';
     }
     if ($status_code == LbInvoice::LB_INVOICE_STATUS_CODE_WRITTEN_OFF) {
         $badge_css = 'badge-warning';
     }
     if ($status_code == LbInvoice::LB_INVOICE_STATUS_CODE_PAID) {
         $badge_css = 'badge-success';
     }
     $status_name = LbInvoice::model()->getDisplayInvoiceStatus($status_code);
     return '<div class="badge ' . $badge_css . '">' . $status_name . '</div>';
 }
Example #4
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>
Example #5
0
        {
            lbAppUILoadModal(invoice_id, 'New Address','<?php 
echo LbInvoice::model()->getActionURLNormalized("ajaxQuickCreateAddress", array("ajax" => 1, "id" => $model->lb_record_primary_key));
?>
');
        }
    }

    function onChangeAttentionDropdown(e, invoice_id)
    {
        var target = e.target;
        //console.log($(target).val());
        if ($(target).val() == -1)
        {
            lbAppUILoadModal(invoice_id, 'New Contact','<?php 
echo LbInvoice::model()->getActionURLNormalized("ajaxQuickCreateContact", array("ajax" => 1, "id" => $model->lb_record_primary_key));
?>
');
        }
    }
    
    function onChangeTaxDropdown(line_item_pk, tax_id)
{
    if (tax_id == -1)
    {
        // show pop up form to create new tax item
        $("#modal-new-tax-form-body-"+<?php 
echo $model->lb_record_primary_key;
?>
).html(getLoadingIconHTML(false));
        $("#modal-new-tax-form-body-"+<?php 
Example #6
0
if (isset($model->customerContact)) {
    $att = ($model->customerContact->lb_customer_contact_first_name != null ? $model->customerContact->lb_customer_contact_first_name . ' ' : '') . ($model->customerContact->lb_customer_contact_last_name != NULL ? $model->customerContact->lb_customer_contact_last_name : '');
}
$add = "";
if (isset($model->ownerAddress->lb_customer_address_line_1) || isset($model->ownerAddress->lb_customer_address_line_2)) {
    $add = 'Address: ';
}
$subject = "";
if (isset($model->lb_invoice_subject)) {
    $subject = '<tr><td>&nbsp;</td></tr>
                    <tr>
                        <td><b>Subject:</b><br></td>
                    </tr>
                    <tr><td colspan="2">' . nl2br($model->lb_invoice_subject) . '</td></tr>';
}
$create_by = AccountProfile::model()->getFullName(LbCoreEntity::model()->getCoreEntity(LbInvoice::model()->module_name, $model->lb_record_primary_key)->lb_created_by);
$tbl = '<table border="0" style="margin:auto;width:100%;" cellpadding="0" cellspacing="0">
        ' . $html_logo . '
        <tr valign="top">
            <td width="300">
                <span style="font-size:20px;font-weight:bold;">INVOICE</span><br>
                Invoice No: ' . $model->lb_invoice_no . '<br>
                Invoice Date: ' . date('d-M-Y', strtotime($model->lb_invoice_date)) . '<br>
                Due Date: ' . date('d-M-Y', strtotime($model->lb_invoice_due_date)) . '<br>
            </td>
            <td width="400" align="right">
                
                <span style="font-size:16px;font-weight:bold;">' . (isset($model->owner->lb_customer_name) ? $model->owner->lb_customer_name . '. ' : '') . '</span><br>
                ' . (isset($model->owner->lb_customer_registration) ? "Registration No: " . $model->owner->lb_customer_registration . '. ' : '') . '
                ' . (isset($model->owner->lb_customer_website_url) ? "Website: " . $model->owner->lb_customer_website_url . '' : '') . '<br>
                ' . $add . (isset($model->ownerAddress->lb_customer_address_line_1) && $model->ownerAddress->lb_customer_address_line_1 != "" ? $model->ownerAddress->lb_customer_address_line_1 . '. ' : '') . '
Example #7
0
<?php

$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 Customer') + $customer_arr;
?>
<style>
    .accordion-heading{
        background: rgb(91,183,91);
    }
</style>
<?php 
echo '<div id="lb-container-header">';
echo '<div class="lb-header-right" style="margin-left:-11px;"><h3>' . Yii::t('lang', 'Payment') . '</h3></div>';
echo '<div class="lb-header-left">';
LBApplicationUI::backButton(LbInvoice::model()->getAdminURLNormalized());
echo '&nbsp;';
echo '</div>';
echo '</div>';
echo '<div style="clear: both;overflow:hidden"><Br>';
?>
<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: #fff;font-size: 20px; font-weight: bold"><?php 
Example #8
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')))));
<?php

$PaymentInvoice = LbPaymentItem::model()->getAllPaymentByInvoice($invoice_id);
$method = LBPayment::model()->method;
if ($invoice_status != LbInvoice::LB_INVOICE_STATUS_CODE_DRAFT) {
    $grid_payment_id = 'invoice-line-payment-grid-' . $invoice_id;
    $this->widget('bootstrap.widgets.TbGridView', array('id' => $grid_payment_id, 'type' => 'bordered', 'dataProvider' => $PaymentInvoice, 'columns' => array(array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => "{delete}", 'deleteButtonUrl' => '"' . LbInvoice::model()->getActionURLNormalized("ajaxDeletePayment") . '" .
                                            "?id={$data->lb_record_primary_key}&invoice_id={$data->lb_invoice_id}"', 'afterDelete' => 'function(link,success,data){

                            if(success) {
                                var responseJSON = $.parseJSON(data);

                                var status = responseJSON.status;
                                 if(status == "I_PAID")
                                {
                                    $("#lb_invocie_status").text("Paid");
                                }
                            else
                                $("#lb_invocie_status").text("Open");

                            $("#invoice-outstanding-' . $invoice_id . '").text(responseJSON.outstanding);
                            $("#invoice-paid-' . $invoice_id . '").text(responseJSON.paid);
                            }
                        } ', 'htmlOptions' => array('style' => 'width: 10px'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Payment No'), 'type' => 'raw', 'value' => 'LbPayment::model()->getPaymentById($data->lb_payment_id)->lb_payment_no

                                                    ', 'htmlOptions' => array('width' => '100', 'style' => 'text-align: right;'), 'headerHtmlOptions' => array('class' => 'lb-grid-header')), array('header' => Yii::t('lang', 'Payment Date'), 'type' => 'raw', 'value' => '
                                                                CHtml::activeTextField(LbPayment::model()->getPaymentById($data->lb_payment_id),"lb_payment_date",
                                                                array("style"=>"width: 100px;text-align: right; padding-right: 0px;
                                                                border-top: none; border-left: none; border-right: none; box-shadow: none;",
                                                                "class"=>"lbinvoice-line-payment_date",
                                                                "name"=>"lb_invoice_item_payment_{$data->lb_record_primary_key}",
Example #10
0
<?php

/* @var $this DefaultControllersController */
/* @var $model LbEmployee */
$this->breadcrumbs = array('Lb Employees' => array('index'), 'Create');
$this->menu = array(array('label' => 'List LbEmployee', 'url' => array('index')), array('label' => 'Manage LbEmployee', 'url' => array('admin')));
echo '<div id="lb-view-header" style="margin: -20px -20px 17px; padding: 4px 20px;">';
echo '<div class="lb-header-right" style="margin-left:-10px"><h3><a style="color:#777;margin-left:9px;margin-top:2px;" href="' . LbInvoice::model()->getActionURLNormalized("dashboard") . '">New Employee</a></h3></div>';
echo '</div>';
?>

<?php 
$this->renderPartial('_form', array('model' => $model, 'salaryModel' => $salaryModel, 'benefitModel' => $benefitModel));
Example #11
0
<?php

$m = $this->module->id;
$canList = BasicPermission::model()->checkModules($m, 'list');
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-invoice-Outstanding-grid', 'type' => 'striped bordered condensed', 'dataProvider' => LbInvoice::model()->searchInvoiceByName($_REQUEST['name'], 10, $canList), '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', 'Invoice No'), 'type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_invoice_no,
                                        $data->customer ? $data->getViewURL($data->customer->lb_customer_name) : $data->getViewURL("No customer"))', '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_invoice_subject."</span>" : "No customer"
                                    ."<br><span style=\'color:#666;\'>". $data->lb_invoice_subject."</span>"', 'htmlOptions' => array('width' => '380')), array('header' => Yii::t('lang', 'Due Date'), 'type' => 'raw', 'value' => '$data->lb_invoice_due_date', 'htmlOptions' => array('width' => '100')), array('header' => Yii::t('lang', 'Amount'), 'type' => 'raw', 'value' => '($data->total_invoice ? LbInvoice::CURRENCY_SYMBOL.$data->total_invoice->lb_invoice_total_outstanding : "0.00")', 'htmlOptions' => array('width' => '120', 'style' => 'text-align:right')), array('header' => Yii::t('lang', 'Status'), 'type' => 'raw', 'value' => 'LbInvoice::model()->getDisplayInvoiceStatus($data->lb_invoice_status_code)', '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(LbInvoice::model()->module_name,$data->lb_record_primary_key)->lb_created_by)'))));
Example #12
0
$m = $this->module->id;
$canAdd = BasicPermission::model()->checkModules($m, 'add');
$canList = BasicPermission::model()->checkModules($m, 'list');
$this->breadcrumbs = array('Lb Contracts' => array('index'), 'Manage');
//$this->menu=array(
//	array('label'=>'List LbContracts', 'url'=>array('index')),
//	array('label'=>'Create LbContracts', 'url'=>array('create')),
//);
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#lb-contracts-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<?php 
echo '<div id="lb-container-header">';
echo '<div class="lb-header-right" ><h3>Contracts</h3></div>';
echo '<div class="lb-header-left" style="width:400px;">';
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 Contract', 'url' => $this->createUrl('create'))), 'encodeLabel' => false));
echo '</div>';
echo '</div>';
echo '<br>';
?>
<div style="width: 100%;text-align: center;">
<?php 
$this->widget('bootstrap.widgets.TbButtonGroup', array('buttons' => array(array('label' => 'Active', 'url' => $this->createUrl('admin')), array('label' => 'No Active', 'url' => $this->createUrl('admin', array('status' => LbContracts::LB_CONTRACT_STATUS_NO_ACTIVE))), array('label' => 'Has Renew', 'url' => $this->createUrl('admin', array('status' => LbContracts::LB_CONTRACT_STATUS_HAS_RENEWED))), array('label' => 'End Contract', 'url' => $this->createUrl('admin', array('status' => LbContracts::LB_CONTRACT_STATUS_END))))));
?>
</div>
<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-contracts-grid', 'dataProvider' => $model->getContract($status, 20, $canList), 'filter' => $model, 'columns' => array(array('header' => 'Contract No', 'name' => 'lb_contract_no', 'type' => 'raw', 'value' => '($data->lb_contract_no ?
					LBApplication::workspaceLink($data->lb_contract_no, $data->getViewURL($data->customer->lb_customer_name) )
					:LBApplication::workspaceLink("No customer", $data->getViewURL("No customer") )
 function actionAjaxCreateInvoice($id)
 {
     $model = $this->loadModel($id);
     $quotationItem = LbQuotationItem::model()->getquotationItems($id, 'ModelArray');
     $quotationDiscount = LbQuotationDiscount::model()->getQuotationDiscounts($id);
     $quotationTax = LbQuotationTax::model()->getTaxQuotation($id);
     $quotationTotal = LbQuotationTotal::model()->getQuotationTotal($id);
     $invoiceModel = new LbInvoice();
     $invoiceTotal = new LbInvoiceTotal();
     $invoice_number_int = LbInvoice::model()->getInvoiceNextNum();
     $invoiceModel->lb_invoice_no = LbInvoice::model()->formatInvoiceNextNumFormatted($invoice_number_int);
     $invoiceModel->lb_invoice_status_code = LbInvoice::LB_INVOICE_STATUS_CODE_OPEN;
     // invoice date
     $invoiceModel->lb_invoice_date = date('Y-m-d');
     $invoiceModel->lb_invoice_due_date = date('Y-m-d');
     // invoice group
     $invoiceModel->lb_invoice_group = LbInvoice::LB_INVOICE_GROUP_INVOICE;
     // invoice base64_decode
     $invoiceModel->lb_invoice_encode = LbInvoice::model()->setBase64_decodeInvoice();
     // invoice note
     $invoiceModel->lb_invoice_note = $model->lb_quotation_note;
     $invoiceModel->lb_invoice_company_id = $model->lb_company_id;
     $invoiceModel->lb_invoice_company_address_id = $model->lb_company_address_id;
     $invoiceModel->lb_invoice_customer_id = $model->lb_quotation_customer_id;
     $invoiceModel->lb_invoice_customer_address_id = $model->lb_quotation_customer_address_id;
     $invoiceModel->lb_invoice_attention_contact_id = $model->lb_quotation_attention_id;
     $invoiceModel->lb_quotation_id = $model->lb_record_primary_key;
     $invoiceModel->lb_invoice_subject = $model->lb_quotation_subject;
     // invoice internal note
     $invoiceModel->lb_invoice_internal_note = $model->lb_quotation_internal_note;
     if ($invoiceModel->save()) {
         // copy line item
         foreach ($quotationItem as $q_item) {
             $invoiceItemModel = new LbInvoiceItem();
             $invoiceItemModel->lb_invoice_id = $invoiceModel->lb_record_primary_key;
             $invoiceItemModel->lb_invoice_item_description = $q_item->lb_quotation_item_description;
             $invoiceItemModel->lb_invoice_item_quantity = $q_item->lb_quotation_item_quantity;
             $invoiceItemModel->lb_invoice_item_value = $q_item->lb_quotation_item_price;
             $invoiceItemModel->lb_invoice_item_total = $q_item->lb_quotation_item_total;
             $invoiceItemModel->lb_invoice_item_type = LbInvoiceItem::LB_INVOICE_ITEM_TYPE_LINE;
             $invoiceItemModel->save();
         }
         // copy tax item
         foreach ($quotationTax->data as $q_tax) {
             $invoiceTaxModel = new LbInvoiceItem();
             $invoiceTaxModel->lb_invoice_id = $invoiceModel->lb_record_primary_key;
             $invoiceTaxModel->lb_invoice_item_description = $q_tax->lb_quotation_tax_id;
             $invoiceTaxModel->lb_invoice_item_quantity = 1;
             $invoiceTaxModel->lb_invoice_item_value = $q_tax->lb_quotation_tax_value;
             $invoiceTaxModel->lb_invoice_item_total = $q_tax->lb_quotation_tax_total;
             $invoiceTaxModel->lb_invoice_item_type = LbInvoiceItem::LB_INVOICE_ITEM_TYPE_TAX;
             $invoiceTaxModel->save();
         }
         // copy discount item
         foreach ($quotationDiscount->data as $q_discount) {
             $invoiceDiscountModel = new LbInvoiceItem();
             $invoiceDiscountModel->lb_invoice_id = $invoiceModel->lb_record_primary_key;
             $invoiceDiscountModel->lb_invoice_item_description = $q_discount->lb_quotation_discount_description;
             $invoiceDiscountModel->lb_invoice_item_quantity = 1;
             $invoiceDiscountModel->lb_invoice_item_value = $q_discount->lb_quotation_discount_total;
             $invoiceDiscountModel->lb_invoice_item_total = $q_discount->lb_quotation_discount_total;
             $invoiceDiscountModel->lb_invoice_item_type = LbInvoiceItem::LB_INVOICE_ITEM_TYPE_DISCOUNT;
             $invoiceDiscountModel->save();
         }
         // Copy Total
         $invoiceTotal->lb_invoice_id = $invoiceModel->lb_record_primary_key;
         $invoiceTotal->lb_invoice_subtotal = $quotationTotal->lb_quotation_subtotal;
         $invoiceTotal->lb_invoice_total_after_discounts = $quotationTotal->lb_quotation_total_after_discount;
         $invoiceTotal->lb_invoice_total_after_taxes = $quotationTotal->lb_quotation_total_after_total;
         $invoiceTotal->lb_invoice_total_outstanding = $quotationTotal->lb_quotation_total_after_total;
         $invoiceTotal->lb_invoice_revision_id = 0;
         $invoiceTotal->save();
         // redirect Invoice
         //            $url_invoice = $model->customer ? LbInvoice::model()->getViewURL($model->customer->lb_customer_name,null,$invoiceModel->lb_record_primary_key) : LbInvoice::model()->getViewURL("No customer",null,$invoiceModel->lb_record_primary_key);
         //            $this->redirect($url_invoice);
     }
 }
Example #14
0
        $invoice_total = LbInvoiceTotal::model()->find('lb_invoice_id=' . intval($data_invocie->lb_record_primary_key));
        ?>
        <h5 style="margin: 20px 0px 5px 0px;font-weight: bold;">
            <span>
                <input class="pdf_checkbox" name="<?php 
        echo $data_invocie->lb_record_primary_key;
        ?>
" type="checkbox" value="<?php 
        echo $data_invocie->lb_record_primary_key;
        ?>
" />
            </span>
            <span style="text-decoration: underline;">
                
                <?php 
        echo LBApplication::workspaceLink($data_invocie->lb_invoice_no, LbInvoice::model()->getViewInvoiceURL($data_invocie->lb_record_primary_key, $data->lb_customer_name));
        ?>
            </span> 
            <sapn style="margin-left: 65px;color: #000000; font-weight: normal">Total: <?php 
        echo $invoice_total->lb_invoice_total_after_taxes;
        ?>
</span>
        </h5>
        <table border="0" width="100%" class="items table table-bordered">
            <thead>
                <tr>
                    <th width="250" class="lb-grid-header"><?php 
        echo Yii::t('lang', 'Amount Paid');
        ?>
</th>
                    <th width="150" class="lb-grid-header"><?php 
Example #15
0
 public function getTotalInvoiceByMonth($year = false, $month = false)
 {
     $status = '("' . LbInvoice::LB_INVOICE_STATUS_CODE_OPEN . '","' . LbInvoice::LB_INVOICE_STATUS_CODE_OVERDUE . '")';
     $model = LbInvoice::model()->findAll('YEAR(lb_invoice_date) = ' . $year . ' AND MONTH(lb_invoice_date) =' . $month . ' AND lb_invoice_status_code IN ' . $status . '');
     $total = 0;
     foreach ($model as $value) {
         $totalArr = LbInvoiceTotal::model()->find('lb_invoice_id = ' . $value->lb_record_primary_key);
         $total += $totalArr->lb_invoice_total_outstanding;
     }
     return $total;
 }
Example #16
0
 public function searchInvoice($search_name)
 {
     if (isset($_REQUEST['search_name'])) {
         $search_name = $_REQUEST['search_name'];
     }
     $status = '("' . LbInvoice::LB_INVOICE_STATUS_CODE_DRAFT . '","' . LbInvoice::LB_INVOICE_STATUS_CODE_OPEN . '","' . LbInvoice::LB_INVOICE_STATUS_CODE_OVERDUE . '")';
     $criteria = new CDbCriteria();
     $criteria->select = 't.*,';
     $criteria->select .= 'i.lb_customer_name';
     $criteria->order = 'lb_invoice_due_date DESC';
     $criteria->join = 'LEFT JOIN lb_customers i ON i.lb_record_primary_key = t.lb_invoice_customer_id';
     $criteria->condition = 'lb_invoice_status_code IN ' . $status;
     if ($search_name) {
         $criteria->condition .= ' AND (lb_invoice_no LIKE "%' . $search_name . '%" OR i.lb_customer_name LIKE "%' . $search_name . '%")';
     }
     //$dataProvider = new CActiveDataProvider($this,array('criteria'=>$criteria),$page,$user_id);
     //return $dataProvider;
     return LbInvoice::model()->findAll($criteria);
 }
Example #17
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>';
Example #18
0
 //$payment = $invoice_arr->customerAddress;
 $customer_name = $data->lb_customer_name;
 //                            echo $customer_name.'<br>';
 $total = 0;
 $i = count($invoice_arr);
 $j = 0;
 $total1 = 0;
 $total2 = 0;
 $total3 = 0;
 $total4 = 0;
 foreach ($invoice_arr as $data_invocie) {
     $j++;
     ?>
  <?php 
     $invoice_total = LbInvoiceTotal::model()->find('lb_invoice_id=' . intval($data_invocie->lb_record_primary_key));
     $lb_invoice = LbInvoice::model()->find('lb_record_primary_key=' . intval($data_invocie->lb_record_primary_key));
     $total = $invoice_total->getTotalInvoiceByCustomer($data->lb_record_primary_key);
     if ($total > 0) {
         if ($Time_Range_search == 0) {
             $PDFAging .= '<tbody>
                     <tr>';
             $PDFAging .= '<td >' . $data_invocie->lb_invoice_no . '</td>
                 <td style="text-align: left;">' . $lb_invoice->lb_invoice_date . '</td>
                 <td style="text-align: left;">';
             $dateNumber = dateNumber($currentDate, $lb_invoice->lb_invoice_date);
             if ($dateNumber >= 0 && $dateNumber <= 30) {
                 $PDFAging .= '$' . $invoice_total->lb_invoice_total_outstanding;
                 $total1 = $total1 + $invoice_total->lb_invoice_total_outstanding;
                 //                                echo $lb_invoice->lb_invoice_date;
             } else {
                 $PDFAging .= '$0.00';
 */
//Da thu
$total = array();
//Can thu
$datatest = array();
//DA chi
$datatest1 = array();
//Can chi
$datatest2 = array();
$thang = array();
for ($i = 1; $i < 13; $i++) {
    //Da Thu
    $payment = LbPayment::model()->getPaymentTotalByMonth($year, $i);
    array_push($total, intval($payment));
    //Can thu
    $oustanding_invoice = LbInvoice::model()->getTotalInvoiceByMonth($year, $i);
    array_push($datatest, intval($oustanding_invoice));
    //Da chi=totalEx + totalVendor
    $totalExpenses = LbExpenses::model()->totalExByVDInMonth($i, $year);
    $totalVendor = LbPaymentVendor::model()->totalPaymentVendorInMonth($i, $year);
    array_push($datatest1, $totalExpenses + $totalVendor);
    //Can Chi
    $totalVendorInvoice = LbVendorInvoice::model()->getVendorInvoiceMonth($i, $year);
    $totalEx = LbExpenses::model()->getExByMonth($i, $year);
    array_push($datatest2, $totalVendorInvoice + $totalEx);
    array_push($thang, intval($i));
}
$this->Widget('highcharts.HighchartsWidget', array('htmlOptions' => array(), 'options' => array('chart' => array('type' => 'column', 'colors' => array('#058DC7', '#5bb75b', '#ED561B', '#DDDF00')), 'yAxis' => array('title' => array('text' => '<b>$</b>'), 'style' => array('fontSize' => '14px')), 'xAxis' => array('title' => array('text' => '<b>Month</b>'), 'categories' => $thang, 'labels' => array('style' => array('fontSize' => '14px'))), 'plotOptions' => array('series' => array('pointWidth' => '13')), 'credits' => array('enabled' => false), 'series' => array(array('name' => 'Payment Received', 'data' => $total, 'stack' => 'male'), array('name' => 'Receivable', 'data' => $datatest, 'stack' => 'male'), array('name' => 'Bill Paid', 'data' => $datatest1, 'stack' => 'female'), array('name' => 'Payable', 'data' => $datatest2, 'stack' => 'female')))));
?>

<?php

/*
 * @var $model LBcustomer
 */
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-invoice-Outstanding-grid', 'dataProvider' => LbInvoice::model()->getInvoiceAllByCustomer($model->lb_record_primary_key, 5), 'template' => "{items}\n{pager}\n{summary}", 'columns' => array(array('header' => Yii::t('lang', 'Date'), 'type' => 'raw', 'value' => 'date("d-M-Y",strtotime($data->lb_invoice_date))', 'htmlOptions' => array('width' => '70')), array('header' => Yii::t('lang', 'Invoice No'), 'type' => 'raw', 'value' => 'LBApplication::workspaceLink($data->lb_invoice_no,
                                    $data->customer ? $data->getViewURL($data->customer->lb_customer_name) : $data->getViewURL("No customer"))', 'htmlOptions' => array('width' => '130')), array('header' => 'Subject', 'type' => 'raw', 'value' => '$data->lb_invoice_subject', 'htmlOptions' => array('width' => '250')), array('header' => Yii::t('lang', 'Amount'), 'type' => 'raw', 'value' => '($data->total_invoice) ? "$".number_format($data->total_invoice->lb_invoice_total_after_taxes,2) : "$0.00"', 'htmlOptions' => array('style' => 'text-align:right', 'width' => '80')), array('header' => Yii::t('lang', 'Paid'), 'type' => 'raw', 'value' => '($data->total_invoice) ? "$".number_format($data->total_invoice->lb_invoice_total_paid,2) : "$0.00"', 'htmlOptions' => array('style' => 'text-align:right', 'width' => '80')), array('header' => Yii::t('lang', 'Due'), 'type' => 'raw', 'value' => '($data->total_invoice) ? "$".number_format($data->total_invoice->lb_invoice_total_outstanding,2) : "$0.00"', 'htmlOptions' => array('style' => 'text-align:right', 'width' => '80')))));
Example #21
0
echo $form->textFieldRow($model, 'lb_expenses_date', array('hint' => 'Format: dd-mm-yyyy, e.g. 31-12-2013', 'value' => $model->lb_expenses_date ? date('d-m-Y', strtotime($model->lb_expenses_date)) : date('d-m-Y')));
echo $form->textFieldRow($model, 'lb_expenses_amount', array('class' => 'span3', 'value' => '0.00'));
echo '<span id="vacation"></span>';
echo '<hr/>';
$customer_arr = LbCustomer::model()->getCompanies($sort = 'lb_customer_name ASC', LbCustomer::LB_QUERY_RETURN_TYPE_DROPDOWN_ARRAY);
$option_customer = $customer_arr;
echo '<div class="control-group">';
echo CHtml::label('Customer', 'LbExpenses_lb_customer_id', array('class' => 'control-label'));
echo '<div class="controls">';
echo CHtml::dropDownList('LbExpensesCustomer[lb_customer_id][]', '', $option_customer, array('multiple' => true));
//            echo Chosen::activeMultiSelect($model,'lb_expenses_amount', $option_customer, array('class'=>'span6'));
echo '</div>';
echo '</div>';
//            echo $form->dropDownListRow($customerModel, 'lb_customer_id', $option_customer, array('multiple'=>true));
$status = '("' . LbInvoice::LB_INVOICE_STATUS_CODE_OPEN . '","' . LbInvoice::LB_INVOICE_STATUS_CODE_OVERDUE . '")';
$invoices = LbInvoice::model()->getInvoiceByStatus($status);
$invoice_arr = array();
if (count($invoices) > 0) {
    foreach ($invoices->data as $data) {
        $invoice_arr[$data->lb_record_primary_key] = $data->lb_invoice_no;
    }
}
if (count($invoice_arr) <= 0) {
    $option_invoice = array('' => 'Choose Invoice');
} else {
    $option_invoice = $invoice_arr;
}
echo '<div class="control-group">';
echo CHtml::label('Invoices', 'LbExpenses_lb_invoice_id', array('class' => 'control-label'));
echo '<div class="controls">';
echo CHtml::dropDownList('LbExpensesInvoice[lb_invoice_id][]', '', $option_invoice, array('multiple' => true));
 }
 if (count($PaymentAll) > 0) {
     $paymentAmount = 0;
     foreach ($PaymentAll as $data) {
         if (LbCustomer::model()->isCustomer($data->attributes['lb_payment_customer_id']) != null) {
             $customer_information = LbCustomer::model()->find('lb_record_primary_key=' . intval($data->attributes['lb_payment_customer_id']));
             $customer_name = $customer_information->lb_customer_name;
             echo '<tr>';
             echo '<td>' . $data->attributes['lb_payment_date'] . '</td>';
             echo '<td>' . $customer_name . '</td>';
             echo '<td>' . $data->attributes['lb_payment_notes'] . '</td>';
             $payment_item = LbPaymentItem::model()->getAllPaymentInvoice($data->lb_record_primary_key);
             echo '<td>';
             foreach ($payment_item as $payment) {
                 //                                        echo $payment->lb_invoice_id;
                 $invoiceNo = LbInvoice::model()->find('lb_record_primary_key=' . intval($payment->lb_invoice_id));
                 if (isset($invoiceNo->lb_record_primary_key)) {
                     echo $invoiceNo->lb_invoice_no . ':$' . $payment->lb_payment_item_amount . '; ';
                     $paymentAmount = $paymentAmount + $payment->lb_payment_item_amount;
                     $AmountMonth = $AmountMonth + $payment->lb_payment_item_amount;
                 }
             }
             echo '</td>';
             $total = $total + $data->attributes['lb_payment_total'];
             echo '<td>' . $data->attributes['lb_payment_total'] . '</td>';
             echo '</tr>';
         }
     }
     if ($paymentAmount > 0) {
         echo '<tr><td colspan="4"><b>Method: ' . $method[$i] . '</b></td>';
         echo '<td style="border-top:1px solid #000"><b>$' . $paymentAmount . '</b></td>';
Example #23
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) {
Example #24
0
 public function actionUpdateStatus()
 {
     $invoice_id = isset($_POST['invoice_id']) ? $_POST['invoice_id'] : 0;
     $status = LbInvoice::model()->UpdateStatusInvoice($invoice_id);
     $model = LbInvoice::model()->findByPk($invoice_id);
     $model->lb_invoice_status_code = $status;
     $model->save();
     //            LBApplication::renderPlain($this,
     //                array('content'=>CJSON::encode($model))
     //            );
     $url_invoice = $model->customer ? $model->getViewURLNormalized($model->customer->lb_customer_name) : $model->getViewURLNormalized("No customer");
     // echo "{'url':'".$url_invoice."'}";
     // echo '{"url": [' . json_encode($url_invoice) . ']}';
     echo $url_invoice;
 }
Example #25
0
     $("#btn_invoice").css("background-color","#5bb75b");
     $("#btn_graph").css("background-color","#f5f5f5");
      $("#btn_quotation").css("background-color","#f5f5f5");
}

function view_oustanding_quotation()
{
    $("#btn_quotation").css("background-color","#5bb75b");
    $("#btn_invoice").css("background-color","#f5f5f5");
    $("#btn_graph").css("background-color","#f5f5f5");
    $('#view_invoice').load('<?php 
echo LbInvoice::model()->getActionURLNormalized('_form_oustanding_quotation');
?>
');
}
function view_chart()
{
   $("#btn_graph").css("background-color","#5bb75b");
   $("#btn_invoice").css("background-color","#f5f5f5");
   $("#btn_quotation").css("background-color","#f5f5f5");
    $('#view_invoice').load('<?php 
echo LbInvoice::model()->getActionURLNormalized('chart');
?>
');
}
</script>



 /**
  * 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)));
 }
    ?>
</b>
                        </td>
                        
                    </tfoot>
  
                    <?php 
} else {
    $customer_arr = LbCustomer::model()->getCompanies($sort = 'lb_customer_name ASC', LbCustomer::LB_QUERY_RETURN_TYPE_MODELS_ARRAY);
    $invoiceValue = 0;
    $gst = 0;
    foreach ($customer_arr as $customer) {
        ?>
                            <tbody>
                            <?php 
        $a = LbInvoice::model()->getInvoiceMonth($customer['lb_record_primary_key'], $date_from, $date_to);
        foreach ($a as $data) {
            $customer_id = false;
            $invoice_information = LbInvoiceTotal::model()->getInvoiceById($data->lb_record_primary_key);
            $invoiceTax = LbInvoiceItem::model()->getInvoiceTaxById($data->lb_record_primary_key, "TAX");
            $invoiceValue = $invoiceValue + $invoice_information->lb_invoice_total_after_discounts;
            echo '<tr>';
            echo '<td>' . $data->lb_invoice_no . '</td>';
            echo '<td>' . $data->lb_invoice_date . '</td>';
            echo '<td>';
            if ($data->lb_invoice_customer_id) {
                $customer_id = $data->lb_invoice_customer_id;
                echo LbCustomer::model()->customerInformation($customer_id)->attributes['lb_customer_name'];
            }
            echo '</td>';
            echo '<td>$' . $invoice_information->lb_invoice_total_after_discounts . '</td>';
Example #28
0
 function actionAjaxSavePaymentInvoice()
 {
     if (isset($_POST['id'])) {
         $model_invoice = LbInvoice::model()->findByPk($_POST['id']);
         $customer = $model_invoice->lb_invoice_customer_id;
     }
     $model = new LbPayment();
     $model->lb_payment_no = LbPayment::model()->FormatPaymentNo(LbPayment::model()->getPaymentNextNum());
     $model->lb_payment_customer_id = $customer;
     $model->lb_payment_method = 0;
     $model->lb_payment_date = date('Y-m-d');
     $model->lb_payment_total = 0;
     if ($model->save()) {
         $paymentItemModel = new LbPaymentItem();
         $paymentItemModel->lb_payment_id = $model->lb_record_primary_key;
         $paymentItemModel->lb_invoice_id = $_POST['id'];
         $paymentItemModel->lb_payment_item_amount = 0;
         if ($paymentItemModel->save()) {
             $response = array();
             $response['success'] = YES;
             $response['payment_no'] = $model->lb_payment_no;
             $response['lb_payment_id'] = $model->lb_record_primary_key;
             LBApplication::renderPlain($this, array('content' => CJSON::encode($response)));
         } else {
             echo '{"status":"fail"}';
         }
     }
 }
 public function actionDeleteContact()
 {
     $error = array();
     $contact_id = $_POST['id'];
     $customer_id = $_POST['customer_id'];
     $invoiceContact = LbInvoice::model()->getInvoiceByContact($contact_id);
     if (count($invoiceContact->data) > 0) {
         $error['exist'] = 'Contact cannot be deleted. This contact is already in use by an invoice or quotation.';
         $model = LbCustomer::model()->findByPk($customer_id);
         $customer_addresses = LbCustomerAddress::model()->getAddresses($customer_id, LbCustomerAddress::LB_QUERY_RETURN_TYPE_MODELS_ARRAY);
         $customer_contacts = LbCustomerContact::model()->getContacts($customer_id, LbCustomerContact::LB_QUERY_RETURN_TYPE_MODELS_ARRAY);
         LBApplication::renderPartial($this, '//layouts/plain_ajax_content', array('content' => CJSON::encode($error)));
     } else {
         $contact = LbCustomerContact::model()->findByPk($contact_id);
         $contact->delete();
     }
 }
Example #30
0
<?php

/* @var $this DefaultControllersController */
/* @var $model LbEmployee */
$this->breadcrumbs = array('Lb Employees' => array('index'), 'Create');
$this->menu = array(array('label' => 'List LbEmployee', 'url' => array('index')), array('label' => 'Manage LbEmployee', 'url' => array('admin')));
echo '<div id="lb-view-header" style="margin: -20px -20px 17px; padding: 4px 20px;">';
echo '<div class="lb-right-header" ><h3><a href="' . LbInvoice::model()->getActionURLNormalized("dashboard") . '" style="color: #fff !important;">New Employee</a></h3></div>';
echo '</div>';
?>

<?php 
$this->renderPartial('_form', array('model' => $model, 'salaryModel' => $salaryModel, 'benefitModel' => $benefitModel));