add discount to product sell js
This commit is contained in:
16
common/components/Helper.php
Normal file
16
common/components/Helper.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use yii\base\InvalidConfigException;
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
|
||||
class Helper
|
||||
{
|
||||
|
||||
public static function hufRound($m){
|
||||
$result = round($m/5, 0) * 5;
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
||||
* @param $currency common\models\Currency
|
||||
* @param $product common\models\Product
|
||||
* */
|
||||
public static function createProductTransfer($account, $discount, $currency, $count,$product ){
|
||||
public static function createProductTransfer($account, $discount, $currency, $count,$product , $status = Transfer::STATUS_PAID){
|
||||
$transfer = new Transfer();
|
||||
|
||||
$transfer->type = Transfer::TYPE_PRODUCT;
|
||||
@@ -262,6 +262,9 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
||||
$transfer->money_currency = Currency::applyCurrency($totalPrice, $currency);
|
||||
}
|
||||
|
||||
$transfer->direction = Transfer::DIRECTION_IN;
|
||||
$transfer->status = $status;
|
||||
|
||||
$transfer->id_account = $account->id_account;
|
||||
|
||||
return $transfer;
|
||||
|
||||
Reference in New Issue
Block a user