::use 'contractadmin/design.mtt'::

::_("Orders")::

::if distribution!=null:: ::_("Delivery of the"):: ::hDate(distribution.date):: ::end::
::if distribution!=null:: ::_("New order"):: ::else:: ::_("New order"):: ::end:: ::if distribution!=null:: $$export(/contractAdmin/orders/::c.id::?csv=1&d=::distribution.id::) ::_("Summary by products"):: ::else:: $$export(/contractAdmin/orders/::c.id::?csv=1) ::_("Summary by products"):: ::end::
::if disabledProducts > 0:: $$alert( ::raw __("Be careful, there are ::disabledProducts:: order(s) containing disabled products.",{disabledProducts:disabledProducts}):: ) ::end:: ::set total = 0:: ::set totalAdh = 0:: ::set name = "":: ::set name2 = "":: ::foreach m orders:: ::if m.userName != name || m.userName2 != name2:: ::end:: ::if m.disabled==true:: ::set class="danger":: ::else:: ::set class="":: ::end:: ::end::
::if distribution!=null:: ::set basket = getBasket(m.userId,distribution._place.id,distribution.date)::
N°::basket.num::
::end:: ::m.userName:: ::if m.userName2!=null:: ::_("alternated with"):: ::m.userName2:: ::end:: ::set name = m.userName :: ::set name2 = m.userName2 :: ::set totalAdh = totalAdh+1::
::if distribution!=null:: ::_("Edit"):: ::else:: ::_("Edit"):: ::end::
::_("Prod. ID"):: ::_("Qty"):: ::_("Product"):: ::_("U.P||price per unit"):: ::_("Sub-total"):: ::_("Fees"):: ::_("Total"):: ::_("Paid")::
$$nullSafe(::m.productRef::) ::if(m.quantity==0 && m.canceled):: ::_("Canceled"):: ::else:: ::raw m.smartQt:: ::end:: ::m.productName:: ::formatNum(m.productPrice):: ::currency():: ::formatNum(m.subTotal):: ::currency():: ::if m.percentageValue!=null:: ::formatNum(m.fees):: ::currency():: ::end:: ::formatNum(m.total):: ::currency():: ::set total = total + m.total:: ::if !m.canceled && m.quantity!=0:: ::if m.paid==true:: ::_("Paid"):: ::else:: ::_("Not paid"):: ::end:: ::end:: ::if(m.quantity==0)::      ::if distribution==null:: ::_("Delete"):: ::else:: ::_("Delete"):: ::end:: ::end::
::_("Total"):: ::formatNum(total):: ::currency()::
::raw __("::totalAdh:: member(s) in this distribution.",{totalAdh:totalAdh})::
::end::