indexSuccess.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <div class="content-add01">
  2. <div class="heading01"><h1>Liste des commandes fournisseurs (<?php echo $pager->getNbResults() ?>)</h1></div>
  3. </div>
  4. <div class="filter">
  5. <div class="filter-left">&nbsp;</div>
  6. <div class="filter-middle">
  7. <?php echo form_tag('@katao_order_filter') ?>
  8. <?php echo select_tag('filter_status', options_for_select(KataoOrderPeer::getAllStatuses(), $filter_status, array('include_custom' => '&mdash;&nbsp;Etat&nbsp;&mdash;'))) ?>
  9. <?php echo image_tag('separator02.gif', array('alt' => '')) ?>&nbsp;<?php echo select_tag('filter_supplier', options_for_select(KataoSupplierPeer::getAllSimple(), $filter_supplier, array('include_custom' => '&mdash;&nbsp;Fournisseur&nbsp;&mdash;'))) ?>
  10. <?php echo image_tag('separator02.gif', array('alt' => '')) ?>&nbsp;<?php echo select_tag('filter_node', options_for_select(KataoNodePeer::getAllArray(), $filter_node, array('include_custom' => '&mdash;&nbsp;Noeud&nbsp;&mdash;'))) ?>
  11. <?php echo image_tag('separator02.gif', array('alt' => '')) ?>&nbsp;<?php echo select_tag('filter_period', options_for_select(KataoPeriodPeer::getAll(), $filter_period, array('include_custom' => '&mdash;&nbsp;Période&nbsp;&mdash;'))) ?>
  12. <?php echo submit_tag('', array('class' => 'btn-search', 'title' => 'Filtrer')) ?><div style="float:right"><a href="<?php echo url_for('@katao_order_filter_reset') ?>">[annuler]</a></div>
  13. </form>
  14. </div>
  15. <div class="filter-right">&nbsp;</div>
  16. </div>
  17. <?php if (empty($katao_orderList)): ?>
  18. <p>Aucune commande.</p>
  19. <?php else : ?>
  20. <?php use_helper('Javascript') ?>
  21. <?php echo link_to('Marquer les commandes sélectionnées (' . multiple_action_info_selected('katao_order') . ') comme ajustées', '@katao_order_adjust_multiple', array('class' => 'adjust', 'confirm' => 'Êtes-vous sûr de vouloir marquer les commandes sélectionnées comme ajustées ?')) ?>
  22. <?php echo link_to('Générer les factures adhérents', '@katao_order_generate_invoices', array('class' => 'invoice')) ?>
  23. <div style="padding-top:4px">
  24. <span class="pdf">Exporter les commandes : </span><?php echo link_to('toutes', '@katao_order_export_pdf_all') ?> | <?php echo link_to('sélectionnées (' . multiple_action_info_selected('katao_order') . ')', '@katao_order_export_pdf_selected') ?>
  25. <?php echo link_to('Supprimer les commandes sélectionnées (' . multiple_action_info_selected('katao_order') . ')', '@katao_order_delete_multiple', array('class' => 'delete', 'confirm' => 'Êtes-vous sûr de vouloir supprimer les commandes sélectionnées ?')) ?>
  26. </div>
  27. <table class="admin-list">
  28. <tr>
  29. <th nowrap="nowrap" width="1%"><?php echo multiple_action_checkbox_all('katao_order') ?></th>
  30. <th nowrap="nowrap">N&deg; <?php echo sort_links($sf_request, 'no', 'kataoOrder/index') ?></th>
  31. <th nowrap="nowrap">Date <?php echo sort_links($sf_request, 'date', 'kataoOrder/index') ?></th>
  32. <th nowrap="nowrap">Etat <?php echo sort_links($sf_request, 'status', 'kataoOrder/index') ?></th>
  33. <th nowrap="nowrap">Fournisseur <?php echo sort_links($sf_request, 'supplier', 'kataoOrder/index') ?></th>
  34. <th nowrap="nowrap">Montant / Min.</th>
  35. <th nowrap="nowrap">Noeud <?php echo sort_links($sf_request, 'node', 'kataoOrder/index') ?></th>
  36. <th nowrap="nowrap">Période <?php echo sort_links($sf_request, 'period', 'kataoOrder/index') ?></th>
  37. <th nowrap="nowrap" width="1%">Actions</th>
  38. </tr>
  39. <?php foreach ($katao_orderList as/*(KataoOrder)*/ $katao_order): ?>
  40. <?php
  41. $criteria = new Criteria();
  42. $criteria->addAscendingOrderByColumn(KataoOrderProductPeer::PRODUCT_NAME);
  43. $katao_order_products = $katao_order->getKataoOrderProductsJoinKataoProduct($criteria);
  44. $total = 0;
  45. $katao_order_products_data = array();
  46. foreach ($katao_order_products as/*(KataoOrderProduct)*/ $katao_order_product) {
  47. $katao_product = $katao_order_product->getKataoProduct();
  48. $quantity_adjusted = $katao_order_product->getQuantity();
  49. $quantity_received = $katao_order_product->getHasBeenReceived()?$katao_order_product->getQuantityReceived():CONST_N_A;
  50. $quantity_delivered = $katao_order_product->getHasBeenDelivered()?$katao_order_product->getQuantityDelivered():CONST_N_A;
  51. $quantity = $quantity_delivered;
  52. if (CONST_N_A === $quantity) {
  53. $quantity = $quantity_received;
  54. }
  55. if (CONST_N_A === $quantity) {
  56. $quantity = $quantity_adjusted;
  57. }
  58. $price = round($katao_order_product->getProductPriceEuro() * (1 + $katao_order_product->getProductTvaRate()), 2);
  59. $sub_total = $quantity * $price;
  60. $total += $sub_total;
  61. $katao_order_products_data[] = array('id' => $katao_order_product->getId(),
  62. 'product_name' => $katao_order_product->getProductName(),
  63. 'quantity_adjusted' => $quantity_adjusted,
  64. 'quantity_received' => $quantity_received,
  65. 'quantity_delivered' => $quantity_delivered,
  66. 'price' => $price,
  67. 'sub_total' => $sub_total,
  68. 'last_incomplete_package' => $katao_product->getLastIncompletePackageQuantity($katao_order->getKataoPeriodId(), $katao_order->getKataoNodeId(), true),
  69. 'order_details' => $katao_product->getOrderDetails($katao_order->getKataoPeriodId(), $katao_order->getKataoNodeId(), true),
  70. );
  71. }
  72. ?>
  73. <tr valign="top" class="line">
  74. <td class="center"><?php echo multiple_action_checkbox_line('katao_order', $katao_order->getId()) ?></td>
  75. <td nowrap="nowrap">
  76. <a href="javascript://" onclick="toggleDetails('<?php echo $katao_order->getId() ?>');" title="Détails"><?php echo image_tag('actions/expand.png', array('alt' => 'Détails', 'id' => 'order-icon-' . $katao_order->getId(), 'align' => 'bottom')) ?></a>
  77. <?php echo $katao_order->getNumber() ?>
  78. </td>
  79. <td nowrap="nowrap"><?php echo $katao_order->getCreatedAtStr() ?></td>
  80. <td nowrap="nowrap"><?php echo $katao_order->getStatusStr() ?></td>
  81. <td><?php echo $katao_order->getSupplierName() ?></td>
  82. <td nowrap="nowrap" style="text-align:right!important">
  83. <?php echo Utils::formatCurrencyEuro($total) ?> / <?php echo Utils::formatCurrencyEuro($katao_order->getKataoSupplier()->getOrderMinAmount()) ?>
  84. <?php $order_min_amount = $katao_order->getKataoSupplier()->getOrderMinAmount() ?>
  85. <?php $is_adjustable = $total >= $order_min_amount ?>
  86. <span id="order-status-red-<?php echo $katao_order->getId() ?>" style="display: <?php echo $is_adjustable?'none':'inline' ?>"><?php echo image_tag('actions/bullet_red.png', array('alt' => 'Montant minimum NON atteint et/ou colisage NON complet', 'title' => 'Montant minimum NON atteint et/ou colisage NON complet', 'align' => 'top')) ?></span>
  87. <span id="order-status-green-<?php echo $katao_order->getId() ?>" style="display: <?php echo $is_adjustable?'inline':'none' ?>"><?php echo image_tag('actions/bullet_green.png', array('alt' => 'Montant minimum atteint et colisage complet', 'title' => 'Montant minimum atteint et colisage complet', 'align' => 'top')) ?></span>
  88. </td>
  89. <td nowrap="nowrap"><?php echo $katao_order->getNodeLink() ?></td>
  90. <td nowrap="nowrap"><?php echo $katao_order->getPeriodLink() ?></td>
  91. <td nowrap="nowrap">
  92. <?php if (KataoOrder::STATUS_GENERATED == $katao_order->getStatus()): ?>
  93. <span id="order-link-adjust-<?php echo $katao_order->getId() ?>" style="display: <?php echo $is_adjustable?'inline':'none' ?>"><?php echo catalyz_link_to_image_tag('@katao_order_adjust?id=' . $katao_order->getId(), 'actions/adjust.png', array('title' => 'Marquer comme ajustée', 'confirm' => 'Êtes-vous sûr de vouloir marquer cette commande comme ajustée ?'), array('alt' => 'Marquer comme ajustée')) ?></span>
  94. <?php if (!$sf_user->isJustDelegate()): ?>
  95. <?php echo catalyz_link_to_image_tag('@katao_order_force_adjustment?id=' . $katao_order->getId(), 'actions/force.png', array('title' => 'Forcer l\'ajustement', 'confirm' => 'Êtes-vous sûr de vouloir forcer l\'ajustement de cette commande ?\nATTENTION : il se peut que le colisage des produits ne soit pas complet\net que le montant minimum de la commande ne soit pas atteint.'), array('alt' => 'Forcer l\'ajustement')) ?>
  96. <?php endif ?>
  97. <?php else: ?>
  98. <?php echo catalyz_link_to_image_tag('@katao_order_pdf?id=' . $katao_order->getId(), 'actions/pdf.png', array('title' => 'Exporter en PDF'), array('alt' => 'Exporter en PDF')) ?>
  99. <?php endif ?>
  100. <?php if (KataoOrder::STATUS_ADJUSTED == $katao_order->getStatus()): ?>
  101. <?php echo catalyz_link_to_image_tag('@katao_order_send?id=' . $katao_order->getId(), 'actions/send.png', array('title' => 'Envoyer au fournisseur', 'confirm' => 'Êtes-vous sûr de vouloir envoyer la commande au fournisseur ?'), array('alt' => 'Envoyer au fournisseur')) ?>
  102. <?php elseif (KataoOrder::STATUS_SENT == $katao_order->getStatus()): ?>
  103. <?php echo catalyz_link_to_image_tag('@katao_order_receive?id=' . $katao_order->getId(), 'actions/receive.png', array('title' => 'Marquer comme réceptionnée'), array('alt' => 'Marquer comme réceptionnée')) ?>
  104. <?php elseif (KataoOrder::STATUS_RECEIVED == $katao_order->getStatus() && $katao_order->checkIfAllProductsHaveBeenDelivered()): ?>
  105. <?php echo catalyz_link_to_image_tag('@katao_order_deliver?id=' . $katao_order->getId(), 'actions/deliver.png', array('title' => 'Marquer comme délivrée', 'confirm' => 'Êtes-vous sûr de vouloir marquer cette commande comme délivrée ?'), array('alt' => 'Marquer comme délivrée')) ?>
  106. <?php endif ?>
  107. <?php echo catalyz_link_to_image_tag('@katao_order_delete?id=' . $katao_order->getId(), 'actions/delete.png', array('title' => 'Supprimer', 'confirm' => 'Êtes-vous sûr de vouloir supprimer cette commande ?'), array('alt' => 'Supprimer')) ?>
  108. </td>
  109. </tr>
  110. <tr valign="top" style="display: none" id="order-details-<?php echo $katao_order->getId() ?>">
  111. <td colspan="9">
  112. <table class="admin-sub-list">
  113. <tr>
  114. <th>Produit</th>
  115. <th nowrap="nowrap" width="1%">Colisage</th>
  116. <th nowrap="nowrap" width="1%"><?php echo image_tag('actions/adjust.png', array('alt' => 'Quantité commandée', 'title' => 'Quantité commandée')) ?></th>
  117. <th nowrap="nowrap" width="1%"><?php echo image_tag('actions/receive.png', array('alt' => 'Quantité réceptionnée', 'title' => 'Quantité réceptionnée')) ?></th>
  118. <th nowrap="nowrap" width="1%"><?php echo image_tag('actions/deliver.png', array('alt' => 'Quantité délivrée', 'title' => 'Quantité délivrée')) ?></th>
  119. <th nowrap="nowrap" width="1%">Prix TTC</th>
  120. <th nowrap="nowrap" width="1%">Total</th>
  121. </tr>
  122. <?php foreach ($katao_order_products_data as $katao_order_product_infos): ?>
  123. <tr valign="top">
  124. <td>
  125. <?php echo $katao_order_product_infos['product_name'] ?>
  126. <?php echo catalyz_link_to_image_tag('@katao_order_product_adjust?id=' . $katao_order_product_infos['id'], 'actions/adjust.png', array('title' => 'Ajuster'), array('alt' => 'Ajuster', 'align' => 'top')) ?>
  127. <?php if (!empty($katao_order_product_infos['last_incomplete_package'])): ?>
  128. <?php echo javascript_tag('$("order-status-red-' . $katao_order->getId() . '").style.display = "inline"; $("order-status-green-' . $katao_order->getId() . '").style.display = "none"; $("order-link-adjust-' . $katao_order->getId() . '").style.display = "none";') ?>
  129. <?php endif ?>
  130. </td>
  131. <td nowrap="nowrap"><?php echo $katao_order_product_infos['order_details'] ?></td>
  132. <td nowrap="nowrap" style="text-align:right!important"><?php echo $katao_order_product_infos['quantity_adjusted'] ?></td>
  133. <td nowrap="nowrap" style="text-align:right!important"><?php echo $katao_order_product_infos['quantity_received'] ?></td>
  134. <td nowrap="nowrap" style="text-align:right!important"><?php echo $katao_order_product_infos['quantity_delivered'] ?></td>
  135. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($katao_order_product_infos['price']) ?></td>
  136. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($katao_order_product_infos['sub_total']) ?></td>
  137. </tr>
  138. <?php endforeach ?>
  139. <tr>
  140. <td colspan="2" style="border:none!important">
  141. <?php if (KataoOrder::STATUS_SENT == $katao_order->getStatus()): ?>
  142. <?php echo link_to('Ajouter un nouveau produit à cette commande', '@katao_order_receive_new_product?id=' . $katao_order->getId(), array('class' => 'add')) ?>
  143. <?php endif ?>
  144. </td>
  145. <th colspan="4" nowrap="nowrap" style="text-align:right!important">MONTANT TOTAL TTC</th>
  146. <th nowrap="nowrap" style="text-align:right!important"><?php echo utils::formatCurrencyEuro($total) ?></th>
  147. </tr>
  148. </table>
  149. <?php if ('' != $katao_order->getDeliveryAddress()): ?>
  150. <p><u>Adresse de livraison</u> : <?php echo str_replace("\n", ' - ', $katao_order->getDeliveryAddress()) ?></p>
  151. <?php endif ?>
  152. </td>
  153. </tr>
  154. <?php endforeach ?>
  155. </table>
  156. <?php echo pager($pager, sprintf('kataoOrder/index?sort=%s%s', $sf_request->getParameter('sort', 'supplier'), $sf_request->hasParameter('desc')?'&desc=on':''), 'katao_order') ?>
  157. <?php endif ?>
  158. <script type="text/javascript" language="JavaScript">
  159. /* <![CDATA[ */
  160. function toggleDetails( id ){
  161. $('order-details-'+id).toggle();
  162. if($('order-details-'+id).visible()) {
  163. $('order-icon-'+id).src = '<?php echo image_path('actions/collapse.png') ?>';
  164. } else {
  165. $('order-icon-'+id).src = '<?php echo image_path('actions/expand.png') ?>';
  166. }
  167. }
  168. /* ]]> */
  169. </script>