::use 'design.mtt'::

::_("Validate the delivery of the"):: ::hDate(date)::

::place::

::set total = 0:: ::foreach o orders:: ::end::
Commande
N°::basket.num::
::member.getName()::
::_("Contract"):: ::_("Qty"):: ::_("Ref"):: ::_("Product"):: ::_("U.P."):: ::_("Sub-total"):: ::_("Fees"):: ::_("Total"):: ::_("Paid")::
::short(o.contractName,40):: ::raw o.smartQt: $$nullSafe(::o.productRef::) ::short(o.productName,40):: ::formatNum(o.productPrice):: ::currency():: ::formatNum(o.subTotal):: ::currency():: ::if o.percentageValue!=null:: ::formatNum(o.fees):: ::currency():: ::end:: ::formatNum(o.total):: ::currency():: ::set total = total + o.total:: $$check(::o.paid::)
::_("Total ordered"):: ::formatNum(total):: ::currency()::
::if (user._amap.hasShopMode()):: ::set op = basket.getOrderOperation(false):: ::if op!=null:: $$operation(::op::) ::set tpaid = 0:: ::foreach tt op.getRelatedPayments():: $$operation(::tt::) ::if !tt.pending:: ::set tpaid = tpaid + tt.amount:: ::end:: ::end:: ::set amount = numClean(op.amount):: ::set tpaid = numClean(tpaid):: ::else:: ::end::
::_("Payment")::
::if(tt.pending):: ::_("This payment was received"):: $$delete(::_("Del.")::,/validate/::date::/::place.id::/::member.id::/deleteOp/::tt.id::?token=::token::) ::end::
::_("Total paid"):: ::tpaid:: ::currency()::
::_("This order has been made when payments were disabled")::
::if(tpaid!=null && amount!=null):: ::if(tpaid+amount != 0):: ::set class="danger":: ::else:: ::set class="success":: ::end::
::if(tpaid+amount > 0):: $$check(::false::) ::set str = Math.abs(tpaid+amount)+" "+currency():: ::raw __("Paid too much, credit of ::amount::",{amount:str}):: ::elseif(tpaid+amount < 0):: $$check(::false::) ::_("Missing"):: ::Math.abs(tpaid+amount):: ::currency():: ::else:: $$check(::true::) ::_("Everything is allright !"):: ::end::
::end::

$$insert(::_("Key-in a refund")::,/validate/::date::/::place.id::/::member.id::/addRefund/) $$insert(::_("Key-in a payment")::,/validate/::date::/::place.id::/::member.id::/addPayment/)

::_("Validate this order")::

::else:: ::foreach op operations:: $$operation(::op::) ::end:: ::if balance<0:: ::set color = "C00":: ::else:: ::set color = "0C0":: ::end::
Solde de l'adhérent ::_("Details")::
::if(op.pending && op.type==2):: ::_("This payment has been received"):: $$delete(Suppr.,/validate/::date::/::place.id::/::member.id::/deleteOp/::op.id::?token=::token::) ::end::
Solde : ::balance:: ::currency()::

$$insert(::_("Key-in a refund")::,/validate/::date::/::place.id::/::member.id::/addRefund/) $$insert(::_("Key-in a payment")::,/validate/::date::/::place.id::/::member.id::/addPayment/)

::if(balance < 0):: ::_("Validate this order")::

::raw _("You cannot validate this order
because the balance of the member is negative")::
::else:: ::_("Validate this order"):: ::end::

::end::

::_("Back to the delivery validation"):: ::_("Payment history of this member")::

::end::