|
|
@@ -1,374 +1,347 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
use yii\helpers\Html ; |
|
|
|
use common\models\Commande ; |
|
|
|
|
|
|
|
$this->title = 'Commande' ; |
|
|
|
|
|
|
|
$cpt_non_vrac = 0 ; |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
if(!$p->vrac) { |
|
|
|
$cpt_non_vrac ++ ; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
use yii\helpers\Html; |
|
|
|
use common\models\Commande; |
|
|
|
|
|
|
|
$this->title = 'Commande'; |
|
|
|
|
|
|
|
$cpt_non_vrac = 0; |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
if (!$p->vrac) { |
|
|
|
$cpt_non_vrac ++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<div id="page-commande"> |
|
|
|
<div class="col-md-3"> |
|
|
|
<?php |
|
|
|
// chargement assets |
|
|
|
common\components\fullcalendar\FullcalendarWidget::widget() ; |
|
|
|
// --> lancement du js en manuel (via lechatdesnoisettes.js) |
|
|
|
?> |
|
|
|
<div id="calendar"></div> |
|
|
|
|
|
|
|
<?php if($production): ?> |
|
|
|
<!-- produits sélectionnés --> |
|
|
|
<br /> |
|
|
|
<form id="produits-production" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index','date'=>$date]); ?>" method="post"> |
|
|
|
<table class="table table-bordered"> |
|
|
|
<tbody> |
|
|
|
<?php foreach($produits as $p): ?> |
|
|
|
<tr<?php if($p->vrac): ?> style="display:none;"<?php endif;?>> |
|
|
|
<td><label for="produit-<?php echo $p->id; ?>"><?php if(strlen($p->description)): echo Html::encode($p->description) ; else: echo Html::encode($p->nom) ; endif; ?></label></td> |
|
|
|
<td><input id="produit-<?php echo $p->id; ?>" name="Produit[<?php echo $p->id; ?>][actif]" type="checkbox" <?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>checked="checked"<?php endif; ?> /></td> |
|
|
|
<td><input class="quantite-max" name="Produit[<?php echo $p->id; ?>][quantite_max]" type="text" value="<?php if(isset($produits_selec[$p->id])) echo $produits_selec[$p->id]['quantite_max'] ; ?>" /></td> |
|
|
|
</tr> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
<input type="submit" name="valider_produit_selec" class="btn btn-default" value="Valider" /> |
|
|
|
</form> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="col-md-9"> |
|
|
|
<input type="hidden" value="<?php echo $date; ?>" id="current-date" /> |
|
|
|
<ul id="jours-production"> |
|
|
|
<?php foreach($jours_production as $j) :?> |
|
|
|
<li><?php echo $j->date ; ?></li> |
|
|
|
<?php endforeach; ?> |
|
|
|
</ul> |
|
|
|
<?php if($date != ''): ?> |
|
|
|
<h1> |
|
|
|
Production du <?php echo date('d/m/Y',strtotime($date)) ; ?> |
|
|
|
<div class="btn-group" role="group"> |
|
|
|
<a class="btn btn-default<?php if($production->actif): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state','date'=>$date,'actif'=>1]); ?>">Activé</a> |
|
|
|
<a class="btn btn-default<?php if(!$production->actif): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state','date'=>$date,'actif'=>0]); ?>">Désactivé</a> |
|
|
|
</div> |
|
|
|
</h1> |
|
|
|
|
|
|
|
<strong>Livraison</strong> |
|
|
|
<div class="btn-group" role="group"> |
|
|
|
<a class="btn btn-default<?php if($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison','date'=>$date,'livraison'=>1]); ?>">Activé</a> |
|
|
|
<a class="btn btn-default<?php if(!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison','date'=>$date,'livraison'=>0]); ?>">Désactivé</a> |
|
|
|
</div> |
|
|
|
<br /><br /> |
|
|
|
|
|
|
|
<?php if(!count($commandes)): ?> |
|
|
|
<div class="alert alert-info">Aucune commande passée pour cette date</div> |
|
|
|
<?php else: ?> |
|
|
|
<a class="btn btn-primary" href="<?php echo Yii::$app->urlManager->createUrl(['commande/download','date'=>$date,'id_point_vente'=>0,'global'=>1]); ?>"><span class="glyphicon glyphicon-download-alt"></span> Récapitulatif global</a> |
|
|
|
<br /> |
|
|
|
<br /> |
|
|
|
<?php endif;?> |
|
|
|
|
|
|
|
<?php |
|
|
|
$num_jour_semaine = date('w',strtotime($date)); |
|
|
|
$arr_jour_semaine = [0=>'dimanche',1=>'lundi',2=>'mardi', 3=>'mercredi', 4=>'jeudi', 5=>'vendredi', 6=>'samedi'] ; |
|
|
|
$champs_horaires_point_vente = 'horaires_'.$arr_jour_semaine[$num_jour_semaine] ; |
|
|
|
?> |
|
|
|
<?php //if(count($pv->commandes)):?> |
|
|
|
<form class="form-commandes-point-vente" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index','date'=>$date]); ?>" method="post"> |
|
|
|
<!-- <h2><?php //echo Html::encode($pv->nom); ?> <a href="<?php //echo Yii::$app->urlManager->createUrl(['commande/download','date'=>$date,'id_point_vente'=>$pv->id]); ?>" class="btn btn-default">CSV</a></h2> --> |
|
|
|
<!-- <p><?php //echo Html::encode($pv->adresse); ?></p> --> |
|
|
|
|
|
|
|
<table class="table table-striped table-bordered"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<td class="title-point-vente" colspan="<?php echo count($produits)+4; ?>"><strong>Global</strong></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td></td> |
|
|
|
<?php foreach($produits as $p): ?> |
|
|
|
<?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?> |
|
|
|
<td class="center<?php if($p->vrac): ?> vrac<?php endif; ?>"> |
|
|
|
<strong><?php echo Html::encode($p->getLibelleAdmin()); ?></strong> |
|
|
|
</td> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
<td><strong>Potentiel</strong></td> |
|
|
|
<td><strong>Commandé</strong></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td><strong>Pain</strong></td> |
|
|
|
<?php |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ; |
|
|
|
$str_quantite = '' ; |
|
|
|
if($quantite) |
|
|
|
$str_quantite = $quantite ; |
|
|
|
|
|
|
|
$classe = 'center total' ; |
|
|
|
if($str_quantite > $produits_selec[$p->id]['quantite_max'] && !$produits_selec[$p->id]['vrac']) { |
|
|
|
$classe .= ' depasse' ; |
|
|
|
} |
|
|
|
|
|
|
|
if($p->vrac) { |
|
|
|
$classe .= ' vrac' ; |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="'.$classe.'"><strong>'.$str_quantite.' <span>' ; |
|
|
|
|
|
|
|
if($produits_selec[$p->id]['quantite_max'] && $str_quantite) |
|
|
|
echo '/ '.$produits_selec[$p->id]['quantite_max'].'</span></strong></td>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<td><strong><?php echo number_format($ca_potentiel,2) ; ?> €</strong><br /><?php echo number_format($poids_total/1000,2) ; ?> kg</td> |
|
|
|
|
|
|
|
<td><strong><?php echo str_replace(' ',' ',$recettes_pain.' €') ; ?></strong><br /><?php echo round($poids_pain).' kg'; ?></td> |
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
|
|
|
|
<tr> |
|
|
|
<td><strong>Vrac</strong></td> |
|
|
|
<td colspan="<?php echo $cpt_non_vrac; ?>"> |
|
|
|
<?php |
|
|
|
$first = true ; |
|
|
|
foreach($produits as $p) { |
|
|
|
if($p->vrac) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ; |
|
|
|
if($quantite) { |
|
|
|
if(!$first) |
|
|
|
echo ', ' ; |
|
|
|
|
|
|
|
echo $quantite.' '.Html::encode($p->diminutif) ; |
|
|
|
|
|
|
|
$first = false ; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
</td> |
|
|
|
|
|
|
|
<!-- liste vrac --> |
|
|
|
<td></td> |
|
|
|
|
|
|
|
<?php |
|
|
|
foreach($produits as $p) { |
|
|
|
if($p->vrac) |
|
|
|
echo '<td class="vrac"></td>' ; |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<td><strong><?php echo str_replace(' ',' ',$recettes_vrac.' €') ; ?></strong><br /><?php echo round($poids_vrac).' kg'; ?></td> |
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
|
|
|
|
<?php foreach($points_vente as $pv): ?> |
|
|
|
<?php |
|
|
|
if(strlen($pv->$champs_horaires_point_vente)): |
|
|
|
?> |
|
|
|
<tr> |
|
|
|
<td class="title-point-vente" colspan="<?php echo count($produits)+4; ?>"><?php echo Html::encode($pv->nom); ?></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td></td> |
|
|
|
<?php foreach($produits as $p): ?> |
|
|
|
<?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?> |
|
|
|
<td class="center<?php if($p->vrac): ?> vrac<?php endif; ?>"> |
|
|
|
<strong><?php echo Html::encode($p->getLibelleAdmin()); ?></strong> |
|
|
|
</td> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
<td class="center"> |
|
|
|
<strong>VRAC</strong> |
|
|
|
</td> |
|
|
|
<td></td> |
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
|
|
|
|
<?php foreach($pv->commandes as $c): ?> |
|
|
|
<tr> |
|
|
|
<td> |
|
|
|
<?php if(isset($c->user)): ?> |
|
|
|
<?php echo Html::encode($c->user->prenom.' '.$c->user->nom) ;?> |
|
|
|
<?php else: ?> |
|
|
|
<?php echo Html::encode($c->username) ; ?> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
<?php if(strlen($c->commentaire)): ?> |
|
|
|
<button type="button" class="btn btn-xs btn-info" data-toggle="popover" title="Commentaire" data-content="<?php echo Html::encode($c->commentaire); ?>"><span class="glyphicon glyphicon-comment"></span></button> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
<br /><span class="date-commande"><?php echo date('d/m/Y à H:i ',strtotime($c->date)) ; if($c->date_update && date('d/m/Y',strtotime($c->date_update)) != date('d/m/Y',strtotime($c->date))): ?><br />modif. <?php echo date('d/m/Y',strtotime($c->date_update)) ; ?><?php endif;?></span> |
|
|
|
</td> |
|
|
|
|
|
|
|
<?php |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$add = false ; |
|
|
|
$quantite = 0 ; |
|
|
|
foreach($c->commandeProduits as $cp) { |
|
|
|
if($p->id == $cp->id_produit) { |
|
|
|
$quantite = $cp->quantite ; |
|
|
|
$add = true ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="td-produit'.(($p->vrac) ? ' vrac' : '').'"><input class="quantite" type="text" value="'.$quantite.'" name="produit_'.$c->id.'_'.$p->id.'" /></td>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<!-- liste vrac --> |
|
|
|
<td><?php echo $c->strListeVrac(); ?></td> |
|
|
|
|
|
|
|
<td><?php echo str_replace(' ',' ',number_format($c->montant,2).' €') ; ?></td> |
|
|
|
<td><a href="<?php echo Yii::$app->urlManager->createUrl(['commande/delete-commande','date'=>$date,'delete'=>1,'id_commande'=>$c->id]) ; ?>" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td> |
|
|
|
</tr> |
|
|
|
<?php endforeach; ?> |
|
|
|
|
|
|
|
<tr> |
|
|
|
<td><!-- <select class="select-user" name="user_pv_<?php echo $pv->id;?>"> |
|
|
|
<?php foreach($users as $id_user => $libelle_user) { |
|
|
|
echo '<option value="'.$id_user.'">'.$libelle_user.'</option>' ; |
|
|
|
}?> |
|
|
|
</select> --> |
|
|
|
|
|
|
|
<input type="text" placeholder="Nom" class="text" name="username_pv_<?php echo $pv->id;?>" /> |
|
|
|
<br /> |
|
|
|
<input type="text" name="date_commande_pv_<?php echo $pv->id;?>" class="datepicker" value="<?php echo date('d/m/Y'); ?>" /> |
|
|
|
</td> |
|
|
|
<?php |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
echo '<td class="td-produit'.(($p->vrac) ? ' vrac' : '').'"><input class="quantite" type="text" value="0" name="produit_pv_'.$pv->id.'_'.$p->id.'" /></td>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<!-- liste vrac --> |
|
|
|
<td><a href="javascript:void(0):" class="btn btn-default btn-xs edit-vrac"><i class="glyphicon glyphicon-pencil"></i></a></td> |
|
|
|
|
|
|
|
<td></td> |
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
|
|
|
|
<?php if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) { |
|
|
|
echo '<tr>' ; |
|
|
|
echo '<td><strong>Total pain</strong></td>' ; |
|
|
|
|
|
|
|
//$cpt_non_vrac = 0 ; |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
|
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes) ; |
|
|
|
$str_quantite = '' ; |
|
|
|
|
|
|
|
if(!$p->vrac) { |
|
|
|
//$cpt_non_vrac ++ ; |
|
|
|
if($quantite) |
|
|
|
$str_quantite = $quantite ; |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="center'.(($p->vrac) ? ' vrac' : '').'"><strong>'.$str_quantite.'</strong></td>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// liste vrac |
|
|
|
echo '<td></td>' ; |
|
|
|
|
|
|
|
// total |
|
|
|
echo '<td><strong>'.number_format($pv->recettes_pain,2).' €</strong></td><td></td></tr>' ; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
* VRAC |
|
|
|
*/ |
|
|
|
echo '<tr>' ; |
|
|
|
echo '<td><strong>Total vrac</strong></td>' ; |
|
|
|
echo '<td colspan="'.$cpt_non_vrac.'">'.$pv->strListeVrac().'</td>' ; |
|
|
|
foreach($produits as $p) { |
|
|
|
if($p->vrac) |
|
|
|
echo '<td class="vrac"></td>' ; |
|
|
|
} |
|
|
|
// liste vrac |
|
|
|
echo '<td></td>' ; |
|
|
|
echo '<td><strong>'.number_format($pv->recettes_vrac,2).' €</strong></td><td></td></tr>' ; |
|
|
|
|
|
|
|
} ?> |
|
|
|
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
<input type="submit" class="btn btn-primary submit-pv" value="Enregistrer" name="submit_pv" /> |
|
|
|
</form> |
|
|
|
<div class="clr"></div> |
|
|
|
|
|
|
|
|
|
|
|
<?php if(count($commandes) && false): ?> |
|
|
|
<h2>Récapitulatif production <a href="<?php echo Yii::$app->urlManager->createUrl(['commande/download','date'=>$date]); ?>" class="btn btn-default">CSV</a></h2> |
|
|
|
<table class="table table-striped table-bordered"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<th>Lieu</th> |
|
|
|
<?php foreach($produits as $p): ?> |
|
|
|
<?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) : ?> |
|
|
|
<th><?php echo Html::encode($p->description); ?></th> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<?php |
|
|
|
foreach($points_vente as $pv) { |
|
|
|
if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) { |
|
|
|
echo '<tr>' ; |
|
|
|
echo '<td>'.Html::encode($pv->nom).'</td>' ; |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes) ; |
|
|
|
$str_quantite = '' ; |
|
|
|
if($quantite) |
|
|
|
$str_quantite = $quantite ; |
|
|
|
|
|
|
|
echo '<td>'.$str_quantite.'</td>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '</tr>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
</tbody> |
|
|
|
<tfoot> |
|
|
|
<tr> |
|
|
|
<td><strong>Total</strong></td> |
|
|
|
<?php |
|
|
|
foreach($produits as $p) { |
|
|
|
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ; |
|
|
|
$str_quantite = '' ; |
|
|
|
if($quantite) |
|
|
|
$str_quantite = $quantite ; |
|
|
|
|
|
|
|
echo '<td class="'.(($p->vrac) ? 'vrac' : '').'">'.$str_quantite.'</td>' ; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
</tr> |
|
|
|
</tfoot> |
|
|
|
</table> |
|
|
|
<?php endif;?> |
|
|
|
<?php endif; ?> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div id="row1"> |
|
|
|
<div class="col-md-3"> |
|
|
|
<div class="panel panel-default"> |
|
|
|
<div class="panel-heading"> |
|
|
|
<h3 class="panel-title">Calendrier</h3> |
|
|
|
</div> |
|
|
|
<div class="panel-body"> |
|
|
|
<?php |
|
|
|
// chargement assets |
|
|
|
common\components\fullcalendar\FullcalendarWidget::widget(); |
|
|
|
// --> lancement du js en manuel (via lechatdesnoisettes.js) |
|
|
|
?> |
|
|
|
<div id="calendar"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<?php if ($date != ''): ?> |
|
|
|
<div class="col-md-5"> |
|
|
|
<div class="panel panel-default"> |
|
|
|
<div class="panel-heading"> |
|
|
|
<h3 class="panel-title">Production du <strong><?php echo date('d/m/Y', strtotime($date)); ?></strong></h3> |
|
|
|
</div> |
|
|
|
<div class="panel-body"> |
|
|
|
<strong>Production</strong> |
|
|
|
<div class="btn-group" role="group"> |
|
|
|
<a class="btn btn-default<?php if ($production->actif): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state', 'date' => $date, 'actif' => 1]); ?>">Activé</a> |
|
|
|
<a class="btn btn-default<?php if (!$production->actif): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state', 'date' => $date, 'actif' => 0]); ?>">Désactivé</a> |
|
|
|
</div> |
|
|
|
<br /> |
|
|
|
<br /> |
|
|
|
<strong>Livraison</strong> |
|
|
|
<div class="btn-group" role="group"> |
|
|
|
<a class="btn btn-default<?php if ($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 1]); ?>">Activé</a> |
|
|
|
<a class="btn btn-default<?php if (!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 0]); ?>">Désactivé</a> |
|
|
|
</div> |
|
|
|
<br /><br /> |
|
|
|
|
|
|
|
<?php if (!count($commandes)): ?> |
|
|
|
<div class="alert alert-info">Aucune commande passée pour cette date</div> |
|
|
|
<?php else: ?> |
|
|
|
<a class="btn btn-primary" href="<?php echo Yii::$app->urlManager->createUrl(['commande/download', 'date' => $date, 'id_point_vente' => 0, 'global' => 1]); ?>"><span class="glyphicon glyphicon-download-alt"></span> Récapitulatif global</a> |
|
|
|
<br /> |
|
|
|
<br /> |
|
|
|
<?php endif; ?> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
<?php if ($production): ?> |
|
|
|
<div id="bloc-produits" class="col-md-4"> |
|
|
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
<div class="panel-heading"> |
|
|
|
<h3 class="panel-title">Produits</h3> |
|
|
|
</div> |
|
|
|
<div class="panel-body"> |
|
|
|
<!-- produits sélectionnés --> |
|
|
|
<form id="produits-production" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index', 'date' => $date]); ?>" method="post"> |
|
|
|
<table class="table table-bordered"> |
|
|
|
<tbody> |
|
|
|
<?php foreach ($produits as $p): ?> |
|
|
|
<tr<?php if ($p->vrac): ?> style="display:none;"<?php endif; ?>> |
|
|
|
<td><label for="produit-<?php echo $p->id; ?>"><?php if (strlen($p->description)): echo Html::encode($p->description); |
|
|
|
else: echo Html::encode($p->nom); |
|
|
|
endif; ?></label></td> |
|
|
|
<td><input id="produit-<?php echo $p->id; ?>" name="Produit[<?php echo $p->id; ?>][actif]" type="checkbox" <?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>checked="checked"<?php endif; ?> /></td> |
|
|
|
<td><input class="quantite-max" name="Produit[<?php echo $p->id; ?>][quantite_max]" type="text" value="<?php if (isset($produits_selec[$p->id])) echo $produits_selec[$p->id]['quantite_max']; ?>" /></td> |
|
|
|
</tr> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
<input type="submit" name="valider_produit_selec" class="btn btn-default" value="Valider" /> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div id="row2" class="col-md-12"> |
|
|
|
<input type="hidden" value="<?php echo $date; ?>" id="current-date" /> |
|
|
|
<ul id="jours-production"> |
|
|
|
<?php foreach ($jours_production as $j) : ?> |
|
|
|
<li><?php echo $j->date; ?></li> |
|
|
|
<?php endforeach; ?> |
|
|
|
</ul> |
|
|
|
<?php if ($date != ''): ?> |
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
$num_jour_semaine = date('w', strtotime($date)); |
|
|
|
$arr_jour_semaine = [0 => 'dimanche', 1 => 'lundi', 2 => 'mardi', 3 => 'mercredi', 4 => 'jeudi', 5 => 'vendredi', 6 => 'samedi']; |
|
|
|
$champs_horaires_point_vente = 'horaires_' . $arr_jour_semaine[$num_jour_semaine]; |
|
|
|
?> |
|
|
|
<form class="form-commandes-point-vente" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index', 'date' => $date]); ?>" method="post"> |
|
|
|
|
|
|
|
<table class="table table-striped table-header-rotated"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<td class="title-point-vente" colspan="<?php echo count($produits) + 3; ?>"><strong>Global</strong></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th></th> |
|
|
|
<?php foreach ($produits as $p): ?> |
|
|
|
<?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?> |
|
|
|
<th class="center rotate-45"> |
|
|
|
<div><span><strong><?php echo Html::encode($p->getLibelleAdmin()); ?></strong></span></div> |
|
|
|
</th> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
<th class="title-totaux"><strong>Potentiel</strong></td> |
|
|
|
<th class="title-totaux"><strong>Commandé</strong></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td><strong>Pain</strong></td> |
|
|
|
<?php |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $commandes); |
|
|
|
$str_quantite = ''; |
|
|
|
if ($quantite) |
|
|
|
$str_quantite = $quantite; |
|
|
|
|
|
|
|
$classe = 'center total'; |
|
|
|
if ($str_quantite > $produits_selec[$p->id]['quantite_max'] && !$produits_selec[$p->id]['vrac']) { |
|
|
|
$classe .= ' depasse'; |
|
|
|
} |
|
|
|
|
|
|
|
if ($p->vrac) { |
|
|
|
$classe .= ' vrac'; |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="' . $classe . '"><strong>' . $str_quantite . ' <span>'; |
|
|
|
|
|
|
|
if ($produits_selec[$p->id]['quantite_max'] && $str_quantite) |
|
|
|
echo '/ ' . $produits_selec[$p->id]['quantite_max'] . '</span></strong></td>'; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<td><strong><?php echo number_format($ca_potentiel, 2); ?> €</strong><br /><?php echo number_format($poids_total / 1000, 2); ?> kg</td> |
|
|
|
|
|
|
|
<td><strong><?php echo str_replace(' ', ' ', $recettes_pain . ' €'); ?></strong><br /><?php echo round($poids_pain) . ' kg'; ?></td> |
|
|
|
|
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
|
|
|
|
<?php foreach ($points_vente as $pv): ?> |
|
|
|
<?php |
|
|
|
if (strlen($pv->$champs_horaires_point_vente)): |
|
|
|
?> |
|
|
|
<tr> |
|
|
|
<td class="title-point-vente" colspan="<?php echo count($produits) + 3; ?>"><?php echo Html::encode($pv->nom); ?></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th></th> |
|
|
|
<?php foreach ($produits as $p): ?> |
|
|
|
<?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?> |
|
|
|
<th class="center rotate-45"> |
|
|
|
<div><span><strong><?php echo Html::encode($p->getLibelleAdmin()); ?></strong></span></div> |
|
|
|
</th> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
<th></th> |
|
|
|
<th></th> |
|
|
|
</tr> |
|
|
|
|
|
|
|
<?php foreach ($pv->commandes as $c): ?> |
|
|
|
<tr> |
|
|
|
<td> |
|
|
|
<?php if (isset($c->user)): ?> |
|
|
|
<?php echo Html::encode($c->user->prenom . ' ' . $c->user->nom); ?> |
|
|
|
<?php else: ?> |
|
|
|
<?php echo Html::encode($c->username); ?> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
<?php if (strlen($c->commentaire)): ?> |
|
|
|
<button type="button" class="btn btn-xs btn-info" data-toggle="popover" title="Commentaire" data-content="<?php echo Html::encode($c->commentaire); ?>"><span class="glyphicon glyphicon-comment"></span></button> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
<br /><span class="date-commande"><?php echo date('d/m/Y à H:i ', strtotime($c->date)); |
|
|
|
if ($c->date_update && date('d/m/Y', strtotime($c->date_update)) != date('d/m/Y', strtotime($c->date))): ?><br />modif. <?php echo date('d/m/Y', strtotime($c->date_update)); ?><?php endif; ?></span> |
|
|
|
</td> |
|
|
|
|
|
|
|
<?php |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$add = false; |
|
|
|
$quantite = 0; |
|
|
|
foreach ($c->commandeProduits as $cp) { |
|
|
|
if ($p->id == $cp->id_produit) { |
|
|
|
$quantite = $cp->quantite; |
|
|
|
$add = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="td-produit"><input class="quantite" type="text" value="' . $quantite . '" name="produit_' . $c->id . '_' . $p->id . '" /></td>'; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<td><?php echo str_replace(' ', ' ', number_format($c->montant, 2) . ' €'); ?></td> |
|
|
|
<td><a href="<?php echo Yii::$app->urlManager->createUrl(['commande/delete-commande', 'date' => $date, 'delete' => 1, 'id_commande' => $c->id]); ?>" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td> |
|
|
|
</tr> |
|
|
|
<?php endforeach; ?> |
|
|
|
|
|
|
|
<tr> |
|
|
|
<td><!-- <select class="select-user" name="user_pv_<?php echo $pv->id; ?>"> |
|
|
|
<?php |
|
|
|
foreach ($users as $id_user => $libelle_user) { |
|
|
|
echo '<option value="' . $id_user . '">' . $libelle_user . '</option>'; |
|
|
|
} |
|
|
|
?> |
|
|
|
</select> --> |
|
|
|
|
|
|
|
<input type="text" placeholder="Nom" class="text" name="username_pv_<?php echo $pv->id; ?>" /> |
|
|
|
<br /> |
|
|
|
<input type="text" name="date_commande_pv_<?php echo $pv->id; ?>" class="datepicker" value="<?php echo date('d/m/Y'); ?>" /> |
|
|
|
</td> |
|
|
|
<?php |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
echo '<td class="td-produit' . (($p->vrac) ? ' vrac' : '') . '"><input class="quantite" type="text" value="0" name="produit_pv_' . $pv->id . '_' . $p->id . '" /></td>'; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<td></td> |
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
|
|
|
|
<?php |
|
|
|
if (count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) { |
|
|
|
echo '<tr>'; |
|
|
|
echo '<td><strong>Total pain</strong></td>'; |
|
|
|
|
|
|
|
//$cpt_non_vrac = 0 ; |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
|
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes); |
|
|
|
$str_quantite = ''; |
|
|
|
|
|
|
|
if (!$p->vrac) { |
|
|
|
//$cpt_non_vrac ++ ; |
|
|
|
if ($quantite) |
|
|
|
$str_quantite = $quantite; |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="center' . (($p->vrac) ? ' vrac' : '') . '"><strong>' . $str_quantite . '</strong></td>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// total |
|
|
|
echo '<td><strong>' . number_format($pv->recettes_pain, 2) . ' €</strong></td><td></td></tr>'; |
|
|
|
} |
|
|
|
?> |
|
|
|
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
<input type="submit" class="btn btn-primary submit-pv" value="Enregistrer" name="submit_pv" /> |
|
|
|
</form> |
|
|
|
<div class="clr"></div> |
|
|
|
|
|
|
|
|
|
|
|
<?php if (count($commandes) && false): ?> |
|
|
|
<h2>Récapitulatif production <a href="<?php echo Yii::$app->urlManager->createUrl(['commande/download', 'date' => $date]); ?>" class="btn btn-default">CSV</a></h2> |
|
|
|
<table class="table table-striped table-bordered"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<th>Lieu</th> |
|
|
|
<?php foreach ($produits as $p): ?> |
|
|
|
<?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) : ?> |
|
|
|
<th><?php echo Html::encode($p->description); ?></th> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<?php |
|
|
|
foreach ($points_vente as $pv) { |
|
|
|
if (count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) { |
|
|
|
echo '<tr>'; |
|
|
|
echo '<td>' . Html::encode($pv->nom) . '</td>'; |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes); |
|
|
|
$str_quantite = ''; |
|
|
|
if ($quantite) |
|
|
|
$str_quantite = $quantite; |
|
|
|
|
|
|
|
echo '<td>' . $str_quantite . '</td>'; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '</tr>'; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
</tbody> |
|
|
|
<tfoot> |
|
|
|
<tr> |
|
|
|
<td><strong>Total</strong></td> |
|
|
|
<?php |
|
|
|
foreach ($produits as $p) { |
|
|
|
if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) { |
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $commandes); |
|
|
|
$str_quantite = ''; |
|
|
|
if ($quantite) |
|
|
|
$str_quantite = $quantite; |
|
|
|
|
|
|
|
echo '<td class="' . (($p->vrac) ? 'vrac' : '') . '">' . $str_quantite . '</td>'; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
</tr> |
|
|
|
</tfoot> |
|
|
|
</table> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
</div> |
|
|
|
</div> |