fix account_state ( collection_money ), display product/ticket on reception only for selected account, add daily transfers (reception/admin)

This commit is contained in:
2015-12-31 13:52:22 +01:00
parent 72fc139674
commit f59eadd8cc
26 changed files with 1153 additions and 404 deletions

View File

@@ -126,7 +126,33 @@ class Product extends \common\models\BaseFitnessActiveRecord {
return $warehouses;
}
public static function findProduct($query){
/**
* $param int $forceIncludeAccount id warehouse, that should be included in list, even if it is inactive
* */
public static function readForDefaultAccount($forceIncludeObjectWithId = null){
$result = null;
$account = Account::readDefault();
if ( $forceIncludeObjectWithId == null){
$query = Product::find()->andWhere(['status' => Product::STATUS_ACTIVE])->orderBy(['product.name' => SORT_ASC]);
if ( $account )
$query->andWhere(["product.id_account" => $account]);
$result = $query->all();
}else{
$query = Product::find()->andWhere( ['or', ['status' => Product::STATUS_ACTIVE], ['id_product' => $forceIncludeObjectWithId ] ])->orderBy(['product.name' => SORT_ASC]);
if ( $account )
$query->andWhere(["product.id_account" => $account]);
$result = $query->all();
}
return $result;
}
public static function findProduct($query, $account = null){
$result = [];
$product = null;
@@ -137,6 +163,7 @@ class Product extends \common\models\BaseFitnessActiveRecord {
['barcode' => $query ],
]
)->andWhere(['status' =>Product::STATUS_ACTIVE])
->andFilterWhere(['product.id_account' => $account])
->all();