Example #1
0
 public function actionAttentionByCustomer()
 {
     $customer_id = $_POST['customer_id_statement'];
     $option_contact = '<option value="0">All</option>';
     $contact_arr = LbCustomerContact::model()->getContacts($customer_id, LbCustomer::LB_QUERY_RETURN_TYPE_DROPDOWN_ARRAY);
     foreach ($contact_arr as $key => $value) {
         $option_contact .= '<option value="' . $key . '">' . $value . '</option>';
     }
     echo $option_contact;
 }
 function ActionLoadAjaxTabContract($id)
 {
     $customer_contacts = LbCustomerContact::model()->getContacts($id, LbCustomerContact::LB_QUERY_RETURN_TYPE_MODELS_ARRAY);
     LBApplication::renderPartial($this, '_customer_contacts', array('customer_contacts' => $customer_contacts, 'customer_id' => $id));
 }
Example #3
0
$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>

<?php 
echo '<div class="btn-toolbar">';
// go back
/**
LBApplicationUI::newButton('New Address');
Example #4
0
		}', 'validate' => 'function(value){
            if (value < 0) return "Please select a valid address";
        }', 'options' => array('sourceCache' => false), 'htmlOptions' => array('id' => 'LbInvoice_invoice_customer_address_id_' . $model->lb_record_primary_key), 'onShown' => 'js: function() {
            var $tip = $(this).data("editableContainer").tip();
            var dropdown = $tip.find("select");
            $(dropdown).bind("change", function(e){
                onChangeAddressDropdown(e,' . $model->lb_record_primary_key . ');
            });
        }'));
echo '</div>';
echo '</div>';
// end customer address
echo '<div id="container-invoice-customer-attention">';
echo '<div class="field-label-left">' . Yii::t('lang', 'Attention') . ':</div>';
echo '<div class="field-value-left lb_info_bill">';
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_vd_invoice_supplier_attention_id', 'emptytext' => 'Choose contact', 'url' => LbVendor::model()->getActionURLNormalized('ajaxUpdateFieldInvoice'), 'source' => LbCustomerContact::model()->getActionURLNormalized('dropdownJSON', array('allow_add' => 2, 'lb_vendor_invoice_id' => $model->lb_record_primary_key)), 'placement' => 'right', 'options' => array('sourceCache' => false), 'htmlOptions' => array('id' => 'LbInvoice_invoice_attention_contact_id_' . $model->lb_record_primary_key), 'onShown' => 'js: function() {
            var $tip = $(this).data("editableContainer").tip();
            var dropdown = $tip.find("select");
            $(dropdown).bind("change", function(e){
                onChangeAttentionDropdown(e,' . $model->lb_record_primary_key . ');
            });
        }'));
echo '</div>';
echo '</div>';
// end attention
?>

<br>
<?php 
echo '<div id="container-invoice-customer-attention">';
echo '<div class="field-label-left">' . Yii::t('lang', 'Category') . ':</div>';
 /**
  * Quick create contact from a modal form
  * over invoice main page
  *
  * @param $id   invoice id
  * @return bool
  * @throws ChttpException if customer is not selected
  */
 public function actionAjaxQuickCreateContact($id)
 {
     $model = $this->loadModel($id);
     $customerModel = LbCustomer::model()->findByPk($model->lb_invoice_customer_id);
     $customerContact = new LbCustomerContact();
     // a customer must have been assigned first
     if ($customerModel === null) {
         throw new CHttpException(404, 'Please select a customer first.');
     }
     if (isset($_POST['LbCustomerContact'])) {
         // save customer data
         $customerContact->attributes = $_POST['LbCustomerContact'];
         $customerContact->lb_customer_id = $customerModel->lb_record_primary_key;
         if ($customerContact->save()) {
             // assign this contact to this invoice
             $model->lb_invoice_attention_contact_id = $customerContact->lb_record_primary_key;
             $model->save();
         }
         //return JSON record of customer address
         LBApplication::renderPlain($this, array('content' => CJSON::encode($customerContact)));
         return true;
     }
     // show quick create form
     LBApplication::render($this, '_form_contact', array('model' => $model, 'customerModel' => $customerModel, 'customerContactModel' => $customerContact));
 }
Example #6
0
                        $(dropdown).bind("change", function(e){
                            onChangeAddressDropdown(e,' . $model->lb_record_primary_key . ');
                        });
                    }', 'htmlOptions' => array('id' => 'LbInvoice_quotation_address_id_' . $model->lb_record_primary_key)));
?>
        </div>
    </div>
    
<div id="container-quotation-customer-attention">
        <div class="field-label-left"><?php 
echo Yii::t('lang', 'Attention');
?>
:</div>
        <div class="field-value-left">
            <?php 
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_attention_id', 'emptytext' => 'Choose attention', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => LbCustomerContact::model()->getActionURLNormalized('dropdownJSON', array('allow_add' => YES, 'quotation_id' => $model->lb_record_primary_key)), 'placement' => 'right', 'options' => array('sourceCache' => false), 'onShown' => 'js: function() {
                            var $tip = $(this).data("editableContainer").tip();
                            var dropdown = $tip.find("select");
                            $(dropdown).bind("change", function(e){
                                onChangeAttentionDropdown(e,' . $model->lb_record_primary_key . ');
                            });
                        }', 'htmlOptions' => array('id' => 'LbInvoice_quotation_contact_id_' . $model->lb_record_primary_key)));
?>
        </div>
</div>
    <br>
    <div id="container-quotation-customer-subject">
        <h4><?php 
echo Yii::t('lang', 'Subject');
?>
:</h4>
Example #7
0
    ';
echo $tbl;
$customerName = false;
if ($model->lb_vendor_supplier_id) {
    $customerName = LbCustomer::model()->findByPk($model->lb_vendor_supplier_id)['lb_customer_name'];
}
$billingName = false;
if ($model->lb_vendor_supplier_address) {
    $informationAdd = LbCustomerAddress::model()->findByPk($model->lb_vendor_supplier_address);
    $billingName = $informationAdd['lb_customer_address_line_1'] . '. ' . $informationAdd['lb_customer_address_line_2'] . '<br />';
    //    $billingName .=$informationAdd['lb_customer_address_postal_code'].'<br>';
    //    $billingName .=$informationAdd['lb_customer_address_website_url'].'<br>';
}
$attentionInformation = false;
if ($model->lb_vendor_supplier_attention_id) {
    $attention = LbCustomerContact::model()->findByPk($model->lb_vendor_supplier_attention_id);
    $attentionInformation = $attention['lb_customer_contact_first_name'] . ' ' . $attention['lb_customer_contact_last_name'];
}
$list_name = false;
if ($model->lb_vendor_category) {
    $list_name = SystemList::model()->findByPk($model->lb_vendor_category)['system_list_item_code'];
}
$tbody = '<table border="0" style="width:100%;" cellpadding="0" cellspacing="0">';
$tbody .= '<tr>' . '<td style="width:100px;"><b>To: </b> </td><td>' . $customerName . '</td>' . '</tr><br />';
$tbody .= '<tr>' . '<td><b>Billing Address: </b></td><td>' . $billingName . '</td>' . '</tr>';
$tbody .= '<tr>' . '<td><b>Attention: </b></td><td>' . $attentionInformation . '</td>' . '</tr>';
$tbody .= '<tr>' . '<td><b>Category: </b></td><td>' . $list_name . '</td>' . '</tr>';
$tbody .= '<tr>' . '<td><b>Subject:</b></td><td>' . $model->lb_vendor_subject . '</td></tr>';
$tbody .= '</table>';
echo $tbody;
echo '<br>';
Example #8
0
//                    'value'=>  number_format($model->lb_contract_amount, 2),
//                )
////		'lb_customer_id',
////		'lb_address_id',
////		'lb_contact_id',
////		'lb_contract_no',
////		'lb_contract_notes',
////		'lb_contract_date_start',
////		'lb_contract_date_end',
////		'lb_contract_type',
////		'lb_contract_amount',
////		'lb_contract_parent',
////		'lb_contract_status',
//	),
//));
$this->widget('editable.EditableDetailView', array('id' => 'user-details', 'data' => $model, 'url' => $model->getActionURL('ajaxUpdateField'), 'placement' => 'right', 'attributes' => array(array('name' => 'lb_customer_id', 'editable' => array('type' => 'select', 'source' => CHtml::listData(LbCustomer::model()->findAll(), 'lb_record_primary_key', 'lb_customer_name'))), array('name' => 'lb_address_id', 'editable' => array('type' => 'select', 'source' => CHtml::listData(LbCustomerAddress::model()->findAll(), 'lb_record_primary_key', 'lb_customer_address_line_1'))), array('name' => 'lb_contact_id', 'editable' => array('type' => 'select', 'source' => CHtml::listData(LbCustomerContact::model()->getResultsAsFindAll(), 'lb_record_primary_key', 'lb_customer_contract_name'))), array('name' => 'lb_contract_date_start', 'editable' => array('type' => 'date', 'viewformat' => 'dd-mm-yyyy', 'format' => 'yyyy-mm-dd')), array('name' => 'lb_contract_date_end', 'editable' => array('type' => 'date', 'viewformat' => 'dd-mm-yyyy', 'format' => 'yyyy-mm-dd')), array('name' => 'lb_contract_type', 'editable' => array('type' => 'text')), array('name' => 'lb_contract_notes', 'editable' => array('type' => 'textarea')), array('name' => 'lb_contract_status', 'editable' => array('type' => 'select', 'source' => LbContracts::$ContractStatusArray)), 'lb_contract_amount')));
?>
<div style="margin-top: 30px;">
    <h4><?php 
