PageRenderTime 79ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 1ms

/application/views/pages/admin/hksearch.php

https://bitbucket.org/chadsaun/ifrogz-panel
PHP | 2017 lines | 1777 code | 43 blank | 197 comment | 271 complexity | fad700ead043ed0546b9fdc9e42bec87 MD5 | raw file
  1. <?php
  2. //This code is copyright (c) Internet Business Solutions SL, all rights reserved.
  3. //The contents of this file are protect under law as the intellectual property of Internet
  4. //Business Solutions SL. Any use, reproduction, disclosure or copying of any kind
  5. //without the express and written permission of Internet Business Solutions SL is forbidden.
  6. //Author: Vince Reid, vince@virtualred.net
  7. include('init.php');
  8. include(APPPATH.'views/pages/admin/cartmisc.php');
  9. include_once(IFZROOT.'kohana.php');
  10. session_register('order_id_commas');
  11. $lisuccess=0;
  12. if(@$dateadjust=="") $dateadjust=0;
  13. if(@$dateformatstr == "") $dateformatstr = "m/d/Y";
  14. $admindatestr="Y-m-d";
  15. if(@$admindateformat=="") $admindateformat=0;
  16. if($admindateformat==1)
  17. $admindatestr="m/d/Y";
  18. elseif($admindateformat==2)
  19. $admindatestr="d/m/Y";
  20. if(@$storesessionvalue=="") $storesessionvalue="virtualstore".time();
  21. $doedit=FALSE;
  22. function editfunc($data,$col,$size){
  23. global $doedit;
  24. if($doedit) return('<input type="text" id="' . $col . '" name="' . $col . '" value="' . str_replace('"','&quot;',$data) . '" size="' . $size . '">'); else return($data);
  25. }
  26. function editnumeric($data,$col,$size){
  27. global $doedit;
  28. if($doedit) return('<input type="text" id="' . $col . '" name="' . $col . '" value="' . number_format($data,2,'.','') . '" size="' . $size . '">'); else return(FormatEuroCurrency($data));
  29. }
  30. if(@$_SESSION["loggedon"] != $storesessionvalue && trim(@$_COOKIE["WRITECKL"])!=""){
  31. $config = RBI_Kohana::config('database.default_ifrogz');
  32. $config = $config['connection'];
  33. $db=mysql_connect($config['hostname'], $config['username'], $config['password']);
  34. mysql_select_db($config['database']) or die ('RBI connection failed.</td></tr></table></body></html>');
  35. $rbiSQL = 'SELECT *
  36. FROM employee
  37. WHERE username="'.mysql_real_escape_string(unstripslashes(trim(@$_COOKIE["WRITECKL"]))).'" and password="'.mysql_real_escape_string(unstripslashes(trim(@$_COOKIE["WRITECKP"]))).'"';
  38. $rs_rbi = mysql_query($rbiSQL);
  39. if(mysql_num_rows($rs_rbi) > 0) {
  40. @$_SESSION["loggedon"] = $storesessionvalue;
  41. }else{
  42. $lisuccess=2;
  43. }
  44. mysql_free_result($rs_rbi);
  45. include(APPPATH.'views/partials/admin/dbconnection.php');
  46. }
  47. if(($_SESSION["loggedon"] != $storesessionvalue && $lisuccess!=2) || @$disallowlogin==TRUE) exit();
  48. if($lisuccess==2){
  49. ?>
  50. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  51. <tr>
  52. <td width="100%">
  53. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  54. <tr>
  55. <td width="100%" colspan="4" align="center"><p>&nbsp;</p><p>&nbsp;</p>
  56. <p><strong><?php print $yyOpFai?></strong></p><p>&nbsp;</p>
  57. <p><?php print $yyCorCoo?> <?php print $yyCorLI?> <a href="/admin/login.php"><?php print $yyClkHer?></a>.</p>
  58. </td>
  59. </tr>
  60. </table>
  61. </td>
  62. </tr>
  63. </table>
  64. <?php
  65. }else{
  66. $success=true;
  67. $alreadygotadmin = getadminsettings();
  68. if(@$_GET["id"] != ""){
  69. $sSQL = "SELECT cartProdId,cartProdName,cartProdPrice,cartQuantity,cartID FROM cart WHERE cartOrderID=" . $_GET["id"];
  70. $allorders = mysql_query($sSQL) or print(mysql_error());
  71. }
  72. $numstatus=0;
  73. $sSQL = "SELECT statID,statPrivate FROM orderstatus WHERE statPrivate<>'' ORDER BY statID";
  74. $result = mysql_query($sSQL) or print(mysql_error());
  75. while($rs = mysql_fetch_assoc($result)){
  76. $allstatus[$numstatus++]=$rs;
  77. }
  78. mysql_free_result($result);
  79. if(@$_GET["id"] != ""){
  80. $statetaxrate=0;
  81. $countrytaxrate=0;
  82. $hsttaxrate=0;
  83. $countryorder=0;
  84. $sSQL = "SELECT ordID,ordName,ordAddress,ordAddress2,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipAddress2,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordPayProvider,ordAuthNumber,ordTransID,ordTotal,ordDate,ordStateTax,ordCountryTax,ordHSTTax,ordShipping,ordShipType,ordIP,ordAffiliate,ordDiscount,ordHandling,ordDiscountText,ordComLoc,ordExtra1,ordExtra2,ordAddInfo,ordCNum,ordStatusInfo,ordSupportInfo,order_changed,ordStatus,ord_cert_amt,ord_cert_id,ordPoApo,ordShipPoApo,ordEID FROM orders LEFT JOIN payprovider ON payprovider.payProvID=orders.ordPayProvider WHERE ordID='" . $_GET["id"] . "'
  85. AND ordEID!=34";
  86. $result = mysql_query($sSQL) or print(mysql_error());
  87. $alldata = mysql_fetch_array($result);
  88. $alldata["ordDate"] = strtotime($alldata["ordDate"]);
  89. mysql_free_result($result);
  90. if($doedit){
  91. print '<form method="post" name="editform" action="/admin/orders.php" onsubmit="return confirmedit()"><input type="hidden" name="orderid" value="' . $_GET["id"] . '" /><input type="hidden" name="doedit" value="true" />';
  92. $overridecurrency=TRUE;
  93. $orcsymbol="";
  94. $orcdecplaces=2;
  95. $orcpreamount=TRUE;
  96. $orcdecimals=".";
  97. $orcthousands="";
  98. }
  99. ?>
  100. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/prototype.js"></script>
  101. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/scriptaculous.js"></script>
  102. <script language="JavaScript" type="text/javascript">
  103. <!--
  104. var newwin="";
  105. var plinecnt=0;
  106. function openemailpopup(id) {
  107. popupWin = window.open('/admin/popupemail.php?'+id,'emailpopup','menubar=no, scrollbars=no, width=300, height=250, directories=no,location=no,resizable=yes,status=no,toolbar=no')
  108. }
  109. function updateoptions(id){
  110. prodid = document.getElementById('prodid'+id).value;
  111. if(prodid != ''){
  112. newwin = window.open('/admin/popupemail.php?prod='+prodid+'&index='+id,'updateopts','menubar=no, scrollbars=no, width=50, height=40, directories=no,location=no,resizable=yes,status=no,toolbar=no');
  113. }
  114. return(false);
  115. }
  116. function extraproduct(plusminus){
  117. var productspan=document.getElementById('productspan');
  118. if(plusminus=='+'){
  119. productspan.innerHTML=productspan.innerHTML.replace(/<!--NEXTPRODUCTCOMMENT-->/,'<!--PLINE'+plinecnt+'--><tr><td valign="top"><input type="button" value="..." onclick="updateoptions('+(plinecnt+1000)+')">&nbsp;<input name="prodid'+(plinecnt+1000)+'" size="18" id="prodid'+(plinecnt+1000)+'"></td><td valign="top"><input type="text" id="prodname'+(plinecnt+1000)+'" name="prodname'+(plinecnt+1000)+'" size="24"></td><td><span id="optionsspan'+(plinecnt+1000)+'">-</span></td><td valign="top"><input type="text" id="quant'+(plinecnt+1000)+'" name="quant'+(plinecnt+1000)+'" size="5" value="1"></td><td valign="top"><input type="text" id="price'+(plinecnt+1000)+'" name="price'+(plinecnt+1000)+'" value="0" size="7"><br /><input type="hidden" id="optdiffspan'+(plinecnt+1000)+'" value="0"></td><td>&nbsp;</td></tr><!--PLINEEND'+plinecnt+'--><!--NEXTPRODUCTCOMMENT-->');
  120. plinecnt++;
  121. }else{
  122. if(plinecnt>0){
  123. plinecnt--;
  124. var restr = '<!--PLINE'+plinecnt+'-->(.|\\n)+<!--PLINEEND'+plinecnt+'-->';
  125. //alert(restr);
  126. var re = new RegExp(restr);
  127. productspan.innerHTML=productspan.innerHTML.replace(re,'');
  128. }
  129. }
  130. }
  131. function confirmedit(){
  132. if(updateClicked) {
  133. if(confirm('<?php print str_replace("'","\'",$yyChkRec)?>'))
  134. return(true);
  135. return(false);
  136. }
  137. if(cloneClicked) {
  138. if(confirm('Are you sure you want to clone this order?'))
  139. return(true);
  140. return(false);
  141. }
  142. }
  143. function checkAIM(frm) {
  144. if(frm.aim_type.selectedIndex==0) {
  145. alert("Please choose a transaction type.");
  146. frm.aim_type.focus();
  147. return false;
  148. }else if(frm.aim_txn=='') {
  149. alert("A transaction number is required.");
  150. frm.aim_txn.focus();
  151. return false;
  152. }else if(frm.aim_amt=='') {
  153. alert("Please enter an amount.");
  154. frm.aim_amt.focus();
  155. return false;
  156. }
  157. return true;
  158. }
  159. function toggleTXN() {
  160. if($('div_trans').style.display=='' || $('div_trans').style.display==undefined) {
  161. //$('div_trans').style.display = 'none';
  162. Effect.BlindUp('div_trans');
  163. $('btn_add_txn').value = 'Credit or Void';
  164. }else if($('div_trans').style.display=='none') {
  165. //$('div_trans').style.display = '';
  166. Effect.BlindDown('div_trans');
  167. $('btn_add_txn').value = 'Hide Credit or Void';
  168. }
  169. }
  170. function toggleCharge() {
  171. if($('div_charge').style.display=='' || $('div_charge').style.display==undefined) {
  172. //$('div_charge').style.display = 'none';
  173. Effect.BlindUp('div_charge');
  174. $('btn_charge').value = 'Charge CC';
  175. }else if($('div_charge').style.display=='none') {
  176. //$('div_charge').style.display = '';
  177. Effect.BlindDown('div_charge');
  178. $('btn_charge').value = 'Hide Charge CC';
  179. }
  180. }
  181. function togglePrcAdd() {
  182. if($('div_prc_add').style.display=='' || $('div_prc_add').style.display==undefined) {
  183. //$('div_charge').style.display = 'none';
  184. Effect.BlindUp('div_prc_add');
  185. $('btn_prc_add').value = 'Add Price Adjustment';
  186. }else if($('div_prc_add').style.display=='none') {
  187. //$('div_charge').style.display = '';
  188. Effect.BlindDown('div_prc_add');
  189. $('btn_prc_add').value = 'Hide Price Adjustment';
  190. }
  191. }
  192. //-->
  193. </script>
  194. <style type="text/css">
  195. a img{
  196. border: 0;
  197. }
  198. </style>
  199. <span id="productspan">
  200. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  201. <?php if($isprinter && @$invoiceheader != ""){ ?>
  202. <tr>
  203. <td colspan="6"><?php print $invoiceheader?></td>
  204. </tr>
  205. <?php } ?>
  206. <tr <? if(!empty($alldata["ordEID"])) echo 'bgcolor="#FA6561"'?>>
  207. <td colspan="6" align="center"><strong><?php print $xxOrdNum . " " . $alldata["ordID"] . "<br /><br />" . date($dateformatstr, $alldata["ordDate"]) . " " . date("H:i", $alldata["ordDate"])?></strong></td>
  208. </tr>
  209. <?php if($isprinter && @$invoiceaddress != ""){ ?>
  210. <tr>
  211. <td colspan="6"><?php print $invoiceaddress?></td>
  212. </tr>
  213. <?php } ?>
  214. <?php if(trim(@$extraorderfield1)!=""){ ?>
  215. <tr>
  216. <td width="23%" align="right"><strong><?php print $extraorderfield1 ?>:</strong></td>
  217. <td align="left" colspan="5"><?php print editfunc($alldata["ordExtra1"],"ordextra1",25)?></td>
  218. </tr>
  219. <?php } ?>
  220. <tr>
  221. <td width="23%" align="right"><strong><?php print $xxName?>:</strong></td>
  222. <td colspan="3" align="left"><?php print editfunc($alldata["ordName"],"name",25)?></td>
  223. <td width="25%" align="right">
  224. <strong><?php print $xxEmail?>:</strong></td>
  225. <td width="24%" align="left"><?php
  226. if($isprinter || $doedit) print editfunc($alldata["ordEmail"],"email",25); else print '<a href="mailto:' . $alldata["ordEmail"] . '">' . $alldata["ordEmail"] . '</a>';?></td>
  227. </tr>
  228. <tr>
  229. <td align="right"><strong><?php print $xxAddress?>:</strong></td>
  230. <td colspan="3" align="left"<?php if(@$useaddressline2==TRUE) print ' colspan="3"'?>><?php print editfunc($alldata["ordAddress"],"address",25)?></td>
  231. <?php if(@$useaddressline2==TRUE){ ?>
  232. </tr>
  233. <tr>
  234. <td align="right"><strong><?php print $xxAddress2?>:</strong></td>
  235. <td colspan="3" align="left"><?php print editfunc($alldata["ordAddress2"],"address2",25)?></td>
  236. <?php } ?>
  237. <td align="right"><strong><?php print $xxCity?>:</strong></td>
  238. <td align="left"><?php print editfunc($alldata["ordCity"],"city",25)?></td>
  239. </tr>
  240. <tr>
  241. <td align="right"><strong><?php print $xxAllSta?>:</strong></td>
  242. <td align="left"><?php print editfunc($alldata["ordState"],"state",25)?></td>
  243. <td align="right"><strong>APO/PO:</strong></td>
  244. <td align="left"><input <?php if (!(strcmp($alldata["ordPoApo"],1))) {echo "checked=\"checked\"";} ?> <? if($doedit) echo ''; else echo 'disabled="disabled"'; ?> name="APO" type="checkbox" value="1" /></td>
  245. <td align="right"><strong><?php print $xxCountry?>:</strong></td>
  246. <td align="left"><?php
  247. if($doedit){
  248. $foundmatch=FALSE;
  249. print '<select name="country" size="1">';
  250. $sSQL = "SELECT countryName,countryTax,countryOrder FROM countries ORDER BY countryOrder DESC, countryName";
  251. $result = mysql_query($sSQL) or print(mysql_error());
  252. while($rs2 = mysql_fetch_array($result)){
  253. print '<option value="' . str_replace('"','&quot;',$rs2["countryName"]) . '"';
  254. if($alldata["ordCountry"]==$rs2["countryName"]){
  255. print ' selected';
  256. $foundmatch=TRUE;
  257. $countrytaxrate=$rs2["countryTax"];
  258. $countryorder=$rs2["countryOrder"];
  259. }
  260. print '>' . $rs2["countryName"] . "</option>\r\n"; }
  261. mysql_free_result($result);
  262. if(! $foundmatch) print '<option value="' . str_replace('"','&quot;',$alldata["ordCountry"]) . '" selected>' . $alldata["ordCountry"] . "</option>\r\n";
  263. print '</select>';
  264. if($countryorder==2){
  265. $sSQL = "SELECT stateTax FROM states WHERE stateAbbrev='" . mysql_real_escape_string($alldata["ordState"]) . "'";
  266. $result = mysql_query($sSQL) or print(mysql_error());
  267. if($rs2 = mysql_fetch_array($result))
  268. $statetaxrate = $rs2["stateTax"];
  269. }
  270. if($alldata["ordStateTax"]==0)$statetaxrate=0;
  271. }else
  272. print $alldata["ordCountry"];?></td>
  273. </tr>
  274. <tr>
  275. <td align="right"><strong><?php print $xxZip?>:</strong></td>
  276. <td colspan="3" align="left"><?php print editfunc($alldata["ordZip"],"zip",15)?></td>
  277. <td align="right"><strong><?php print $xxPhone?>:</strong></td>
  278. <td align="left"><?php print editfunc($alldata["ordPhone"],"phone",25)?></td>
  279. </tr>
  280. <?php if(trim(@$extraorderfield2)!=""){ ?>
  281. <tr>
  282. <td align="right"><strong><?php print @$extraorderfield2 ?>:</strong></td>
  283. <td align="left" colspan="5"><?php print editfunc($alldata["ordExtra2"],"ordextra2",25)?></td>
  284. </tr>
  285. <?php } ?>
  286. <?php if(! $isprinter){ ?>
  287. <tr>
  288. <td align="right"><strong>IP Address:</strong></td>
  289. <td colspan="3" align="left"><?php print editfunc($alldata["ordIP"],"ipaddress",15)?></td>
  290. <td align="right"><strong><?php print $yyAffili?>:</strong></td>
  291. <td align="left"><?php print editfunc($alldata["ordAffiliate"],"PARTNER",15)?></td>
  292. </tr>
  293. <?php }
  294. if(trim($alldata["ordDiscountText"])!=""){ ?>
  295. <tr>
  296. <td align="right" valign="top"><strong><?php print $xxAppDs?>:</strong></td>
  297. <td align="left" colspan="5"><?php print editfunc($alldata["ordDiscountText"],"discounttext",25)?></td>
  298. </tr>
  299. <?php }
  300. if(trim($alldata["ordShipName"]) != "" || trim($alldata["ordShipAddress"]) != "" || trim($alldata["ordShipCity"]) != "" || $doedit){ ?>
  301. <tr>
  302. <td align="center" colspan="6"><strong><?php print $xxShpDet?>.</strong></td>
  303. </tr>
  304. <tr>
  305. <td align="right"><strong><?php print $xxName?>:</strong></td>
  306. <td align="left" colspan="5"><?php print editfunc($alldata["ordShipName"],"sname",25)?></td>
  307. </tr>
  308. <tr>
  309. <td align="right"><strong><?php print $xxAddress?>:</strong></td>
  310. <td colspan="3" align="left"<?php if(@$useaddressline2==TRUE) print ' colspan="3"'?>><?php print editfunc($alldata["ordShipAddress"],"saddress",25)?></td>
  311. <?php if(@$useaddressline2==TRUE){ ?>
  312. </tr>
  313. <tr>
  314. <td align="right"><strong><?php print $xxAddress2?>:</strong></td>
  315. <td colspan="3" align="left"><?php print editfunc($alldata["ordShipAddress2"],"saddress2",25)?></td>
  316. <?php } ?>
  317. <td align="right"><strong><?php print $xxCity?>:</strong></td>
  318. <td align="left"><?php print editfunc($alldata["ordShipCity"],"scity",25)?></td>
  319. </tr>
  320. <tr>
  321. <td align="right"><strong><?php print $xxAllSta?>:</strong></td>
  322. <td align="left"><?php print editfunc($alldata["ordShipState"],"sstate",25)?></td>
  323. <td align="right"><strong>APO/PO:</strong></td>
  324. <td align="left"><input name="ShipAPO" type="checkbox" id="ShipAPO" value="1" <?php if (!(strcmp($alldata["ordShipPoApo"],1))) {echo "checked=\"checked\"";} ?> <? if($doedit) echo ''; else echo 'disabled="disabled"'; ?>></td>
  325. <td align="right"><strong><?php print $xxCountry?>:</strong></td>
  326. <td align="left"><?php
  327. if($doedit){
  328. if(trim($alldata["ordShipName"]) != "" || trim($alldata["ordShipAddress"]) != "") $usingshipcountry=TRUE; else $usingshipcountry=FALSE;
  329. $foundmatch=FALSE;
  330. print '<select name="scountry" size="1">';
  331. $sSQL = "SELECT countryName,countryTax,countryOrder FROM countries ORDER BY countryOrder DESC, countryName";
  332. $result = mysql_query($sSQL) or print(mysql_error());
  333. while($rs2 = mysql_fetch_array($result)){
  334. print '<option value="' . str_replace('"','&quot;',$rs2["countryName"]) . '"';
  335. if($alldata["ordShipCountry"]==$rs2["countryName"]){
  336. print ' selected';
  337. $foundmatch=TRUE;
  338. if($usingshipcountry) $countrytaxrate=$rs2["countryTax"];
  339. $countryorder=$rs2["countryOrder"];
  340. }
  341. print '>' . $rs2["countryName"] . "</option>\r\n"; }
  342. mysql_free_result($result);
  343. if(! $foundmatch) print '<option value="' . str_replace('"','&quot;',$alldata["ordShipCountry"]) . '" selected>' . $alldata["ordShipCountry"] . "</option>\r\n";
  344. print '</select>';
  345. if($countryorder==2 && $usingshipcountry){
  346. $sSQL = "SELECT stateTax FROM states WHERE stateName='" . mysql_real_escape_string($alldata["ordShipState"]) . "'";
  347. $result = mysql_query($sSQL) or print(mysql_error());
  348. if($rs2 = mysql_fetch_array($result))
  349. $statetaxrate = $rs2["stateTax"];
  350. }
  351. }else
  352. print $alldata["ordShipCountry"]?></td>
  353. </tr>
  354. <tr>
  355. <td align="right"><strong><?php print $xxZip?>:</strong></td>
  356. <td align="left" colspan="5"><?php print editfunc($alldata["ordShipZip"],"szip",15)?></td>
  357. </tr>
  358. <?php }
  359. if($alldata["ordShipType"] != "" || $alldata["ordComLoc"]>0 || $doedit){ ?>
  360. <tr>
  361. <td align="right"><strong><?php print $xxShpMet?>:</strong></td>
  362. <td colspan="3" align="left"><?php
  363. if($doedit && $alldata["ordStatus"]<=3){
  364. print editfunc($alldata["ordShipType"],"shipmethod",25);?>
  365. <a href="javascript:void(0);" onclick="$('shipmethod').value='Standard';">Standard</a> <a href="javascript:void(0);" onclick="$('shipmethod').value='FedEx Express';">FedEx</a> <a href="javascript:void(0);" onclick="$('shipmethod').value='International';">Int</a>
  366. <? }else{
  367. echo $alldata["ordShipType"].'<input type="hidden" name="shipmethod" value="'.$alldata["ordShipType"].'" />';
  368. }
  369. if(! $doedit && ($alldata["ordComLoc"]&2)==2) print $xxWtIns?>
  370. </td>
  371. <td align="right"><strong><?php print $xxCLoc?>:</strong></td>
  372. <td align="left"><?php if($doedit){
  373. print '<select name="commercialloc" size="1">';
  374. print '<option value="N">' . $yyNo . '</option>';
  375. print '<option value="Y"' . (($alldata["ordComLoc"]&1)==1 ? ' selected' : '') . '>' . $yyYes . '</option>';
  376. print '</select>';
  377. }else{
  378. if(($alldata["ordComLoc"]&1)==1) print $yyYes; else print $yyNo;
  379. }?></td>
  380. </tr>
  381. <?php if($doedit){ ?>
  382. <tr>
  383. <td align="right"><strong><?php print $xxShpIns?>:</strong></td>
  384. <td align="left" colspan="5"><?php
  385. print '<select name="wantinsurance" size="1">';
  386. print '<option value="N">' . $yyNo . '</option>';
  387. print '<option value="Y"' . (($alldata["ordComLoc"]&2)==2 ? ' selected' : '') . '>' . $yyYes . '</option>';
  388. print '</select>';
  389. ?></td>
  390. </tr>
  391. <?php }
  392. }
  393. $ordAuthNumber = trim($alldata["ordAuthNumber"]);
  394. $ordTransID = trim($alldata["ordTransID"]);
  395. if(! $isprinter && ($ordAuthNumber != "" || $ordTransID != "" || $doedit)){ ?>
  396. <tr>
  397. <td align="right"><strong><?php print $yyAutCod?>:</strong></td>
  398. <td colspan="3" align="left"><?php print editfunc($ordAuthNumber,"ordAuthNumber",15) ?></td>
  399. <td align="right"><strong><?php print $yyTranID?>:</strong></td>
  400. <td align="left"><?php print editfunc($ordTransID,"ordTransID",15) ?></td>
  401. </tr>
  402. <?php }
  403. // BOL#s ADDED BY CHAD JUL 27,06
  404. $sql_bol = "SELECT * FROM bol WHERE ordID = " . $alldata["ordID"];
  405. $res_bol = mysql_query($sql_bol) or print(mysql_error());
  406. if(mysql_num_rows($res_bol) > 0) {
  407. $row_bol = mysql_fetch_assoc($res_bol);
  408. ?>
  409. <tr>
  410. <td align="right"><strong>Express BOL#:</strong></td>
  411. <td colspan="3"><?=$row_bol['exBOL']?></td>
  412. <?php
  413. if(!empty($row_bol['smBOL'])) {
  414. ?>
  415. <td align="right"><strong>Smart Mail BOL#:</strong></td>
  416. <td><?=$row_bol['smBOL']?></td>
  417. <?php
  418. }
  419. if(!empty($row_bol['gmBOL'])) {
  420. ?>
  421. <td align="right"><strong>Global Mail BOL#:</strong></td>
  422. <td><?=$row_bol['gmBOL']?></td>
  423. <?php
  424. }
  425. ?>
  426. </tr>
  427. <?php
  428. }
  429. // ADD ENDED
  430. $ordAddInfo = Trim($alldata["ordAddInfo"]);
  431. if($ordAddInfo != "" || $doedit){ ?>
  432. <tr>
  433. <td align="right" valign="top"><strong><?php print $xxAddInf?>:</strong></td>
  434. <td align="left" colspan="5"><?php
  435. if($doedit)
  436. print '<textarea name="ordAddInfo" cols="50" rows="4" wrap=virtual>' . $ordAddInfo . '</textarea>';
  437. else
  438. print str_replace(array("\r\n","\n"),array("<br />","<br />"),$ordAddInfo); ?></td>
  439. </tr>
  440. <?php }
  441. if(! $isprinter){
  442. if(! $doedit) print '<form method="post" action="/admin/orders.php"><input type="hidden" name="updatestatus" value="1" /><input type="hidden" name="orderid" value="' . @$_GET["id"] . '" />';
  443. ?>
  444. <tr>
  445. <td align="right" valign="top"><strong><?php print $yyStaInf?>:</strong></td>
  446. <td align="left" colspan="5"><textarea name="ordStatusInfo" cols="50" rows="4" wrap="virtual"><?php print $alldata["ordStatusInfo"]?></textarea>
  447. <?php if(! $doedit) print '<input type="submit" value="' . $yyUpdate . '" />'?></td>
  448. </tr>
  449. <? if($doedit) { ?>
  450. <tr>
  451. <td align="right" valign="top"><strong><?php print $yySupInf?>:</strong></td>
  452. <td align="left" colspan="5"><textarea name="ordSupportInfo" cols="50" rows="4" wrap="virtual"><?php print $alldata["ordSupportInfo"]?></textarea>
  453. <?php if(! $doedit) print '<input type="submit" value="' . $yyUpdate . '" />'?></td>
  454. </tr>
  455. <? } ?>
  456. <?php if(($alldata["ordPayProvider"]==3 || $alldata["ordPayProvider"]==13) && $alldata["ordAuthNumber"] != ""){ ?>
  457. <!--<tr>
  458. <td align="center" colspan="6">
  459. <input type="button" value="Capture Funds" onclick="javascript:openemailpopup('oid=<?php print $alldata["ordID"]?>')" /> </td>
  460. </tr>-->
  461. <?php }
  462. if(! $doedit) print '</form>';
  463. if((int)$alldata["ordPayProvider"]==10){ ?>
  464. <tr>
  465. <td align="center" colspan="6"><hr width="50%" />
  466. </td>
  467. </tr>
  468. <?php if(@$_SERVER["HTTPS"] != "on" && (@$_SERVER["SERVER_PORT"] != "443") && @$nochecksslserver != TRUE){ ?>
  469. <tr>
  470. <td align="center" colspan="6"><strong><font color="#FF0000">You do not appear to be viewing this page on a secure (https) connection. Credit card information cannot be shown.</font></strong></td>
  471. </tr>
  472. <?php }else{
  473. $ordCNum = $alldata["ordCNum"];
  474. if($ordCNum != ""){
  475. $cnumarr = "";
  476. $encryptmethod = strtolower(@$encryptmethod);
  477. if($encryptmethod=="none"){
  478. $cnumarr = explode("&",$ordCNum);
  479. }elseif($encryptmethod=="mcrypt"){
  480. if(@$mcryptalg == "") $mcryptalg = MCRYPT_BLOWFISH;
  481. $td = mcrypt_module_open($mcryptalg, '', 'cbc', '');
  482. $thekey = @$ccencryptkey;
  483. $thekey = substr($thekey, 0, mcrypt_enc_get_key_size($td));
  484. $cnumarr = explode(" ", $ordCNum);
  485. $iv = @$cnumarr[0];
  486. $iv = @pack("H" . strlen($iv), $iv);
  487. $ordCNum = @pack("H" . strlen(@$cnumarr[1]), @$cnumarr[1]);
  488. mcrypt_generic_init($td, $thekey, $iv);
  489. $cnumarr = explode("&", mdecrypt_generic($td, $ordCNum));
  490. mcrypt_generic_deinit($td);
  491. mcrypt_module_close($td);
  492. }else{
  493. print '<tr><td colspan="4">WARNING: $encryptmethod is not set. Please see http://www.ecommercetemplates.com/phphelp/ecommplus/parameters.asp#encryption</td></tr>';
  494. }
  495. } ?>
  496. <tr>
  497. <td align="right" colspan="4"><strong><?php print $xxCCName?>:</strong></td>
  498. <td align="left" colspan="2"><?php
  499. if(@$encryptmethod!=""){
  500. if(is_array(@$cnumarr)) print URLDecode(@$cnumarr[4]);
  501. } ?></td>
  502. </tr>
  503. <tr>
  504. <td align="right" colspan="4"><strong><?php print $yyCarNum?>:</strong></td>
  505. <td align="left" colspan="2"><?php
  506. if($ordCNum != ""){
  507. if(is_array($cnumarr)) print $cnumarr[0];
  508. }else{
  509. print "(no data)";
  510. } ?></td>
  511. </tr>
  512. <tr>
  513. <td align="right" colspan="4"><strong><?php print $yyExpDat?>:</strong></td>
  514. <td align="left" colspan="2"><?php
  515. if(@$encryptmethod!=""){
  516. if(is_array(@$cnumarr)) print @$cnumarr[1];
  517. } ?></td>
  518. </tr>
  519. <tr>
  520. <td align="right" colspan="4"><strong>CVV Code:</strong></td>
  521. <td align="left" colspan="2"><?php
  522. if(@$encryptmethod!=""){
  523. if(is_array(@$cnumarr)) print @$cnumarr[2];
  524. } ?></td>
  525. </tr>
  526. <tr>
  527. <td align="right" colspan="4"><strong>Issue Number:</strong></td>
  528. <td align="left" colspan="2"><?php
  529. if(@$encryptmethod!=""){
  530. if(is_array(@$cnumarr)) print @$cnumarr[3];
  531. } ?></td>
  532. </tr>
  533. <?php if($ordCNum != "" && !$doedit){ ?>
  534. <form method="post" action="/admin/orders.php?id=<?php print $_GET["id"]?>">
  535. <input type="hidden" name="delccdets" value="<?php print $_GET["id"]?>" />
  536. <tr>
  537. <td align="center" colspan="6"><input name="submit" type="submit" value="<?php print $yyDelCC?>" /></td>
  538. </tr>
  539. </form>
  540. <?php }
  541. }
  542. }
  543. } // isprinter ?>
  544. <tr>
  545. <td align="center" colspan="6">&nbsp;<br /></td>
  546. </tr>
  547. </table>
  548. <tr>
  549. <table width="100%" border="1" cellspacing="0" cellpadding="4" bordercolor="#999999" style="border-collapse: collapse">
  550. <tr>
  551. <td><strong><?php print $xxPrId?></strong></td>
  552. <td><strong><?php print $xxPrNm?></strong></td>
  553. <td><strong><?php print $xxPrOpts?></strong></td>
  554. <td><strong><?php print $xxQuant?></strong></td>
  555. <td><strong>&nbsp;</strong></td>
  556. <?php if($doedit) print '<td align="center"><strong>DEL</strong></td>' ?>
  557. </tr>
  558. <?php
  559. $totoptpricediff = 0;
  560. if(mysql_num_rows($allorders)>0){
  561. $totoptpricediff = 0;
  562. $rowcounter=0;
  563. while($rsOrders = mysql_fetch_assoc($allorders)){
  564. $optpricediff = 0;
  565. ?>
  566. <tr>
  567. <td valign="top" nowrap><?php if($doedit) print '<input type="button" value="..." onclick="updateoptions(' . $rowcounter . ')">&nbsp;<input type="hidden" name="cartid' . $rowcounter . '" value="' . str_replace('"','&quot;',$rsOrders["cartID"]) . '" />'?><strong><?php print editfunc($rsOrders["cartProdId"],'prodid' . $rowcounter,18)?></strong></td>
  568. <td valign="top">
  569. <?php print editfunc($rsOrders["cartProdName"],'prodname' . $rowcounter,24)?><br />
  570. <?
  571. $sql_cert="SELECT cert_id,cert_code FROM certificates WHERE cert_order_id=".$_GET["id"]." AND cert_prod_id='".$rsOrders["cartProdId"]."'";
  572. //echo $sql_cert;
  573. $result_cert=mysql_query($sql_cert);
  574. if(mysql_num_rows($result_cert)>0) {
  575. while($row_cert=mysql_fetch_assoc($result_cert)){?>
  576. <stong>(<?=$row_cert['cert_code']?>)</strong> <a href="/admin/certs.php?mode=1&amp;sbcode=<?=$row_cert['cert_id']?>">view</a> | <a href="/admin/certs.php?mode=2&amp;sbcode=<?=$row_cert['cert_id']?>">history</a><br />
  577. <? }
  578. }?>
  579. <?
  580. $sql_down="SELECT * FROM digitaldownloads WHERE orderID=".$_GET["id"]." AND type='".$rsOrders["cartProdId"]."'";
  581. //echo $sql_cert;
  582. $result_down=mysql_query($sql_down);
  583. if(mysql_num_rows($result_down)>0) {?>
  584. <ol style="margin:2px;">
  585. <? while($row_down=mysql_fetch_assoc($result_down)){?>
  586. <li style="margin:1px; font-weight:bold;">License ID: <?=$row_down['licenseID']?><br />
  587. Password: <?=$row_down['password']?></li>
  588. <? } ?>
  589. </ol>
  590. <? }?> </td>
  591. <td valign="top"><?php
  592. if($doedit) print '<span id="optionsspan' . $rowcounter . '">';
  593. $sSQL = "SELECT coOptGroup,coCartOption,coPriceDiff,coOptID,optGroup,optStyleID,coExtendShipping,ui.display_image,ui.org_img_name FROM cartoptions LEFT JOIN options ON cartoptions.coOptID=options.optID LEFT JOIN uploaded_images ui ON cartoptions.coCartOption=ui.id WHERE coCartID=" . $rsOrders["cartID"] . " ORDER BY coID";
  594. $result = mysql_query($sSQL) or print(mysql_error());
  595. if(mysql_num_rows($result) > 0){
  596. if($doedit) print '<table border="0" cellspacing="0" cellpadding="1" width="100%">';
  597. while($rs2 = mysql_fetch_array($result)){
  598. $imgsrc='';
  599. $imgname='';
  600. if(!empty($rs2["display_image"])) {
  601. $imgsrc='<br /><img src="/imguploads/img_screen/'.$rs2["display_image"].'.gif" align="top"><div style="font-size:9px;">(If the image does not appear there is a problem with the custom screen upload)</div>';
  602. $imgname='<br />&nbsp;&nbsp;&nbsp;-Image Name: '.$rs2["org_img_name"];
  603. }
  604. if($doedit){
  605. print '<tr><td align="right"><strong>' . $rs2["coOptGroup"] . ':</strong></td><td>';
  606. if(is_null($rs2["optGroup"])){
  607. print 'xxxxxx';
  608. }else{
  609. $sSQL="SELECT optID," . getlangid("optName",32) . ",optPriceDiff,optType,optFlags,optStock,optPriceDiff AS optDims FROM options INNER JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optGroup=" . $rs2["optGroup"] . ' ORDER BY optID';
  610. $result2 = mysql_query($sSQL) or print(mysql_error());
  611. if($rsl = mysql_fetch_assoc($result2)){
  612. if(abs($rsl["optType"])==2){
  613. print '<select onchange="dorecalc(true)" name="optn' . $rowcounter . '_' . $rs2["coOptID"] . '" id="optn' . $rowcounter . '_' . $rs2["coOptID"] . '" size="1">';
  614. do {
  615. print '<option value="' . $rsl["optID"] . "|" . (($rsl["optFlags"] & 1) == 1 ? ($rsOrders["cartProdPrice"]*$rsl["optPriceDiff"])/100.0 : $rsl["optPriceDiff"]) . '"';
  616. if($rsl["optID"]==$rs2["coOptID"]) print ' selected';
  617. print '>' . $rsl[getlangid("optName",32)];
  618. if((double)$rsl["optPriceDiff"] != 0){
  619. print ' ';
  620. if((double)$rsl["optPriceDiff"] > 0) print '+';
  621. if(($rsl["optFlags"] & 1) == 1)
  622. print number_format(($rsOrders["cartProdPrice"]*$rsl["optPriceDiff"])/100.0,2,'.','');
  623. else
  624. print number_format($rsl["optPriceDiff"],2,'.','');
  625. }
  626. print '</option>';
  627. } while($rsl = mysql_fetch_array($result2));
  628. print '</select>';
  629. }else{
  630. print "<input type='hidden' name='optn" . $rowcounter . '_' . $rs2["coOptID"] . "' value='" . $rsl["optID"] . "' /><textarea wrap='virtual' name='voptn" . $rowcounter . '_' . $rs2["coOptID"] . "' id='voptn". $rowcounter. '_' . $rs2["coOptID"] . "' cols='30' rows='3'>";
  631. print $rs2["coCartOption"] . '</textarea>';
  632. }
  633. }
  634. }
  635. print "</td></tr>";
  636. }else{
  637. $extend_shipping='';
  638. if(!empty($rs2["coExtendShipping"])) $extend_shipping=' <span style="color:#FF0000;font-weight:bold;">(This option increases shipping time by '.$rs2["coExtendShipping"]. ' days)</span>';
  639. print '<strong>' . $rs2["coOptGroup"] . ':</strong> ' . str_replace(array("\r\n","\n"),array("<br />","<br />"),$rs2["coCartOption"]).' ' .$imgname.' '.$imgsrc.$cert_code. $extend_shipping . '<br />';
  640. }
  641. if($doedit)
  642. $optpricediff += $rs2["coPriceDiff"];
  643. else
  644. $rsOrders["cartProdPrice"] += $rs2["coPriceDiff"];
  645. }
  646. if($doedit) print '</table>';
  647. }else{
  648. print '-';
  649. }
  650. mysql_free_result($result);
  651. if($doedit) print '</span>' ?></td>
  652. <td valign="top"><?php print editfunc($rsOrders["cartQuantity"],'quant' . $rowcounter . '" onchange="dorecalc(true)',5)?></td>
  653. <td valign="top"><?php /*?><?php if($doedit) print editnumeric($rsOrders["cartProdPrice"],'price' . $rowcounter . '" onchange="dorecalc(true)',7); else print FormatEuroCurrency($rsOrders["cartProdPrice"]*$rsOrders["cartQuantity"])?>
  654. <?php if($doedit){
  655. print '<input type="hidden" id="optdiffspan' . $rowcounter . '" value="' . $optpricediff . '">';
  656. $totoptpricediff += ($optpricediff*$rsOrders["cartQuantity"]);
  657. }
  658. ?><?php */?></td>
  659. <?php if($doedit) print '<td align="center"><input type="checkbox" name="del_' . $rowcounter . '" id="del_' . $rowcounter . '" value="yes" /></td>' ?>
  660. </tr>
  661. <?php $rowcounter++;
  662. }
  663. }
  664. ?>
  665. <!--NEXTPRODUCTCOMMENT-->
  666. <?php /*?><?php if($doedit){ ?>
  667. <tr>
  668. <td align="right" colspan="4">
  669. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  670. <tr>
  671. <td align="center"><?php if($doedit) print '<input style="width:30px;" type="button" value="-" onclick="extraproduct(\'-\')"> ' . $yyMoProd . ' <input style="width:30px;" type="button" value="+" onclick="extraproduct(\'+\')"> &nbsp; <input type="button" value="' . $yyRecal . '" onclick="dorecalc(false)">'?></td>
  672. <td align="right"><strong>Options Total:</strong></td>
  673. </tr>
  674. </table></td>
  675. <td align="left" colspan="2"><span id="optdiffspan"><?php print number_format($totoptpricediff, 2, '.', '')?></span></td>
  676. </tr>
  677. <?php } ?>
  678. <tr>
  679. <td align="right" colspan="4"><strong><?php print $xxOrdTot?>:</strong></td>
  680. <td align="left"><div id="ordTot"><?php echo sprintf("%.2f",$alldata["ordTotal"]); ?></div><input name="ordtotal" id="ordtotal" type="hidden" value="<?php echo $alldata["ordTotal"] ?>" /></td>
  681. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  682. </tr>
  683. <?php
  684. $runTot = $alldata["ordTotal"];
  685. $sql = "SELECT * FROM price_adj WHERE ordID = " . $_GET['id'] . " ORDER BY ordering";
  686. $res = mysql_query($sql) or print(mysql_error());
  687. if(mysql_num_rows($res) > 0) {
  688. $k=1;
  689. $prcTot = 0;
  690. ?>
  691. <tr>
  692. <td>&nbsp;</td>
  693. <td>&nbsp;</td>
  694. <td>&nbsp;</td>
  695. <td>&nbsp;</td>
  696. <td>&nbsp;</td>
  697. </tr>
  698. <?php
  699. while($row=mysql_fetch_assoc($res)) {
  700. $price = 0;
  701. $disp_price = 0;
  702. $amount = '';
  703. if($row['type'] == 'credit') {
  704. if($row['amt_type'] == 'percentage') {
  705. $price = $runTot * ($row['amt'] * .01);
  706. $runTot -= $price;
  707. $prcTot -= $price;
  708. $disp_price = '-'.(int)$row['amt'].'%';
  709. $amount = '-'.money_format("%!.2n",$price);
  710. }else{
  711. $price = '$-'.money_format("%!.2n",$row['amt']);
  712. $runTot -= $row['amt'];
  713. $prcTot -= $row['amt'];
  714. $disp_price = $price;
  715. $amount = '-'.money_format("%!.2n",$row['amt']);
  716. }
  717. }else{
  718. if($row['amt_type'] == 'percentage') {
  719. $price = $runTot * ($row['amt'] * .01);
  720. $runTot += $price;
  721. $prcTot += $price;
  722. $disp_price = (int)$row['amt'].'%';
  723. $amount = money_format("%.2n",$price);
  724. }else{
  725. $price = money_format("%.2n",$row['amt']);
  726. $runTot += $row['amt'];
  727. $prcTot += $row['amt'];
  728. $disp_price = $price;
  729. $amount = money_format("%.2n",$row['amt']);
  730. }
  731. }
  732. ?>
  733. <tr>
  734. <td colspan="3" style="font-weight: bold; text-align: right">Price Adjustment <?=$k?>:</td>
  735. <td align="left"<?=(strstr($disp_price,"-"))?' style="color: red"':''?>><?=$disp_price?></td>
  736. <td align="left"<?=(strstr($disp_price,"-"))?' style="color: red"':''?>><?=$amount?></td>
  737. </tr>
  738. <?php
  739. $k++;
  740. }
  741. ?>
  742. <tr>
  743. <td>&nbsp;</td>
  744. <td>&nbsp;</td>
  745. <td>&nbsp;</td>
  746. <td>&nbsp;</td>
  747. <td>&nbsp;</td>
  748. </tr>
  749. <?php
  750. }
  751. ?>
  752. <?php if((double)$alldata["ordShipping"]!=0.0 || $doedit){ ?>
  753. <tr>
  754. <td align="right" colspan="4"><strong><?php print $xxShippg?>:</strong></td>
  755. <td align="left"><?php print editnumeric($alldata["ordShipping"],"ordShipping",7)?></td>
  756. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  757. </tr>
  758. <?php }
  759. if((double)$alldata["ordHandling"]!=0.0 || $doedit){ ?>
  760. <tr>
  761. <td align="right" colspan="4"><strong><?php print $xxHndlg?>:</strong></td>
  762. <td align="left"><?php print editnumeric($alldata["ordHandling"],"ordHandling",7)?></td>
  763. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  764. </tr>
  765. <?php }
  766. if((double)$alldata["ordDiscount"]!=0.0 || $doedit){ ?>
  767. <tr>
  768. <td align="right" colspan="4"><strong><?php print $xxDscnts?>:</strong></td>
  769. <td align="left"><font color="#FF0000"><?php print editnumeric($alldata["ordDiscount"],"ordDiscount",7)?></font></td>
  770. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  771. </tr>
  772. <?php }
  773. if((double)$alldata["ord_cert_amt"]!=0.0 || $doedit){
  774. $sqlcert="SELECT cert_code FROM certificates WHERE cert_id=".$alldata["ord_cert_id"];
  775. $resultcert=mysql_query($sqlcert);
  776. $rowcert=mysql_fetch_assoc($resultcert);
  777. ?>
  778. <tr>
  779. <td align="right" colspan="4"><strong><?='('.$rowcert["cert_code"].')'?> <?php print $xxGCerts?>:</strong></td>
  780. <td align="left"><font color="#FF0000"><?php print editnumeric($alldata["ord_cert_amt"],"ord_cert_amt",7)?></font></td>
  781. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  782. </tr>
  783. <?php }
  784. if((double)$alldata["ordStateTax"]!=0.0 || $doedit){ ?>
  785. <tr>
  786. <td align="right" colspan="4"><strong><?php print $xxStaTax?>:</strong></td>
  787. <td align="left"><?php print editnumeric($alldata["ordStateTax"],"ordStateTax",7)//$alldata["ordStateTax"]?></td>
  788. <?php if($doedit) print '<td align="center" nowrap><input type="text" name="staterate" id="staterate" size="1" value="' . $statetaxrate . '">%</td>' ?>
  789. </tr>
  790. <?php }
  791. if((double)$alldata["ordCountryTax"]!=0.0 || $doedit){ ?>
  792. <tr>
  793. <td align="right" colspan="4"><strong><?php print $xxCntTax?>:</strong></td>
  794. <td align="left"><?php print editnumeric($alldata["ordCountryTax"],"ordCountryTax",7)?></td>
  795. <?php if($doedit) print '<td align="center" nowrap><input type="text" name="countryrate" id="countryrate" size="1" value="' . $countrytaxrate . '">%</td>' ?>
  796. </tr>
  797. <?php }
  798. if((double)$alldata["ordHSTTax"]!=0.0 || ($doedit && @$canadataxsystem)){ ?>
  799. <tr>
  800. <td align="right" colspan="4"><strong><?php print $xxHST?>:</strong></td>
  801. <td align="left"><?php print editnumeric($alldata["ordHSTTax"],"ordHSTTax",7)?></td>
  802. <?php if($doedit) print '<td align="center" nowrap><input type="text" name="hstrate" id="hstrate" size="1" value="' . $hsttaxrate . '">%</td>' ?>
  803. </tr>
  804. <?php } ?>
  805. <tr>
  806. <td align="right" colspan="4"><strong><?php print $xxGndTot?>:</strong></td>
  807. <td align="left"><span id="grandtotalspan"><?php print FormatEuroCurrency(($alldata["ordTotal"]+$alldata["ordStateTax"]+$alldata["ordCountryTax"]+$alldata["ordHSTTax"]+$alldata["ordShipping"]+$alldata["ordHandling"]+$prcTot)-$alldata["ordDiscount"]-$alldata["ord_cert_amt"])?></span></td>
  808. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  809. </tr>
  810. </table>
  811. </span>
  812. </td>
  813. </tr>
  814. <?php if($isprinter && @$invoicefooter != ""){ ?>
  815. <tr>
  816. <td width="100%"><?php print $invoicefooter?></td>
  817. </tr>
  818. <?php }elseif($doedit){ ?>
  819. <tr>
  820. <td align="center" width="100%">&nbsp;<br /><input type="submit" value="<?php print $yyUpdate?>" onclick="updateClicked=true; cloneClicked=false;" />&nbsp;<input type="submit" name="clone" value="Clone Order" onclick="updateClicked=false; cloneClicked=true;" /><br />&nbsp;</td>
  821. </tr>
  822. <?php } ?><?php */?>
  823. </table>
  824. <?php
  825. if($doedit) print '</form>';
  826. if($doedit){
  827. // ADDED by Chad Jun-06-06
  828. // PRICE ADJUSTMENTS
  829. ?>
  830. <h2><a name="prc_adj"></a>Price Adjustments</h2>
  831. <?php
  832. if(!empty($_GET['adj_err'])) {
  833. ?>
  834. <div style="margin: 5px auto; color: #FF0000; font-weight: bold; text-align: center"><?=$_GET['adj_err']?>
  835. </div>
  836. <?php
  837. }elseif(!empty($_GET['adj_msg'])) {
  838. ?>
  839. <div style="margin: 5px auto; color: #009900; font-weight: bold; text-align: center"><?=$_GET['adj_msg']?>
  840. </div>
  841. <?php
  842. }
  843. ?>
  844. <table width="95%" cellpadding="3" cellspacing="0" border="1" style="margin: 0 auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  845. <tr style="background-color: #BFC9E0; color: #194C7F">
  846. <th width="60" style="text-align: center">Type</th>
  847. <th width="80" style="text-align: center">Amount Type</th>
  848. <th width="80" style="text-align: center">Amount</th>
  849. <th width="150" style="text-align: center">Date</th>
  850. <th>Note</th>
  851. <?php
  852. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  853. ?>
  854. <th width="28">Edit</th>
  855. <th width="28">Delete</th>
  856. <th width="28">Move Up</th>
  857. <th width="28">Move Down</th>
  858. <?php
  859. }
  860. ?>
  861. </tr>
  862. <?php
  863. $sql = "SELECT * FROM price_adj WHERE ordID = " . $_GET["id"] . " ORDER BY ordering";
  864. $res = mysql_query($sql) or print(mysql_error());
  865. $num_rows = mysql_num_rows($res);
  866. if($num_rows > 0) {
  867. $j=0;
  868. while($row=mysql_fetch_assoc($res)) {
  869. ?>
  870. <tr<?=($j%0==0?'':' style="background-color: #E6E9F5"')?>>
  871. <td style="text-align: center"><?=$row['type']?></td>
  872. <td style="text-align: center"><?=$row['amt_type']?></td>
  873. <td style="text-align: right"><?=$row['amt']?></td>
  874. <td style="text-align: left"><?=date("n/j/Y g:i a",strtotime($row['date']))?></td>
  875. <td style="text-align: left"><?=$row['note']?></td>
  876. <?php
  877. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  878. ?>
  879. <td style="text-align: center"><a href="/admin/editprcadj.php?pa_id=<?=$row['id']?>&action=edit" onclick="window.open(this.href,'edit_txn','left=700,top=100,width=550,height=150,toolbar=0'); return false;"><img src="/lib/images/misc/edit.gif" height="24" width="24" /></a></td>
  880. <td style="text-align: center"><a href="/admin/editprcadj.php?pa_id=<?=$row['id']?>&action=delete" onclick="window.open(this.href,'edit_txn','left=700,top=100,width=550,height=150,toolbar=0'); return false;"><img src="/lib/images/misc/delete.gif" width="24" height="24" /></a></td>
  881. <td style="text-align: center"><? if($row['ordering']!=1){?><a href="/admin/mvprcadj.php?pa_id=<?=$row['id']?>&pa_ordID=<?=$row['ordID']?>&position=<?=$row['ordering']?>&action=moveup" onclick=""><img src="/lib/images/misc/arrow_up.png" width="24" height="24" /></a><? } ?></td>
  882. <td style="text-align: center"><? if($row['ordering']!=$num_rows){?><a href="/admin/mvprcadj.php?pa_id=<?=$row['id']?>&pa_ordID=<?=$row['ordID']?>&position=<?=$row['ordering']?>&action=movedown" onclick=""><img src="/lib/images/misc/arrow_down.png" width="24" height="24" /></a><? } ?></td>
  883. <?php
  884. }
  885. ?>
  886. </tr>
  887. <?php
  888. $j++;
  889. }
  890. }else{
  891. ?>
  892. <tr>
  893. <td colspan="9" style="text-align: center; font-weight: bold">No Price Adjustments Found</td>
  894. </tr>
  895. <?php
  896. }
  897. ?>
  898. </table>
  899. <?php
  900. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  901. ?>
  902. <input type="button" id="btn_prc_add" value="Add Price Adjustment" onclick="togglePrcAdd();" />
  903. <div id="div_prc_add" style="display: none">
  904. <form id="adj_frm" name="adj_frm" method="post" action="/admin/ordersprocess.php">
  905. <table cellpadding="3" cellspacing="0" border="1" style="margin: 0 auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  906. <tr style="background-color: #BFC9E0; color: #194C7F">
  907. <td colspan="2" style="text-align: center; font-weight: bold; font-size: 14px">Add Price Adjustment</td>
  908. </tr>
  909. <tr>
  910. <td style="font-weight: bold">Type:</td>
  911. <td>
  912. <select id="adj_type" name="adj_type">
  913. <option value="" selected="selected">Choose...</option>
  914. <option value="credit">Credit</option>
  915. <option value="debit">Debit</option>
  916. </select> </td>
  917. </tr>
  918. <tr>
  919. <td style="font-weight: bold">Amt Type:</td>
  920. <td>
  921. <select id="adj_amt_type" name="adj_amt_type">
  922. <option value="" selected="selected">Choose...</option>
  923. <option value="fixed">Fixed</option>
  924. <option value="percentage">Percentage</option>
  925. </select> </td>
  926. </tr>
  927. <tr>
  928. <td style="font-weight: bold">Amount:</td>
  929. <td><input id="adj_amt" name="adj_amt" type="text" value="" /></td>
  930. </tr>
  931. <tr>
  932. <td style="font-weight: bold">Note:</td>
  933. <td><textarea id="adj_note" name="adj_note"></textarea></td>
  934. </tr>
  935. <tr>
  936. <td colspan="2" style="text-align: center"><input type="submit" id="adj_submit" name="adj_submit" value="Add" /></td>
  937. </tr>
  938. </table>
  939. <input type="hidden" id="adj_ordID" name="adj_ordID" value="<?=$_GET["id"]?>" />
  940. <input type="hidden" id="adj_doedit" name="adj_doedit" value="<?=$_GET["doedit"]?>" />
  941. </form>
  942. </div>
  943. <?php
  944. }
  945. // ADD ENDED
  946. // ADDED by Chad Jun-05-06
  947. // TRANSACTIONS
  948. $sql = "SELECT * FROM transactions WHERE ordID = " . $_GET["id"];
  949. $res = mysql_query($sql) or print(mysql_error());
  950. ?>
  951. <h2><a name="aim"></a>Transactions</h2>
  952. <?php
  953. if(!empty($_GET['aim_err'])) {
  954. ?>
  955. <div style="margin: 5px auto; color: #FF0000; font-weight: bold; text-align: center"><?=$_GET['aim_err']?>
  956. </div>
  957. <?php
  958. }elseif(!empty($_GET['aim_msg'])) {
  959. ?>
  960. <div style="margin: 5px auto; color: #009900; font-weight: bold; text-align: center"><?=$_GET['aim_msg']?>
  961. </div>
  962. <?php
  963. }
  964. ?>
  965. <table width="95%" cellpadding="3" cellspacing="0" border="1" style="margin: 0 auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  966. <tr style="background-color: #BFC9E0; color: #194C7F">
  967. <th width="85" style="text-align: center">Type</th>
  968. <th width="60" style="text-align: right">Amount</th>
  969. <th width="80" style="text-align: center">TXN</th>
  970. <th width="120" style="text-align: left">Date</th>
  971. <th>Note</th>
  972. </tr>
  973. <?php
  974. while($row=mysql_fetch_assoc($res)) {
  975. ?>
  976. <tr>
  977. <td style="text-align: center"><?=$row['type']?></td>
  978. <td style="text-align: center"><?=money_format("%.2n",$row['amt'])?></td>
  979. <td style="text-align: center"><?=$row['txn']?></td>
  980. <td style="text-align: center"><?=date("n/j/Y g:i a",strtotime($row['date_received']))?></td>
  981. <td><?=$row['note']?></td>
  982. </tr>
  983. <?php
  984. }
  985. ?>
  986. </table>
  987. <?php
  988. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==9 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  989. ?>
  990. <input type="button" id="btn_add_txn" value="Credit or Void" onclick="toggleTXN();" />
  991. <div id="div_trans" style="display: none">
  992. <form id="aim_frm" name="aim_frm" method="post" action="/admin/ordersprocess.php" onsubmit="return checkAIM(this);">
  993. <table cellpadding="3" cellspacing="0" border="1" style="margin: 5px auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  994. <tr style="background-color: #BFC9E0; color: #194C7F">
  995. <td colspan="4" style="text-align: center; font-weight: bold; font-size: 14px">Credit or Void a Transaction</td>
  996. </tr>
  997. <tr>
  998. <th style="text-align: center">Type</th>
  999. <th style="text-align: center">TXN</th>
  1000. <th style="text-align: center">Amount</th>
  1001. <th>Note</th>
  1002. </tr>
  1003. <tr>
  1004. <td valign="top">
  1005. <select name="aim_type" id="aim_type">
  1006. <option value="" selected="selected">Choose...</option>
  1007. <option value="CREDIT">Credit</option>
  1008. <option value="VOID">Void</option>
  1009. </select> </td>
  1010. <td valign="top"><input type="text" id="aim_txn" name="aim_txn" value="" autocomplete="off" /></td>
  1011. <td valign="top"><input type="text" id="aim_amt" name="aim_amt" value="" autocomplete="off" /></td>
  1012. <td valign="top"><textarea id="aim_note" name="aim_note"></textarea></td>
  1013. </tr>
  1014. <tr>
  1015. <td colspan="4" style="text-align: right"><input type="submit" id="aim_submit" name="aim_submit" value="Submit" /></td>
  1016. </tr>
  1017. </table>
  1018. <input type="hidden" id="aim_inv" name="aim_inv" value="<?=$_GET["id"]?>" />
  1019. <?php
  1020. $tmp = explode(" ",$alldata["ordName"]);
  1021. ?>
  1022. <input type="hidden" id="aim_fname" name="aim_fname" value="<?=$tmp[0]?>" />
  1023. <input type="hidden" id="aim_lname" name="aim_lname" value="<?=(!empty($tmp[1]))?$tmp[1]:''?>" />
  1024. <input type="hidden" id="aim_doedit" name="aim_doedit" value="<?=$_GET['doedit']?>" />
  1025. </form>
  1026. </div>
  1027. <input type="button" id="btn_charge" value="Charge CC" onclick="toggleCharge();" style="display: block; margin: 5px 5px 5px 0" />
  1028. <div id="div_charge" style="display: none">
  1029. <?
  1030. if(!empty($alldata["ordEID"])){
  1031. $sql_eid="SELECT * FROM customers WHERE custID=".$alldata["ordEID"];
  1032. $result_eid=mysql_query($sql_eid);
  1033. if(mysql_num_rows($result_eid)>0){
  1034. $row_eid=mysql_fetch_assoc($result_eid);
  1035. }
  1036. }
  1037. ?>
  1038. <form id="frmCharge" name="frmCharge" method="post" action="/admin/ordersprocess.php">
  1039. <table cellpadding="3" cellspacing="0" border="1" style="margin: 5px auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  1040. <tr style="background-color: #BFC9E0; color: #194C7F">
  1041. <td colspan="2" style="font-size: 14px; font-weight: bold; text-align: center">Authorize &amp; Capture</td>
  1042. </tr>
  1043. <tr>
  1044. <td>First Name:</td>
  1045. <td><input type="text" id="am_fname" name="am_fname" value="<?=$row_eid['Name']?>" /></td>
  1046. </tr>
  1047. <tr>
  1048. <td>Last Name:</td>
  1049. <td><input type="text" id="am_lname" name="am_lname" value="" /></td>
  1050. </tr>
  1051. <tr>
  1052. <td>Address:</td>
  1053. <td><input type="text" id="am_address" name="am_address" value="<?=$row_eid['Address']?>" /></td>
  1054. </tr>
  1055. <tr>
  1056. <td>Address 2:</td>
  1057. <td><input type="text" id="am_address2" name="am_address2" value="<?=$row_eid['Address2']?>" /></td>
  1058. </tr>
  1059. <tr>
  1060. <td>City:</td>
  1061. <td><input type="text" id="am_city" name="am_city" value="<?=$row_eid['City']?>" /></td>
  1062. </tr>
  1063. <tr>
  1064. <td>State:</td>
  1065. <td><input type="text" id="am_state" name="am_state" value="<? if(!empty($row_eid['State2'])) echo $row_eid['State2']; else echo $row_eid['State']; ?>" /></td>
  1066. </tr>
  1067. <tr>
  1068. <td>Zip:</td>
  1069. <td><input type="text" id="am_zip" name="am_zip" value="<?=$row_eid['Zip']?>" /></td>
  1070. </tr>
  1071. <tr>
  1072. <td>Amount:</td>
  1073. <td><input type="text" id="am_amt" name="am_amt" value="" autocomplete="off" /></td>
  1074. </tr>
  1075. <tr>
  1076. <td>CC#:</td>
  1077. <td><input type="text" id="am_cc_num" name="am_cc_num" value="<?=Decrypt($row_eid['ccNum'], $cart_misc)?>" autocomplete="off" /></td>
  1078. </tr>
  1079. <tr>
  1080. <td>Exp. Date:</td>
  1081. <td>
  1082. <select id="am_exp_mon" name="am_exp_mon">
  1083. <?
  1084. $ccexp=explode('/',$row_eid['ccExp']);
  1085. for($i=1; $i<=12; $i++)
  1086. {
  1087. if($i<10)
  1088. $i = '0'.$i;
  1089. if($i == $ccexp[0])
  1090. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1091. else if(date('n') == $i )
  1092. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1093. else
  1094. echo '<option value="'.$i.'">'.$i.'</option>';
  1095. }
  1096. ?>
  1097. </select>&nbsp;/&nbsp;
  1098. <select id="am_exp_year" name="am_exp_year">
  1099. <?
  1100. $cur_year = date('Y');
  1101. for($i=($cur_year); $i<=$cur_year+10; $i++)
  1102. {
  1103. if($i == $ccexp[1])
  1104. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1105. elseif(date('Y') == $i || $i==$ccexp[1])
  1106. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1107. else
  1108. echo '<option value="'.$i.'">'.$i.'</option>';
  1109. }
  1110. ?>
  1111. </select> </td>
  1112. </tr>
  1113. <tr>
  1114. <td>CCV:</td>
  1115. <td><input type="text" id="am_ccv" name="am_ccv" value="<?=$row_eid['ccCCV']?>" autocomplete="off" /></td>
  1116. </tr>
  1117. <tr>
  1118. <td colspan="2" style="text-align: center"><input type="submit" id="am_submit" name="am_submit" value="Submit" /></td>
  1119. </tr>
  1120. </table>
  1121. <input type="hidden" id="am_inv" name="am_inv" value="<?=$_GET["id"]?>" />
  1122. <input type="hidden" id="am_type" name="am_type" value="AUTH_CAPTURE" />
  1123. <input type="hidden" id="am_doedit" name="am_doedit" value="<?=$_GET['doedit']?>" />
  1124. </form>
  1125. </div>
  1126. <?php
  1127. }
  1128. } // End of User permission check
  1129. // ADDED by Chad Apr-04-06
  1130. // LOCATION HISTORY
  1131. $qry = "SELECT * FROM location WHERE ordID = '".$_GET["id"]."'";
  1132. $res = mysql_query($qry) or print(mysql_error());
  1133. ?>
  1134. <table width="300" cellpadding="3" cellspacing="0" style="margin: 10px auto; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #4B1610; border-collapse: collapse">
  1135. <tr style="border-bottom: 1px solid #4B1610">
  1136. <td colspan="2" style="text-align: center; background-color: #4B1610; color: #FFFFFF; font-weight: bold">Location History</td>
  1137. </tr>
  1138. <?php
  1139. $i=0;
  1140. if(mysql_num_rows($res) > 0 ) {
  1141. while($row = mysql_fetch_assoc($res)) {
  1142. ?>
  1143. <tr style="background-color: #<?=($i%2==0)?'903E36':'903E36'?>; border-bottom: 1px solid #4B1610">
  1144. <td width="50%" style="color: #FFFFFF"><?=$row['location']?></td>
  1145. <td style="color: #FFFFFF"><?=$row['stamp']?></td>
  1146. </tr>
  1147. <?php
  1148. $i++;
  1149. }
  1150. }else{
  1151. ?>
  1152. <tr>
  1153. <td colspan="2" style="text-align: center">No location found</td>
  1154. </tr>
  1155. <?php
  1156. }
  1157. ?>
  1158. </table>
  1159. <?php
  1160. // ADD ENDED
  1161. // ADDED by Chad Apr-04-06
  1162. // FEDEX TRACKING
  1163. $qry = "SELECT * FROM fedex WHERE ordID = '".$_GET["id"]."'";
  1164. $res = mysql_query($qry);
  1165. if(mysql_num_rows($res) > 0) {
  1166. $row = mysql_fetch_assoc($res);
  1167. $trackNum = $row['trackNum'];
  1168. if(!empty($trackNum)) {
  1169. include(DOCROOT.'includes/fedex/fedexdc.php');
  1170. $fed = new FedExDC();
  1171. $track_Ret = $fed->track(
  1172. array(
  1173. '1537' => $trackNum, //Tracking Number
  1174. '1534' =>'Y' // detail_scan_indicator (Show me all the tracking data)
  1175. )
  1176. );
  1177. $ctr = 0;
  1178. $hasChanged = false;
  1179. $isDelivered = false;
  1180. for($i=1; $i<=$track_Ret[1584]; $i++) {
  1181. // See Customer Service Page for displaying results
  1182. ?>
  1183. <div style="margin: 10px auto; border: 2px solid #2C578A; width: 550px">
  1184. <table align="center" width="550" border="0" cellpadding="3" cellspacing="0" style="font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif">
  1185. <tr>
  1186. <th colspan="2" style="font-size: 18px; background-color: #2C578A; color: #FFF; font-weight: bold; text-align: left">Fed<span style="margin-left: -3px; color: #FF6600">Ex</span></th>
  1187. <th colspan="3" style="font-size: 14px; text-align: right; background-color: #2C578A; color: #FFF; font-weight: bold">Tracking# <?=$trackNum?></th>
  1188. </tr>
  1189. <?php
  1190. if(!empty($track_Ret['1339-'.$i]))
  1191. {
  1192. $tmp_date = $track_Ret['1339-'.$i];
  1193. $est_del = substr($tmp_date,0,4).'-'.substr($tmp_date,4,2).'-'.substr($tmp_date,6,2);
  1194. ?>
  1195. <tr>
  1196. <td colspan="5" style="background-color: #2C578A; height: 15px">&nbsp;</td>
  1197. </tr>
  1198. <tr>
  1199. <td colspan="5" style="background-color: #DFE7FF"><strong>Estimated Delivery Date:</strong> <?=date('M j, Y',strtotime($est_del))?></td>
  1200. </tr>
  1201. <?php
  1202. }
  1203. ?>
  1204. <tr>
  1205. <th align="left" width="150" colspan="2" style="background-color: #2C578A; color: #FFF; font-weight: bold">Date/Time</th>
  1206. <th align="left" style="background-color: #2C578A; color: #FFF; font-weight: bold">Activity</th>
  1207. <th align="left" style="background-color: #2C578A; color: #FFF; font-weight: bold">Location</th>
  1208. <th align="left" style="background-color: #2C578A; color: #FFF; font-weight: bold">Details</th>
  1209. </tr>
  1210. <?php
  1211. for($j=1; $j<=$track_Ret['1715-'.$i]; $j++)
  1212. {
  1213. $date = $track_Ret['1162-'.$i.'-'.$j];
  1214. $year = substr($date,0,4);
  1215. $mon = substr($date,4,2);
  1216. $day = substr($date,6,2);
  1217. $hrs = substr($track_Ret['1163-'.$i.'-'.$j],0,2);
  1218. $min = substr($track_Ret['1163-'.$i.'-'.$j],2,2);
  1219. $sec = substr($track_Ret['1163-'.$i.'-'.$j],4,2);
  1220. $date = $year.'-'.$mon.'-'.$day.' '.$hrs.':'.$min.':'.$sec;
  1221. $unixDate = strtotime($date);
  1222. if(empty($track_Ret['1161-'.$i.'-'.$j]))
  1223. {
  1224. $state = $track_Ret['1164-'.$i.'-'.$j];
  1225. }
  1226. else
  1227. {
  1228. $state = $track_Ret['1161-'.$i.'-'.$j];
  1229. }
  1230. if(date('Ymd',$unixDate) != date('Ymd',$last_date))
  1231. {
  1232. $ctr++;
  1233. $hasChanged = true;
  1234. }
  1235. if($track_Ret['1159-'.$i.'-'.$j] == 'Delivered' && empty($track_Ret['1711-'.$i.'-'.$j]))
  1236. {
  1237. $isDelivered = true;
  1238. }
  1239. ?>
  1240. <tr style="background-color: #<?=($ctr%2==0)?'FFF':'DFE7FF'?>">
  1241. <?php
  1242. if($hasChanged)
  1243. {
  1244. ?>
  1245. <td style="text-align: left" valign="top">
  1246. <span style="font-weight: bold"><?=date('M j, Y',$unixDate)?></span> </td>
  1247. <td valign="top" style="text-align: right; border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=date('g:i A',$unixDate)?></td>
  1248. <?php
  1249. $hasChanged = false;
  1250. }
  1251. else
  1252. {
  1253. ?>
  1254. <td valign="top" colspan="2" style="text-align: right; border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=date('g:i A',$unixDate)?></td>
  1255. <?php
  1256. }
  1257. ?>
  1258. </td>
  1259. <td valign="top" style="border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=($isDelivered)?'<strong>':''?><?=$track_Ret['1159-'.$i.'-'.$j]?><?=($isDelivered)?'</strong>':''?></td>
  1260. <td valign="top" style="border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=$track_Ret['1160-'.$i.'-'.$j]?>, <?=$state?></td>
  1261. <td valign="top"><?=$track_Ret['1711-'.$i.'-'.$j]?></td>
  1262. </tr>
  1263. <?php
  1264. if($isDelivered)
  1265. {
  1266. $isDelivered = false;
  1267. }
  1268. $last_date = $unixDate;
  1269. }
  1270. }
  1271. ?>
  1272. </table>
  1273. </div>
  1274. <?php
  1275. }
  1276. }
  1277. // ADD ENDED
  1278. // ADDED by Chad Apr-03-06
  1279. // DHL AND USPS TRACKING
  1280. $qry = "SELECT * FROM dhl WHERE custPackID = '".$_GET["id"]."'";
  1281. $res = mysql_query($qry) or print(mysql_error());
  1282. if(mysql_num_rows($res) > 0) {
  1283. $row = mysql_fetch_assoc($res);
  1284. $trackNum = $row['DHLGMTrackNum'];
  1285. if(!empty($trackNum)) {
  1286. $ch = curl_init();
  1287. curl_setopt($ch,CURLOPT_URL,"http://api.smartmail.com/tnt2.cfm?number=$trackNum&criteria=3&type=wddx&custid=rband&passwd=sm36732");
  1288. //curl_setopt($ch, CURLOPT_POST, 1);
  1289. curl_setopt($ch,CURLOPT_HEADER,0);
  1290. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  1291. //curl_setopt($ch, CURLOPT_POSTFIELDS, "number=$trackNum&criteria=3&type=wddx&custid=rband&passwd=sm36732");
  1292. $res = curl_exec($ch);
  1293. curl_close($ch);
  1294. $info = wddx_deserialize($res);
  1295. if(empty($info['Detail'][0])) { //If no errors
  1296. ?>
  1297. <div style="height: 20px"></div>
  1298. <table align="center" width="500" cellpadding="3" cellspacing="0" style="border: 1px solid #FFFFFF">
  1299. <tr>
  1300. <td colspan="2" style="color: #FFFFFF; background-color: #CC0000; text-align: center; font-weight: bold; font-size: 18px">DHL Tracking</td>
  1301. </tr>
  1302. <?php
  1303. if(!empty($info['TRACK_PKUP_DATE'][0])) {
  1304. ?>
  1305. <tr>
  1306. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_PKUP_DATE'][0]?></td>
  1307. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Picked Up by SmartMail</td>
  1308. </tr>
  1309. <?php
  1310. }
  1311. if(!empty($info['TRACK_RECV_DATE'][0])) {
  1312. ?>
  1313. <tr>
  1314. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_RECV_DATE'][0]?></td>
  1315. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Arrived at Smart Center</td>
  1316. </tr>
  1317. <?php
  1318. }
  1319. if(!empty($info['TRACK_ENCD_DATE'][0])) {
  1320. ?>
  1321. <tr>
  1322. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_ENCD_DATE'][0]?></td>
  1323. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Processed and Verified</td>
  1324. </tr>
  1325. <?php
  1326. }
  1327. if(!empty($info['TRACK_DNSD_DATE'][0])) {
  1328. ?>
  1329. <tr>
  1330. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_DNSD_DATE'][0]?></td>
  1331. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Sent via <?=(!empty($info['TRACK_DNDC'][0]))?$info['TRACK_DNDC'][0]:"SmartMail"?></td>
  1332. </tr>
  1333. <?php
  1334. }
  1335. if(!empty($info['TRACK_DNRC_DATE'][0])) {
  1336. ?>
  1337. <tr>
  1338. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_DNRC_DATE'][0]?></td>
  1339. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Received</td>
  1340. </tr>
  1341. <?php
  1342. }
  1343. if(!empty($info['TRACK_MFST_DATE'][0])) {
  1344. ?>
  1345. <tr>
  1346. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_MFST_DATE'][0]?></td>
  1347. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Mail Delivered to Post Office</td>
  1348. </tr>
  1349. <?php
  1350. }
  1351. ?>
  1352. </table>
  1353. <?php
  1354. // CHECK USPS TRACKING INFO
  1355. if(!empty($info['TRACK_DELV_CONF'][0])) {
  1356. $ch = curl_init();
  1357. curl_setopt($ch,CURLOPT_URL,"http://Production.ShippingAPIs.com/ShippingAPI.dll");
  1358. curl_setopt($ch, CURLOPT_POST, 1);
  1359. curl_setopt($ch,CURLOPT_HEADER,0);
  1360. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  1361. curl_setopt($ch, CURLOPT_POSTFIELDS, 'API=TrackV2&XML=<TrackFieldRequest USERID="268REMIN3619"><TrackID ID="'.$info['TRACK_DELV_CONF'][0].'"></TrackID></TrackFieldRequest>');
  1362. $res = curl_exec($ch);
  1363. curl_close($ch);
  1364. include(APPPATH.'views/pages/admin/xml2array.php');
  1365. $xmlData = new xml2array();
  1366. $uspsData = $xmlData -> parseXMLintoarray($res);
  1367. ?>
  1368. <div style="margin: 5px auto; width: 500px">
  1369. <div style="margin: 0; height: 5px; background-color: #CC0000"></div>
  1370. <div style="margin: 0; padding: 2px; background-color: #0066CB; color: #FFFFFF; font-weight: bold; font-size: 18px; text-align: center">USPS Tracking<br /><span style="font-size: 11px">Tracking # <?=$info['TRACK_DELV_CONF'][0]?></span></div>
  1371. <div style="margin: 0; height: 7px; background-color: #98CCFF"></div>
  1372. <div style="margin: 2px 0 0 0; background-color: #E3F1FC; border: 1px solid #89B9E7">
  1373. <?php
  1374. if(is_array($uspsData['TrackResponse']['TrackInfo']['Error'])) {
  1375. echo '<div style="margin: 0; text-align: center; font-weight: bold">Error Getting USPS Tracking Information</div>';
  1376. }else{
  1377. if(is_array($uspsData['TrackResponse']['TrackInfo']['TrackSummary'])) {
  1378. $eventTime = $uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventDate'].' '.$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventTime'];
  1379. ?>
  1380. <div style="margin: 0; padding: 3px; background-color: #89B9E7; color: #FFFFFF; font-weight: bold">Event Summary</div>
  1381. <div style="margin: 0">
  1382. <table width="500" border="0" cellpadding="3" cellspacing="0" style="margin: 2px;">
  1383. <tr>
  1384. <td valign="top" style="font-weight: bold"><?=$eventTime?></td>
  1385. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventCity']?>, <?=$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventState']?></td>
  1386. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['Event']?></td>
  1387. </tr>
  1388. </table>
  1389. </div>
  1390. <?php
  1391. }
  1392. if(is_array($uspsData['TrackResponse']['TrackInfo']['TrackDetail'])) {
  1393. ?>
  1394. <div style="margin: 0; padding: 3px; background-color: #89B9E7; color: #FFFFFF; font-weight: bold">Tracking Details</div>
  1395. <table width="500" border="0" align="center" cellpadding="3" cellspacing="0" style="margin: 2px;">
  1396. <?php
  1397. if(is_array($uspsData['TrackResponse']['TrackInfo']['TrackDetail'][0])){
  1398. for($i=0; $i<count($uspsData['TrackResponse']['TrackInfo']['TrackDetail']); $i++) {
  1399. $eventTime = $uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventDate'].' '.$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventTime'];
  1400. ?>
  1401. <tr>
  1402. <td valign="top" style="font-weight: bold"><?=$eventTime?></td>
  1403. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventCity']?>, <?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventState']?></td>
  1404. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['Event']?></td>
  1405. </tr>
  1406. <?php
  1407. } // End of TrackDetail Loop
  1408. }else{
  1409. $eventTime = $uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventDate'].' '.$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventTime'];
  1410. ?>
  1411. <tr>
  1412. <td valign="top" style="font-weight: bold"><?=$eventTime?></td>
  1413. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventCity']?>, <?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventState']?></td>
  1414. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['Event']?></td>
  1415. </tr>
  1416. <?php
  1417. }
  1418. ?>
  1419. </table>
  1420. <?php
  1421. } // End of displaying all Tracking Details
  1422. } // End of displaying all USPS tracking information
  1423. ?>
  1424. </div>
  1425. </div>
  1426. <?php
  1427. }
  1428. }
  1429. }
  1430. }
  1431. // ADD ENDED
  1432. }elseif(!empty($_REQUEST['ship_to_logan'])) {
  1433. ?>
  1434. <h2 style="margin-left: 20px">Provide Reason for Change of Status to Shipping from Logan</h2>
  1435. <form id="mainform" action="<?=$_SERVER['PHP_SELF']?>" method="post">
  1436. <table align="center" width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="" style="margin-top: 20px;">
  1437. <tr>
  1438. <td colspan="6">&nbsp;</td>
  1439. <td align="center"><strong>Master Reason for Change</strong><br /><textarea name="master_reason" id="master_reason" rows="2" cols="17"></textarea></td>
  1440. </tr>
  1441. <tr bgcolor="#030133">
  1442. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdId?></font></strong></td>
  1443. <td align="center"><strong><font color="#E7EAEF"><?php print $yyName?></font></strong></td>
  1444. <td align="center"><strong><font color="#E7EAEF"><?php print $yyShipMe?></font></strong></td>
  1445. <td align="center"><strong><font color="#E7EAEF">Status</font></strong></td>
  1446. <td align="center"><strong><font color="#E7EAEF"><?php print $yyBatDate?></font></strong></td>
  1447. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdDate?></font></strong></td>
  1448. <td align="center"><strong><font color="#E7EAEF">Reason for Change</font></strong></td>
  1449. </tr>
  1450. <?php
  1451. foreach($_REQUEST['orders'] as $order) {
  1452. $sql = "SELECT * FROM orders WHERE ordID = " . $order;
  1453. $res = mysql_query($sql) or print(mysql_error());
  1454. $row = mysql_fetch_assoc($res);
  1455. $sql_st = "SELECT os.statPrivate FROM orderstatus os, orders o
  1456. WHERE o.ordStatus = os.statID
  1457. AND o.ordID = " . $order;
  1458. $res_st = mysql_query($sql_st) or print(mysql_error());
  1459. $row_st = mysql_fetch_assoc($res_st);
  1460. $sql_b = "select * from location l where ordID = ". $order ." and l.location = 'Packing'";
  1461. $result_b = mysql_query($sql_b);
  1462. $row_b = mysql_fetch_assoc($result_b);
  1463. if(@$bgcolor=="#E7EAEF") $bgcolor="#EAECEB"; else $bgcolor="#E7EAEF";
  1464. ?>
  1465. <tr bgcolor="<?=$bgcolor?>">
  1466. <td align="center"><?=$row['ordID']?></td>
  1467. <td align="center"><?=$row['ordName']?></td>
  1468. <td align="center"><?=$row['ordShipType']?></td>
  1469. <td align="center"><?=$row_st['statPrivate']?><input name="oldstatus_<?=$order?>" type="text" value="<?=$row['ordStatus']?>" /></td>
  1470. <td align="center"><?=$row_b['stamp']?></td>
  1471. <td align="center"><?=$row['ordDate']?></td>
  1472. <td align="center"><textarea name="reason<?=$order?>" rows="2" cols="17"></textarea></td>
  1473. </tr>
  1474. <?php
  1475. }
  1476. ?>
  1477. <tr>
  1478. <td colspan="7" align="center"><input type="submit" id="ship_to_logan_final" name="ship_to_logan_final" value="Update Statuses" /></td>
  1479. </tr>
  1480. </table>
  1481. </form>
  1482. <p>&nbsp;</p>
  1483. <?php
  1484. }elseif(!empty($_REQUEST['ship_to_logan_final'])) {
  1485. $aReasons = array();
  1486. $i=0;
  1487. foreach($_REQUEST as $key => $request) {
  1488. if(eregi("^reason",$key)) {
  1489. $aReasons[$i]['order'] = substr($key,6);
  1490. $aReasons[$i]['oldstatus'] = $_REQUEST['oldstatus_'.substr($key,6)];
  1491. if(!empty($_REQUEST['master_reason'])) {
  1492. $aReasons[$i]['reason'] = $_REQUEST['master_reason'];
  1493. }else{
  1494. $aReasons[$i]['reason'] = $request;
  1495. }
  1496. $i++;
  1497. }
  1498. }
  1499. //showarray($aReasons); exit();
  1500. for($i=0; $i<count($aReasons); $i++) {
  1501. $sql = "UPDATE orders
  1502. SET ordStatus = 10, ordStatusDate = '".date("Y-m-d H:i:s")."'
  1503. WHERE ordID = " . $aReasons[$i]['order'];
  1504. $res = mysql_query($sql) or print(mysql_error());
  1505. setNewLocation(10,$aReasons[$i]['order'],'Manual',$aReasons[$i]['reason']);
  1506. //release stock if old status !=10 and >=3
  1507. if($aReasons[$i]['oldstatus']!=10 && $aReasons[$i]['oldstatus']!=17 && $aReasons[$i]['oldstatus']>=3) release_stock($smOrdId);
  1508. }
  1509. ?>
  1510. <script language="JavaScript" type="text/javascript">
  1511. <!--
  1512. setTimeout("window.location = '/admin/hksearch.php'",4000);
  1513. // -->
  1514. </script>
  1515. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  1516. <tr>
  1517. <td width="100%">
  1518. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  1519. <tr>
  1520. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyUpdSuc?></strong><br /><br />You will now be forwarded to the HK Search Page<br /><br />
  1521. <?php print $yyNoAuto?> <a href="javascript:window.location='/admin/hksearch.php'"><strong><?php print $yyClkHer?></strong></a>.<br /><br />
  1522. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" /></td>
  1523. </tr>
  1524. </table> </td>
  1525. </tr>
  1526. </table>
  1527. <?php
  1528. }elseif(!empty($_REQUEST['send_packing'])) {
  1529. ?>
  1530. <h2 style="margin-left: 20px">Provide Reason for Change of Status to Packing</h2>
  1531. <form id="mainform" action="<?=$_SERVER['PHP_SELF']?>" method="post">
  1532. <table align="center" width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="" style="margin-top: 20px;">
  1533. <tr>
  1534. <td colspan="6">&nbsp;</td>
  1535. <td align="center"><strong>Master Reason for Change</strong><br /><textarea name="master_reason" id="master_reason" rows="2" cols="17"></textarea></td>
  1536. </tr>
  1537. <tr bgcolor="#030133">
  1538. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdId?></font></strong></td>
  1539. <td align="center"><strong><font color="#E7EAEF"><?php print $yyName?></font></strong></td>
  1540. <td align="center"><strong><font color="#E7EAEF"><?php print $yyShipMe?></font></strong></td>
  1541. <td align="center"><strong><font color="#E7EAEF">Status</font></strong></td>
  1542. <td align="center"><strong><font color="#E7EAEF"><?php print $yyBatDate?></font></strong></td>
  1543. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdDate?></font></strong></td>
  1544. <td align="center"><strong><font color="#E7EAEF">Reason for Change</font></strong></td>
  1545. </tr>
  1546. <?php
  1547. foreach($_REQUEST['orders'] as $order) {
  1548. $sql = "SELECT * FROM orders WHERE ordID = " . $order;
  1549. $res = mysql_query($sql) or print(mysql_error());
  1550. $row = mysql_fetch_assoc($res);
  1551. $sql_st = "SELECT os.statPrivate FROM orderstatus os, orders o
  1552. WHERE o.ordStatus = os.statID
  1553. AND o.ordID = " . $order;
  1554. $res_st = mysql_query($sql_st) or print(mysql_error());
  1555. $row_st = mysql_fetch_assoc($res_st);
  1556. // Get Batch Date
  1557. $sql_b = "select * from location l where ordID = ". $order ." and l.location = 'Packing'";
  1558. $result_b = mysql_query($sql_b);
  1559. $row_b = mysql_fetch_assoc($result_b);
  1560. if(@$bgcolor=="#E7EAEF") $bgcolor="#EAECEB"; else $bgcolor="#E7EAEF";
  1561. ?>
  1562. <tr bgcolor="<?=$bgcolor?>">
  1563. <td align="center"><?=$row['ordID']?></td>
  1564. <td align="center"><?=$row['ordName']?></td>
  1565. <td align="center"><?=$row['ordShipType']?></td>
  1566. <td align="center"><?=$row_st['statPrivate']?></td>
  1567. <td align="center"><?=$row_b['stamp']?></td>
  1568. <td align="center"><?=$row['ordDate']?></td>
  1569. <td align="center"><textarea name="reason<?=$order?>" rows="2" cols="17"></textarea></td>
  1570. </tr>
  1571. <?php
  1572. }
  1573. ?>
  1574. <tr>
  1575. <td colspan="7" align="center"><input type="submit" id="send_packing_final" name="send_packing_final" value="Update Statuses" /></td>
  1576. </tr>
  1577. </table>
  1578. </form>
  1579. <p>&nbsp;</p>
  1580. <?php
  1581. }elseif(!empty($_REQUEST['send_packing_final'])) {
  1582. $aReasons = array();
  1583. $i=0;
  1584. foreach($_REQUEST as $key => $request) {
  1585. if(eregi("^reason",$key)) {
  1586. $aReasons[$i]['order'] = substr($key,6);
  1587. if(!empty($_REQUEST['master_reason'])) {
  1588. $aReasons[$i]['reason'] = $_REQUEST['master_reason'];
  1589. }else{
  1590. $aReasons[$i]['reason'] = $request;
  1591. }
  1592. $i++;
  1593. }
  1594. }
  1595. //showarray($aReasons); exit();
  1596. for($i=0; $i<count($aReasons); $i++) {
  1597. $sql = "UPDATE orders
  1598. SET ordStatus = 6, ordStatusDate = '".date("Y-m-d H:i:s")."'
  1599. WHERE ordID = " . $aReasons[$i]['order'];
  1600. $res = mysql_query($sql) or print(mysql_error());
  1601. setNewLocation(6,$aReasons[$i]['order'],'Manual',$aReasons[$i]['reason']);
  1602. }
  1603. ?>
  1604. <script language="JavaScript" type="text/javascript">
  1605. <!--
  1606. setTimeout("window.location = '/admin/hksearch.php'",4000);
  1607. // -->
  1608. </script>
  1609. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  1610. <tr>
  1611. <td width="100%">
  1612. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  1613. <tr>
  1614. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyUpdSuc?></strong><br /><br />You will now be forwarded to the HK Search Page<br /><br />
  1615. <?php print $yyNoAuto?> <a href="javascript:window.location='/admin/hksearch.php'"><strong><?php print $yyClkHer?></strong></a>.<br /><br />
  1616. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" /></td>
  1617. </tr>
  1618. </table> </td>
  1619. </tr>
  1620. </table>
  1621. <?php
  1622. }else{
  1623. if(@$_POST["sd"] != "")
  1624. $sd = @$_POST["sd"];
  1625. elseif(@$_GET["sd"] != "")
  1626. $sd = @$_GET["sd"];
  1627. else
  1628. $sd = date($admindatestr, time() + ($dateadjust*60*60));
  1629. if(@$_POST["ed"] != "")
  1630. $ed = @$_POST["ed"];
  1631. elseif(@$_GET["ed"] != "")
  1632. $ed = @$_GET["ed"];
  1633. else
  1634. $ed = date($admindatestr, time() + ($dateadjust*60*60));
  1635. $sd = parsedate($sd);
  1636. $ed = parsedate($ed);
  1637. if($sd > $ed) $ed = $sd;
  1638. $fromdate = trim(@$_POST["fromdate"]);
  1639. $todate = trim(@$_POST["todate"]);
  1640. $ordid = trim(str_replace('"',"",str_replace("'","",@$_POST["ordid"])));
  1641. $origsearchtext = trim(unstripslashes(@$_POST["searchtext"]));
  1642. $searchtext = trim(mysql_real_escape_string(unstripslashes(@$_POST["searchtext"])));
  1643. $ordstatus = "";
  1644. if(@$_POST["powersearch"]=="1" && !empty($_POST['searchby'])){
  1645. $sSQL = "SELECT o.ordID,ordName,ordDate, ordAuthNumber, ordShipType,l.stamp,ordStatus,ordTotal-ordDiscount AS ordTot,ordTransID,ordEID FROM orders o INNER JOIN location l ON l.ordID=o.ordID WHERE ordStatus>=0 ";
  1646. $addcomma = "";
  1647. if(is_array(@$_POST["ordstatus"])){
  1648. foreach($_POST["ordstatus"] as $objValue){
  1649. if(is_array($objValue))$objValue=$objValue[0];
  1650. $ordstatus .= $addcomma . $objValue;
  1651. $addcomma = ",";
  1652. }
  1653. }else
  1654. $ordstatus = trim((string)@$_POST["ordstatus"]);
  1655. //discounts
  1656. if($_POST['searchby'] == "invoice" && $_POST['invoice_number'] != ""){
  1657. $sSQL .= ' AND o.ordID="'.$_POST['invoice_number'].'" group by o.ordID';
  1658. }
  1659. elseif($_POST['searchby'] == "status" && $_POST['ordstatus'] != ""){
  1660. if($ordstatus == 9999) {
  1661. $ordstatus = '3,4,6';
  1662. }
  1663. $sSQL .= " AND ordStatus IN (".$ordstatus.") group by o.ordID";
  1664. }
  1665. elseif($_POST['searchby'] == "name" && $_POST['order_name'] != ""){
  1666. $sSQL .= " AND (ordName like '%" . $_POST['order_name'] . "%' or ordShipName like '%" . $_POST['order_name'] . "%') group by o.ordID";
  1667. }
  1668. elseif($_POST['searchby'] == "batches" && $_POST['batch_to'] != "" && $_POST['batch_from'] != ""){
  1669. $sSQL .= ' AND l.statNum=6 AND l.stamp BETWEEN "' . $_POST['batch_from'] . ' 00:00:00" AND "' . $_POST['batch_to'] . ' 23:59:59"';
  1670. }
  1671. $sSQL .= " ORDER BY ordID DESC".(($_POST['batches_to'] != "" && $_POST['batches_from'] != "")?',l.stamp DESC':'');
  1672. }else{
  1673. $sSQL = "SELECT * FROM orders WHERE ordStatus = 6"; // Purposely querying 0 results for default view
  1674. }
  1675. $alldata = mysql_query($sSQL) or print(mysql_error());
  1676. $num_of_listed = mysql_num_rows($alldata);
  1677. //echo $sSQL;
  1678. //showarray($_POST);
  1679. ?>
  1680. <script language="JavaScript" type="text/javascript" src="/lib/js/util/popcalendar.js"></script>
  1681. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/prototype.js"></script>
  1682. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/scriptaculous.js"></script>
  1683. <script language="JavaScript" type="text/javascript">
  1684. <!--
  1685. function showCell() {
  1686. var val = $('searchby').value;
  1687. if(val == 'invoice') {
  1688. resetCells();
  1689. $('invoice').style.display = 'block';
  1690. }else if(val == 'batches') {
  1691. resetCells();
  1692. $('batches').style.display = 'block';
  1693. }else if(val == 'name') {
  1694. resetCells();
  1695. $('name').style.display = 'block';
  1696. }else if(val == 'status') {
  1697. resetCells();
  1698. $('status').style.display = 'block';
  1699. }
  1700. }
  1701. function resetCells() {
  1702. $('invoice').style.display = 'none';
  1703. $('batches').style.display = 'none';
  1704. $('name').style.display = 'none';
  1705. $('status').style.display = 'none';
  1706. }
  1707. function delrec(id) {
  1708. cmsg = "<?php print $yyConDel?>\n"
  1709. if (confirm(cmsg)) {
  1710. document.mainform.id.value = id;
  1711. document.mainform.act.value = "delete";
  1712. document.mainform.sd.value="<?php print date($admindatestr, $sd)?>";
  1713. document.mainform.ed.value="<?php print date($admindatestr, $ed)?>";
  1714. document.mainform.submit();
  1715. }
  1716. }
  1717. function authrec(id) {
  1718. var aucode;
  1719. cmsg = "<?php print $yyEntAuth?>"
  1720. if ((aucode=prompt(cmsg,'<?php print $yyManAut?>')) != null) {
  1721. document.mainform.id.value = id;
  1722. document.mainform.act.value = "authorize";
  1723. document.mainform.authcode.value = aucode;
  1724. document.mainform.sd.value="<?php print date($admindatestr, $sd)?>";
  1725. document.mainform.ed.value="<?php print date($admindatestr, $ed)?>";
  1726. document.mainform.submit();
  1727. }
  1728. }
  1729. function checkcontrol(tt,evt){
  1730. <?php if(strstr(@$HTTP_SERVER_VARS["HTTP_USER_AGENT"], "Gecko")){ ?>
  1731. theevnt = evt;
  1732. return;
  1733. <?php }else{ ?>
  1734. theevnt=window.event;
  1735. <?php } ?>
  1736. if(theevnt.ctrlKey){
  1737. maxitems=document.mainform.maxitems.value;
  1738. for(index=0;index<maxitems;index++){
  1739. if(eval('document.mainform.ordstatus'+index+'.length') > tt.selectedIndex){
  1740. eval('document.mainform.ordstatus'+index+'.selectedIndex='+tt.selectedIndex);
  1741. eval('document.mainform.ordstatus'+index+'.options['+tt.selectedIndex+'].selected=true');
  1742. }
  1743. }
  1744. }
  1745. }
  1746. function displaysearch(){
  1747. thestyle = document.getElementById('searchspan').style;
  1748. if(thestyle.display=='none')
  1749. thestyle.display = 'block';
  1750. else
  1751. thestyle.display = 'none';
  1752. }
  1753. function checkprinter(tt,evt){
  1754. <?php if(strstr(@$HTTP_SERVER_VARS["HTTP_USER_AGENT"], "Gecko")){ ?>
  1755. if(evt.ctrlKey || evt.altKey || document.mainform.ctrlmod[document.mainform.ctrlmod.selectedIndex].value=="1"){
  1756. tt.href += "&printer=true";
  1757. window.location.href = tt.href;
  1758. }
  1759. if(document.mainform.ctrlmod[document.mainform.ctrlmod.selectedIndex].value=="2"){
  1760. tt.href += "&doedit=true";
  1761. window.location.href = tt.href;
  1762. }
  1763. <?php }else{ ?>
  1764. theevnt=window.event;
  1765. if(theevnt.ctrlKey || document.mainform.ctrlmod[document.mainform.ctrlmod.selectedIndex].value=="1")tt.href += "&printer=true";
  1766. if(document.mainform.ctrlmod[document.mainform.ctrlmod.selectedIndex].value=="2")tt.href += "&doedit=true";
  1767. <?php } ?>
  1768. return(true);
  1769. }
  1770. // -->
  1771. </script>
  1772. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="">
  1773. <tr>
  1774. <td width="100%" align="center">
  1775. <?php $themask = 'yyyy-mm-dd';
  1776. if($admindateformat==1)
  1777. $themask='mm/dd/yyyy';
  1778. elseif($admindateformat==2)
  1779. $themask='dd/mm/yyyy';
  1780. if(! $success) print "<p><font color='#FF0000'>" . $errmsg . "</font></p>"; ?>
  1781. <span name="searchspan" id="searchspan" >
  1782. <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="">
  1783. <form method="post" action="/admin/hksearch.php" name="psearchform">
  1784. <input type="hidden" name="powersearch" value="1" />
  1785. <tr bgcolor="#030133"><td colspan="7"><strong><font color="#E7EAEF">&nbsp;<?php print $yyPowSea?></font></strong></td></tr>
  1786. <tr bgcolor="#E7EAEF">
  1787. <td align="right" width="15%"><strong>Search By:</strong></td>
  1788. <td align="left" width="15%">
  1789. <select id="searchby" name="searchby" onchange="showCell();">
  1790. <option value="status"<?=($_POST['searchby']=='status')?' selected="selected"':''?>>Status</option>
  1791. <option value="invoice"<?=($_POST['searchby']=='invoice')?' selected="selected"':''?>>Invoice #</option>
  1792. <option value="batches"<?=($_POST['searchby']=='batches')?' selected="selected"':''?>>Batches</option>
  1793. <option value="name"<?=($_POST['searchby']=='name')?' selected="selected"':''?>>Name</option>
  1794. </select> </td>
  1795. <td id="invoice" align="left" style="display:none">
  1796. <strong>Invoice #:</strong> <input name="invoice_number" type="text" id="invoice_number" value="<?=$_POST['invoice_number']?>" /> </td>
  1797. <td id="batches" align="left" style="display:none">
  1798. <strong>Batches:</strong> between <input type="text" id="batch_from" name="batch_from" value="<?php print $_POST['batch_from']?>" /> <input type="button" onclick="popUpCalendar(this, document.forms.psearchform.batch_from, '<?php print $themask?>', -205)" value='DP' />
  1799. and <input type="text" id="batch_to" name="batch_to" value="<?php print $_POST['batch_to']?>" /> <input type="button" onclick="popUpCalendar(this, document.forms.psearchform.batch_to, '<?php print $themask?>', -205)" value='DP' /> </td>
  1800. <td id="name" align="left" style="display:none">
  1801. Name: <input type="text" size="24" name="order_name" value="<?php print $_POST['order_name']?>" /> </td>
  1802. <td id="status" align="left" valign="middle" style="display:none">
  1803. <strong><?php print $yyOrdSta?>:</strong>
  1804. &nbsp;<select name="ordstatus[]" size="5" multiple><option value="9999" <?php if(strpos($ordstatus,"9999") !== FALSE) print "selected"?>><?php print $yyAllSta?></option><?php
  1805. $ordstatus="";
  1806. $addcomma = "";
  1807. if(empty($_POST["ordstatus"])) $_POST["ordstatus"]=6;
  1808. if(is_array(@$_POST["ordstatus"])){
  1809. foreach($_POST["ordstatus"] as $objValue){
  1810. if(is_array($objValue))$objValue=$objValue[0];
  1811. $ordstatus .= $addcomma . $objValue;
  1812. $addcomma = ",";
  1813. }
  1814. }else
  1815. $ordstatus = trim(@$_POST["ordstatus"]);
  1816. $ordstatusarr = explode(",", $ordstatus);
  1817. for($index=0; $index < $numstatus; $index++){
  1818. if(in_array($allstatus[$index]["statID"],array(3,4,6,10))) {
  1819. print '<option value="' . $allstatus[$index]["statID"] . '"';
  1820. if(is_array($ordstatusarr)){
  1821. foreach($ordstatusarr as $objValue)
  1822. if($objValue==$allstatus[$index]["statID"]) print " selected";
  1823. }
  1824. print ">" . $allstatus[$index]["statPrivate"] . "</option>";
  1825. }
  1826. } ?></select> </td>
  1827. </tr>
  1828. <script type="text/javascript">
  1829. <!--
  1830. resetCells();
  1831. showCell();
  1832. function shipLogan(){
  1833. var resp = confirm("Are you sure you want to update all CHECKED orders to Shipping Logan?");
  1834. return resp;
  1835. }
  1836. function sendPacking(){
  1837. var resp = confirm("Are you sure you want to update all CHECKED orders to Packing?");
  1838. return resp;
  1839. }
  1840. -->
  1841. </script>
  1842. </table><input type="submit" value="<?php print $yySearch?>" />
  1843. </span>
  1844. <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="" style="margin-top: 20px">
  1845. <tr>
  1846. <td colspan="7">
  1847. <?
  1848. $sql_status = "SELECT count( * ) as statcount , os.statPrivate , os.statID
  1849. FROM orders o, orderstatus os
  1850. WHERE o.ordStatus = os.statID
  1851. AND o.ordStatus
  1852. BETWEEN 3
  1853. AND 10
  1854. GROUP BY os.statID,os.statPrivate";
  1855. $result_status=mysql_query($sql_status);
  1856. while($row_status=mysql_fetch_assoc($result_status)){?>
  1857. <div style="color:#000066; font-weight:bold; border:#030133 solid 1px; margin:2px; float:left; width:146px;padding:2px; text-align:center; background-color:#E7EAEF;"><?=$row_status['statID'].'-'.$row_status['statPrivate'].': '.$row_status['statcount'] ?></div>
  1858. <? } ?> </td>
  1859. </tr>
  1860. <tr>
  1861. <td colspan="3"><input type="submit" id="ship_to_logan" name="ship_to_logan" value="Ship From Logan" onclick="return shipLogan();" />&nbsp;<!--<input type="submit" id="send_packing" name="send_packing" value="Send to Packing" onclick="return sendPacking();" />--></td>
  1862. <td colspan="4" align="right">* Order has Custom Screenz | <span style="background-color:#FA6561; padding:2px;">etailer</span></td>
  1863. </tr>
  1864. <tr bgcolor="#030133">
  1865. <td align="center">&nbsp;</td>
  1866. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdId?></font></strong></td>
  1867. <td align="center"><strong><font color="#E7EAEF"><?php print $yyName?></font></strong></td>
  1868. <td align="center"><strong><font color="#E7EAEF"><?php print $yyShipMe?></font></strong></td>
  1869. <td align="center"><strong><font color="#E7EAEF">Status</font></strong></td>
  1870. <td align="center"><strong><font color="#E7EAEF"><?php print $yyBatDate?></font></strong></td>
  1871. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdDate?></font></strong></td>
  1872. </tr>
  1873. <?php
  1874. if(mysql_num_rows($alldata) > 0){
  1875. $rowcounter=0;
  1876. $ordTot=0;
  1877. $i=0;
  1878. $num_rows_order=mysql_num_rows($alldata);
  1879. while($rs = mysql_fetch_assoc($alldata)){
  1880. $order_id_array[$i]=$rs["ordID"];
  1881. $i++;
  1882. if($rs["ordStatus"]>=3) $ordTot += $rs["ordTot"];
  1883. if($rs["ordStatus"]>=3) $num_auth_order += 1;
  1884. if($rs["ordAuthNumber"]=="" || is_null($rs["ordAuthNumber"])){
  1885. $startfont="<font color='#FF0000'>";
  1886. $endfont="</font>";
  1887. } else{
  1888. $startfont="";
  1889. $endfont="";
  1890. }
  1891. if($rs["order_changed"]=='yes'){
  1892. $startfont="<font color='#00CC00'>";
  1893. $endfont="</font>";
  1894. }
  1895. //check for custom screenz
  1896. $hascustomscreen='';
  1897. $sql_check="SELECT * FROM cart WHERE cartOrderID=".$rs["ordID"]." AND cartProdID LIKE '%-Custom'";
  1898. $result_check=mysql_query($sql_check);
  1899. if(mysql_num_rows($result_check)>0) $hascustomscreen='*';
  1900. // Get Current Status Name
  1901. $sql_st = "SELECT os.statPrivate FROM orderstatus os, orders o
  1902. WHERE o.ordStatus = os.statID
  1903. AND o.ordID = " . $rs["ordID"];
  1904. $res_st = mysql_query($sql_st) or print(mysql_error());
  1905. $row_st = mysql_fetch_assoc($res_st);
  1906. if(@$bgcolor=="#E7EAEF") $bgcolor="#EAECEB"; else $bgcolor="#E7EAEF";
  1907. if(!empty($rs["ordEID"])) $bgcolor="#FA6561";
  1908. ?>
  1909. <tr bgcolor="<?php print $bgcolor?>">
  1910. <td><input type="checkbox" id="orders<?=$i?>" name="orders[]" value="<?=$rs["ordID"]?>" /></td>
  1911. <td align="center"><a onclick="return(checkprinter(this,event));" href="/admin/hksearch.php?id=<?php print $rs["ordID"]?>"><?php print "<strong>" . $hascustomscreen.$startfont . $rs["ordID"] . $endfont . "</strong>"?></a></td>
  1912. <td align="center"><a onclick="return(checkprinter(this,event));" href="/admin/hksearch.php?id=<?php print $rs["ordID"]?>"><?php print $startfont . $rs["ordName"] . $endfont?></a></td>
  1913. <td align="center"><a onclick="return(checkprinter(this,event));" href="/admin/hksearch.php?id=<?php print $rs["ordID"]?>"><?php print $startfont . $rs["ordShipType"] . $endfont?></a></td>
  1914. <td align="center"><a onclick="return(checkprinter(this,event));" href="/admin/hksearch.php?id=<?php print $rs["ordID"]?>"><?php print $startfont . $row_st["statPrivate"] . $endfont?></a></td>
  1915. <td align="center">
  1916. <?php
  1917. $sql="select * from location l where ordID = ". $rs["ordID"] ." and l.location = 'Packing'";
  1918. $result= mysql_query($sql);
  1919. $row= mysql_fetch_assoc($result);
  1920. echo $row["stamp"];
  1921. ?></td>
  1922. <td align="center"><font size="1"><?php print $startfont . date($admindatestr . "\<\\b\\r\>H:i:s", strtotime($rs["ordDate"])) . $endfont?></font></td>
  1923. </tr>
  1924. <?php $rowcounter++;
  1925. if($rowcounter>=1000){
  1926. print "<tr><td colspan='6' align='center'><strong>Limit of " . $rowcounter . " orders reached. Please refine your search.</strong></td></tr>";
  1927. break;
  1928. }
  1929. }
  1930. ?>
  1931. <tr>
  1932. <td colspan="6" align="left"><?=$num_rows_order?> Orders</td>
  1933. </tr>
  1934. <?php
  1935. }else{
  1936. ?>
  1937. <tr>
  1938. <td colspan="9" align="center">
  1939. <p><?php
  1940. if(@$_POST["powersearch"]=="1")
  1941. print $yyNoMat1;
  1942. elseif($num_of_listed==0)
  1943. print "There were no orders found";
  1944. ?></p> </td>
  1945. </tr>
  1946. <?php if($hasdeleted){ ?>
  1947. <tr>
  1948. <td colspan="9"><input type="submit" value="<?php print $yyPurDel?>" onclick="document.mainform.act.value='purge';" /></td>
  1949. </tr>
  1950. <?php } ?>
  1951. <!--</form>-->
  1952. <?php
  1953. } ?>
  1954. </table> </td>
  1955. </tr>
  1956. </table>
  1957. <?php
  1958. }
  1959. }
  1960. ?>