add product sell discount js changes
This commit is contained in:
parent
1a1477b26b
commit
f2e30779f0
@ -4,6 +4,7 @@ namespace common\models;
|
|||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\behaviors\TimestampBehavior;
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "discount".
|
* This is the model class for table "discount".
|
||||||
@ -113,9 +114,24 @@ class Discount extends \yii\db\ActiveRecord
|
|||||||
* */
|
* */
|
||||||
public static function applyDiscount($money,$discount){
|
public static function applyDiscount($money,$discount){
|
||||||
$result = $money;
|
$result = $money;
|
||||||
$valueOfDiscount = $money * $discount->value * 100;
|
$valueOfDiscount = $money * $discount->value / 100;
|
||||||
$result = $money - $valueOfDiscount;
|
$result = $money - $valueOfDiscount;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function modelsToArray($discounts,$default = []){
|
||||||
|
|
||||||
|
if ( $discounts == null ){
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ArrayHelper::toArray($discounts, [
|
||||||
|
'common\models\Discount' => [
|
||||||
|
'id_discount',
|
||||||
|
'value',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,8 +148,10 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
$result = "";
|
$result = "";
|
||||||
if ( $this->type == Transfer::TYPE_TICKET ){
|
if ( $this->type == Transfer::TYPE_TICKET ){
|
||||||
$result = $this->ticketName;
|
$result = $this->ticketName;
|
||||||
}else{
|
}else if ( $this->type == Transfer::TYPE_PRODUCT ){
|
||||||
$result = $this->productName;
|
$result = $this->productName;
|
||||||
|
}else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){
|
||||||
|
$result = "Pénz kivétel - " . $this->moneyMovement->name;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -201,10 +203,6 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
}else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){
|
}else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){
|
||||||
$result = Yii::t('common/transfer','Money movement');
|
$result = Yii::t('common/transfer','Money movement');
|
||||||
}
|
}
|
||||||
|
|
||||||
// $result .= " xx";
|
|
||||||
// $result .= $this->type;
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +279,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
$transfer->type = Transfer::TYPE_MONEY_MOVEMENT_OUT;
|
$transfer->type = Transfer::TYPE_MONEY_MOVEMENT_OUT;
|
||||||
$transfer->status = Transfer::STATUS_PAID;
|
$transfer->status = Transfer::STATUS_PAID;
|
||||||
$transfer->direction = Transfer::DIRECTION_OUT;
|
$transfer->direction = Transfer::DIRECTION_OUT;
|
||||||
$transfer->count = 0;
|
$transfer->count = null;
|
||||||
|
|
||||||
$transfer->id_object = $moneyMovement->id_money_movement;
|
$transfer->id_object = $moneyMovement->id_money_movement;
|
||||||
$transfer->money = $moneyMovement->money;
|
$transfer->money = $moneyMovement->money;
|
||||||
|
|||||||
@ -4,15 +4,41 @@ namespace frontend\components;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use common\models\Order;
|
use common\models\Order;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
use yii\db\Query;
|
||||||
|
use common\models\AccountState;
|
||||||
|
|
||||||
class FrontendMenuStructure{
|
class FrontendMenuStructure{
|
||||||
|
|
||||||
public $menuItems;
|
public $menuItems;
|
||||||
|
public $start;
|
||||||
|
public $tomorrow;
|
||||||
|
|
||||||
public function FrontendMenuStructure(){
|
public function __construct(){
|
||||||
$this->menuItems = [];
|
$this->menuItems = [];
|
||||||
|
// print('abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>');
|
||||||
|
|
||||||
|
$this->start = Yii::$app->formatter->asDatetime( strtotime('today UTC') );
|
||||||
|
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
||||||
|
|
||||||
|
Yii::info("Start date is : ". $this->start);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ( $this->isLogged() ){
|
||||||
|
$lastAccountState = AccountState::find()->andWhere(['id_user' => Yii::$app->user->id])->orderBy(['account_state.created_at' => SORT_DESC])->limit(1)->one();
|
||||||
|
if ( isset($lastAccountState) ){
|
||||||
|
$this->start = strtotime( $lastAccountState->created_at . ' UTC' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($this->start);
|
||||||
|
// print_r($this->tomorrow);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected function can($authItem){
|
protected function can($authItem){
|
||||||
$result = false;
|
$result = false;
|
||||||
if (\Yii::$app->user->can($authItem)) {
|
if (\Yii::$app->user->can($authItem)) {
|
||||||
@ -30,7 +56,8 @@ class FrontendMenuStructure{
|
|||||||
protected function addRecepcio(){
|
protected function addRecepcio(){
|
||||||
if ( $this->isLogged() ){
|
if ( $this->isLogged() ){
|
||||||
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
||||||
$this->menuItems[] = ['label' => 'Pénzmozgások', 'url' => ['/money-movement/index'] ];
|
// , 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow
|
||||||
|
$this->menuItems[] = ['label' => 'Pénzmozgások', 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ];
|
||||||
$this->menuItems[] = ['label' => 'Kassza',
|
$this->menuItems[] = ['label' => 'Kassza',
|
||||||
'items' => [
|
'items' => [
|
||||||
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index'] ],
|
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index'] ],
|
||||||
|
|||||||
@ -12,14 +12,22 @@ use common\models\MoneyMovement;
|
|||||||
*/
|
*/
|
||||||
class MoneyMovementSearch extends MoneyMovement
|
class MoneyMovementSearch extends MoneyMovement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public $start;
|
||||||
|
public $end;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['id_money_movement', 'id_account', 'id_user', 'type', 'money'], 'integer'],
|
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
[['name', 'comment', 'created_at', 'updated_at'], 'safe'],
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,22 +59,13 @@ class MoneyMovementSearch extends MoneyMovement
|
|||||||
|
|
||||||
if (!$this->validate()) {
|
if (!$this->validate()) {
|
||||||
// uncomment the following line if you do not want to return any records when validation fails
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
// $query->where('0=1');
|
$query->where('0=1');
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->andFilterWhere([
|
|
||||||
'id_money_movement' => $this->id_money_movement,
|
|
||||||
'id_account' => $this->id_account,
|
|
||||||
'id_user' => $this->id_user,
|
|
||||||
'type' => $this->type,
|
|
||||||
'money' => $this->money,
|
|
||||||
'created_at' => $this->created_at,
|
|
||||||
'updated_at' => $this->updated_at,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$query->andFilterWhere(['like', 'name', $this->name])
|
$query->andFilterWhere([ '>=', 'money_movement.created_at', $this->timestampStart ] );
|
||||||
->andFilterWhere(['like', 'comment', $this->comment]);
|
$query->andFilterWhere([ '<', 'money_movement.created_at', $this->timestampEnd ] );
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,21 +48,6 @@ AppAsset::register($this);
|
|||||||
'class' => 'navbar-inverse navbar-fixed-top',
|
'class' => 'navbar-inverse navbar-fixed-top',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$menuItems = [
|
|
||||||
['label' => 'Home', 'url' => ['/site/index']],
|
|
||||||
['label' => 'About', 'url' => ['/site/about']],
|
|
||||||
['label' => 'Contact', 'url' => ['/site/contact']],
|
|
||||||
];
|
|
||||||
if (Yii::$app->user->isGuest) {
|
|
||||||
$menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
|
|
||||||
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
|
|
||||||
} else {
|
|
||||||
$menuItems[] = [
|
|
||||||
'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
|
|
||||||
'url' => ['/site/logout'],
|
|
||||||
'linkOptions' => ['data-method' => 'post']
|
|
||||||
];
|
|
||||||
}
|
|
||||||
echo Nav::widget([
|
echo Nav::widget([
|
||||||
'options' => ['class' => 'navbar-nav navbar-right'],
|
'options' => ['class' => 'navbar-nav navbar-right'],
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\models\MoneyMovementSearch */
|
/* @var $model frontend\models\MoneyMovementSearch */
|
||||||
@ -15,27 +17,27 @@ use yii\widgets\ActiveForm;
|
|||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_money_movement') ?>
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
<?= $form->field($model, 'id_account') ?>
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
<?= $form->field($model, 'id_user') ?>
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
<?= $form->field($model, 'name') ?>
|
]
|
||||||
|
]) ?>
|
||||||
<?= $form->field($model, 'type') ?>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<?php // echo $form->field($model, 'money') ?>
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
<?php // echo $form->field($model, 'comment') ?>
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
<?php // echo $form->field($model, 'created_at') ?>
|
]
|
||||||
|
]) ?>
|
||||||
<?php // echo $form->field($model, 'updated_at') ?>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton(Yii::t('backend/money-movement', 'Search'), ['class' => 'btn btn-primary']) ?>
|
<?= Html::submitButton(Yii::t('backend/money-movement', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
<?= Html::resetButton(Yii::t('backend/money-movement', 'Reset'), ['class' => 'btn btn-default']) ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|||||||
@ -13,7 +13,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<div class="money-movement-index">
|
<div class="money-movement-index">
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?= Html::a(Yii::t('backend/money-movement', 'Create Money Movement'), ['create'], ['class' => 'btn btn-success']) ?>
|
<?= Html::a(Yii::t('backend/money-movement', 'Create Money Movement'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use frontend\assets\ProductSellAsset;
|
|||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
use yii\bootstrap\ActiveForm;
|
use yii\bootstrap\ActiveForm;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\Discount;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $form yii\bootstrap\ActiveForm */
|
/* @var $form yii\bootstrap\ActiveForm */
|
||||||
@ -20,6 +21,8 @@ $options = [];
|
|||||||
$options['lookup_product_url'] = Url::toRoute(['product/lookup']);
|
$options['lookup_product_url'] = Url::toRoute(['product/lookup']);
|
||||||
$options['clear_list_url'] = Url::toRoute(['product/clear-list']);
|
$options['clear_list_url'] = Url::toRoute(['product/clear-list']);
|
||||||
$options['sold_items'] = $userTransfers;
|
$options['sold_items'] = $userTransfers;
|
||||||
|
$options['discounts'] = Discount::modelsToArray($discounts);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->registerJs ( 'new ProductSell( '. json_encode($options).');' );
|
$this->registerJs ( 'new ProductSell( '. json_encode($options).');' );
|
||||||
|
|||||||
@ -15,35 +15,25 @@ use yii\widgets\ActiveForm;
|
|||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_transfer') ?>
|
|
||||||
|
|
||||||
<?= $form->field($model, 'id_discount') ?>
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
<?= $form->field($model, 'id_currency') ?>
|
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
<?= $form->field($model, 'id_object') ?>
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd'
|
||||||
<?= $form->field($model, 'status') ?>
|
]
|
||||||
|
]) ?>
|
||||||
<?php // echo $form->field($model, 'type') ?>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<?php // echo $form->field($model, 'item_price') ?>
|
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
<?php // echo $form->field($model, 'count') ?>
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd'
|
||||||
<?php // echo $form->field($model, 'money') ?>
|
]
|
||||||
|
]) ?>
|
||||||
<?php // echo $form->field($model, 'money_currency') ?>
|
</div>
|
||||||
|
</div>
|
||||||
<?php // echo $form->field($model, 'rate') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'id_user') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'comment') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'created_at') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'updated_at') ?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
|||||||
@ -19,6 +19,7 @@ function ProductSell(o){
|
|||||||
message_paid: 'Tételek fizetve',
|
message_paid: 'Tételek fizetve',
|
||||||
/**list of sold items by current user*/
|
/**list of sold items by current user*/
|
||||||
sold_items: [],
|
sold_items: [],
|
||||||
|
discounts: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@ -34,12 +35,17 @@ function ProductSell(o){
|
|||||||
setFocus();
|
setFocus();
|
||||||
addEnterPressedBehaviours();
|
addEnterPressedBehaviours();
|
||||||
addBehaviorCountChangedListener();
|
addBehaviorCountChangedListener();
|
||||||
|
addBehaviourDisocuntChanged();
|
||||||
createUserSoldItemsTable();
|
createUserSoldItemsTable();
|
||||||
addBehaviourBtnPaid();
|
addBehaviourBtnPaid();
|
||||||
productChanged();
|
productChanged();
|
||||||
addDocumentKeypressedListener();
|
addDocumentKeypressedListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addBehaviourDisocuntChanged(){
|
||||||
|
$("#productsaleform-id_discount").change(refreshCalculatedValues);
|
||||||
|
}
|
||||||
|
|
||||||
function addDocumentKeypressedListener(){
|
function addDocumentKeypressedListener(){
|
||||||
$( document ).keypress(function( event ) {
|
$( document ).keypress(function( event ) {
|
||||||
|
|
||||||
@ -235,15 +241,23 @@ function ProductSell(o){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshCalculatedValues(){
|
function refreshCalculatedValues(){
|
||||||
var count,price;
|
var count,price,id_discount,discount;
|
||||||
var table;
|
var table;
|
||||||
table = $('.table-product');
|
table = $('.table-product');
|
||||||
count = $("#productsaleform-count").val();
|
count = $("#productsaleform-count").val();
|
||||||
|
id_discount = $("#productsaleform-id_discount").val();
|
||||||
|
app.discount = findDiscount( id_discount );
|
||||||
count = +count;
|
count = +count;
|
||||||
if ( isNaN(count)){
|
if ( isNaN(count)){
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
price = count * app.product.sale_price;
|
price = count * app.product.sale_price;
|
||||||
|
|
||||||
|
|
||||||
|
discount = calcDiscount(price, app.discount);
|
||||||
|
price = deductDiscount(price,discount);
|
||||||
|
price = normalizePrice(price);
|
||||||
|
|
||||||
table.find('.product-count').html(count);
|
table.find('.product-count').html(count);
|
||||||
table.find('.product-price').html(price);
|
table.find('.product-price').html(price);
|
||||||
}
|
}
|
||||||
@ -345,13 +359,54 @@ function ProductSell(o){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createUserSoldItemsTable(){
|
function createUserSoldItemsTable(){
|
||||||
$('.sold-items-container').transferList({
|
$('.sold-items-container').transferList({
|
||||||
'transfers' : app.defaults.sold_items
|
'transfers' : app.defaults.sold_items
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findDiscount(id_discount){
|
||||||
|
var discount;
|
||||||
|
discount = null;
|
||||||
|
$.each( app.defaults.discounts , function(e,i){
|
||||||
|
if ( e.id_discount == id_discount ){
|
||||||
|
discount = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
return discount;
|
||||||
|
}
|
||||||
|
|
||||||
|
function calcDiscount(price,discount){
|
||||||
|
var result, discountMoney;
|
||||||
|
result = 0;
|
||||||
|
|
||||||
|
if ( discount ){
|
||||||
|
result = price * ( discount.value / 100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deductDiscount( price , discount ){
|
||||||
|
var result;
|
||||||
|
result = price - discount;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizePrice( price ){
|
||||||
|
var result;
|
||||||
|
result = hufRound(price);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hufRound(x)
|
||||||
|
{
|
||||||
|
if (x > 0) {
|
||||||
|
return (x % 5) >= 2.5 ? parseInt(x / 5) * 5 + 5 : parseInt(x / 5) * 5;
|
||||||
|
} else {
|
||||||
|
return ((Math.abs(x) % 5) >= 2.5 ? parseInt(Math.abs(x) / 5) * 5 + 5 : parseInt(Math.abs(x) / 5) * 5)*-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user