echo Yii::t('translation', 'Invoices Management'); ?> </h1> <?php echo CHtml::link(Yii::t('translation', 'Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $cmsFormater = new CmsFormatter(); $total_amount = $cmsFormater->formatPrice(FiInvoice::getTotalAmountGst()); $this->widget('zii.widgets.grid.CGridView', array('id' => 'fi-invoice-grid', 'dataProvider' => $model->searchMixed(), 'enableSorting' => true, 'afterAjaxUpdate' => 'function(id, data){ fixTargetBlank(); fnUpdateLink(); }', 'template' => "<div class='item_b'>Total Amount: {$total_amount}</div>{summary}{items}{pager}", 'columns' => array(array('header' => 'S/N', 'type' => 'raw', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 'headerHtmlOptions' => array('width' => '30px', 'style' => 'text-align:center;'), 'htmlOptions' => array('style' => 'text-align:center;')), array('header' => 'Invoice No', 'name' => 'invoice_no'), array('header' => 'Invoice Date', 'name' => 'created_date', 'type' => 'date', 'htmlOptions' => array('style' => 'text-align:center;')), array('header' => 'Transaction No', 'name' => 'transactions_no'), array('header' => 'Property Address', 'name' => 'property_address', 'type' => 'raw'), array('header' => 'Total Amount Due Gst', 'name' => 'total_amount_due_gst'), array('header' => 'Status', 'name' => 'status'), array('header' => 'Receipt', 'name' => 'receipt', 'type' => 'raw', 'htmlOptions' => array('style' => 'text-align:center;')), array('header' => 'Actions', 'class' => 'CButtonColumn', 'template' => '{view}{update}{delete}', 'buttons' => array('view' => array('url' => '$data["viewUrl"]'), 'update' => array('visible' => 'isset($data["updateUrl"])', 'url' => '$data["updateUrl"]'), 'delete' => array('visible' => 'isset($data["deleteUrl"])', 'url' => '$data["deleteUrl"]')))))); ?> <script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?> /admin/colorbox/jquery.colorbox-min.js"></script> <link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl; ?> /admin/css/colorbox.css" /> <script> $(function(){ fnUpdateLink(); });
<!--1: invoice normal For Sale - Rent--> <?php $text1 = FiInvoice::getFiTextViewInvoice($model); $ChequeText = "Cheque should be crossed and made payable to 'OneHome Infologic'"; //if($mTransactions->type == ProTransactions::FOR_RENT){ // $text1 = 'Being commission due to us for services rendered in connection with the lease of the above-mentioned property.'; // $ChequeText = "Cheque should be crossed and made payable to 'OneHome Infologic'."; //} ?> <div id="container"> <table> <tbody> <tr> <td> <img src="<?php echo Yii::app()->theme->baseUrl; ?> /img/property-infologic-logo.png" alt="property infologic" /> </td> <td class="info-company"> <h4><?php echo Yii::app()->params['invoice_title']; ?> </h4> <address> <?php echo Yii::app()->params['invoice_address_line_1']; ?> <br/> <?php echo Yii::app()->params['invoice_address_line_2'];
public function searchMixed() { $criteria = new CDbCriteria(); $criteria->compare('t.id', $this->id, true); $criteria->compare('t.invoice_no', trim($this->invoice_no), true); $criteria->compare('t.transactions_no', trim($this->transactions_no), true); $criteria->compare('t.bill_to', $this->bill_to); $criteria->compare('t.user_id', $this->user_id, true); $criteria->compare('t.user_name', $this->user_name, true); $criteria->compare('t.user_billing_address', $this->user_billing_address, true); $criteria->compare('t.user_postal_code', $this->user_postal_code, true); $criteria->compare('t.total_amount_due', $this->total_amount_due, true); $criteria->compare('t.status', $this->status); $date_from = ''; $date_to = ''; if (!empty($this->date_from)) { $date_from = MyFormat::dateConverDmyToYmdForSeach($this->date_from) . " 00:00:00"; } if (!empty($this->date_to)) { $date_to = MyFormat::dateConverDmyToYmdForSeach($this->date_to) . " 23:59:00"; } if (!empty($date_from) && empty($date_to)) { $criteria->addCondition("t.created_date>='{$date_from}'"); } if (empty($date_from) && !empty($date_to)) { $criteria->addCondition("t.created_date<='{$date_to}'"); } if (!empty($date_from) && !empty($date_to)) { $criteria->addBetweenCondition("t.created_date", $date_from, $date_to); } if (!empty($this->keyword)) { $criteria->compare('rDetail.description', $this->keyword, true); $criteria->with = array('rDetail'); $criteria->together = true; } $criteria->order = "t.created_date desc"; $fiInvoices = static::model()->findAll($criteria); $c2 = new CDbCriteria(); $c2->compare('invoice_number', trim($this->invoice_no), true); $c2->compare('invoice_type', ProTransactionsInvoice::TYPE_INVOICE); $c2->order = 'created_date desc'; $invoices = ProTransactionsInvoice::model()->findAll($c2); $mixedInvoice = array(); $f = Yii::app()->format; foreach ($fiInvoices as $invoice) { $data = array('id' => $invoice->id, 'invoice_no' => $invoice->invoice_no, 'created_date' => $invoice->created_date, 'transactions_no' => $invoice->transactions_no, 'property_address' => $f->formatInvoicePropertyAddress($invoice), 'total_amount_due_gst' => $f->formatPrice($invoice->total_amount_due_gst), 'status' => FiInvoice::$STA_STATUS[$invoice->status], 'receipt' => $f->formatInvoiceGenReceipt($invoice), 'viewUrl' => Yii::app()->createAbsoluteUrl('admin/fiInvoice/view', array('id' => $invoice->id)), 'deleteUrl' => Yii::app()->createAbsoluteUrl('admin/fiInvoice/delete', array('id' => $invoice->id))); if (FiInvoice::CanUpdate($invoice)) { $data['updateUrl'] = Yii::app()->createAbsoluteUrl('admin/fiInvoice/update', array('id' => $invoice->id)); } $mixedInvoice[] = $data; } foreach ($invoices as $invoice) { $mixedInvoice[] = array('id' => $invoice->id + 200000, 'invoice_no' => $invoice->invoice_number, 'created_date' => $invoice->created_date, 'transactions_no' => $invoice->rTransaction->transactions_no, 'property_address' => $invoice->rTransaction->rPropertyDetail->property_name_or_address, 'total_amount_due_gst' => $f->formatTransactionPropertyPrice($invoice->rTransaction), 'viewUrl' => Yii::app()->createAbsoluteUrl('admin/transactions/viewInvoice', array('id' => $invoice->id))); } return new CArrayDataProvider($mixedInvoice, array('sort' => array('defaultOrder' => 'created_date DESC', 'attributes' => array('created_date', 'invoice_no')), 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize'])))); }
protected function afterSave() { FiInvoice::UpdateFieldInvoice($this->rInvoice, 'date_paid', $this->receipt_date_paid); return parent::afterSave(); }
$arrayType = array('H' => array('id' => 18, 'title' => 'HDB Apartment'), 'K' => array('id' => 0, 'title' => 'Block'), 'A' => array('id' => 1, 'title' => 'Apartment/Condo'), 'C' => array('id' => 3, 'title' => 'Condominium'), 'S' => array('id' => 0, 'title' => 'Standard'), 'G' => array('id' => 0, 'title' => 'Godown'), 'P' => array('id' => 0, 'title' => 'PO Box, My Mail Box or My SingPost'), 'B' => array('id' => 0, 'title' => 'Locked Bag'), 'W' => array('id' => 0, 'title' => 'Window Delivery'), 'U' => array('id' => 5, 'title' => 'Walk-up')); $criteria = new CDbCriteria(); foreach ($data as $v) { $criteria->compare('t.postal_code', trim($v), true, 'OR'); } $dataTmp = ApiPostcode::model()->findAll($criteria); if ($dataTmp) { $tmp = array(); $building = array(); $buildingTmp = array(); //search postal code foreach ($dataTmp as $v) { $code = substr($v->postal_code, 0, 6); $type = substr($v->postal_code, 6, 1); $keyBuilding = substr($v->postal_code, strlen($v->postal_code) - 6, strlen($v->postal_code)); $building[$code] = $keyBuilding;
/** * @Author: ANH DUNG Sep 15, 2014 * @Todo: show Report */ public function actionReport_transaction() { try { FiInvoice::ToExcelReportTrans(); $model = new FiInvoice(); $model->date_from = date("d/m/Y"); $model->date_to = date("d/m/Y"); $model->report_type = FiInvoice::REPORT_DAILY; $data = array(); unset($_SESSION['REPORT_TRANSACTION']); if (isset($_POST['FiInvoice'])) { $model->attributes = $_POST['FiInvoice']; $data = FiInvoice::CalcReportTrans($model); } $this->render('Report_transaction/Report_transaction', array('model' => $model, 'actions' => $this->listActionsCanAccess, 'data' => $data)); } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
?> <?php echo $cmsFormater->formatDate($model->created_date); ?> </div> </div> <?php } ?> <div class="row"> <?php echo Yii::t('translation', $form->labelEx($model, 'bill_to')); ?> <?php echo $form->dropDownList($model, 'bill_to', FiInvoice::getListOptionBillTo(), array("class" => "w-350", 'empty' => 'Select')); ?> <?php echo $form->error($model, 'bill_to'); ?> </div> <div class="row"> <?php echo Yii::t('translation', $form->labelEx($model, 'user_name')); ?> <div class="f-left"> <?php // ANH DUNG Sep 11, 2014 widget auto complete search user customer and supplier $url = Yii::app()->createAbsoluteUrl('ajax/search_user_financial'); $aData = array('model' => $model, 'name_relation_user' => 'rUser', 'field_customer_id' => 'user_id', 'field_autocomplete_name' => 'user_name', 'placeHolder' => 'Type Full Name to search', 'divClosest' => 'unique_wrap_autocomplete', 'CallFunctionLandLord' => "InvoiceSelectUser", 'NotShowTableInfo' => 1, 'CustomClass' => "w-350", 'ShowNoDataFound' => 0, 'url' => $url);