ソースを参照

Merge branch 'fix/montant_pain' into dev

refactoring
コミット
974e446a1e
11個のファイルの変更21行の追加53行の削除
  1. +9
    -19
      backend/controllers/CommandeController.php
  2. +1
    -1
      backend/controllers/StatsController.php
  3. +1
    -1
      backend/views/commande/_total_commandes.php
  4. +2
    -2
      backend/views/commande/index.php
  5. +1
    -1
      common/models/Commande.php
  6. +7
    -9
      common/models/Etablissement.php
  7. +0
    -4
      common/models/PointVente.php
  8. +0
    -9
      producer/controllers/CommandeController.php
  9. +0
    -5
      producer/views/commande/_liste_etablissements.php
  10. +0
    -1
      producer/views/commande/create.php
  11. +0
    -1
      producer/views/commande/update.php

+ 9
- 19
backend/controllers/CommandeController.php ファイルの表示

@@ -309,29 +309,22 @@ class CommandeController extends BackendController {
]);

$recettes = 0;
$recettes_pain = 0;
$recettes_vrac = 0;
$recettes_pain_livre = 0;
$poids_pain = 0;
$poids_vrac = 0;
$poids = 0 ;
$recettes_livre = 0;

foreach ($commandes as $c) {
$c->init();
if(is_null($c->date_delete)) {
$recettes += $c->montant;
$recettes_pain += $c->montant_pain;
$recettes_vrac += $c->montant_vrac;
if ($c->id_point_vente != 1)
$recettes_pain_livre += $c->montant_pain;

$poids_pain += $c->poids_pain;
$poids_vrac += $c->poids_vrac;
if ($c->id_point_vente != 1) {
$recettes_livre += $c->montant;
}
$poids += $c->poids;
}
}
$recettes = number_format($recettes, 2);
$recettes_pain = number_format($recettes_pain, 2);
$recettes_vrac = number_format($recettes_vrac, 2);

