소스 검색

Récap commandes : ajout du rappel du crédit de l'utilisateur

refactoring
keun 6 년 전
부모
커밋
d6f217f4d3
3개의 변경된 파일26개의 추가작업 그리고 9개의 파일을 삭제
  1. +4
    -4
      backend/controllers/CommandeController.php
  2. +20
    -3
      backend/views/commande/report.php
  3. +2
    -2
      common/models/Commande.php

+ 4
- 4
backend/controllers/CommandeController.php 파일 보기

@@ -40,10 +40,10 @@ class CommandeController extends BackendController {
$id_etablissement = Yii::$app->user->identity->id_etablissement;

$commandes = Commande::findBy([
'date' => $date,
'id_etablissement' => $id_etablissement,
'orderby' => 'commentaire_point_vente ASC, user.nom ASC'
]);
'date' => $date,
'id_etablissement' => $id_etablissement,
'orderby' => 'commentaire_point_vente ASC, user.nom ASC'
]);

foreach ($commandes as $c)
$c->init();

+ 20
- 3
backend/views/commande/report.php 파일 보기

@@ -15,12 +15,18 @@ foreach ($points_vente as $pv) {
$html .= '<h3>'.$pv->nom.'</h3>' ;

$col_credit_pain = '' ;
if($pv->credit_pain) {
$col_credit_pain = '<th>Rappel crédit</th>' ;
}
$html .= '<table class="table table-bordered">'
. '<thead>'
. '<tr>'
. '<th>Client</th>'
. '<th>Produits</th>'
. '<th>Commentaire</th>'
. $col_credit_pain
. '<th>Montant</th>'
. '</tr>'
. '<tbody>';
@@ -64,7 +70,16 @@ foreach ($points_vente as $pv) {
$html .= '<td>'.substr($str_produits, 0, strlen($str_produits) - 2).'</td>';
$html .= '<td>'.$c->commentaire.'</td>';
$html .= '<td>'.number_format($c->montant, 2) . ' € ';
if($pv->credit_pain) {
$credit = '' ;
if(isset($c->user) && isset($c->user->userEtablissement)) {
$credit = number_format($c->user->userEtablissement[0]->credit,2).' €' ;
}
$html .= '<td>'.$credit.'</td>' ;
}
$html .= '<td><strong>'.number_format($c->montant, 2) . ' € ';

if($c->getStatutPaiement() == Commande::STATUT_PAYEE)
{
@@ -79,8 +94,7 @@ foreach ($points_vente as $pv) {
$html .= '(surplus : '.$c->getMontantSurplus(true).' à rembourser)' ;
}
$html .= '</td>' ;
$html .= '</strong></td>' ;
$html .= '</tr>' ;
@@ -103,6 +117,9 @@ foreach ($points_vente as $pv) {
$str_produits = substr($str_produits, 0, strlen($str_produits) - 2) ;
$html .= '<td>'.$str_produits.'</td><td></td>' ;
if($pv->credit_pain) {
$html .= '<td></td>' ;
}
$html .= '<td><strong>'.number_format($pv->recettes_pain, 2) . ' €</strong></td>';
$html .= '</tbody></table><pagebreak>' ;

+ 2
- 2
common/models/Commande.php 파일 보기

@@ -313,7 +313,7 @@ class Commande extends \yii\db\ActiveRecord {

$commandes = Commande::find()
->with('commandeProduits', 'creditHistorique', 'pointVente')
->joinWith(['production', 'user'])
->joinWith(['production', 'user','user.userEtablissement'])
->where(['production.id_etablissement' => $params['id_etablissement']]);

if (isset($params['condition']))
@@ -335,7 +335,7 @@ class Commande extends \yii\db\ActiveRecord {
$commandes = $commandes->limit($params['limit']);

$commandes = $commandes->all();
return $commandes;
}


Loading…
취소
저장