Esempio n. 1
0
 public function getCoreEntity($entity_type, $entity_primary_key)
 {
     $coreEntity = LbCoreEntity::model()->find('lb_entity_type = :lb_entity_type AND lb_entity_primary_key = :lb_entity_primary_key', array(':lb_entity_type' => $entity_type, ':lb_entity_primary_key' => $entity_primary_key));
     return $coreEntity;
 }
Esempio n. 2
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. 3
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 . '. ' : '') . '
Esempio n. 4
0
 /**
  * Save record to the database (update/add)
  * Basically, this parent method covers basic fields that the children shouldn't need to care.
  * These are: created date, created by, last update date, last updated by, subscription id, etc.
  * 
  * @return boolean success or failure of the operation
  * @access public
  */
 function save($runValidation = true, $attributes = NULL)
 {
     $new_record = $this->isNewRecord;
     $now = date('Y-m-d H:i:s');
     $result = parent::save($runValidation, $attributes);
     if ($result) {
         /**
          * set values for new record in CoreEntity
          */
         $coreEntity = $this->getCoreEntity();
         if ($new_record || $coreEntity === null) {
             $coreEntity = new LbCoreEntity();
             $coreEntity->lb_entity_type = $this->getEntityType();
             $coreEntity->lb_entity_primary_key = $this->lb_record_primary_key;
             $coreEntity->lb_created_by = Yii::app()->user->id;
             $coreEntity->lb_created_date = $now;
         } else {
         }
         $coreEntity->lb_last_updated_by = Yii::app()->user->id;
         $coreEntity->lb_last_update = $now;
         $coreEntity->lb_subscription_id = LBApplication::getCurrentlySelectedSubscription();
         $coreEntity->lb_locked_from_deletion = self::RECORD_NOT_LOCKED_FROM_DELETION;
         $coreEntity->save();
     }
     return $result;
 }