|
|
@@ -126,6 +126,56 @@ foreach ($produits as $p) { |
|
|
|
$champs_horaires_point_vente = 'horaires_' . $arr_jour_semaine[$num_jour_semaine]; |
|
|
|
?> |
|
|
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
<div class="panel-heading"> |
|
|
|
<h3 class="panel-title">Commandes</h3> |
|
|
|
</div> |
|
|
|
<div class="panel-body"> |
|
|
|
<!-- Nav tabs --> |
|
|
|
<ul class="nav nav-tabs" role="tablist"> |
|
|
|
<?php foreach($points_vente as $pv): ?> |
|
|
|
<li role="presentation" class="<?php if($pv->point_fabrication): ?>active<?php endif; ?>"> |
|
|
|
<a href="#point-vente-<?= $pv->id ?>" aria-controls="point-vente-<?= $pv->id ?>" role="tab" data-toggle="tab"><?= Html::encode($pv->nom) ?> <span class="label label-<?php if(count($pv->commandes)): ?>success<?php else: ?>danger<?php endif; ?>"><?php echo count($pv->commandes); ?></span></a> |
|
|
|
</li> |
|
|
|
<?php endforeach; ?> |
|
|
|
</ul> |
|
|
|
|
|
|
|
<!-- Tab panes --> |
|
|
|
<div class="tab-content"> |
|
|
|
<?php foreach($points_vente as $pv): ?> |
|
|
|
<div role="tabpanel" class="tab-pane<?php if($pv->point_fabrication): ?> active<?php endif; ?>" id="point-vente-<?= $pv->id ?>"> |
|
|
|
<table class="table"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<th>Produits</th> |
|
|
|
<th> |
|
|
|
<select> |
|
|
|
<option value="">Guillaume Bourgeois</option> |
|
|
|
<option value="">Jean-Marc Bonard</option> |
|
|
|
</select> |
|
|
|
</th> |
|
|
|
<th><a href="#" class="btn btn-default">Nouvelles commande</a></th> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<?php foreach ($produits as $p): ?> |
|
|
|
<?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?> |
|
|
|
<tr> |
|
|
|
<td><?php echo Html::encode($p->getLibelleAdmin()); ?></td> |
|
|
|
<td><?= rand(1,10) ?></td> |
|
|
|
<td><input type="text" /></td> |
|
|
|
</tr> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
|
|
|
|
</div> |
|
|
|
<?php endforeach; ?> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="panel panel-default"> |
|
|
|
<div class="panel-heading"> |
|
|
|
<h3 class="panel-title">Commandes</h3> |
|
|
@@ -133,174 +183,174 @@ foreach ($produits as $p) { |
|
|
|
<div class="panel-body"> |
|
|
|
<form class="form-commandes-point-vente" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index', 'date' => $date]); ?>" method="post"> |
|
|
|
|
|
|
|
<table class="table table-hover table-header-rotated"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<td class="title-point-vente" colspan="<?php echo count($produits) + 3; ?>"><strong>Global</strong></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th class="border-left"></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></th> |
|
|
|
<th class="title-totaux border-right"><strong>Commandé</strong></th> |
|
|
|
</tr> |
|
|
|
<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; |
|
|
|
<table class="table table-hover table-header-rotated"> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<td class="title-point-vente" colspan="<?php echo count($produits) + 3; ?>"><strong>Global</strong></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th class="border-left"></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></th> |
|
|
|
<th class="title-totaux border-right"><strong>Commandé</strong></th> |
|
|
|
</tr> |
|
|
|
<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; |
|
|
|
|
|
|
|
$classe = 'center total'; |
|
|
|
if ($str_quantite > $produits_selec[$p->id]['quantite_max'] && !$produits_selec[$p->id]['vrac']) { |
|
|
|
$classe .= ' depasse'; |
|
|
|
} |
|
|
|
$classe = 'center total'; |
|
|
|
if ($str_quantite > $produits_selec[$p->id]['quantite_max'] && !$produits_selec[$p->id]['vrac']) { |
|
|
|
$classe .= ' depasse'; |
|
|
|
} |
|
|
|
|
|
|
|
if ($p->vrac) { |
|
|
|
$classe .= ' vrac'; |
|
|
|
} |
|
|
|
if ($p->vrac) { |
|
|
|
$classe .= ' vrac'; |
|
|
|
} |
|
|
|
|
|
|
|
echo '<td class="' . $classe . '"><strong>' . $str_quantite . ' <span>'; |
|
|
|
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>'; |
|
|
|
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><strong><?php echo number_format($ca_potentiel, 2); ?> €</strong><br /><?php echo number_format($poids_total / 1000, 2); ?> kg</td> |
|
|
|
|
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<td><strong><?php echo str_replace(' ', ' ', $recettes_pain . ' €'); ?></strong><br /><?php echo round($poids_pain) . ' kg'; ?></td> |
|
|
|
|
|
|
|
<?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 class="border-left"></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 class="border-right"></th> |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
|
|
|
|
<?php foreach ($pv->commandes as $c): ?> |
|
|
|
<?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> |
|
|
|
<td class="client"> |
|
|
|
<?php if (isset($c->user)): ?> |
|
|
|
<?php echo Html::encode($c->user->prenom . ' ' . $c->user->nom); ?> |
|
|
|
<?php else: ?> |
|
|
|
<?php echo Html::encode($c->username); ?> |
|
|
|
<th class="border-left"></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 class="border-right"></th> |
|
|
|
</tr> |
|
|
|
|
|
|
|
<?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; ?> |
|
|
|
<?php foreach ($pv->commandes as $c): ?> |
|
|
|
<tr> |
|
|
|
<td class="client"> |
|
|
|
<?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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
<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> |
|
|
|
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 class="client"><!-- <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']) { |
|
|
|
$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>'; |
|
|
|
echo '<td class="td-produit' . (($p->vrac) ? ' vrac' : '') . '"><input class="quantite" type="text" value="0" name="produit_pv_' . $pv->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> |
|
|
|
<td></td> |
|
|
|
<td></td> |
|
|
|
</tr> |
|
|
|
<?php endforeach; ?> |
|
|
|
|
|
|
|
<tr> |
|
|
|
<td class="client"><!-- <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>'; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
if (count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) { |
|
|
|
echo '<tr>'; |
|
|
|
echo '<td><strong>Total pain</strong></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']) { |
|
|
|
|
|
|
|
//$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 = ''; |
|
|
|
|
|
|
|
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes); |
|
|
|
$str_quantite = ''; |
|
|
|
if (!$p->vrac) { |
|
|
|
//$cpt_non_vrac ++ ; |
|
|
|
if ($quantite) |
|
|
|
$str_quantite = $quantite; |
|
|
|
} |
|
|
|
|
|
|
|
if (!$p->vrac) { |
|
|
|
//$cpt_non_vrac ++ ; |
|
|
|
if ($quantite) |
|
|
|
$str_quantite = $quantite; |
|
|
|
echo '<td class="center' . (($p->vrac) ? ' vrac' : '') . '"><strong>' . $str_quantite . '</strong></td>'; |
|
|
|
} |
|
|
|
|
|
|
|
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>'; |
|
|
|
} |
|
|
|
?> |
|
|
|
// 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" /> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endforeach; ?> |
|
|
|
</tbody> |
|
|
|
</table> |
|
|
|
<input type="submit" class="btn btn-primary submit-pv" value="Enregistrer" name="submit_pv" /> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |