You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
8.0 KiB

  1. ::use 'design.mtt'::
  2. <div class="col-md-12">
  3. <div class="article">
  4. <div class="text-center">
  5. <h3>
  6. ::_("Validate the delivery of the"):: ::hDate(date)::
  7. </h3>
  8. <h4
  9. ><span class="glyphicon glyphicon-map-marker"></span>::place::
  10. </h4>
  11. </div>
  12. ::set total = 0::
  13. <table class="table table-condensed table-bordered">
  14. <tr style="background-color:#DDD;">
  15. <th colspan="9" class="text-center">Commande</th>
  16. </tr>
  17. <tr class="head">
  18. <td colspan="9">
  19. <div class="basketNumber" ::cond basket!=null:: >
  20. <i class="fa fa-shopping-basket" aria-hidden="true"></i> N°::basket.num::
  21. </div>
  22. ::member.getName()::
  23. </td>
  24. </tr>
  25. <tr>
  26. <th>::_("Contract")::</th>
  27. <th>::_("Qty")::</th>
  28. <th>::_("Ref")::</th>
  29. <th>::_("Product")::</th>
  30. <th><a href="#" data-toggle="tooltip" data-placement="top" title="::_("Unit price incl. VAT")::">::_("U.P.")::</a></th>
  31. <th>::_("Sub-total")::</th>
  32. <th>::_("Fees")::</th>
  33. <th>::_("Total")::</th>
  34. <th>::_("Paid")::</th>
  35. </tr>
  36. ::foreach o orders::
  37. <tr>
  38. <td>
  39. <a href="/contractAdmin/view/::o.contractId::">
  40. ::short(o.contractName,40)::
  41. </a>
  42. </td>
  43. <td>
  44. ::raw o.smartQt:
  45. </td>
  46. <td>
  47. $$nullSafe(::o.productRef::)
  48. </td>
  49. <td>
  50. ::short(o.productName,40)::
  51. </td>
  52. <td>
  53. ::formatNum(o.productPrice)::&nbsp;::currency()::
  54. </td>
  55. <td>
  56. ::formatNum(o.subTotal)::&nbsp;::currency()::
  57. </td>
  58. <td>
  59. <!-- fees -->
  60. ::if o.percentageValue!=null::
  61. <a href="#" data-toggle="tooltip" data-placement="top" title="::o.percentageName:: : ::o.percentageValue:: %">
  62. ::formatNum(o.fees)::&nbsp;::currency()::
  63. </a>
  64. ::end::
  65. </td>
  66. <td>
  67. <!-- total -->
  68. ::formatNum(o.total)::&nbsp;::currency()::
  69. ::set total = total + o.total::
  70. </td>
  71. <td>
  72. $$check(::o.paid::)
  73. </td>
  74. </tr>
  75. ::end::
  76. <tr class="subrow">
  77. <th colspan="7" class="text-right">::_("Total ordered")::</th>
  78. <th>::formatNum(total)::&nbsp;::currency()::</th>
  79. <th></th>
  80. </tr>
  81. </table>
  82. ::if (user._amap.hasShopMode())::
  83. <!-- PAYMENT CHECK FOR SHOP MODE -->
  84. <table class="table table-condensed table-bordered">
  85. <tr style="background-color:#DDD;">
  86. <th colspan="9" class="text-center">::_("Payment")::</th>
  87. </tr>
  88. ::set op = basket.getOrderOperation(false)::
  89. ::if op!=null::
  90. <tr>
  91. $$operation(::op::)
  92. <td></td>
  93. </tr>
  94. ::set tpaid = 0::
  95. ::foreach tt op.getRelatedPayments()::
  96. <tr>
  97. $$operation(::tt::)
  98. ::if !tt.pending::
  99. ::set tpaid = tpaid + tt.amount::
  100. ::end::
  101. <td>
  102. ::if(tt.pending)::
  103. <a href="/validate/::date::/::place.id::/::member.id::/validateOp/::tt.id::?token=::token::" class="btn btn-primary btn-sm">
  104. <span class="glyphicon glyphicon-ok"></span>
  105. ::_("This payment was received")::
  106. </a>
  107. $$delete(::_("Del.")::,/validate/::date::/::place.id::/::member.id::/deleteOp/::tt.id::?token=::token::)
  108. ::end::
  109. </td>
  110. </tr>
  111. ::end::
  112. ::set amount = numClean(op.amount)::
  113. ::set tpaid = numClean(tpaid)::
  114. <!-- total -->
  115. <tr style="background-color:#DDD;">
  116. <td colspan="2"></td>
  117. <th class="text-right">::_("Total paid")::</th>
  118. <th>
  119. ::tpaid::&nbsp;::currency()::
  120. </th>
  121. <td colspan="2">
  122. </td>
  123. </tr>
  124. ::else::
  125. <tr><td>
  126. <div class="alert alert-danger text-center" style="width:50%;margin:auto;">
  127. ::_("This order has been made when payments were disabled")::
  128. </div>
  129. </td></tr>
  130. ::end::
  131. </table>
  132. <!-- credit / debit / ok message -->
  133. ::if(tpaid!=null && amount!=null)::
  134. ::if(tpaid+amount != 0)::
  135. ::set class="danger"::
  136. ::else::
  137. ::set class="success"::
  138. ::end::
  139. <div class="alert alert-::class:: text-center" style="width:50%;margin:12px auto">
  140. ::if(tpaid+amount > 0)::
  141. $$check(::false::)
  142. ::set str = Math.abs(tpaid+amount)+"&nbsp;"+currency()::
  143. ::raw __("Paid too much, credit of ::amount::",{amount:str})::
  144. ::elseif(tpaid+amount < 0)::
  145. $$check(::false::)
  146. ::_("Missing"):: ::Math.abs(tpaid+amount):: ::currency()::
  147. ::else::
  148. $$check(::true::) ::_("Everything is allright !")::
  149. ::end::
  150. </div>
  151. ::end::
  152. <p class="text-center" ::cond op!=null::>
  153. $$insert(::_("Key-in a refund")::,/validate/::date::/::place.id::/::member.id::/addRefund/)
  154. $$insert(::_("Key-in a payment")::,/validate/::date::/::place.id::/::member.id::/addPayment/)
  155. </p>
  156. <p class="text-center">
  157. <!--
  158. ::if(op!=null && tpaid+op.amount < 0)::
  159. <a href="" class="btn btn-default btn-lg disabled">
  160. <span class="glyphicon glyphicon-ok"></span>
  161. ::_("Validate this order")::
  162. </a>
  163. <div class="alert alert-danger text-center" style="width:50%;margin:auto;">
  164. ::raw _("You cannot validate this order because the amount paid<br/> by the member does not correspond to the total amount of his order!")::
  165. </div>
  166. ::else::
  167. -->
  168. <a href="/validate/::date::/::place.id::/::member.id::/validate/?token=::token::" class="btn btn-primary btn-lg">
  169. <span class="glyphicon glyphicon-ok"></span>
  170. ::_("Validate this order")::
  171. </a>
  172. <!--::end::-->
  173. </p>
  174. ::else::
  175. <!-- PAYMENT CHECK FOR STANDARD MODE -->
  176. <table class="table table-condensed table-bordered">
  177. <tr style="background-color:#DDD;">
  178. <th colspan="9" class="text-center">
  179. Solde de l'adhérent <a href="/member/payments/::member.id::" target="_blank" class="btn btn-default btn-xs">::_("Details")::</a>
  180. </th>
  181. </tr>
  182. ::foreach op operations::
  183. <tr>
  184. $$operation(::op::)
  185. <td>
  186. ::if(op.pending && op.type==2)::
  187. <a href="/validate/::date::/::place.id::/::member.id::/validateOp/::op.id::?token=::token::" class="btn btn-primary btn-sm">
  188. <span class="glyphicon glyphicon-ok"></span>
  189. ::_("This payment has been received")::
  190. </a>
  191. $$delete(Suppr.,/validate/::date::/::place.id::/::member.id::/deleteOp/::op.id::?token=::token::)
  192. ::end::
  193. </td>
  194. </tr>
  195. ::end::
  196. <tr style="font-size:1.3em;">
  197. <td colspan="2"></td>
  198. <td>Solde&nbsp;:</td>
  199. ::if balance<0::
  200. ::set color = "C00"::
  201. ::else::
  202. ::set color = "0C0"::
  203. ::end::
  204. <td style="color:#::color::;">
  205. ::balance::&nbsp;::currency()::
  206. </td>
  207. <td></td>
  208. </tr>
  209. </table>
  210. <p class="text-center">
  211. $$insert(::_("Key-in a refund")::,/validate/::date::/::place.id::/::member.id::/addRefund/)
  212. $$insert(::_("Key-in a payment")::,/validate/::date::/::place.id::/::member.id::/addPayment/)
  213. </p>
  214. <p class="text-center">
  215. ::if(balance < 0)::
  216. <a href="" class="btn btn-default btn-lg disabled">
  217. <span class="glyphicon glyphicon-ok"></span>
  218. ::_("Validate this order")::
  219. </a>
  220. <div class="alert alert-danger text-center" style="width:50%;margin:auto;">
  221. ::raw _("You cannot validate this order<br/>because the balance of the member is negative")::
  222. </div>
  223. ::else::
  224. <a href="/validate/::date::/::place.id::/::member.id::/validate/?token=::token::" class="btn btn-primary btn-lg">
  225. <span class="glyphicon glyphicon-ok"></span>
  226. ::_("Validate this order")::
  227. </a>
  228. ::end::
  229. </p>
  230. ::end::
  231. <!-- END -->
  232. <p class="text-center">
  233. <a href="/distribution/validate/::date::/::place.id::" class="btn btn-default btn-sm">
  234. <span class="glyphicon glyphicon-chevron-left"></span> ::_("Back to the delivery validation")::
  235. </a>
  236. <a href="/member/payments/::member.id::" target="_blank" class="btn btn-default btn-sm">::_("Payment history of this member")::</a>
  237. </p>
  238. </div>
  239. </div>
  240. ::end::