PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/catalog/YOUR_ADMIN/super_orders.php

https://github.com/numinix/numinix_barcodes
PHP | 1402 lines | 1179 code | 70 blank | 153 comment | 181 complexity | 6e6bc19e809239c0d6829076c5dbc20c MD5 | raw file
Possible License(s): GPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /*
  3. //////////////////////////////////////////////////////////
  4. // SUPER ORDERS //
  5. // //
  6. // By Frank Koehl (PM: BlindSide) //
  7. // //
  8. // Powered by Zen-Cart (www.zen-cart.com) //
  9. // Portions Copyright (c) 2005 The Zen-Cart Team //
  10. // //
  11. // Released under the GNU General Public License //
  12. // available at www.zen-cart.com/license/2_0.txt //
  13. // or see "license.txt" in the downloaded zip //
  14. //////////////////////////////////////////////////////////
  15. // DESCRIPTION: Replaces admin/orders.php, adding //
  16. // new features, navigation options, and an advanced //
  17. // payment management system. //
  18. //////////////////////////////////////////////////////////
  19. // $Id: super_orders.php 43 2006-08-29 14:05:21Z BlindSide $
  20. */
  21. //_TODO add admin account id to status history record
  22. //_TODO form verifications on edit & payment popup forms
  23. //_TODO payment_types table interface
  24. //_TODO popup class to build/display help or additional data in new window
  25. //_TODO make following replacements in all SO files...
  26. // <br> --> <br />
  27. // <b> --> <strong>
  28. // zen_db_output --> zen_db_scrub_out($x)
  29. // zen_db_input --> zen_db_scrub_in($x, true/false)
  30. // zen_db_prepare_input --> zen_db_scrub_in($x, true/false)
  31. require('includes/application_top.php');
  32. $action = (isset($_GET['action']) ? $_GET['action'] : '');
  33. $oID = (isset($_GET['oID']) ? (int)$_GET['oID'] : false);
  34. if ($oID) {
  35. require_once(DIR_WS_CLASSES . 'super_order.php');
  36. $so = new super_order($oID);
  37. }
  38. if (zen_not_null($action)) {
  39. switch ($action) {
  40. case 'mark_completed':
  41. $so->mark_completed();
  42. $messageStack->add_session(sprintf(SUCCESS_MARK_COMPLETED, $oID), 'success');
  43. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'action=edit&oID=' . $oID, 'NONSSL'));
  44. break;
  45. case 'mark_cancelled':
  46. $so->mark_cancelled();
  47. $messageStack->add_session(sprintf(WARNING_MARK_CANCELLED, $oID), 'warning');
  48. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'action=edit&oID=' . $oID, 'NONSSL'));
  49. break;
  50. case 'reopen':
  51. $so->reopen();
  52. $messageStack->add_session(sprintf(WARNING_ORDER_REOPEN, $oID), 'warning');
  53. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'action=edit&oID=' . $oID, 'NONSSL'));
  54. break;
  55. case 'add_note':
  56. $oID = $_POST['oID'];
  57. $new_admin_note = array();
  58. $new_admin_note['customers_id'] = $_POST['cID'];
  59. $new_admin_note['date_added'] = 'now()';
  60. $new_admin_note['admin_id'] = $_SESSION['admin_id'];
  61. $new_admin_note['notes'] = zen_db_scrub_in($_POST['notes']);
  62. $new_admin_note['karma'] = $_POST['karma'];
  63. zen_db_perform(TABLE_CUSTOMERS_ADMIN_NOTES, $new_admin_note);
  64. $messageStack->add_session(SUCCESS_NEW_ADMIN_NOTE, 'success');
  65. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'oID=' . $oID . '&action=edit', 'NONSSL'));
  66. break;
  67. case 'edit':
  68. // reset single download to on
  69. if ($_GET['download_reset_on'] > 0) {
  70. // adjust download_maxdays based on current date
  71. $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
  72. date_purchased from " . TABLE_ORDERS . "
  73. where orders_id = '" . $_GET['oID'] . "'");
  74. $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS;
  75. $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
  76. $db->Execute($update_downloads_query);
  77. unset($_GET['download_reset_on']);
  78. $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_ON, 'success');
  79. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  80. }
  81. // reset single download to off
  82. if ($_GET['download_reset_off'] > 0) {
  83. // adjust download_maxdays based on current date
  84. $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='0', download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";
  85. unset($_GET['download_reset_off']);
  86. $db->Execute($update_downloads_query);
  87. $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_OFF, 'success');
  88. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  89. }
  90. break;
  91. case 'update_order':
  92. $status = zen_db_scrub_in($_POST['status'], true);
  93. $comments = zen_db_scrub_in($_POST['comments']);
  94. $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
  95. date_purchased from " . TABLE_ORDERS . "
  96. where orders_id = '" . (int)$oID . "'");
  97. if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
  98. $customer_notified = '0';
  99. if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
  100. $customer_notified = '1';
  101. $notify = 'on';
  102. } else {
  103. $notify = 'off';
  104. }
  105. update_status($oID, $status, $notify, $comments);
  106. if ($customer_notified == '1') {
  107. email_latest_status($oID);
  108. }
  109. if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
  110. // adjust download_maxdays based on current date
  111. $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS;
  112. $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int)$oID . "'";
  113. $db->Execute($update_downloads_query);
  114. }
  115. $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
  116. }
  117. else {
  118. $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
  119. }
  120. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
  121. break;
  122. case 'deleteconfirm':
  123. zen_remove_order($oID, $_POST['restock']);
  124. $so->delete_all_data();
  125. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
  126. break;
  127. }
  128. }
  129. if (($action == 'edit') && isset($_GET['oID'])) {
  130. $orders = $db->Execute("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . $oID . "'");
  131. $order_exists = true;
  132. if ($orders->RecordCount() <= 0) {
  133. $order_exists = false;
  134. $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');
  135. zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
  136. }
  137. }
  138. require(DIR_WS_CLASSES . 'currencies.php');
  139. $currencies = new currencies();
  140. $orders_statuses = array();
  141. $orders_status_array = array();
  142. $orders_status = $db->Execute("select orders_status_id, orders_status_name
  143. from " . TABLE_ORDERS_STATUS . "
  144. where language_id = '" . (int)$_SESSION['languages_id'] . "'");
  145. while (!$orders_status->EOF) {
  146. $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'],
  147. 'text' => $orders_status->fields['orders_status_name'] . ' [' . $orders_status->fields['orders_status_id'] . ']');
  148. $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name'];
  149. $orders_status->MoveNext();
  150. }
  151. require(DIR_WS_CLASSES . 'order.php');
  152. ?>
  153. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  154. <html <?php echo HTML_PARAMS; ?>>
  155. <head>
  156. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  157. <title><?php echo TITLE; ?></title>
  158. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  159. <link rel="stylesheet" type="text/css" href="includes/super_stylesheet.css">
  160. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  161. <script language="javascript" src="includes/menu.js"></script>
  162. <script language="javascript" src="includes/general.js"></script>
  163. <script type="text/javascript">
  164. <!--
  165. function init()
  166. {
  167. cssjsmenu('navbar');
  168. if (document.getElementById)
  169. {
  170. var kill = document.getElementById('hoverJS');
  171. kill.disabled = true;
  172. }
  173. }
  174. function popupWindow(url, features) {
  175. window.open(url,'popupWindow',features)
  176. }
  177. // -->
  178. </script>
  179. </head>
  180. <body onload="init()">
  181. <!-- header //-->
  182. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  183. <!-- header_eof //-->
  184. <!-- body //-->
  185. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  186. <tr>
  187. <!-- body_text //-->
  188. <?php if (empty($action)) {?>
  189. <!-- search -->
  190. <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  191. <tr>
  192. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  193. <tr><?php echo zen_draw_form('search', FILENAME_SUPER_ORDERS, '', 'get', '', true); ?>
  194. <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  195. <td colspan="2" class="smallText" align="right">
  196. <?php
  197. // show search reset
  198. if ((isset($_GET['search']) && zen_not_null($_GET['search'])) or $_GET['cID'] !='') {
  199. echo '<a href="' . zen_href_link(FILENAME_SUPER_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />';
  200. }
  201. echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search');
  202. if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  203. $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  204. echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  205. }
  206. ?>
  207. </td>
  208. </form></tr>
  209. </table></td>
  210. </tr>
  211. <!-- search -->
  212. <?php
  213. } // END if (empty($action))
  214. /*
  215. ** ORDER DETAIL DISPLAY
  216. */
  217. if (($action == 'edit') && ($order_exists == true)) {
  218. $order = new order ($oID);
  219. if ($order->info['payment_module_code']) {
  220. if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
  221. require(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
  222. require(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
  223. $module = new $order->info['payment_module_code'];
  224. // echo $module->admin_notification($oID);
  225. }
  226. }
  227. // NUMINIX BARCODES
  228. if (MODULE_BARCODE_ORDERS_SWITCH == 'true') {
  229. $barcode = $db->Execute("SELECT orders_barcode FROM " . TABLE_ORDERS . " WHERE orders_id = " . $oID . " LIMIT 1");
  230. $barcode = $barcode->fields['orders_barcode'];
  231. if ($barcode == '') {
  232. // create barcode and store in db
  233. $barcode = MODULE_BARCODE_ORDERS_DEFAULT + $oID;
  234. $db->Execute("UPDATE " . TABLE_ORDERS . " SET orders_barcode = '" . $barcode . "' WHERE orders_id = " . $oID . " LIMIT 1");
  235. }
  236. }
  237. // END
  238. $get_prev = $db->Execute("SELECT orders_id FROM " . TABLE_ORDERS . " WHERE orders_id < '" . $oID . "' ORDER BY orders_id DESC LIMIT 1");
  239. if (zen_not_null($get_prev->fields['orders_id'])) {
  240. $prev_button = ' <INPUT TYPE="BUTTON" VALUE="<<< ' . $get_prev->fields['orders_id'] . '" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_SUPER_ORDERS, 'oID=' . $get_prev->fields['orders_id'] . '&action=edit') . '\'">';
  241. }
  242. else {
  243. $prev_button = ' <INPUT TYPE="BUTTON" VALUE="' . BUTTON_TO_LIST . '" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_SUPER_ORDERS) . '\'">';
  244. }
  245. $get_next = $db->Execute("SELECT orders_id FROM " . TABLE_ORDERS . " WHERE orders_id > '" . $oID . "' ORDER BY orders_id ASC LIMIT 1");
  246. if (zen_not_null($get_next->fields['orders_id'])) {
  247. $next_button = ' <INPUT TYPE="BUTTON" VALUE="' . $get_next->fields['orders_id'] . ' >>>" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_SUPER_ORDERS, 'oID=' . $get_next->fields['orders_id'] . '&action=edit') . '\'">';
  248. }
  249. else {
  250. $next_button = ' <INPUT TYPE="BUTTON" VALUE="' . BUTTON_TO_LIST . '" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_SUPER_ORDERS) . '\'">';
  251. }
  252. ?>
  253. <tr>
  254. <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  255. <tr>
  256. <td class="pageHeading"><?php echo HEADING_TITLE_ORDER_DETAILS . $oID; ?></td>
  257. <?php if ($so->status) { ?>
  258. <td class="main" valign="middle"><?php echo
  259. '<span class="status-' . $so->status . '">' . zen_datetime_short($so->status_date) . '</span>&nbsp;' .
  260. '<a href="' . zen_href_link(FILENAME_SUPER_ORDERS, 'action=reopen&oID=' . $oID) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_x.gif', '', '', '', '') . HEADING_REOPEN_ORDER . '</a>';
  261. ?></td>
  262. <?php } ?>
  263. <td align="center"><table border="0" cellspacing="3" cellpadding="0">
  264. <tr>
  265. <td class="main" align="center" valign="bottom"><?php echo $prev_button; ?></td>
  266. <td class="smallText" align="center" valign="bottom"><?php
  267. echo SELECT_ORDER_LIST . '<br />';
  268. echo zen_draw_form('input_oid', FILENAME_SUPER_ORDERS, '', 'get', '', true);
  269. echo zen_draw_input_field('oID', '', 'size="6"');
  270. echo zen_draw_hidden_field('action', 'edit');
  271. echo '</form>';
  272. ?></td>
  273. <td class="main" align="center" valign="bottom"><?php echo $next_button; ?></td>
  274. </tr>
  275. </table></td>
  276. <td align="right"><?php
  277. echo '<a href="' . zen_href_link(FILENAME_SUPER_DATA_SHEET, 'oID=' . $oID) . '" target="_blank">' . zen_image_button('btn_print.gif', ICON_ORDER_PRINT) . '</a>&nbsp;&nbsp;';
  278. echo '<a href="' . zen_href_link(FILENAME_SUPER_INVOICE, 'oID=' . $oID) . '" target="_blank">' . zen_image_button('button_invoice.gif', ICON_ORDER_INVOICE) . '</a>&nbsp;&nbsp;';
  279. echo '<a href="' . zen_href_link(FILENAME_SUPER_PACKINGSLIP, 'oID=' . $oID) . '" target="_blank">' . zen_image_button('button_packingslip.gif', ICON_ORDER_PACKINGSLIP) . '</a>&nbsp;&nbsp;';
  280. echo '<a href="javascript:history.back()">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>';
  281. ?></td>
  282. </tr>
  283. </table></td>
  284. </tr>
  285. <tr>
  286. <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
  287. <tr>
  288. <td colspan="3"><?php echo zen_draw_separator(); ?></td>
  289. </tr>
  290. <tr>
  291. <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  292. <tr>
  293. <td class="main" valign="top">
  294. <strong><?php echo ENTRY_CUSTOMER_ADDRESS; ?></strong><?php
  295. if (!$so->status) {
  296. echo '<br /><a href="javascript:popupWindow(\'' .
  297. zen_href_link(FILENAME_SUPER_EDIT, 'oID=' . $oID . '&target=contact', 'NONSSL') . '\', \'scrollbars=yes,resizable=yes,width=600,height=450,screenX=150,screenY=100,top=100,left=150\')">' .
  298. zen_image(DIR_WS_IMAGES . 'icon_edit3.gif', ICON_EDIT_CONTACT) . ICON_EDIT_CONTACT . '</a>';
  299. }
  300. ?></td>
  301. <td class="main"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'); ?></td>
  302. </tr>
  303. </table></td>
  304. <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  305. <tr>
  306. <td class="main" valign="top"><strong><?php echo ENTRY_BILLING_ADDRESS; ?></strong></td>
  307. <td class="main"><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'); ?></td>
  308. </tr>
  309. </table></td>
  310. <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  311. <tr>
  312. <td class="main" valign="top"><strong><?php echo ENTRY_SHIPPING_ADDRESS; ?></strong></td>
  313. <td class="main"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'); ?></td>
  314. </tr>
  315. <?php if (MODULE_BARCODE_ORDERS_SWITCH == 'true') { ?>
  316. <tr>
  317. <td class="main" valign="top"><strong><?php echo ENTRY_BARCODE; ?></strong></td>
  318. <td class="main"><?php echo '<img src="' . DIR_WS_CATALOG . 'barcode/barcode.php?code=' . $barcode . '&scale=' . (int)MODULE_BARCODE_SCALE . '">'; ?></td>
  319. </tr>
  320. <?php } ?>
  321. </table></td>
  322. </tr>
  323. </table></td>
  324. </tr>
  325. <tr>
  326. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  327. </tr>
  328. <tr>
  329. <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  330. <tr>
  331. <td><table border="0" cellspacing="0" cellpadding="2">
  332. <tr>
  333. <td class="main"><strong><?php echo ENTRY_TELEPHONE_NUMBER; ?></strong></td>
  334. <td class="main"><?php echo $order->customer['telephone']; ?></td>
  335. </tr>
  336. <tr>
  337. <td class="main"><strong><?php echo ENTRY_EMAIL_ADDRESS; ?></strong></td>
  338. <td class="main"><?php
  339. echo $order->customer['email_address'] . '&nbsp;[<a href="mailto:' . $order->customer['email_address'] . '">' . TEXT_MAILTO . '</a>]&nbsp;[<a href="' . zen_href_link(FILENAME_MAIL, 'origin=super_orders.php&mode=NONSSL&selected_box=customers&customer=' . $order->customer['email_address'], 'NONSSL') . '">' . TEXT_STORE_EMAIL . '</a>]';
  340. ?></td>
  341. </tr>
  342. <tr>
  343. <td class="main"><strong><?php echo TEXT_INFO_IP_ADDRESS; ?></strong></td>
  344. <?php if ($order->info['ip_address'] != '') { ?>
  345. <td class="main"><?php echo $order->info['ip_address'] . '&nbsp;[<a target="_blank" href="http://www.dnsstuff.com/tools/whois.ch?ip=' . $order->info['ip_address'] . '">' . TEXT_WHOIS_LOOKUP . '</a>]'; ?></td>
  346. <?php } else { ?>
  347. <td class="main"><?php echo TEXT_NONE; ?></td>
  348. <?php } ?>
  349. </tr>
  350. <tr>
  351. <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  352. </tr>
  353. <tr>
  354. <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
  355. <td class="main"><?php echo zen_datetime_long($order->info['date_purchased']); ?></td>
  356. </tr>
  357. <tr>
  358. <td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td>
  359. <td class="main"><?php echo $order->info['payment_method']; ?></td>
  360. </tr>
  361. </table></td>
  362. <?php
  363. $notes = $db->Execute("select * from " . TABLE_CUSTOMERS_ADMIN_NOTES . " where customers_id = '" . $order->customer['id'] . "'");
  364. if ($notes->RecordCount() > 0) {
  365. $num_feedback_good = 0;
  366. $num_feedback_poor = 0;
  367. $num_admin_notes = 0;
  368. while (!$notes->EOF) {
  369. if ($notes->fields['rating'] > 0) $num_feedback_good++;
  370. if ($notes->fields['rating'] < 0) $num_feedback_poor++;
  371. if (zen_not_null($notes->fields['admin_notes'])) $num_admin_notes++;
  372. $notes->MoveNext();
  373. }
  374. ?>
  375. <td><table border="0" cellspacing="0" cellpadding="2">
  376. <tr>
  377. </tr>
  378. </table></td>
  379. <?php
  380. } // END if ($notes->RecordCount() > 0)
  381. ?>
  382. <td align="right"><table border="0" cellspacing="0" cellpadding="2">
  383. <?php
  384. if (zen_not_null($order->info['cc_type']) || zen_not_null($order->info['cc_owner']) || zen_not_null($order->info['cc_number'])) {
  385. ?>
  386. <tr>
  387. <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  388. </tr>
  389. <tr>
  390. <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>
  391. <td class="main"><?php echo $order->info['cc_type']; ?></td>
  392. </tr>
  393. <tr>
  394. <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>
  395. <td class="main"><?php echo $order->info['cc_owner']; ?></td>
  396. </tr>
  397. <tr>
  398. <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>
  399. <td class="main"><?php echo $order->info['cc_number']; ?></td>
  400. </tr>
  401. <tr>
  402. <td class="main"><?php echo ENTRY_CREDIT_CARD_CVV; ?></td>
  403. <td class="main"><?php echo $order->info['cc_cvv']; ?></td>
  404. </tr>
  405. <tr>
  406. <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>
  407. <td class="main"><?php echo $order->info['cc_expires']; ?></td>
  408. </tr>
  409. <?php
  410. }
  411. ?>
  412. </table></td>
  413. </tr>
  414. </table></td>
  415. </tr>
  416. <tr>
  417. <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  418. </tr>
  419. <?php
  420. if (!$so->payment && !$so->refund && !$so->purchase_order && !$so->po_payment) {
  421. ?>
  422. <tr>
  423. <td><table border="0" cellspacing="0" cellpadding="2">
  424. <tr>
  425. <td class="main"><strong><?php echo TEXT_NO_PAYMENT_DATA; ?></strong></td>
  426. <td class="main"><?php $so->button_add('payment'); $so->button_add('purchase_order'); $so->button_add('refund'); ?></td>
  427. </tr>
  428. </table></td>
  429. </tr>
  430. <?php
  431. }
  432. else {
  433. ?>
  434. <tr>
  435. <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
  436. <tr>
  437. <td class="main"><strong><?php echo TEXT_PAYMENT_DATA; ?></strong></td>
  438. <td align="right" colspan="6"><?php $so->button_add('payment'); $so->button_add('purchase_order'); $so->button_add('refund'); ?></td>
  439. </tr>
  440. <tr class="dataTableHeadingRow">
  441. <td class="dataTableHeadingContent" align="left"><?php echo PAYMENT_TABLE_NUMBER; ?></td>
  442. <td class="dataTableHeadingContent" align="left"><?php echo PAYMENT_TABLE_NAME; ?></td>
  443. <td class="dataTableHeadingContent" align="right"><?php echo PAYMENT_TABLE_AMOUNT; ?></td>
  444. <td class="dataTableHeadingContent" align="center"><?php echo PAYMENT_TABLE_TYPE; ?></td>
  445. <td class="dataTableHeadingContent" align="center"><?php echo PAYMENT_TABLE_POSTED; ?></td>
  446. <td class="dataTableHeadingContent" align="center"><?php echo PAYMENT_TABLE_MODIFIED; ?></td>
  447. <td class="dataTableHeadingContent" align="right"><?php echo PAYMENT_TABLE_ACTION; ?></td>
  448. </tr>
  449. <?php
  450. if ($so->payment) {
  451. for($a = 0; $a < sizeof($so->payment); $a++) {
  452. if ($a != 0) {
  453. ?>
  454. <tr>
  455. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  456. </tr>
  457. <?php
  458. }
  459. ?>
  460. <tr class="paymentRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" <?php echo 'onclick="popupWindow(\'' . zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=payment&index=' . $so->payment[$a]['index'] . '&action=update', 'NONSSL') . '\', \'scrollbars=yes,resizable=yes,width=400,height=300,screenX=150,screenY=100,top=100,left=150\')"'; ?>>
  461. <td class="paymentContent" align="left"><?php echo $so->payment[$a]['number']; ?></td>
  462. <td class="paymentContent" align="left"><?php echo $so->payment[$a]['name']; ?></td>
  463. <td class="paymentContent" align="right"><strong><?php echo $currencies->format($so->payment[$a]['amount']); ?></strong></td>
  464. <td class="paymentContent" align="center"><?php echo $so->full_type($so->payment[$a]['type']); ?></td>
  465. <td class="paymentContent" align="center"><?php echo zen_datetime_short($so->payment[$a]['posted']); ?></td>
  466. <td class="paymentContent" align="center"><?php echo zen_datetime_short($so->payment[$a]['modified']); ?></td>
  467. <td align="right"><?php $so->button_update('payment', $so->payment[$a]['index']); $so->button_delete('payment', $so->payment[$a]['index']);?></td>
  468. </tr>
  469. <?php
  470. if ($so->refund) {
  471. for($b = 0; $b < sizeof($so->refund); $b++) {
  472. if ($so->refund[$b]['payment'] == $so->payment[$a]['index']) {
  473. ?>
  474. <tr class="refundRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" <?php echo 'onclick="popupWindow(\'' . zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=refund&index=' . $so->refund[$b]['index'] . '&action=update', 'NONSSL') . '\', \'scrollbars=yes,resizable=yes,width=400,height=300,screenX=150,screenY=100,top=100,left=150\')"'; ?>>
  475. <td class="refundContent" align="left"><?php echo $so->refund[$b]['number']; ?></td>
  476. <td class="refundContent" align="left"><?php echo $so->refund[$b]['name']; ?></td>
  477. <td class="refundContent" align="right"><strong><?php echo '-' . $currencies->format($so->refund[$b]['amount']); ?></strong></td>
  478. <td class="refundContent" align="center"><?php echo $so->full_type($so->refund[$b]['type']); ?></td>
  479. <td class="refundContent" align="center"><?php echo zen_datetime_short($so->refund[$b]['posted']); ?></td>
  480. <td class="refundContent" align="center"><?php echo zen_datetime_short($so->refund[$b]['modified']); ?></td>
  481. <td align="right"><?php $so->button_update('refund', $so->refund[$b]['index']); $so->button_delete('refund', $so->refund[$b]['index']); ?></td>
  482. </tr>
  483. <?php
  484. } // END if ($so->refund[$b]['payment'] == $so->payment[$a]['index'])
  485. } // END for($b = 0; $b < sizeof($so->refund); $b++)
  486. } // END if ($so->refund)
  487. } // END for($a = 0; $a < sizeof($payment); $a++)
  488. } // END if ($so->payment)
  489. if ($so->purchase_order) {
  490. for($c = 0; $c < sizeof($so->purchase_order); $c++) {
  491. if ($c < 1 && $so->payment) {
  492. ?>
  493. <tr>
  494. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  495. </tr>
  496. <tr>
  497. <td colspan="7"><?php echo zen_black_line(); ?></td>
  498. </tr>
  499. <tr>
  500. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  501. </tr>
  502. <?php
  503. }
  504. elseif ($c > 1) {
  505. ?>
  506. <tr>
  507. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  508. </tr>
  509. <?php
  510. }
  511. ?>
  512. <tr class="purchaseOrderRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" <?php echo 'onclick="popupWindow(\'' . zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=purchase_order&index=' . $so->purchase_order[$c]['index'] . '&action=update', 'NONSSL') . '\', \'scrollbars=yes,resizable=yes,width=400,height=300,screenX=150,screenY=100,top=100,left=150\')"'; ?>>
  513. <td class="purchaseOrderContent" colspan="4" align="left"><strong><?php echo $so->purchase_order[$c]['number']; ?></strong></td>
  514. <td class="purchaseOrderContent" align="center"><?php echo zen_datetime_short($so->purchase_order[$c]['posted']); ?></td>
  515. <td class="purchaseOrderContent" align="center"><?php echo zen_datetime_short($so->purchase_order[$c]['modified']); ?></td>
  516. <td align="right"><?php $so->button_update('purchase_order', $so->purchase_order[$c]['index']); $so->button_delete('purchase_order', $so->purchase_order[$c]['index']);?></td>
  517. </tr>
  518. <?php
  519. if ($so->po_payment) {
  520. for($d = 0; $d < sizeof($so->po_payment); $d++) {
  521. if ($so->po_payment[$d]['assigned_po'] == $so->purchase_order[$c]['index']) {
  522. if ($d != 0) {
  523. ?>
  524. <tr>
  525. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  526. </tr>
  527. <?php
  528. }
  529. ?>
  530. <tr class="paymentRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" <?php echo 'onclick="popupWindow(\'' . zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=payment&index=' . $so->po_payment[$d]['index'] . '&action=update', 'NONSSL') . '\', \'scrollbars=yes,resizable=yes,width=400,height=300,screenX=150,screenY=100,top=100,left=150\')"'; ?>>
  531. <td class="paymentContent" align="left"><?php echo $so->po_payment[$d]['number']; ?></td>
  532. <td class="paymentContent" align="left"><?php echo $so->po_payment[$d]['name']; ?></td>
  533. <td class="paymentContent" align="right"><strong><?php echo $currencies->format($so->po_payment[$d]['amount']); ?></strong></td>
  534. <td class="paymentContent" align="center"><?php echo $so->full_type($so->po_payment[$d]['type']); ?></td>
  535. <td class="paymentContent" align="center"><?php echo zen_datetime_short($so->po_payment[$d]['posted']); ?></td>
  536. <td class="paymentContent" align="center"><?php echo zen_datetime_short($so->po_payment[$d]['modified']); ?></td>
  537. <td align="right"><?php $so->button_update('payment', $so->po_payment[$d]['index']); $so->button_delete('payment', $so->po_payment[$d]['index']); ?></td>
  538. </tr>
  539. <?php
  540. if ($so->refund) {
  541. for($e = 0; $e < sizeof($so->refund); $e++) {
  542. if ($so->refund[$e]['payment'] == $so->po_payment[$d]['index']) {
  543. ?>
  544. <tr class="refundRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" <?php echo 'onclick="popupWindow(\'' . zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=refund&index=' . $so->refund[$e]['index'] . '&action=update', 'NONSSL') . '\')"'; ?>>
  545. <td class="refundContent" align="left"><?php echo $so->refund[$e]['number']; ?></td>
  546. <td class="refundContent" align="left"><?php echo $so->refund[$e]['name']; ?></td>
  547. <td class="refundContent" align="right"><strong><?php echo '-' . $currencies->format($so->refund[$e]['amount']); ?></strong></td>
  548. <td class="refundContent" align="center"><?php echo $so->full_type($so->refund[$e]['type']); ?></td>
  549. <td class="refundContent" align="center"><?php echo zen_datetime_short($so->refund[$e]['posted']); ?></td>
  550. <td class="refundContent" align="center"><?php echo zen_datetime_short($so->refund[$e]['modified']); ?></td>
  551. <td align="right"><?php $so->button_update('refund', $so->refund[$e]['index']); $so->button_delete('refund', $so->refund[$e]['index']); ?></td>
  552. </tr>
  553. <?php
  554. } // END if ($so->refund[$e]['payment'] == $so->po_payment[$d]['index'])
  555. } // END for($e = 0; $e < sizeof($so->refund); $e++)
  556. } // END if ($so->refund)
  557. } // END if ($so->po_payment[$d]['assigned_po'] == $so->purchase_order[$c]['index'])
  558. } // END for($d = 0; $d < sizeof($so->po_payment); $d++)
  559. } // END if ($so->po_payment)
  560. } // END for($c = 0; $c < sizeof($so->purchase_order); $c++)
  561. } // END if ($so->purchase_order)
  562. // display any refunds not tied directly to a payment
  563. if ($so->refund) {
  564. for ($f = 0; $f < sizeof($so->refund); $f++) {
  565. if ($so->refund[$f]['payment'] == 0) {
  566. if ($f < 1) {
  567. ?>
  568. <tr>
  569. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  570. </tr>
  571. <tr>
  572. <td colspan="7"><?php echo zen_black_line(); ?></td>
  573. </tr>
  574. <tr>
  575. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  576. </tr>
  577. <?php
  578. } else {
  579. ?>
  580. <tr>
  581. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
  582. </tr>
  583. <?php
  584. }
  585. ?>
  586. <tr class="refundRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"<?php echo 'onclick="popupWindow(\'' . zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=refund&index=' . $so->refund[$f]['index'] . '&action=update', 'NONSSL') . '\', \'scrollbars=yes,resizable=yes,width=400,height=300,screenX=150,screenY=100,top=100,left=150\')"'; ?>>
  587. <td class="refundContent" align="left"><?php echo $so->refund[$f]['number']; ?></td>
  588. <td class="refundContent" align="left"><?php echo $so->refund[$f]['name']; ?></td>
  589. <td class="refundContent" align="right"><strong><?php echo '-' . $currencies->format($so->refund[$f]['amount']); ?></strong></td>
  590. <td class="refundContent" align="center"><?php echo $so->full_type($so->refund[$f]['type']); ?></td>
  591. <td class="refundContent" align="center"><?php echo zen_datetime_short($so->refund[$f]['posted']); ?></td>
  592. <td class="refundContent" align="center"><?php echo zen_datetime_short($so->refund[$f]['modified']); ?></td>
  593. <td align="right"><?php $so->button_update('refund', $so->refund[$f]['index']); $so->button_delete('refund', $so->refund[$f]['index']); ?></td>
  594. </tr>
  595. <?php
  596. }
  597. }
  598. } // END if ($so->refund)
  599. ?>
  600. </table></td>
  601. </tr>
  602. <?php
  603. } // END else
  604. if ($so->payment || $so->refund || $so->purchase_order || $so->po_payment) {
  605. ?>
  606. </tr>
  607. <td><table border="0" cellspacing="0" cellpadding="0">
  608. <tr>
  609. <td class="main" align="center"><?php echo HEADING_COLOR_KEY; ?></td>
  610. <td><table border="0" cellspacing="2" cellpadding="3">
  611. <tr class="purchaseOrderRow">
  612. <td class="dataTableContent" width="90" align="center"><?php echo TEXT_PURCHASE_ORDERS; ?></td>
  613. </tr>
  614. </table></td>
  615. <td><table border="0" cellspacing="2" cellpadding="3">
  616. <tr class="paymentRow">
  617. <td class="dataTableContent" width="90" align="center"><?php echo TEXT_PAYMENTS; ?></td>
  618. </tr>
  619. </table></td>
  620. <td><table border="0" cellspacing="2" cellpadding="3">
  621. <tr class="refundRow">
  622. <td class="dataTableContent" width="90" align="center"><?php echo TEXT_REFUNDS; ?></td>
  623. </tr>
  624. </table></td>
  625. </tr>
  626. </table></td>
  627. </tr>
  628. <?php
  629. }
  630. if (method_exists($module, 'admin_notification')) {
  631. ?>
  632. <tr>
  633. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  634. </tr>
  635. <tr>
  636. <?php echo $module->admin_notification($oID); ?>
  637. </tr>
  638. <tr>
  639. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  640. </tr>
  641. <?php
  642. }
  643. ?>
  644. <tr>
  645. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  646. </tr>
  647. <?php if (!$so->status) { ?>
  648. <tr>
  649. <td class="main"><?php echo '<a href="javascript:popupWindow(\'' .
  650. zen_href_link(FILENAME_SUPER_EDIT, 'oID=' . $oID . '&target=product', 'NONSSL') . '\', \'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=450,screenX=150,screenY=100,top=100,left=150\')">' .
  651. zen_image(DIR_WS_IMAGES . 'icon_edit3.gif', ICON_EDIT_PRODUCT) . ICON_EDIT_PRODUCT . '</a>';
  652. ?></td>
  653. </tr>
  654. <?php } ?>
  655. <tr>
  656. <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  657. <tr class="dataTableHeadingRow">
  658. <?php if (sizeof($order->products) > 1) { ?>
  659. <td class="dataTableHeadingContent">&nbsp;</td>
  660. <?php } ?>
  661. <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
  662. <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
  663. <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
  664. <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
  665. <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
  666. <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
  667. <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
  668. </tr>
  669. <?php
  670. if (sizeof($order->products) > 1) {
  671. echo ' ' . zen_draw_form('split_packing', FILENAME_SUPER_PACKINGSLIP, '', 'get', 'target="_blank"', true) . "\n";
  672. echo ' ' . zen_draw_hidden_field('oID', (int)$oID) . "\n";
  673. echo ' ' . zen_draw_hidden_field('split', 'true') . "\n";
  674. echo ' ' . zen_draw_hidden_field('reverse_count', 0) . "\n";
  675. }
  676. for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  677. echo ' <tr class="dataTableRow">' . "\n";
  678. if (sizeof($order->products) > 1) {
  679. echo ' <td class="dataTableContent" valign="top" width="10">' . zen_draw_checkbox_field('incl_product_' . $i, 'yes') . '</td>' . "\n";
  680. }
  681. echo ' <td class="dataTableContent" valign="middle" align="left">' . $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name'];
  682. if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
  683. for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
  684. echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
  685. if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
  686. if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE;
  687. echo '</i></small></nobr>';
  688. }
  689. }
  690. echo ' </td>' . "\n" .
  691. ' <td class="dataTableContent" valign="middle">' . $order->products[$i]['model'] . '</td>' . "\n" .
  692. ' <td class="dataTableContent" align="right" valign="middle">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
  693. ' <td class="dataTableContent" align="right" valign="middle"><strong>' .
  694. $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) .
  695. ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') .
  696. '</strong></td>' . "\n" .
  697. ' <td class="dataTableContent" align="right" valign="middle"><strong>' .
  698. $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) .
  699. ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
  700. '</strong></td>' . "\n" .
  701. ' <td class="dataTableContent" align="right" valign="middle"><strong>' .
  702. $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) .
  703. ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') .
  704. '</strong></td>' . "\n" .
  705. ' <td class="dataTableContent" align="right" valign="middle"><strong>' .
  706. $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) .
  707. ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
  708. '</strong></td>' . "\n";
  709. echo ' </tr>' . "\n";
  710. }
  711. ?>
  712. <tr>
  713. <?php if (sizeof($order->products) > 1) { ?>
  714. <td valign="top" colspan="2"><table border="0" cellspacing="0" cellpadding="0">
  715. <tr>
  716. <td valign="top">&nbsp;&nbsp;<?php echo zen_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
  717. <td valign="bottom" class="main"><input type="submit" value="<?php echo BUTTON_SPLIT; ?>"></td>
  718. </tr>
  719. <tr>
  720. <td class="smallText">&nbsp;</td>
  721. <td class="smallText" valign="top" align="center"><?php echo TEXT_DISPLAY_ONLY; ?></td>
  722. </tr>
  723. </table></td>
  724. </form>
  725. <?php
  726. $colspan = 7;
  727. } else {
  728. $colspan = 8;
  729. }
  730. ?>
  731. <td align="right" colspan="<? echo $colspan; ?>"><table border="0" cellspacing="0" cellpadding="2">
  732. <?php
  733. // Short shipping display
  734. // Formats shipping entry to remove the TEXT_WAY define
  735. for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
  736. if ($order->totals[$i]['class'] == 'ot_shipping') {
  737. $format_shipping = explode(" (", $order->totals[$i]['title'], 2);
  738. $clean_shipping = rtrim($format_shipping[0], ":");
  739. $display_title = $clean_shipping . ':';
  740. }
  741. else {
  742. $display_title = $order->totals[$i]['title'];
  743. }
  744. echo ' <tr>' . "\n" .
  745. ' <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $display_title . '</td>' . "\n" .
  746. ' <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $order->totals[$i]['text'] . '</td>' . "\n" .
  747. ' </tr>' . "\n";
  748. }
  749. // determine what to display on the "Amount Applied" and "Balance Due" lines
  750. $amount_applied = $currencies->format($so->amount_applied);
  751. $balance_due = $currencies->format($so->balance_due);
  752. // determine display format of the number
  753. // 'balanceDueRem' = customer still owes money
  754. // 'balanceDueNeg' = customer is due a refund
  755. // 'balanceDueNone' = order is all paid up
  756. // 'balanceDueNull' = balance nullified by order status
  757. switch ($so->status) {
  758. case 'completed':
  759. switch ($so->balance_due) {
  760. case 0:
  761. $class = 'balanceDueNone';
  762. break;
  763. case $so->balance_due < 0:
  764. $class = 'balanceDueNeg';
  765. break;
  766. case $so->balance_due > 0:
  767. $class = 'balanceDueRem';
  768. break;
  769. }
  770. break;
  771. case 'cancelled':
  772. switch ($so->balance_due) {
  773. case 0:
  774. $class = 'balanceDueNone';
  775. break;
  776. case $so->balance_due < 0:
  777. $class = 'balanceDueNeg';
  778. break;
  779. case $so->balance_due > 0:
  780. $class = 'balanceDueRem';
  781. break;
  782. }
  783. break;
  784. default:
  785. switch ($so->balance_due) {
  786. case 0:
  787. $class = 'balanceDueNone';
  788. break;
  789. case $so->balance_due < 0:
  790. $class = 'balanceDueNeg';
  791. break;
  792. case $so->balance_due > 0:
  793. $class = 'balanceDueRem';
  794. break;
  795. }
  796. break;
  797. }
  798. ?>
  799. <tr>
  800. <td align="right" class="ot-tax-Text"><?php echo ENTRY_AMOUNT_APPLIED; ?></td>
  801. <td align="right" class="ot-tax-Amount"><?php echo $amount_applied; ?></td>
  802. </tr>
  803. <tr>
  804. <td align="right" class="ot-tax-Text"><?php echo ENTRY_BALANCE_DUE; ?></td>
  805. <td align="right" <?php echo 'class="' . $class . '">' . $balance_due; ?></td>
  806. </tr>
  807. <?php if (!$so->status) { ?>
  808. <tr>
  809. <td colspan="2" align="right"><?php echo '<a href="javascript:popupWindow(\'' .
  810. zen_href_link(FILENAME_SUPER_EDIT, 'oID=' . $oID . '&target=total', 'NONSSL') . '\', \'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=450,screenX=150,screenY=100,top=100,left=150\')">' .
  811. zen_image(DIR_WS_IMAGES . 'icon_edit3.gif', ICON_EDIT_TOTAL) . ICON_EDIT_TOTAL . '</a>';
  812. ?></td>
  813. </tr>
  814. <?php } ?>
  815. </table></td>
  816. </tr>
  817. </table></td>
  818. </tr>
  819. <?php
  820. // show downloads
  821. require(DIR_WS_MODULES . 'orders_download.php');
  822. ?>
  823. <tr>
  824. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  825. </tr>
  826. <tr>
  827. <td class="main"><strong><?php echo TABLE_HEADING_STATUS_HISTORY; ?></strong></td>
  828. </tr>
  829. <tr>
  830. <td valign="top" class="main"><table border="1" cellspacing="0" cellpadding="5">
  831. <tr>
  832. <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td>
  833. <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td>
  834. <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td>
  835. <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
  836. </tr>
  837. <?php
  838. $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments
  839. from " . TABLE_ORDERS_STATUS_HISTORY . "
  840. where orders_id = '" . $oID . "'
  841. order by date_added");
  842. if ($orders_history->RecordCount() > 0) {
  843. while (!$orders_history->EOF) {
  844. echo ' <tr>' . "\n" .
  845. ' <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" .
  846. ' <td class="smallText" align="center">';
  847. if ($orders_history->fields['customer_notified'] == '1') {
  848. echo zen_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
  849. } else {
  850. echo zen_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
  851. }
  852. echo ' <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
  853. echo ' <td class="smallText">' . nl2br(zen_db_scrub_out($orders_history->fields['comments'])) . '&nbsp;</td>' . "\n" .
  854. ' </tr>' . "\n";
  855. $orders_history->MoveNext();
  856. }
  857. } else {
  858. echo ' <tr>' . "\n" .
  859. ' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
  860. ' </tr>' . "\n";
  861. }
  862. ?>
  863. </table></td>
  864. </tr>
  865. <?php if (!$so->status) { ?>
  866. <tr>
  867. <td><?php echo '<a href="javascript:popupWindow(\'' .
  868. zen_href_link(FILENAME_SUPER_EDIT, 'oID=' . $oID . '&target=history', 'NONSSL') . '\', \'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=450,screenX=150,screenY=100,top=100,left=150\')">' .
  869. zen_image(DIR_WS_IMAGES . 'icon_edit3.gif', ICON_EDIT_HISTORY) . ICON_EDIT_HISTORY . '</a>';
  870. ?></td>
  871. </tr>
  872. <?php } ?>
  873. <?php
  874. // hide status-updating code and cancel/complete buttons
  875. // if the order is already closed
  876. if (!$so->status) {
  877. ?>
  878. <tr>
  879. <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  880. </tr>
  881. <tr>
  882. <td><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>
  883. <td valign="top"><table border="0" cellspacing="0" cellpadding="0">
  884. <tr>
  885. <td class="main"><strong><?php echo TABLE_HEADING_ADD_COMMENTS; ?></strong></td>
  886. </tr>
  887. <tr>
  888. <td><?php echo zen_dr

Large files files are truncated, but you can click here to view the full file