예제 #1
0
 /**
  * @Author: ANH DUNG Jul 16, 2014
  * @Todo: to gen receipt for transaction
  * @Param: $model model ProTransactionsInvoice::
  * @Param: $mTransaction
  */
 public static function DoGenReceipt($model, $mTransaction)
 {
     $prefix_code = self::getPrefix(ProTransactionsInvoice::TYPE_RECEIPT);
     $model->invoice_number = MyFormat::getNextId('ProTransactionsInvoice', $prefix_code, 'invoice_number', self::getLengthInvoiceNo());
     $model->invoice_type = ProTransactionsInvoice::TYPE_RECEIPT;
     $model->invoice_template = ProTransactionsInvoice::TEMPLATE_6_RECEIPT;
     $model->type = $mTransaction->type;
     $model->save();
     // *** 1. update status table transaction
     ProTransactions::UpdateStatusTrans($mTransaction->id, STATUS_GEN_RECEIPT);
     // *** 2. update status table save commission
     // 1. update cột status receipt qua table saveCommission để chạy thống kê
     // 2. update cột received_on
     ProTransactionsSaveCommission::UpdateStatusOfCommission($mTransaction, $model->receipt_date_paid, STATUS_GEN_RECEIPT);
 }