コード例 #1
0
 public function getPVNextNum()
 {
     $next_invoice_number = 0;
     $last_used = LbNextId::model()->getOneRecords();
     // TODO: if more than 1 record, something is wrong
     if (count($last_used) > 1) {
         return 0;
         // something is wrong
     }
     // If no record, probably first time generation
     // generate first record
     if (count($last_used) <= 0) {
         $nextInvoiceNo = new LbNextId();
         $nextInvoiceNo->lb_next_invoice_number = 1;
         $nextInvoiceNo->lb_next_quotation_number = 1;
         $nextInvoiceNo->lb_next_payment_number = 1;
         $nextInvoiceNo->lb_next_contract_number = 1;
         $nextInvoiceNo->lb_next_po_number = 1;
         $nextInvoiceNo->lb_next_supplier_invoice_number = 1;
         $nextInvoiceNo->lb_next_supplier_payment_number = 1;
         if ($nextInvoiceNo->save()) {
             $next_po_number = $nextInvoiceNo->lb_next_pv_number;
         }
     } else {
         $nextInvoiceNo = $last_used;
         $next_invoice_number = $nextInvoiceNo->lb_next_pv_number;
     }
     // advance next invoice number
     $nextInvoiceNo->lb_next_pv_number++;
     $nextInvoiceNo->save();
     return $next_invoice_number;
     //trigger_error('Not Implemented!', E_USER_WARNING);
 }
コード例 #2
0
ファイル: LbInvoice.php プロジェクト: nhuhtlb/linxbooks
 public function setBase64_decodeInvoice()
 {
     $last_used = LbNextId::model()->getFullRecords();
     if (count($last_used) <= 0) {
         $next_invoice_number = 0;
     } else {
         $nextNo = $last_used[0];
         $next_invoice_number = $nextNo->lb_next_quotation_number;
     }
     $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $randstring = '';
     for ($i = 0; $i < 10; $i++) {
         $randstring .= $characters[rand(0, strlen($characters) - 1)];
     }
     $randstring .= $next_invoice_number;
     return base64_encode($randstring);
 }
コード例 #3
0
ファイル: LbExpenses.php プロジェクト: Lucerin/Yii-projects
 public function setExpensesNextNum($expensesNextNo)
 {
     $expensesNextNo++;
     $last_used = LbNextId::model()->getFullRecords();
     $nextexpensesNo = $last_used[0];
     $nextexpensesNo->lb_next_expenses_number = $expensesNextNo;
     $nextexpensesNo->save();
 }
コード例 #4
0
ファイル: LbPayment.php プロジェクト: Lucerin/Yii-projects
 public function setPaymentNextNum($paymentNextNum)
 {
     $paymentNextNum++;
     $last_used = LbNextId::model()->getFullRecords();
     $nextcontractNo = $last_used[0];
     $nextcontractNo->lb_next_payment_number = $paymentNextNum;
     $nextcontractNo->save();
 }
コード例 #5
0
 public function actionAjaxUpdateNexIDField()
 {
     if (isset($_POST['pk']) && isset($_POST['name']) && isset($_POST['value'])) {
         $id = $_POST['pk'];
         $attribute = $_POST['name'];
         $value = $_POST['value'];
         // get model
         $model = LbNextId::model()->findByPk($id);
         // update
         $model->{$attribute} = $value;
         return $model->save();
     }
     return false;
 }
コード例 #6
0
<?php

/* @var $this DefaultController */
?>
<div style="width: 40%;">
<?php 
$nextID = LbNextId::model()->getNextIdSubscription();
$this->widget('editable.EditableDetailView', array('id' => 'next-id-details', 'data' => $nextID, 'url' => $nextID->getActionURL('ajaxUpdateNexIDField'), 'placement' => 'right', 'attributes' => array(array('name' => 'lb_next_invoice_number'), array('name' => 'lb_next_quotation_number'), array('name' => 'lb_next_payment_number'), array('name' => 'lb_next_contract_number'))));
?>
</div>
コード例 #7
0
ファイル: LbNextId.php プロジェクト: Lucerin/Yii-projects
 public function getNextIdSubscription()
 {
     $lastNextID = $this->getFullRecords();
     if (count($lastNextID) <= 0) {
         $nextInvoiceNo = new LbNextId();
         $nextInvoiceNo->lb_next_invoice_number = 1;
         $nextInvoiceNo->lb_next_quotation_number = 1;
         $nextInvoiceNo->lb_next_payment_number = 1;
         $nextInvoiceNo->lb_next_contract_number = 1;
         $nextInvoiceNo->lb_next_expenses_number = 1;
         $nextInvoiceNo->lb_next_po_number = 1;
         $nextInvoiceNo->lb_next_supplier_invoice_number = 1;
         $nextInvoiceNo->lb_next_supplier_payment_number = 1;
         $nextInvoiceNo->lb_payment_vendor_number = 1;
         if ($nextInvoiceNo->save()) {
             $lastNextID = $this->getFullRecords();
         }
     }
     $NextID = $lastNextID[0]->lb_record_primary_key;
     $dataProvider = LbNextId::model()->findByPk($NextID);
     return $dataProvider;
 }
コード例 #8
0
ファイル: LbContracts.php プロジェクト: Lucerin/Yii-projects
 public function setContractNextNum($contractNextNo)
 {
     $contractNextNo++;
     $last_used = LbNextId::model()->getFullRecords();
     $nextcontractNo = $last_used[0];
     $nextcontractNo->lb_next_contract_number = $contractNextNo;
     $nextcontractNo->save();
 }