ソースを参照

[Backend] Ajout d'informations au bilan global des commandes

Ajout du prix et du poids global potentiel (production totale renseignée)
et commandé.
master
keun 8年前
コミット
706534eb16
4個のファイルの変更46行の追加13行の削除
  1. +27
    -3
      backend/controllers/CommandeController.php
  2. +9
    -1
      backend/views/commande/_total_commandes.php
  3. +9
    -8
      backend/views/commande/index.php
  4. +1
    -1
      backend/web/js/lechatdesnoisettes.js

+ 27
- 3
backend/controllers/CommandeController.php ファイルの表示

@@ -444,7 +444,7 @@ class CommandeController extends BackendController {
if ($produit->id == $id_produit_selec) {
//echo $produit->nom.' : '.$produit_selec['quantite_max'].'<br />' ;
$ca_potentiel += $produit_selec['quantite_max'] * $produit->prix;
$poids_total += $produit_selec['quantite_max'] * $produit->poids;
$poids_total += $produit_selec['quantite_max'] * $produit->poids/1000;
}
}
}
@@ -1048,22 +1048,46 @@ class CommandeController extends BackendController {
->orderBy('date ASC')
->all();

$recettes = 0 ;
$poids_pain = 0 ;
foreach ($commandes as $c)
{
$c->init();
$recettes += $c->montant ;
$poids_pain += $c->poids_pain;
}

// produits selec pour production
$produits_selec = ProductionProduit::findProduits($production->id);
$ca_potentiel = 0;
$poids_total = 0;
foreach ($produits_selec as $id_produit_selec => $produit_selec) {
if ($produit_selec['actif']) {
foreach ($produits as $produit) {
if ($produit->id == $id_produit_selec) {
$ca_potentiel += $produit_selec['quantite_max'] * $produit->prix;
$poids_total += $produit_selec['quantite_max'] * $produit->poids/1000;
}
}
}
}
$html_totaux = $this->renderPartial('_total_commandes.php',[
'produits' => $produits,
'commandes' => $commandes,
'produits_selec' => $produits_selec
'produits_selec' => $produits_selec,
'recettes_pain' => $recettes,
'poids_total' => $poids_total,
'ca_potentiel' => $ca_potentiel,
'poids_pain' => $poids_pain,
]);
echo json_encode([
'html_totaux' => $html_totaux
'html_totaux' => $html_totaux,
]) ;
}

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

@@ -5,7 +5,14 @@ use yii\helpers\Html ;

?>

<h2>Global</h2>

<div class="alert alert-warning">
<strong>Potentiel :</strong> <?= number_format($ca_potentiel,2); ?> € (<?= $poids_total ?> kg)<br />
<strong>Commandé :</strong> <?= number_format($recettes_pain,2); ?> € (<?= $poids_pain ?> kg)
</div>

<table class="table table-bordered table-condensed tab-content table-produits">
<tbody>
<?php
foreach ($produits as $p) {
@@ -40,4 +47,5 @@ use yii\helpers\Html ;
<td class="td-total"></td>
<td></td>
</tr>
</tbody>
</tbody>
</table>

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

@@ -226,14 +226,15 @@ foreach ($produits as $p) {
</div>
<div class="col-md-3" id="bloc-totaux">
<h2>Global</h2>
<table class="table table-bordered table-condensed tab-content table-produits">
<?= $this->render('_total_commandes.php',[
'produits' => $produits,
'commandes' => $commandes,
'produits_selec' => $produits_selec
]); ?>
</table>
<?= $this->render('_total_commandes.php',[
'produits' => $produits,
'commandes' => $commandes,
'produits_selec' => $produits_selec,
'recettes_pain' => $recettes_pain,
'poids_pain' => $poids_pain,
'ca_potentiel' => $ca_potentiel,
'poids_total' => $poids_total,
]); ?>
</div>
</div>

+ 1
- 1
backend/web/js/lechatdesnoisettes.js ファイルの表示

@@ -201,7 +201,7 @@ function chat_index_commandes_maj_total_commandes() {
r: 'commande/ajax-total-commandes',
date: $('#date-production').val()
}, function(data) {
$('#bloc-totaux .table-produits').html(data.html_totaux) ;
$('#bloc-totaux').html(data.html_totaux) ;
}, 'json') ;
}


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