Add property reception show stock.

This commit is contained in:
Roland Schneider 2017-02-06 08:20:18 +01:00
parent 7bbd4dcfa4
commit c8e3ef6754
7 changed files with 91 additions and 26 deletions

View File

@ -2,6 +2,7 @@
namespace common\components; namespace common\components;
use common\models\Transfer;
use \Yii; use \Yii;
class Helper { class Helper {
@ -13,8 +14,11 @@ class Helper {
} }
/** /**
* Calculate time until today.
* @param string $start the date string, format "datetime => "Y-m-d H:i", "date => "Y-m-d" * @param string $start the date string, format "datetime => "Y-m-d H:i", "date => "Y-m-d"
* */ * @param string $format the format of date
* @return float the days between start and today.
*/
public static function calcStartDatimeDaysSinceToday($start, $format = "datetime" ){ public static function calcStartDatimeDaysSinceToday($start, $format = "datetime" ){
$now = time(); $now = time();
@ -39,7 +43,12 @@ class Helper {
* dátumot e params-ban megadott dátumra állítjuk * dátumot e params-ban megadott dátumra állítjuk
* *
* *
* */ * @param \yii\db\Query $query
* @param string $date
* @param string[] array $fields
* @param string string $format
* @return null
*/
public static function restrictIfNotAdminTheStartDate($query,$date, $fields = ['transfer.paid_at','transfer.created_at'], $format = 'datetime'){ public static function restrictIfNotAdminTheStartDate($query,$date, $fields = ['transfer.paid_at','transfer.created_at'], $format = 'datetime'){
$result = null; $result = null;
@ -110,6 +119,13 @@ class Helper {
$result = round ( $m / 5, 0 ) * 5; $result = round ( $m / 5, 0 ) * 5;
return $result; return $result;
} }
/**
* @param \yii\db\Query $query
* @param $field
* @param $start
* @param $end
*/
public static function notInInterval($query, $field, $start, $end) { public static function notInInterval($query, $field, $start, $end) {
$query->andFilterWhere ( [ $query->andFilterWhere ( [
'or', 'or',
@ -125,6 +141,13 @@ class Helper {
] ]
] ); ] );
} }
/**
* @param \yii\db\Query $query the query
* @param string $field the field name
* @param string $start the start date
* @param string $end the end date
*/
public static function notPaid($query, $field, $start, $end) { public static function notPaid($query, $field, $start, $end) {
$query->andFilterWhere ( [ $query->andFilterWhere ( [
'or', 'or',
@ -143,6 +166,13 @@ class Helper {
] ]
] ); ] );
} }
/**
* @param \yii\db\Query $query the query
* @param string $field the field name
* @param string $start the start date
* @param string $end the end date
*/
public static function inInterval($query, $field, $start, $end) { public static function inInterval($query, $field, $start, $end) {
$query->andFilterWhere ( [ $query->andFilterWhere ( [
'>=', '>=',
@ -155,6 +185,13 @@ class Helper {
$end $end
] ); ] );
} }
/**
* @param string $field the field name
* @param string $start the start date
* @param string $end the end date
* @return array the query 'in interval' rule
*/
public static function queryInIntervalRule($field, $start, $end) { public static function queryInIntervalRule($field, $start, $end) {
return [ return [
'and', 'and',
@ -208,12 +245,27 @@ class Helper {
public static function sqlInIntervalRule($field, $paramStart, $paramEnd) { public static function sqlInIntervalRule($field, $paramStart, $paramEnd) {
return ' ' . $field . ' >= ' . $paramStart . ' and ' . $field . ' < ' . $paramEnd; return ' ' . $field . ' >= ' . $paramStart . ' and ' . $field . ' < ' . $paramEnd;
} }
/**
* @noinspection PhpUnusedParameterInspection
*
* @param $field_start
* @param $field_endsqlExpireRulesqlExpireRule
* @param $paramStart
* @param $paramEnd
* @return string
*/
public static function sqlExpireRule($field_start, $field_end, $paramStart, $paramEnd) { public static function sqlExpireRule($field_start, $field_end, $paramStart, $paramEnd) {
return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' < ' . $paramEnd; return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' < ' . $paramEnd;
} }
public static function sqlValidRule($field_start, $field_end, $paramStart, $paramEnd) { public static function sqlValidRule($field_start, $field_end, $paramStart, $paramEnd) {
return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' >=' . $paramStart; return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' >=' . $paramStart;
} }
/**
* @param \yii\db\Query $query the query
* @param string $field the field name
*/
public static function queryAccountConstraint($query, $field) { public static function queryAccountConstraint($query, $field) {
if (! RoleDefinition::isAdmin ()) { if (! RoleDefinition::isAdmin ()) {
$query->innerJoin ( "user_account_assignment", $field . ' = user_account_assignment.id_account' ); $query->innerJoin ( "user_account_assignment", $field . ' = user_account_assignment.id_account' );
@ -316,6 +368,9 @@ class Helper {
return \Yii::$app->params ['reception_visibility_days'] ; return \Yii::$app->params ['reception_visibility_days'] ;
} }
public static function isReceptionShowStock() {
return \Yii::$app->params ['reception_show_stock'] ;
}
public static function isTicketCreatePriceEditable() { public static function isTicketCreatePriceEditable() {
return \Yii::$app->params ['ticket_create_price_editable'] == true ; return \Yii::$app->params ['ticket_create_price_editable'] == true ;

View File

@ -82,11 +82,8 @@ class GiroBeszed extends GiroBase {
$tetel->tetelSorszam = $request->number; $tetel->tetelSorszam = $request->number;
$tetel->terhelesiDatum = $terhelesiDatum; $tetel->terhelesiDatum = $terhelesiDatum;
$tetel->osszeg = $request->money; $tetel->osszeg = $request->money;
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account; $tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
$tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer; $tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer;
// $tetel->ugyfelNeve = "Schneider Roland";
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
$tetel->szamlaTulajdonosNeve = $customer->name; $tetel->szamlaTulajdonosNeve = $customer->name;
$tetel->kozlemeny = "Fitness berlet. Megbizas azon: " . $request->id_ticket_installment_request; $tetel->kozlemeny = "Fitness berlet. Megbizas azon: " . $request->id_ticket_installment_request;

View File

@ -33,6 +33,8 @@ return [
'reception_account_state_index_only_today' => false, 'reception_account_state_index_only_today' => false,
'reception_transfer_list_only_today' => false, 'reception_transfer_list_only_today' => false,
'reception_show_stock' => true,
'backend_skin' => 'skin-red', //skin-green 'backend_skin' => 'skin-red', //skin-green
/**User cart module on/off*/ /**User cart module on/off*/
'user_cart_on' => true, 'user_cart_on' => true,

View File

@ -285,6 +285,7 @@ class ContractController extends Controller {
'id' => $contract->id_contract 'id' => $contract->id_contract
] ); ] );
} }
public function actionMake($id) { public function actionMake($id) {
$customer = Customer::findOne ( $id ); $customer = Customer::findOne ( $id );
@ -301,7 +302,6 @@ class ContractController extends Controller {
$model->started_at = date(date('Y.m.d')); $model->started_at = date(date('Y.m.d'));
$model->fillOut (); $model->fillOut ();
if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) { if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) {

View File

@ -154,7 +154,7 @@ class ContractForm extends Model {
public function validateTicketType($attribute, $params) { public function validateTicketType($attribute, $params) {
$this->ticketType = TicketType::findOne ( $this->ticket_type ); $this->ticketType = TicketType::findOne ( $this->ticket_type );
if (! isset ( $this->ticketType )) { if (! isset ( $this->ticketType ) ) {
$this->addError ( $attribute, "Bérlet típus nem található" ); $this->addError ( $attribute, "Bérlet típus nem található" );
}else{ }else{
$contracts = Contract::find() $contracts = Contract::find()

View File

@ -203,7 +203,9 @@ class ProductSaleForm extends Model
$paid_at = date('Y-m-d H:i:s' ) ; $paid_at = date('Y-m-d H:i:s' ) ;
} }
$this->transfer = Transfer::createProductTransfer($this->sale,$this->account, $this->discount, $this->currency, $this->count, $this->product,$status,$customer); $this->transfer = Transfer::createProductTransfer($this->sale, $this->account, $this->discount,
$this->currency, $this->count,
$this->product,$status,$customer);
$this->transfer->payment_method = $this->payment_method; $this->transfer->payment_method = $this->payment_method;
if ( isset($this->comment)){ if ( isset($this->comment)){
$this->transfer->comment = $this->comment; $this->transfer->comment = $this->comment;

View File

@ -25,6 +25,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<?php if ( \common\components\Helper::isReceptionShowStock() ) {?>
<th> <th>
<?php echo Yii::t('frontend/product','Stock'). ' (Db)'?> <?php echo Yii::t('frontend/product','Stock'). ' (Db)'?>
</th> </th>
@ -37,6 +38,14 @@
<td> <td>
<span class="product-count">1</span> <span class="product-count">1</span>
</td> </td>
<?php }else { ?>
<th colspan="3">
<?php echo Yii::t('frontend/product','Count'). ' (Db)'?>
</th>
<td>
<span class="product-count">1</span>
</td>
<?php } ?>
</tr> </tr>
<tr> <tr>
<th> <th>