public function getDefaultNoteSubscription() { $lastDefaultNote = $this->getFullRecords(); $DefaultNoteID = $lastDefaultNote[0]->lb_record_primary_key; $dataProvider = LbDefaultNote::model()->findByPk($DefaultNoteID); return $dataProvider; }
public function actionCreateDefaultNote() { $model = new LbDefaultNote(); $lastDefaultNote = LbDefaultNote::model()->getFullRecords(); if (count($lastDefaultNote) > 0) { return false; } else { if ($model->save()) { return LBApplication::renderPlain($this, array('content' => CJSON::encode($model))); } } }
public function __construct($scenario = 'insert') { parent::__construct($scenario); $this->lb_quotation_no = 0; $this->lb_quotation_no = $this->formatQuotationNextNumFormatted($this->lb_quotation_no); $this->lb_quotation_status = self::LB_QUOTATION_STATUS_CODE_DRAFT; $this->lb_company_id = 5; $this->lb_quotation_date = date('Y-m-d'); $this->lb_quotation_due_date = date('Y-m-d'); $this->lb_quotation_encode = $this->setBase64_decodeQuotation(); // set invoice note $lastDefaultNote = LbDefaultNote::model()->getFullRecords(); if (count($lastDefaultNote) > 0) { $this->lb_quotation_note = $lastDefaultNote[0]->lb_default_note_quotation; } }
public function __construct($scenario = 'insert') { parent::__construct($scenario); // initiate invoice number $this->lb_invoice_no = 0; // a draft only. $this->getInvoiceNextNum(); $this->lb_invoice_no = $this->formatInvoiceNextNumFormatted($this->lb_invoice_no); $this->lb_invoice_status_code = self::LB_INVOICE_STATUS_CODE_DRAFT; // invoice date $this->lb_invoice_date = date('Y-m-d'); $this->lb_invoice_due_date = date('Y-m-d'); // invoice group $this->lb_invoice_group = self::LB_INVOICE_GROUP_INVOICE; // invoice base64_decode $this->lb_invoice_encode = $this->setBase64_decodeInvoice(); // set invoice note $lastDefaultNote = LbDefaultNote::model()->getFullRecords(); if (count($lastDefaultNote) > 0) { $this->lb_invoice_note = $lastDefaultNote[0]->lb_default_note_invoice; } }
public function actionAjaxUpdateDefaultNoteField() { if (isset($_POST['pk']) && isset($_POST['name']) && isset($_POST['value'])) { $id = $_POST['pk']; $attribute = $_POST['name']; $value = $_POST['value']; // get model $model = LbDefaultNote::model()->findByPk($id); // update $model->{$attribute} = $value; return $model->save(); } return false; }
<?php $defaultNote = LbDefaultNote::model()->getDefaultNoteSubscription(); $this->widget('editable.EditableDetailView', array('id' => 'default-note-details', 'data' => $defaultNote, 'url' => $defaultNote->getActionURL('AjaxUpdateDefaultNoteField'), 'placement' => 'right', 'attributes' => array(array('name' => 'lb_default_note_quotation'), array('name' => 'lb_default_note_invoice'))));
public function getDefaultNoteSubscription() { $lastDefaultNote = $this->getFullRecords(); if (count($lastDefaultNote) <= 0) { $DefaultNote = new LbDefaultNote(); $DefaultNote->lb_default_note_quotation = ""; $DefaultNote->lb_default_note_invoice = ""; if ($DefaultNote->save()) { $lastDefaultNote = $this->getFullRecords(); } } $DefaultNoteID = $lastDefaultNote[0]->lb_record_primary_key; $dataProvider = LbDefaultNote::model()->findByPk($DefaultNoteID); return $dataProvider; }