echo Yii::t('lang', 'Document');
?>
</h4>
    <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb-contracts-documnet_grid', 'dataProvider' => LbContractDocument::model()->getContractDocument($model->lb_record_primary_key), 'template' => '{items}', 'hideHeader' => true, 'htmlOptions' => array('width' => '500'), 'columns' => array(array('type' => 'raw', 'value' => '"<a href=\'".Yii::app()->getBaseUrl().$data->lb_document_url."\'><img border=\'0\' alt=\'\' src=\'".Yii::app()->getBaseUrl().$data->lb_document_url_icon."\' />".$data->lb_document_name."</a>"'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => "{delete}", 'deleteButtonUrl' => 'Yii::app()->createUrl("lbContract/default/deleteDocument",array("id"=>$data->lb_record_primary_key))', 'htmlOptions' => array('width' => '20')))));
?>
    <div>
            <?php 
if ($canEdit) {
    $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => $this->createUrl('uploadDocument', array('id' => $model->lb_record_primary_key)), 'allowedExtensions' => array("jpeg", "jpg", "gif", "png", "pdf", "odt", "docx", "doc", "dia"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 1 * 1024, 'onComplete' => "js:function(id, fileName, responseJSON){\n                                            \$.fn.yiiGridView.update('lb-contracts-documnet_grid');\n                                            \$('#uploadFile .qq-upload-list').html('');\n                                       }")));
}
?>
 public function getResultsAsFindAll()
 {
     $criteria = new CDbCriteria();
     $criteria->select = "lb_record_primary_key, CONCAT(lb_customer_contact_first_name,' ',lb_customer_contact_last_name) AS lb_customer_contract_name";
     $criteria->order = 'lb_customer_contact_first_name ASC, lb_customer_contact_last_name ASC';
     return LbCustomerContact::model()->findAll($criteria);
 }
 public function actionAjaxDropDownContact()
 {
     $customer_id = $_POST['customer_id'];
     $option_contact = '<option value="0">Choose Contact</option>';
     $contact_arr = LbCustomerContact::model()->getContacts($customer_id, LbCustomer::LB_QUERY_RETURN_TYPE_DROPDOWN_ARRAY);
     foreach ($contact_arr as $key => $value) {
         $option_contact .= '<option value="' . $key . '">' . $value . '</option>';
     }
     echo $option_contact;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return LbCustomerContact the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = LbCustomerContact::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #12
0
 public function actionExpensesNewCustomer()
 {
     //   $model = $this->loadModel($id);
     $expenses_id = isset($_REQUEST['expenses_id']) ? $_REQUEST['expenses_id'] : 0;
     //    $submission_type = isset($_GET['form_type']) ? $_GET['form_type'] : 'default';
     $expensesModel = LbExpenses::model()->findByPk($expenses_id);
     $customerModel = new LbCustomer();
     $addressModel = new LbCustomerAddress();
     $contactModel = new LbCustomerContact();
     $own = false;
     if (isset($_POST['LbCustomer'])) {
         $customerModel->attributes = $_POST['LbCustomer'];
         //    $customerModel->lb_customer_is_own_company = 0;
         if ($customerModel->save()) {
             //   if($submission_type == 'ajax'){
             if (isset($expenses_id) && $expenses_id > 0) {
                 $expenses_customer = new LbExpensesCustomer();
                 $expenses_customer->lb_expenses_id = $expenses_id;
                 $expenses_customer->lb_customer_id = $customerModel->lb_record_primary_key;
                 $expenses_customer->save();
                 LBApplication::renderPlain($this, array('content' => CJSON::encode($expenses_customer)));
             }
             if (isset($_POST['LbCustomerAddress'])) {
                 $addressModel->attributes = $_POST['LbCustomerAddress'];
                 $addressModel->lb_customer_id = $customerModel->lb_record_primary_key;
                 $addressModel->save();
             }
             // save contact if any
             if (isset($_POST['LbCustomerContact'])) {
                 $contactModel->attributes = $_POST['LbCustomerContact'];
                 $contactModel->lb_customer_id = $customerModel->lb_record_primary_key;
                 if ($contactModel->save()) {
                     // automatically assign this contact to submitted address
                     $contactAddressModel = new LbCustomerAddressContact();
                     $contactAddressModel->lb_customer_address_id = $addressModel->lb_record_primary_key;
                     $contactAddressModel->lb_customer_contact_id = $contactModel->lb_record_primary_key;
                     $contactAddressModel->save();
                 }
             }
         }
     }
     LBApplication::render($this, 'addCustomer', array('expensesModel' => $expensesModel, 'own' => $own, 'customerModel' => $customerModel, 'addressModel' => $addressModel, 'contactModel' => $contactModel));
 }
Example #13
0
                            <tr><td >
                            <table border="0" style="margin:auto;width:100%;" cellpadding="0" cellspacing="0">
                            <tr><td >
                             <span style="margin:10px;padding:10px">From: ' . $date_from . '</span>
                             <span style="margin:10px;">To: ' . $date_to . '</span>
                                 
                            </td></tr></table>
                            
                         </td></tr>
                            
                            </table>';
echo '<table border="0" style="width:100%;" cellpadding="0" cellspacing="0">
                            <tr><td >
                             <span style="fload:left"><b>Bill To: </b>' . $customer_name . '</span></td></tr>';
if ($_GET['attention'] > 0) {
    $attention_name = LbCustomerContact::model()->find('lb_record_primary_key=' . $_GET['attention']);
    echo '   <tr><td> <span style="fload:left"><b>Attention: </b>' . $attention_name['lb_customer_contact_first_name'] . ' ' . $attention_name['lb_customer_contact_last_name'] . '</span>
                                 
                            </td></tr>
                            ';
}
echo '</table>';
//                                <div style="width:80%;border: 1px solid #CCCCCC;padding:15px;">
echo '<br /><br />';
if ($address_option) {
    tableSearch($customer_id_statements, $_GET['attention'], $address_option, $status, $date_from, $date_to);
} else {
    $outstanding = 0;
    $paid = 0;
    $tax = 0;
    $StatementSearch = LbInvoice::model()->getInvoiceStatement($customer_id_statements, $_GET['attention'], $address_option, $status, $date_from, $date_to);