// init commandes point de vente
foreach ($points_vente as $pv) {
@@ -555,11 +548,8 @@ class CommandeController extends BackendController {
'produits_selec' => $produits_selec,
'users' => $arr_users,
'recettes' => $recettes,
'recettes_pain' => $recettes_pain,
'recettes_vrac' => $recettes_vrac,
'recettes_pain_livre' => $recettes_pain_livre,
'poids_pain' => $poids_pain,
'poids_vrac' => $poids_vrac,
'recettes_livre' => $recettes_livre,
'poids' => $poids,
'ca_potentiel' => $ca_potentiel,
'poids_total' => $poids_total,
'model_commande_auto' => $model_commande_auto,

+ 1
- 1
backend/controllers/StatsController.php ファイルの表示

@@ -105,7 +105,7 @@ class StatsController extends BackendController {
$c->init();
$mois = date('m/Y', strtotime($c->production->date));
if (isset($data_pain[$mois])) {
$data_pain[$mois] += $c->montant_pain;
$data_pain[$mois] += $c->montant;
}
}


+ 1
- 1
backend/views/commande/_total_commandes.php ファイルの表示

@@ -49,7 +49,7 @@ use yii\helpers\Html ;
<div class="panel-body">
<div class="alert alert-warning">
<strong>Potentiel :</strong> <?= number_format($ca_potentiel,2); ?> € (<?= $poids_total ?> kg) &bull;
<strong>Commandé :</strong> <?= number_format($recettes_pain,2); ?> € (<?= $poids_pain ?> kg)
<strong>Commandé :</strong> <?= number_format($recettes,2); ?> € (<?= $poids ?> kg)
</div>

<table class="table table-bordered tab-content table-produits table-header-rotated">

+ 2
- 2
backend/views/commande/index.php ファイルの表示

@@ -174,8 +174,8 @@ foreach ($produits as $p) {
'produits' => $produits,
'commandes' => $commandes,
'produits_selec' => $produits_selec,
'recettes_pain' => $recettes_pain,
'poids_pain' => $poids_pain,
'recettes' => $recettes,
'poids' => $poids,
'ca_potentiel' => $ca_potentiel,
'poids_total' => $poids_total,
]); ?>

+ 1
- 1
common/models/Commande.php ファイルの表示

@@ -294,7 +294,7 @@ class Commande extends \yii\db\ActiveRecord
$json_commande = [
'produits' => [],
'montant' => $commande->montant,
'str_montant' => $commande->getMontantFormat(),
'str_montant' => $commande->getMontant(true),
'montant_paye' => $commande->getMontantPaye(),
'commentaire' => $commande->commentaire,
];

+ 7
- 9
common/models/Etablissement.php ファイルの表示

@@ -164,17 +164,15 @@ class Etablissement extends \yii\db\ActiveRecord
$data_etablissements_dispos = [];
$options_etablissements_dispos = [];
foreach ($etablissements_dispos as $e) {
if ($e->etatPaiement() == self::PAIEMENT_OK || $e->etatPaiement() == self::PAIEMENT_ESSAI) {
if (!key_exists('d' . substr($e->code_postal, 0, 2), $data_etablissements_dispos)) {
$data_etablissements_dispos['d' . substr($e->code_postal, 0, 2)] = '<strong>' . $departements[substr($e->code_postal, 0, 2)] . '</strong>';
$options_etablissements_dispos['d' . substr($e->code_postal, 0, 2)] = ['disabled' => true];
}
if (!key_exists('d' . substr($e->code_postal, 0, 2), $data_etablissements_dispos)) {
$data_etablissements_dispos['d' . substr($e->code_postal, 0, 2)] = '<strong>' . $departements[substr($e->code_postal, 0, 2)] . '</strong>';
$options_etablissements_dispos['d' . substr($e->code_postal, 0, 2)] = ['disabled' => true];
}

$data_etablissements_dispos[$e->id] = '<span class="glyphicon glyphicon-lock"></span> ' . Html::encode($e->nom) . ' - ' . Html::encode($e->code_postal) . ' ' . Html::encode($e->ville) . ' <span class="glyphicon glyphicon-lock"></span>';
$data_etablissements_dispos[$e->id] = '<span class="glyphicon glyphicon-lock"></span> ' . Html::encode($e->nom) . ' - ' . Html::encode($e->code_postal) . ' ' . Html::encode($e->ville) . ' <span class="glyphicon glyphicon-lock"></span>';

if (strlen($e->code))
$options_etablissements_dispos[$e->id] = ['class' => 'lock'];
}
if (strlen($e->code))
$options_etablissements_dispos[$e->id] = ['class' => 'lock'];
}

return ['data' => $data_etablissements_dispos, 'options' => $options_etablissements_dispos];

+ 0
- 4
common/models/PointVente.php ファイルの表示

@@ -144,8 +144,6 @@ class PointVente extends \yii\db\ActiveRecord
{
$this->commandes = [];
$this->recettes = 0;
$this->recettes_pain = 0;
$this->recettes_vrac = 0;

foreach ($commandes as $c) {
if ($this->id == $c->id_point_vente) {
@@ -154,8 +152,6 @@ class PointVente extends \yii\db\ActiveRecord
if(is_null($c->date_delete)) {
$this->recettes += (float) $c->montant;
}
$this->recettes_pain += (float) $c->montant_pain;
$this->recettes_vrac += (float) $c->montant_vrac;
}
}
}

+ 0
- 9
producer/controllers/CommandeController.php ファイルの表示

@@ -96,14 +96,6 @@ class CommandeController extends ProducerBaseController {
$etablissements = Yii::$app->user->identity->getEtablissementsFavoris();
$id_etablissement = $this->getProducer()->id;

$etablissement_paiement_ok = false;
if ($id_etablissement) {
$etablissement = Etablissement::findOne($id_etablissement);
if ($etablissement->etatPaiement() == Etablissement::PAIEMENT_OK || $etablissement->etatPaiement() == Etablissement::PAIEMENT_ESSAI) {
$etablissement_paiement_ok = true;
}
}

// etablissement
$etablissement = Etablissement::findOne($id_etablissement);

@@ -206,7 +198,6 @@ class CommandeController extends ProducerBaseController {
'etablissements' => $etablissements,
'id_etablissement' => $id_etablissement,
'etablissement' => $etablissement,
'etablissement_paiement_ok' => $etablissement_paiement_ok,
'credit' => $credit
];
}

+ 0
- 5
producer/views/commande/_liste_etablissements.php ファイルの表示

@@ -43,11 +43,6 @@ use common\helpers\Url ;
<div class="liste-etablissements">
<?php if(count($etablissements)): ?>
<?php if(isset($id_etablissement) && $id_etablissement &&
isset($etablissement_paiement_ok) && !$etablissement_paiement_ok): ?>
<div class="alert alert-warning">Ce producteur est désactivé.</div>
<?php endif; ?>
<?php foreach($etablissements as $e): ?>
<div class="col-md-6 boulangerie <?php if(isset($id_etablissement) && $e['id'] == $id_etablissement): ?>selected<?php endif; ?>">
<div class="panel panel-default">

+ 0
- 1
producer/views/commande/create.php ファイルの表示

@@ -54,7 +54,6 @@ $this->setTitle('Passer une commande') ;
'etablissements' => $etablissements,
'id_etablissement' => $id_etablissement,
'etablissement' => $etablissement,
'etablissement_paiement_ok' => $etablissement_paiement_ok,
'credit' => $credit
]) ?>


+ 0
- 1
producer/views/commande/update.php ファイルの表示

@@ -59,7 +59,6 @@ $this->setTitle('Modifier une commande') ;
'etablissements' => $etablissements,
'etablissement' => $etablissement,
'id_etablissement' => $id_etablissement,
'etablissement_paiement_ok' => $etablissement_paiement_ok,
'credit' => $credit
]) ?>

読み込み中…
キャンセル
保存