re-work coupons to allow multiple coupon types
[bse.git] / site / templates / admin / order_detail.tmpl
1 <:wrap admin/base.tmpl title => [concatenate "Order " [order id] " details"] bodyid => bse-order-detail :> 
2 <h1>Shop Administration</h1>
3 <p>| <a href="<:adminurl menu:>">Admin menu</a> |
4 <a href="<:adminurl shopadmin:>">Manage catalogs</a> |
5 <a href="<:adminurl shopadmin order_list 1:>">Manage orders</a> |
6 <a href="<:adminurl shopadmin order_list 1 template order_list_unfilled:>">Unfilled 
7   orders</a> |
8 <a href="<:adminurl shopadmin order_list 1 template order_list_filled:>">Filled 
9   orders</a> |
10 <:ifSiteuser id:><a href="<:adminurl siteusers a_edit 1 id [siteuser id]:>">Edit Member</a> |
11 <a href="<:adminurl siteusers a_edit 1 id [siteuser id] _t orders:>">Other member orders</a> |<:or:><:eif:>
12 </p>
13 <:ifMessage:><div class="message"><:message:></div><:or:><:eif:>
14 <h2>Order details - No: #<:order id:></h2>
15 <h3>Received: <span class="date order-date" data-datetime="<:date "%y-%m-%dT%H:%M:%S" order orderDate:>"><:date "%d/%m/%Y %I:%M%P" order orderDate:></span></h3>
16 <:ifOrder purchase_order:>
17 <h3 class="purchase-order">Purchase Order: <span class="purchase-order"><:order purchase_order:></span></h3>
18 <:or:><:eif:>
19 <:ifOrder complete:><:or:><p>This order is incomplete and should not be filled.</p><:eif:>
20 <table class="editform orderdetail_head">
21   <tr>
22     <th colspan="2" class="col_typehead">Billing</th>
23     <td rowspan="6">&nbsp;</td>
24     <th colspan="2" class="col_typehead">Delivery</th>
25   </tr>
26   <tr> 
27     <th class="col_head">E-mail:</th>
28     <td class="col_value"><a href="mailto:<:order billEmail:>"><:order billEmail:></a></td>
29     <th class="col_head">Email:</th>
30     <td class="col_value"><a href="mailto:<:order emailAddress:>"><:order emailAddress:></a></td>
31   </tr>
32   <tr> 
33     <th class="col_head">Phone:</th>
34     <td class="col_value"><a href="tel:<:order billTelephone:>"><:order billTelephone:></a></td>
35     <th class="col_head">Phone:</th>
36     <td class="col_value"><a href="tel:<:order telephone:>"><:order telephone:></a></td>
37   </tr>
38   <tr> 
39     <th class="col_head">Mobile:</th>
40     <td class="col_value"><a href="tel:<:order billMobile:>"><:order billMobile:></a></td>
41     <th class="col_head">Mobile:</th>
42     <td class="col_value"><a href="tel:<:order delivMobile:>"><:order delivMobile:></a></td>
43   </tr>
44   <tr> 
45     <th class="col_head">Facsimile:</th>
46     <td class="col_value"><a href="fax:<:order billFacsimile:>"><:order billFacsimile:></a></td>
47     <th class="col_head">Facsimile:</th>
48     <td class="col_value"><a href="fax:<:order facsimile:>"><:order facsimile:></a></td>
49   </tr>
50   <tr> 
51     <th class="col_head">Address:</th>
52     <td class="col_value">
53       <:order billFirstName:> <:order billLastName:>
54       <:ifOrder billOrganization:><br /><:order billOrganization:><:or:><:eif:>
55       <br /><:order billStreet:>
56       <:ifOrder billStreet2:><br /><:order billStreet2:><:or:><:eif:>
57       <br /><:order billSuburb:> <:order billState:> <:order billPostCode:>
58       <br /><:order billCountry:>
59     </td>
60     <th class="col_head">Address:</th>
61     <td class="col_value"><:order delivFirstName:> <:order delivLastName:>
62       <:ifOrder delivOrganization:><br /><:order delivOrganization:><:or:><:eif:>
63       <br /><:order delivStreet:>
64       <:ifOrder delivStreet2:><br /><:order delivStreet2:><:or:><:eif:>
65       <br /><:order delivSuburb:> <:order delivState:> <:order delivPostCode:>
66       <br /><:order delivCountry:></td>
67   </tr>
68 <:ifOrder instructions:>
69   <tr>
70     <th>Special Instructions:</th>
71     <td colspan="4" class="col_instructions"><:order instructions:></td>
72   </tr>
73 <:or:><:eif:>
74   <:include custom/order_detail.include optional:><:include admin/include/custom/order_detail_custom.tmpl optional:><:include admin/include/order_detail_custom.tmpl optional:>
75 </table>
76
77 <br />
78       <table class="editform orderdetail">
79         <tr> 
80           <th class="col_description">Description</th>
81           <th class="col_units">Units</th>
82           <th class="col_unit_wsale">Unit Wsale</th>
83           <th class="col_ext_wsale">Ext Wsale</th>
84           <th class="col_unit_gst">Unit GST</th>
85           <th class="col_ext_gst">Ext GST</th>
86           <th class="col_unitprice">Unit Price</th>
87           <th class="col_extension">Extension</th>
88 </tr>
89 <:.for item in [order.items] -:>
90   <:.set product = @undef -:>
91   <:.if item.productId > 0 -:>
92     <:.set product = bse.products.getByPkey(item.productId) -:>
93   <:.end if -:>
94         <tr> 
95           <td class="col_description"><:.if product :><a href="<:= product.admin :>"><:= product.title :></a><:.else:><:= item.title :> (product deleted)<:.end if:> <:= item.nice_options:>
96           <:.if item.tier_id:><br><span class="price_tier"><:= item.tier.description :></span><:.end if:>
97           <:.if item.product_discount_units -:>
98           <br><span class="productdiscount">
99             <:.if item.product_discount_units < item.units -:>
100           (Saved $<:= bse.number("money", item.product_discount) :> on the first <:= item.product_discount_units :> units)
101             <:-.else -:>
102 Saved $<:= bse.number("money", item.product_discount) :> on each unit
103             <:.end if -:>
104 &nbsp;(total $<:= bse.number("money", item.product_discount * item.product_discount_units) :>)
105            </span>
106           <:-.end if -:>
107           </td>
108           <td class="col_units"><:= item.units:></td>
109           <td class="col_unit_wsale"><:= bse.number("money", item.wholesalePrice) :></td>
110           <td class="col_ext_wsale"><:= bse.number("money", item.extended("wholesalePrice")) :></td>
111           <td class="col_unit_gst"><:= bse.number("money", item.gst):></td>
112           <td class="col_ext_gst"><:= bse.number("money", item.extended("gst")):></td>
113           <td class="col_unitprice"><:= bse.number("money", item.price):></td>
114           <td class="col_extension"><:= bse.number("money", item.extended("price")) :></td>
115 </tr>
116 <:.end for -:>
117 <tr>
118   <td colspan="7" class="col_label_right">Total Price of goods:</td>
119   <td  class="col_extension"><:= bse.number("money", order.total_cost) -:></td>
120 </tr>
121 <:.if order.coupon -:>
122 <tr>
123    <td>Coupon code <b><:= order.coupon_code -:></b> (<:= order.coupon_description :>)</td>
124    <td colspan="6" class="col_label_right">Discount:</td>
125    <td class="col_extension">(<:= bse.number("money", order.product_cost_discount) -:>)</td>
126 </tr>
127 <tr>
128    <td colspan="7" class="col_label_right">Discounted total:</td>
129    <td class="col_extension"><:= bse.number("money", order.discounted_product_cost) -:></td>
130 </tr>
131 <:.end if -:>
132         <tr> 
133           <td colspan="7" class="col_contact">
134 <:if Eq [order shipping_name] "none":>
135 Nothing to ship.
136 <:or:>
137 <form method="post" action="<:adminurl shopadmin a_order_save 1:>">
138 Shipping via <:shipping_method_select:>
139     <input type="hidden" name="id" value="<:order id:>" />
140     <:csrfp shop_order_save hidden:>
141     <label>tracking code: <input type="text" name="freight_tracking" value="<:order freight_tracking:>" /></label>
142     <input type="submit" name="a_order_save" value="Save" />
143     </form>
144 <:eif:>
145 </td>
146           <td class="col_extension"><:money order shipping_cost:></td>
147 </tr>
148         <tr> 
149           <td colspan="3" class="col_total">Total:</td>
150           <td class="col_ext_wsale total"><:money order wholesaleTotal:></td>
151           <td>&nbsp;</td>
152           <td class="col_ext_gst total"><:money order gst:></td>
153           <td>&nbsp;</td>
154           <td class="col_extension total"><:money order total:></td>
155 </tr>
156 </table>
157 <p>Order progress: <:stage_description:> <a href="#" onclick="document.getElementById('update_stage').style.display='block'; this.style.display='none'; return false;">update</a></p>
158
159 <form id="update_stage" action="<:adminurl shopadmin:>" style="display: none" method="post">
160   <input type="hidden" name="id" value="<:order id:>" />
161   <:csrfp shop_order_save hidden:>
162   <:stage_select:>
163   <label>Log note: <input type="text" name="stage_note" size="40" /> (optional)</label>
164   <input type="submit" name="a_order_save" value="Save" />
165 </form>
166
167 <:.if !order.paidFor :>
168 <p>This order hasn't been paid</p>
169
170 <form action="<:adminurl2 shopadmin:>" method="post">
171 <input type="hidden" name="id" value="<:= order.id :>" />
172 <:csrfp shop_order_paid hidden:>
173 Payment type: <:.call "make_select", "name": "paymentType", "list": payment_types, "id": "id", "desc": "desc", "default": order.paymentType -:>
174 <input type="submit" name="a_order_paid" value="Mark this order paid" /></form>
175 <:.elsif order.is_manually_paid -:>
176 <form action="<:adminurl2 shopadmin:>" method="post">
177 This order has been manually marked paid via <:= payment_type_desc | html :>
178 <input type="hidden" name="id" value="<:= order.id :>" />
179 <:csrfp shop_order_unpaid hidden:>
180 <input type="submit" name="a_order_unpaid" value="Mark this order unpaid" /></form>
181
182 <:.elsif order.ccOnline:>
183 <p>This was processed as an online credit card transaction.</p>
184 <:.if order.ccSuccess:>
185 <p>This transaction was <b>SUCCESSFUL</b>.</p>
186 <table>
187 <tr><th>Receipt Number:</th><td><:order ccReceipt:></td></tr>
188 <:.if order.ccTranId:>
189 <tr><th>Transaction Id:</th><td><:order ccTranId:></td></tr>
190 <:.end if:>
191 <:.if order.ccName:>
192 <tr><th>Card Holder:</th><td><:order ccName:></td>
193 <:.end if:>
194 <:.if order.ccPAN:>
195 <tr><th>Card Number (partial):</th><td>...<:order ccPAN:></td>
196 <:.end if:>
197 </table>
198 <:.else:>
199 <p>This transaction <b>FAILED</b>.</p>
200 <table>
201 <tr><th>Status:</th><td><:order ccStatus:></td>
202 <tr><th>Error:</th><td><:order ccStatusText:></td>
203 <:.if order.ccStatus2:>
204 <tr><th>More status</th><td><:order ccStatus2:></td>
205 <:.end if:>
206 </table>
207 <:.end if:>
208 <:.elsif order.paymentType == 0:>
209 <p>Payment made by credit card.  Credit card details can be found in the encrypted email you received when the customer made the order.</p>
210 <:.if order.ccPAN or order.ccName :>
211 <table>
212 <:.if order.ccName:>
213 <tr><th>Card Holder</th><td><:order ccName:></td>
214 <:.end if:>
215 <:.if order.ccPAN:>
216 <tr><th>Card Number (partial)</th><td>...<:order ccPAN:></td>
217 <:.end if:>
218 </table>
219 <:.end if:>
220 <:.elsif order.paymentType == 1 -:>
221   <p>Payment will be made by cheque.</p>
222 <:.elsif order.paymentType == 2 -:>
223   <p>Contact the customer to arrange for payment.</p>
224 <:.elsif order.paymentType == 4:><p>Paid via PayPal, transaction id <:order paypal_tran_id:><:ifUserCan bse_shop_order_refund_paypal:> <a href="<:adminurl shopadmin a_paypal_refund 1 id [order id]:>">Refund</a><:or:><:eif:></p>
225 <:.end if:>
226 <:include custom/order_detail_payment.include optional:>
227 <:.if order.filled:>
228 <p>This order was filled on <:date order whenFilled:> by <:order whoFilled:>.</p>
229 <:.elsif order.complete:>
230 <p>This order hasn't been filled yet.  <a href="<:adminurl shopadmin id [order id] order_filled Yep filled 1 detail 1:>">Mark order filled</a>.</p>
231 <:.end if:>
232 <:.if order.instructions:>
233 <p style="white-space: pre-wrap;"><:order instructions:></p>
234 <:.end if:>
235
236 <table class="editform" id="auditlog">
237 <:include admin/include/audithead.tmpl:>
238 <:iterator begin auditlog object_id [order id] object_type BSE::TB::Order:>
239 <:include admin/include/auditentry.tmpl:>
240 <:iterator end auditlog:>
241 </table>